/home/runner/work/amr-wind/amr-wind/amr-wind/equation_systems/PDEBase.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/equation_systems/PDEBase.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
PDEBase.H
Go to the documentation of this file.
1#ifndef PDEBASE_H
2#define PDEBASE_H
3
4#include <string>
5
11
12namespace amr_wind {
13
14class CFDSim;
15
16namespace pde {
17
50class PDEBase : public Factory<PDEBase, CFDSim&>
51{
52public:
53 ~PDEBase() override = default;
54
56 virtual PDEFields& fields() = 0;
57 virtual const PDEFields& fields() const = 0;
58
60 virtual void initialize() = 0;
61
63 virtual void post_regrid_actions() = 0;
64
66 virtual void compute_source_term(const FieldState fstate) = 0;
67
69 virtual void compute_mueff(const FieldState fstate) = 0;
70
72 virtual void compute_diffusion_term(const FieldState fstate) = 0;
73
75 virtual void pre_advection_actions(const FieldState fstate) = 0;
76
78 virtual void compute_advection_term(const FieldState fstate) = 0;
79
86 virtual void compute_predictor_rhs(const DiffusionType difftype) = 0;
87
95 virtual void compute_corrector_rhs(const DiffusionType difftype) = 0;
96
98 virtual void solve(const amrex::Real dt) = 0;
99
101 virtual void post_solve_actions() = 0;
102
104 static std::string base_identifier() { return "PDESystem"; }
105};
106
114class PDEMgr : public CollMgr<PDEMgr, PDEBase>
115{
116public:
117 explicit PDEMgr(CFDSim& sim);
118
119 ~PDEMgr() = default;
120
122 PDEBase& icns() { return *m_icns; }
123 const PDEBase& icns() const { return *m_icns; }
124
128
130 PDEBase& register_transport_pde(const std::string& pde_name);
131
133 void advance_states();
134
137 void prepare_boundaries();
138
141 const amrex::Real time, const FieldState fstate = FieldState::New);
142
149 const TypeVector& scalar_eqns() const { return m_obj_vec; }
150
152 bool has_pde(const std::string& pde_name) const;
153
154 int num_ghost_state() const;
155
156 bool constant_density() const { return m_constant_density; }
157
158 std::string scheme() const { return m_scheme; }
159
160private:
163
165 std::unique_ptr<PDEBase> m_icns;
166
168 std::string m_scheme;
169
171 bool m_use_godunov{true};
172
175};
176
177} // namespace pde
178} // namespace amr_wind
179
180#endif /* PDEBASE_H */
Definition CFDSim.H:47
Definition CollMgr.H:22
amrex::Vector< TypePtr > TypeVector
Definition CollMgr.H:25
TypeVector m_obj_vec
Definition CollMgr.H:81
Definition PDEBase.H:51
virtual void pre_advection_actions(const FieldState fstate)=0
Perform necessary steps to prepare for advection calculations.
virtual void compute_corrector_rhs(const DiffusionType difftype)=0
virtual void initialize()=0
Perform initialization actions for a PDE after the mesh is generated.
virtual void compute_source_term(const FieldState fstate)=0
Compute the source (forcing) terms for this PDE.
virtual PDEFields & fields()=0
Return the object that holds references to fields for this PDE system.
virtual const PDEFields & fields() const =0
virtual void solve(const amrex::Real dt)=0
Solve the diffusion linear system and update the field.
~PDEBase() override=default
virtual void post_regrid_actions()=0
Perform updates specific to PDE after a regrid is performed.
virtual void compute_predictor_rhs(const DiffusionType difftype)=0
virtual void compute_mueff(const FieldState fstate)=0
Compute the effective dynamic viscosity for this PDE.
virtual void post_solve_actions()=0
Perform post-processing actions after a system solve.
virtual void compute_diffusion_term(const FieldState fstate)=0
Compute the diffusion term used in the RHS of the PDE system.
virtual void compute_advection_term(const FieldState fstate)=0
Compute the time derivative and advective term for the PDE system.
static std::string base_identifier()
Base class identifier used for factory registration interface.
Definition PDEBase.H:104
Definition PDEBase.H:115
void advance_states()
Advance states for all registered PDEs at the beginning of a timestep.
Definition PDEBase.cpp:79
const PDEBase & icns() const
Definition PDEBase.H:123
int num_ghost_state() const
Definition PDEBase.cpp:74
bool constant_density() const
Definition PDEBase.H:156
PDEMgr(CFDSim &sim)
Definition PDEBase.cpp:22
bool m_constant_density
Flag indicating whether density is constant for this simulation.
Definition PDEBase.H:174
std::unique_ptr< PDEBase > m_icns
ICNS instance.
Definition PDEBase.H:165
bool m_use_godunov
Flag indicating whether Godunov scheme is active.
Definition PDEBase.H:171
std::string scheme() const
Definition PDEBase.H:158
PDEBase & icns()
Return the incompressible Navier-Stokes instance.
Definition PDEBase.H:122
PDEBase & register_icns()
Definition PDEBase.cpp:47
bool has_pde(const std::string &pde_name) const
Query if a PDE has already been registered.
Definition PDEBase.cpp:68
TypeVector & scalar_eqns()
Definition PDEBase.H:148
CFDSim & m_sim
Instance of the CFD simulation controller.
Definition PDEBase.H:162
std::string m_scheme
Unique identifier for the numerical scheme.
Definition PDEBase.H:168
void fillpatch_state_fields(const amrex::Real time, const FieldState fstate=FieldState::New)
Call fillpatch operator on state variables for all registered PDEs.
Definition PDEBase.cpp:145
PDEBase & register_transport_pde(const std::string &pde_name)
Register a new PDE instance and return its reference.
Definition PDEBase.cpp:55
const TypeVector & scalar_eqns() const
Definition PDEBase.H:149
void prepare_boundaries()
Definition PDEBase.cpp:91
FieldState
Definition FieldDescTypes.H:14
@ New
Same as FieldState::NP1.
DiffusionType
Definition incflo_enums.H:4
Definition BCInterface.cpp:7
Definition Factory.H:65
Definition PDEFields.H:27