ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ek/Solver.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023-2026 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 "system/Leaf.hpp"
23
24#include "utils.hpp"
25
26#include <cassert>
27#include <memory>
28
29namespace EK {
30
31struct Solver : public System::Leaf<Solver> {
32 struct Implementation;
33
34 Solver();
35
36 /** @brief Return true if an EK solver is active. */
37 [[nodiscard]] bool is_solver_set() const;
38
39 /** @brief Return true if an EK solver can be propagated. */
40 bool is_ready_for_propagation() const;
41
42 /** @brief Remove the EK solver. */
43 void reset();
44
45 /**
46 * @brief Set the EK solver.
47 * For developers: a specialization must exist for every new EK type.
48 */
49 template <typename LB, class... Args> void set(Args... args);
50
51 /**
52 * @brief Connector to the implementation internal state.
53 * For developers: use this mechanism to access the underlying variant.
54 */
55 template <class Connector> void connect(Connector &&connector) const {
56 assert(impl != nullptr);
57 connector(*this->impl);
58 }
59
60 /**
61 * @brief Propagate the EK species.
62 */
63 void propagate();
64
65 /**
66 * @brief Perform a full initialization of the lattice-Boltzmann system.
67 * All derived parameters and the fluid are reset to their default values.
68 */
69 void init() const {}
70
71 bool is_gpu() const;
72
73 /**
74 * @brief Get the EK time step.
75 */
76 double get_tau() const;
77
78 /**
79 * @brief Perform EK parameter checks.
80 */
81 void sanity_checks() const;
82
83 /**
84 * @brief Check if a MD time step is compatible with the EK tau.
85 */
86 void veto_time_step(double time_step) const;
87
88 /**
89 * @brief Check if a thermostat is compatible with the EK temperature.
90 */
91 void veto_kT(double kT) const;
92
93 void on_boxl_change();
96 void on_timestep_change();
98 void veto_boxl_change() const;
99
100private:
101 /** @brief Pointer-to-implementation. */
102 std::unique_ptr<Implementation> impl;
103};
104
105} // namespace EK
Abstract class that represents a component of the system.
void veto_time_step(double time_step) const
Check if a MD time step is compatible with the EK tau.
Definition ek/Solver.cpp:86
void on_boxl_change()
void on_node_grid_change()
void propagate()
Propagate the EK species.
Definition ek/Solver.cpp:74
void sanity_checks() const
Perform EK parameter checks.
Definition ek/Solver.cpp:79
void connect(Connector &&connector) const
Connector to the implementation internal state.
Definition ek/Solver.hpp:55
void on_cell_structure_change()
void set(Args... args)
Set the EK solver.
void init() const
Perform a full initialization of the lattice-Boltzmann system.
Definition ek/Solver.hpp:69
void veto_boxl_change() const
Definition ek/Solver.cpp:99
bool is_gpu() const
bool is_ready_for_propagation() const
Return true if an EK solver can be propagated.
Definition ek/Solver.cpp:68
double get_tau() const
Get the EK time step.
void on_timestep_change()
void on_temperature_change()
void veto_kT(double kT) const
Check if a thermostat is compatible with the EK temperature.
Definition ek/Solver.cpp:93
void reset()
Remove the EK solver.
Definition ek/Solver.cpp:60
bool is_solver_set() const
Return true if an EK solver is active.
Definition ek/Solver.cpp:58