Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
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;
68 bool add_force_at_pos(Utils::Vector3d const &pos,
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();
78 void veto_time_step(double time_step) const;
79 void veto_kT(double kT) const;
80 void sanity_checks(System::System const &system) const;
81 void lebc_sanity_checks(unsigned int shear_direction,
82 unsigned int shear_plane_normal) const;
83
85 void veto_boxl_change() const {
86 throw std::runtime_error("MD cell geometry change not supported by LB");
87 }
88 void on_boxl_change() const { veto_boxl_change(); }
89 void on_node_grid_change() const {
90 throw std::runtime_error("MPI topology change not supported by LB");
91 }
92 void on_timestep_change() const {}
93 void on_temperature_change() const {}
96 static void update_collision_model(LBWalberlaBase &instance,
97 LBWalberlaParams &params, double kT,
98 unsigned int seed);
99};
100
101} // namespace LB
102
103#endif // WALBERLA
Vector implementation and trait types for boost qvm interoperability.
Interface of a lattice-based fluid model.
Main system class.
This file contains the defaults for ESPResSo.
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
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)
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()