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
EKinWalberlaBase.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022-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
23
24#include <utils/Vector.hpp>
25
26#include <cstddef>
27#include <optional>
28#include <vector>
29
30/** @brief Interface of a lattice-based electrokinetic model. */
32public:
33 /** @brief Integrate EKin for one time step */
34 virtual void integrate(std::size_t potential_id, std::size_t velocity_id,
35 std::size_t force_id) = 0;
36
37 /** @brief perform ghost communication of densities */
38 virtual void ghost_communication() = 0;
39
40 /** @brief Number of discretized fluxes */
41 [[nodiscard]] virtual std::size_t stencil_size() const noexcept = 0;
42
43 /** @brief Set node density. */
44 virtual bool set_node_density(Utils::Vector3i const &node,
45 double density) = 0;
46
47 /** @brief Get node density. */
48 [[nodiscard]] virtual std::optional<double>
49 get_node_density(Utils::Vector3i const &node,
50 bool consider_ghosts = false) const = 0;
51
52 /** @brief Set slice density. */
53 virtual void set_slice_density(Utils::Vector3i const &lower_corner,
54 Utils::Vector3i const &upper_corner,
55 std::vector<double> const &density) = 0;
56
57 /** @brief Get slice density. */
58 [[nodiscard]] virtual std::vector<double>
59 get_slice_density(Utils::Vector3i const &lower_corner,
60 Utils::Vector3i const &upper_corner) const = 0;
61
62 /** @brief Set node flux boundary conditions. */
63 virtual bool set_node_flux_boundary(Utils::Vector3i const &node,
64 Utils::Vector3d const &flux) = 0;
65
66 /** @brief Get node flux boundary conditions. */
67 [[nodiscard]] virtual std::optional<Utils::Vector3d>
68 get_node_flux_at_boundary(Utils::Vector3i const &node,
69 bool consider_ghosts = false) const = 0;
70
71 /** @brief Set slice flux boundary conditions. */
73 Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner,
74 std::vector<std::optional<Utils::Vector3d>> const &flux) = 0;
75
76 /** @brief Get slice flux boundary conditions. */
77 [[nodiscard]] virtual std::vector<std::optional<Utils::Vector3d>>
78 get_slice_flux_at_boundary(Utils::Vector3i const &lower_corner,
79 Utils::Vector3i const &upper_corner) const = 0;
80
81 virtual bool remove_node_from_flux_boundary(Utils::Vector3i const &node) = 0;
82
83 /** @brief Set node density boundary conditions. */
84 virtual bool set_node_density_boundary(Utils::Vector3i const &node,
85 double density) = 0;
86
87 /** @brief Get node density boundary conditions. */
88 [[nodiscard]] virtual std::optional<double>
89 get_node_density_at_boundary(Utils::Vector3i const &node,
90 bool consider_ghosts = false) const = 0;
91
92 /** @brief Set slice density boundary conditions. */
94 Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner,
95 std::vector<std::optional<double>> const &density) = 0;
96
97 /** @brief Get slice density boundary conditions. */
98 [[nodiscard]] virtual std::vector<std::optional<double>>
99 get_slice_density_at_boundary(Utils::Vector3i const &lower_corner,
100 Utils::Vector3i const &upper_corner) const = 0;
101
102 virtual bool
103 remove_node_from_density_boundary(Utils::Vector3i const &node) = 0;
104
105 /** @brief Check if node has flux boundary conditions. */
106 [[nodiscard]] virtual std::optional<bool>
107 get_node_is_flux_boundary(Utils::Vector3i const &node,
108 bool consider_ghosts = false) const = 0;
109
110 /** @brief Check if node has density boundary conditions. */
111 [[nodiscard]] virtual std::optional<bool>
112 get_node_is_density_boundary(Utils::Vector3i const &node,
113 bool consider_ghosts = false) const = 0;
114
115 /** @brief Check if node has any boundary conditions. */
116 [[nodiscard]] virtual std::optional<bool>
117 get_node_is_boundary(Utils::Vector3i const &node,
118 bool consider_ghosts = false) const = 0;
119
120 /** @brief Check if slice has any boundary conditions. */
121 [[nodiscard]] virtual std::vector<bool>
122 get_slice_is_boundary(Utils::Vector3i const &lower_corner,
123 Utils::Vector3i const &upper_corner) const = 0;
124
125 virtual void clear_flux_boundaries() = 0;
126 virtual void clear_density_boundaries() = 0;
127
128 virtual void update_flux_boundary_from_shape(std::vector<int> const &,
129 std::vector<double> const &) = 0;
130 virtual void
131 update_density_boundary_from_shape(std::vector<int> const &,
132 std::vector<double> const &) = 0;
133
134 // Global parameters
135 [[nodiscard]] virtual double get_diffusion() const noexcept = 0;
136 [[nodiscard]] virtual double get_kT() const noexcept = 0;
137 [[nodiscard]] virtual double get_valency() const noexcept = 0;
138 [[nodiscard]] virtual bool get_advection() const noexcept = 0;
139 [[nodiscard]] virtual bool get_friction_coupling() const noexcept = 0;
140 [[nodiscard]] virtual Utils::Vector3d get_ext_efield() const noexcept = 0;
141 [[nodiscard]] virtual bool is_double_precision() const noexcept = 0;
142 [[nodiscard]] virtual bool is_thermalized() const noexcept = 0;
143 [[nodiscard]] virtual unsigned int get_seed() const noexcept = 0;
144 [[nodiscard]] virtual std::optional<uint64_t> get_rng_state() const = 0;
145
146 virtual void set_diffusion(double diffusion) = 0;
147 virtual void set_kT(double kT) = 0;
148 virtual void set_valency(double valency) = 0;
149 virtual void set_advection(bool advection) = 0;
150 virtual void set_friction_coupling(bool friction_coupling) = 0;
151 virtual void set_rng_state(uint64_t counter) = 0;
152 virtual void set_ext_efield(Utils::Vector3d const &field) = 0;
153
154 [[nodiscard]] virtual std::size_t get_density_id() const noexcept = 0;
155
156 ~EKinWalberlaBase() override = default;
157};
Vector implementation and trait types for boost qvm interoperability.
Interface of a lattice-based electrokinetic model.
virtual std::vector< std::optional< double > > get_slice_density_at_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice density boundary conditions.
virtual std::optional< double > get_node_density(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Get node density.
virtual std::optional< Utils::Vector3d > get_node_flux_at_boundary(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Get node flux boundary conditions.
virtual std::vector< bool > get_slice_is_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Check if slice has any boundary conditions.
virtual void set_slice_density_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< std::optional< double > > const &density)=0
Set slice density boundary conditions.
virtual std::optional< bool > get_node_is_boundary(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Check if node has any boundary conditions.
virtual bool is_double_precision() const noexcept=0
virtual void clear_density_boundaries()=0
virtual std::optional< double > get_node_density_at_boundary(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Get node density boundary conditions.
virtual void set_slice_flux_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< std::optional< Utils::Vector3d > > const &flux)=0
Set slice flux boundary conditions.
virtual std::optional< bool > get_node_is_density_boundary(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Check if node has density boundary conditions.
virtual void set_diffusion(double diffusion)=0
virtual void clear_flux_boundaries()=0
virtual void set_advection(bool advection)=0
virtual std::vector< std::optional< Utils::Vector3d > > get_slice_flux_at_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice flux boundary conditions.
virtual std::optional< uint64_t > get_rng_state() const =0
virtual void set_kT(double kT)=0
virtual void integrate(std::size_t potential_id, std::size_t velocity_id, std::size_t force_id)=0
Integrate EKin for one time step.
virtual bool get_friction_coupling() const noexcept=0
virtual double get_kT() const noexcept=0
virtual void update_flux_boundary_from_shape(std::vector< int > const &, std::vector< double > const &)=0
virtual Utils::Vector3d get_ext_efield() const noexcept=0
virtual void set_ext_efield(Utils::Vector3d const &field)=0
virtual void set_rng_state(uint64_t counter)=0
virtual bool set_node_density(Utils::Vector3i const &node, double density)=0
Set node density.
virtual double get_diffusion() const noexcept=0
virtual std::vector< double > get_slice_density(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice density.
virtual bool is_thermalized() const noexcept=0
virtual std::optional< bool > get_node_is_flux_boundary(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Check if node has flux boundary conditions.
virtual bool set_node_flux_boundary(Utils::Vector3i const &node, Utils::Vector3d const &flux)=0
Set node flux boundary conditions.
virtual bool remove_node_from_flux_boundary(Utils::Vector3i const &node)=0
virtual bool get_advection() const noexcept=0
virtual void set_friction_coupling(bool friction_coupling)=0
virtual double get_valency() const noexcept=0
virtual void ghost_communication()=0
perform ghost communication of densities
virtual std::size_t stencil_size() const noexcept=0
Number of discretized fluxes.
virtual unsigned int get_seed() const noexcept=0
virtual void set_slice_density(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< double > const &density)=0
Set slice density.
virtual bool remove_node_from_density_boundary(Utils::Vector3i const &node)=0
virtual std::size_t get_density_id() const noexcept=0
virtual void update_density_boundary_from_shape(std::vector< int > const &, std::vector< double > const &)=0
virtual bool set_node_density_boundary(Utils::Vector3i const &node, double density)=0
Set node density boundary conditions.
virtual void set_valency(double valency)=0
Abstract representation of a lattice-based model.