/home/runner/work/amr-wind/amr-wind/amr-wind/core/Physics.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/core/Physics.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
Physics.H
Go to the documentation of this file.
1#ifndef PHYSICS_H
2#define PHYSICS_H
3
6#include "AMReX_MultiFab.H"
7#include "AMReX_Geometry.H"
8
9namespace amr_wind {
10
11class CFDSim;
12
14{
15public:
16 virtual ~PhysicsOld() = default;
17
18 virtual std::string physics_name() const = 0;
19
21 virtual void
22 initialize_fields(int level, const amrex::Geometry& geom) const = 0;
23
25 virtual void pre_advance_work() = 0;
26
29 const amrex::Geometry& geom,
30 const amrex::MultiFab& density,
31 const amrex::MultiFab& velocity,
32 const amrex::MultiFab& scalars,
33 amrex::MultiFab& vel_forces) const = 0;
34};
35
59class Physics : public Factory<Physics, CFDSim&>
60{
61public:
62 static std::string base_identifier() { return "Physics"; }
63
64 ~Physics() override = default;
65
67 virtual void initialize_fields(int level, const amrex::Geometry& geom) = 0;
68
71 virtual void pre_init_actions() {}
72
74 virtual void post_init_actions() = 0;
75
77 virtual void post_regrid_actions() = 0;
78
80 virtual void pre_advance_work() = 0;
81
83 virtual void pre_predictor_work() {}
84
86 virtual void post_advance_work() = 0;
87
90
93};
94
99class PhysicsMgr : public CollMgr<PhysicsMgr, Physics>
100{
101public:
103 template <typename T>
104 T& get()
105 {
106 AMREX_ASSERT(contains(T::identifier()));
107 return dynamic_cast<T&>(operator()(T::identifier()));
108 }
109
111 template <typename T>
112 const T& get() const
113 {
114 AMREX_ASSERT(contains(T::identifier()));
115 return dynamic_cast<const T&>(operator()(T::identifier()));
116 }
117};
118
119} // namespace amr_wind
120
121#endif /* PHYSICS_H */
Definition CollMgr.H:22
Physics & operator()(const std::string &key)
Definition CollMgr.H:62
bool contains(const std::string &key) const
Definition CollMgr.H:55
Definition Physics.H:60
virtual void post_advance_work()=0
Perform tasks necessary after advancing timestep.
virtual void pre_predictor_work()
Perform tasks necessary only once per timestep, after pre_advance.
Definition Physics.H:83
static std::string base_identifier()
Definition Physics.H:62
virtual void post_pressure_correction_work()
Perform tasks necessary after applying the pressure correction.
Definition Physics.H:92
virtual void post_init_actions()=0
Actions to perform post initialization.
virtual void pre_pressure_correction_work()
Perform tasks necessary before applying the pressure correction.
Definition Physics.H:89
virtual void pre_init_actions()
Definition Physics.H:71
virtual void post_regrid_actions()=0
Actions to perform post regrid.
~Physics() override=default
virtual void initialize_fields(int level, const amrex::Geometry &geom)=0
Initialize the fields for a given level during init/regrid.
virtual void pre_advance_work()=0
Perform tasks necessary before advancing timestep.
Definition Physics.H:100
T & get()
Return a concrete physics instance.
Definition Physics.H:104
const T & get() const
Return a concrete physics instance.
Definition Physics.H:112
Definition Physics.H:14
virtual void pre_advance_work()=0
Perform tasks necessary before advancing timestep.
virtual ~PhysicsOld()=default
virtual std::string physics_name() const =0
virtual void add_momentum_sources(const amrex::Geometry &geom, const amrex::MultiFab &density, const amrex::MultiFab &velocity, const amrex::MultiFab &scalars, amrex::MultiFab &vel_forces) const =0
Add momentum source terms.
virtual void initialize_fields(int level, const amrex::Geometry &geom) const =0
Initialize the fields for the physics/problem.
Definition BCInterface.cpp:7
Definition Factory.H:65