ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
LBWalberla.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "config/config.hpp"
23
24#ifdef WALBERLA
25
26#include <utils/Vector.hpp>
27
28#include <memory>
29#include <optional>
30#include <stdexcept>
31#include <utility>
32
33class LBWalberlaBase;
34namespace System {
35class System;
36}
37
38namespace LB {
39
41 LBWalberlaParams(double agrid, double tau) : m_agrid(agrid), m_tau(tau) {}
42 double get_agrid() const { return m_agrid; };
43 double get_tau() const { return m_tau; };
44
45private:
46 double m_agrid;
47 double m_tau;
48};
49
50struct LBWalberla {
51 std::shared_ptr<LBWalberlaBase> lb_fluid;
52 std::shared_ptr<LBWalberlaParams> lb_params;
53 LBWalberla(std::shared_ptr<LBWalberlaBase> lb_fluid_,
54 std::shared_ptr<LBWalberlaParams> lb_params_)
55 : lb_fluid{std::move(lb_fluid_)}, lb_params{std::move(lb_params_)} {}
56 double get_kT() const;
57 auto get_tau() const { return lb_params->get_tau(); }
58 auto get_agrid() const { return lb_params->get_agrid(); }
59 auto get_lattice_speed() const { return get_agrid() / get_tau(); }
61 bool is_gpu() const;
62 std::optional<Utils::Vector3d>
64 bool consider_points_in_halo) const;
65 std::optional<double> get_density_at_pos(Utils::Vector3d const &pos,
66 bool consider_points_in_halo) const;
69 Utils::Vector3d const &force);
70 void add_forces_at_pos(std::vector<Utils::Vector3d> const &pos,
71 std::vector<Utils::Vector3d> const &forces);
72 std::vector<Utils::Vector3d>
73 get_velocities_at_pos(std::vector<Utils::Vector3d> const &pos);
74 void propagate();
75 void veto_time_step(double time_step) const;
76 void veto_kT(double kT) const;
77 void sanity_checks(System::System const &system) const;
78 void lebc_sanity_checks(unsigned int shear_direction,
79 unsigned int shear_plane_normal) const;
80
82 void veto_boxl_change() const {
83 throw std::runtime_error("MD cell geometry change not supported by LB");
84 }
85 void on_boxl_change() const { veto_boxl_change(); }
86 void on_node_grid_change() const {
87 throw std::runtime_error("MPI topology change not supported by LB");
88 }
89 void on_timestep_change() const {}
90 void on_temperature_change() const {}
91};
92
93} // namespace LB
94
95#endif // WALBERLA
Vector implementation and trait types for boost qvm interoperability.
__global__ float * force
__shared__ int pos[MAXDEPTH *THREADS5/WARPSIZE]
Interface of a lattice-based fluid model.
Main system class.
This file contains the defaults for ESPResSo.
double get_agrid() const
double get_tau() const
LBWalberlaParams(double agrid, double tau)
auto get_agrid() const
bool is_gpu() const
Utils::Vector3d get_momentum() const
auto get_lattice_speed() const
std::shared_ptr< LBWalberlaBase > lb_fluid
Utils::VectorXd< 9 > get_pressure_tensor() const
auto get_tau() const
std::optional< Utils::Vector3d > get_velocity_at_pos(Utils::Vector3d const &pos, bool consider_points_in_halo) const
void veto_time_step(double time_step) const
void add_forces_at_pos(std::vector< Utils::Vector3d > const &pos, std::vector< Utils::Vector3d > const &forces)
void veto_kT(double kT) const
std::optional< double > get_density_at_pos(Utils::Vector3d const &pos, bool consider_points_in_halo) const
LBWalberla(std::shared_ptr< LBWalberlaBase > lb_fluid_, std::shared_ptr< LBWalberlaParams > lb_params_)
void on_boxl_change() const
void on_cell_structure_change() const
double get_kT() const
std::shared_ptr< LBWalberlaParams > lb_params
void veto_boxl_change() const
std::vector< Utils::Vector3d > get_velocities_at_pos(std::vector< Utils::Vector3d > const &pos)
void on_temperature_change() const
void on_node_grid_change() const
void sanity_checks(System::System const &system) const
void on_timestep_change() const
void lebc_sanity_checks(unsigned int shear_direction, unsigned int shear_plane_normal) const
bool add_force_at_pos(Utils::Vector3d const &pos, Utils::Vector3d const &force)