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 ESPRESSO_WALBERLA
25
26#include <utils/Vector.hpp>
27
28#include <functional>
29#include <memory>
30#include <optional>
31#include <stdexcept>
32#include <utility>
33#include <vector>
34
35class LBWalberlaBase;
36namespace System {
37class System;
38}
39
40namespace LB {
41
43 LBWalberlaParams(double agrid, double tau) : m_agrid(agrid), m_tau(tau) {}
44 double get_agrid() const { return m_agrid; }
45 double get_tau() const { return m_tau; }
46
47private:
48 double m_agrid;
49 double m_tau;
50};
51
52struct LBWalberla {
53 std::shared_ptr<LBWalberlaBase> lb_fluid;
54 std::shared_ptr<LBWalberlaParams> lb_params;
55 LBWalberla(std::shared_ptr<LBWalberlaBase> lb_fluid_,
56 std::shared_ptr<LBWalberlaParams> lb_params_)
57 : lb_fluid{std::move(lb_fluid_)}, lb_params{std::move(lb_params_)} {}
58 double get_kT() const;
59 auto get_tau() const { return lb_params->get_tau(); }
60 auto get_agrid() const { return lb_params->get_agrid(); }
61 auto get_lattice_speed() const { return get_agrid() / get_tau(); }
63 bool is_gpu() const;
64 std::optional<Utils::Vector3d>
66 bool consider_points_in_halo) const;
67 std::optional<double> get_density_at_pos(Utils::Vector3d const &pos,
68 bool consider_points_in_halo) const;
70 std::function<bool(Utils::Vector3d const &)>
71 make_lattice_position_checker(bool consider_points_in_halo) const;
72 bool add_force_at_pos(Utils::Vector3d const &pos,
73 Utils::Vector3d const &force);
74 void add_forces_at_pos(std::vector<Utils::Vector3d> const &pos,
75 std::vector<Utils::Vector3d> const &forces);
76 std::vector<double>
77 get_densities_at_pos(std::vector<Utils::Vector3d> const &pos);
78 std::vector<Utils::Vector3d>
79 get_velocities_at_pos(std::vector<Utils::Vector3d> const &pos);
80 void propagate();
84 void veto_time_step(double time_step) const;
85 void veto_kT(double kT) const;
86 void sanity_checks(System::System const &system) const;
87 void lebc_sanity_checks(unsigned int shear_direction,
88 unsigned int shear_plane_normal) const;
89
91 void veto_boxl_change() const {
92 throw std::runtime_error("MD cell geometry change not supported by LB");
93 }
94 void on_boxl_change() const { veto_boxl_change(); }
95 void on_node_grid_change() const {
96 throw std::runtime_error("MPI topology change not supported by LB");
97 }
98 void on_timestep_change() const {}
99 void on_temperature_change() const {}
102 static void update_collision_model(LBWalberlaBase &instance,
103 LBWalberlaParams &params, double kT,
104 unsigned int seed);
105};
106
107} // namespace LB
108
109#endif // ESPRESSO_WALBERLA
Vector implementation and trait types for boost qvm interoperability.
Interface of a lattice-based fluid model.
Main system class.
STL namespace.
static SteepestDescentParameters params
Currently active steepest descent instance.
double get_agrid() const
double get_tau() const
LBWalberlaParams(double agrid, double tau)
void update_collision_model()
auto get_agrid() const
std::vector< double > get_densities_at_pos(std::vector< Utils::Vector3d > const &pos)
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
void ghost_communication_vel()
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)
std::function< bool(Utils::Vector3d const &)> make_lattice_position_checker(bool consider_points_in_halo) const
void ghost_communication()
void on_temperature_change() const
void ghost_communication_pdf()
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)
void on_lees_edwards_change()