21#ifdef ESPRESSO_WALBERLA
27#include "communication.hpp"
30#include "system/System.hpp"
31#include "thermostat.hpp"
54 return lb_fluid->get_pressure_tensor();
70 unsigned int shear_plane_normal)
const {
71 lb_fluid->check_lebc(shear_direction, shear_plane_normal);
76 return lb_fluid->make_lattice_position_checker(consider_points_in_halo);
79std::optional<Utils::Vector3d>
81 bool consider_points_in_halo)
const {
82 return lb_fluid->get_velocity_at_pos(pos, consider_points_in_halo);
87 bool consider_points_in_halo)
const {
88 return lb_fluid->get_density_at_pos(pos, consider_points_in_halo);
97 return lb_fluid->add_force_at_pos(pos, force);
101 std::vector<Utils::Vector3d>
const &forces) {
102 lb_fluid->add_forces_at_pos(pos, forces);
107 return lb_fluid->get_densities_at_pos(pos);
110std::vector<Utils::Vector3d>
112 return lb_fluid->get_velocities_at_pos(pos);
120 auto const energy_conversion =
122 auto const lb_kT =
lb_fluid->get_kT() * energy_conversion;
124 throw std::runtime_error(
"Temperature change not supported by LB");
129 auto const agrid =
lb_params->get_agrid();
130 auto [lb_left, lb_right] =
lb_fluid->get_lattice().get_local_domain();
133 auto const &md_left = system.
local_geo->my_left();
134 auto const &md_right = system.
local_geo->my_right();
145 auto const energy_conversion =
147 auto const kT =
lb_fluid->get_kT() * energy_conversion;
148 auto const seed =
lb_fluid->get_seed();
156 auto le_protocol = system.lees_edwards->get_protocol();
158 not std::holds_alternative<LeesEdwards::Off>(*le_protocol)) {
160 throw std::runtime_error(
161 "Lees-Edwards LB doesn't support thermalization");
163 auto const &le_bc = system.box_geo->lees_edwards_bc();
164 auto lees_edwards_object = std::make_unique<LeesEdwardsPack>(
165 le_bc.shear_direction, le_bc.shear_plane_normal,
166 [&
params, le_protocol, &system]() {
167 return get_pos_offset(system.get_sim_time(), *le_protocol) /
170 [&
params, le_protocol, &system]() {
171 return get_shear_velocity(system.get_sim_time(), *le_protocol) *
172 (params.get_tau() / params.get_agrid());
LBWalberlaBase provides the public interface of the LB waLBerla bridge.
Vector implementation and trait types for boost qvm interoperability.
Interface of a lattice-based fluid model.
virtual void set_collision_model(double kT, unsigned int seed)=0
Configure the default collision model.
virtual void ghost_communication()=0
Perform a full ghost communication.
auto get_time_step() const
Get time_step.
std::shared_ptr< LocalBox > local_geo
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
void walberla_agrid_sanity_checks(std::string method, Utils::Vector3d const &geo_left, Utils::Vector3d const &geo_right, Utils::Vector3d const &lattice_left, Utils::Vector3d const &lattice_right, double agrid)
void walberla_tau_sanity_checks(std::string method, double tau, double time_step)
Molecular dynamics integrator.
bool are_kT_equal(double old_kT, double new_kT)
Check that two kT values are close up to a small tolerance.
static SteepestDescentParameters params
Currently active steepest descent instance.
void update_collision_model()
std::vector< double > get_densities_at_pos(std::vector< Utils::Vector3d > const &pos)
Utils::Vector3d get_momentum() const
std::shared_ptr< LBWalberlaBase > lb_fluid
Utils::VectorXd< 9 > get_pressure_tensor() const
void ghost_communication_vel()
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
std::shared_ptr< LBWalberlaParams > lb_params
std::vector< Utils::Vector3d > get_velocities_at_pos(std::vector< Utils::Vector3d > const &pos)
std::function< bool(Utils::Vector3d const &)> make_lattice_position_checker(bool consider_points_in_halo) const
void ghost_communication()
void ghost_communication_pdf()
void sanity_checks(System::System const &system) 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)
void on_lees_edwards_change()