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 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 <cmath>
28#include <memory>
29#include <optional>
30
31namespace EK {
32
33struct Solver : public System::Leaf<Solver> {
34 struct Implementation;
35
36 Solver();
37
38 /** @brief Return true if an EK solver is active. */
39 [[nodiscard]] bool is_solver_set() const;
40
41 /** @brief Return true if an EK solver can be propagated. */
42 bool is_ready_for_propagation() const;
43
44 /** @brief Remove the EK solver. */
45 void reset();
46
47 /**
48 * @brief Set the EK solver.
49 * For developers: a specialization must exist for every new EK type.
50 */
51 template <typename LB, class... Args> void set(Args... args);
52
53 /**
54 * @brief Connector to the implementation internal state.
55 * For developers: use this mechanism to access the underlying variant.
56 */
57 template <class Connector> void connect(Connector &&connector) const {
58 assert(impl != nullptr);
59 connector(*this->impl);
60 }
61
62 /**
63 * @brief Propagate the EK species.
64 */
65 void propagate();
66
67 /**
68 * @brief Perform a full initialization of the lattice-Boltzmann system.
69 * All derived parameters and the fluid are reset to their default values.
70 */
71 void init() 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:80
void on_boxl_change()
void on_node_grid_change()
void propagate()
Propagate the EK species.
Definition ek/Solver.cpp:68
void sanity_checks() const
Perform EK parameter checks.
Definition ek/Solver.cpp:73
void connect(Connector &&connector) const
Connector to the implementation internal state.
Definition ek/Solver.hpp:57
void on_cell_structure_change()
Definition ek/Solver.cpp:99
void set(Args... args)
Set the EK solver.
void init() const
Perform a full initialization of the lattice-Boltzmann system.
Definition ek/Solver.hpp:71
void veto_boxl_change() const
Definition ek/Solver.cpp:93
bool is_ready_for_propagation() const
Return true if an EK solver can be propagated.
Definition ek/Solver.cpp:62
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:87
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