ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
EKinWalberlaBase.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022-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
23
24#include <utils/Vector.hpp>
25
26#include <cstddef>
27#include <cstdint>
28#include <optional>
29#include <vector>
30
31/** @brief Interface of a lattice-based electrokinetic model. */
33public:
34 /** @brief Integrate EKin for one time step */
35 virtual void integrate(std::size_t potential_id, std::size_t velocity_id,
36 std::size_t force_id, double lb_density) = 0;
37
38 /** @brief perform ghost communication of densities */
39 virtual void ghost_communication() = 0;
40
41 /** @brief Number of discretized fluxes */
42 [[nodiscard]] virtual std::size_t stencil_size() const noexcept = 0;
43
44 /** @brief Set node density. */
45 virtual bool set_node_density(Utils::Vector3i const &node,
46 double density) = 0;
47
48 /** @brief Get node density. */
49 [[nodiscard]] virtual std::optional<double>
50 get_node_density(Utils::Vector3i const &node,
51 bool consider_ghosts = false) const = 0;
52
53 /** @brief Set slice density. */
55 Utils::Vector3i const &upper_corner,
56 std::vector<double> const &density) = 0;
57
58 /** @brief Get slice density. */
59 [[nodiscard]] virtual std::vector<double>
61 Utils::Vector3i const &upper_corner) const = 0;
62
63 /** @brief Get node flux vector. */
64 [[nodiscard]] virtual std::optional<Utils::Vector3d>
66 bool consider_ghosts = false) const = 0;
67
68 /** @brief Get slice density. */
69 [[nodiscard]] virtual std::vector<double>
71 Utils::Vector3i const &upper_corner) const = 0;
72
73 /** @brief Set node flux boundary conditions. */
75 Utils::Vector3d const &flux) = 0;
76
77 /** @brief Get node flux boundary conditions. */
78 [[nodiscard]] virtual std::optional<Utils::Vector3d>
80 bool consider_ghosts = false) const = 0;
81
82 /** @brief Set slice flux boundary conditions. */
84 Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner,
85 std::vector<std::optional<Utils::Vector3d>> const &flux) = 0;
86
87 /** @brief Get slice flux boundary conditions. */
88 [[nodiscard]] virtual std::vector<std::optional<Utils::Vector3d>>
90 Utils::Vector3i const &upper_corner) const = 0;
91
93
94 /** @brief Set node density boundary conditions. */
96 double density) = 0;
97
98 /** @brief Get node density boundary conditions. */
99 [[nodiscard]] virtual std::optional<double>
101 bool consider_ghosts = false) const = 0;
102
103 /** @brief Set slice density boundary conditions. */
105 Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner,
106 std::vector<std::optional<double>> const &density) = 0;
107
108 /** @brief Get slice density boundary conditions. */
109 [[nodiscard]] virtual std::vector<std::optional<double>>
111 Utils::Vector3i const &upper_corner) const = 0;
112
113 virtual bool
115
116 /** @brief Check if node has flux boundary conditions. */
117 [[nodiscard]] virtual std::optional<bool>
119 bool consider_ghosts = false) const = 0;
120
121 /** @brief Check if node has density boundary conditions. */
122 [[nodiscard]] virtual std::optional<bool>
124 bool consider_ghosts = false) const = 0;
125
126 /** @brief Check if node has any boundary conditions. */
127 [[nodiscard]] virtual std::optional<bool>
129 bool consider_ghosts = false) const = 0;
130
131 /** @brief Check if slice has any boundary conditions. */
132 [[nodiscard]] virtual std::vector<bool>
134 Utils::Vector3i const &upper_corner) const = 0;
135
138
140 std::vector<double> const &) = 0;
141 virtual void
143 std::vector<double> const &) = 0;
144
145 // Global parameters
154 [[nodiscard]] virtual unsigned int get_seed() const noexcept = 0;
156
158 virtual void set_kT(double kT) = 0;
159 virtual void set_valency(double valency) = 0;
162 virtual void set_rng_state(uint64_t counter) = 0;
163 virtual void set_ext_efield(Utils::Vector3d const &field) = 0;
164
166
167 /** @brief Get whether the kernels run on GPUs. */
169
171};
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 std::vector< double > get_slice_flux_vector(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice density.
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 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 std::optional< Utils::Vector3d > get_node_flux_vector(Utils::Vector3i const &node, bool consider_ghosts=false) const =0
Get node flux vector.
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 bool is_gpu() const noexcept=0
Get whether the kernels run on GPUs.
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 void integrate(std::size_t potential_id, std::size_t velocity_id, std::size_t force_id, double lb_density)=0
Integrate EKin for one time step.
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.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
STL namespace.