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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/equation_systems/PDEHelpers.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
PDEHelpers.H
Go to the documentation of this file.
1#ifndef PDEHELPERS_H
2#define PDEHELPERS_H
3
4#include <string>
5
11
12namespace amr_wind {
13namespace pde_impl {
14
16inline std::string conv_term_name(const std::string& var)
17{
18 return var + "_conv_term";
19}
20
22inline std::string diff_term_name(const std::string& var)
23{
24 return var + "_diff_term";
25}
26
28inline std::string src_term_name(const std::string& var)
29{
30 return var + "_src_term";
31}
32
34inline std::string mueff_name(const std::string& var) { return var + "_mueff"; }
35
36} // namespace pde_impl
37
38namespace pde {
39
48template <typename PDE, typename Scheme>
50 const SimTime& time,
51 FieldRepo& repo,
53{
54 repo.declare_field(
55 PDE::var_name(), PDE::ndim, Scheme::nghost_state, Scheme::num_states);
56 repo.declare_field(pde_impl::mueff_name(PDE::var_name()), 1, 1, 1);
57 repo.declare_field(
58 pde_impl::src_term_name(PDE::var_name()), PDE::ndim, Scheme::nghost_src,
59 1);
60 repo.declare_field(
61 pde_impl::diff_term_name(PDE::var_name()), PDE::ndim, 0,
62 Scheme::num_diff_states);
63 repo.declare_field(
64 pde_impl::conv_term_name(PDE::var_name()), PDE::ndim, 0,
65 Scheme::num_conv_states);
66
67 PDEFields fields(repo, PDE::var_name());
69 repo.mesh(), time, itype);
73
74 fields.field.fillpatch_on_regrid() = true;
75
76 if (PDE::need_nph_state) {
78 }
79
80 return fields;
81}
82
83} // namespace pde
84} // namespace amr_wind
85
86#endif /* PDEHELPERS_H */
Definition FieldFillPatchOps.H:174
Field & create_state(const FieldState fstate) noexcept
Create a new time state after the field has been created.
Definition Field.cpp:333
bool & fillpatch_on_regrid()
Definition Field.H:161
void set_default_fillpatch_bc(const SimTime &time, const amrex::BCType::mathematicalBndryTypes bctype=amrex::BCType::hoextrap) noexcept
Definition Field.cpp:377
void register_fill_patch_op(Args &&... args)
Definition Field.H:306
Definition FieldRepo.H:86
Field & declare_field(const std::string &name, const int ncomp=1, const int ngrow=0, const int nstates=1, const FieldLoc floc=FieldLoc::CELL)
Definition FieldRepo.cpp:83
const amrex::AmrCore & mesh() const
Return a reference to the underlying AMR mesh instance.
Definition FieldRepo.H:358
Definition SimTime.H:30
FieldInterpolator
Definition FieldDescTypes.H:37
@ NPH
State at (n + 1/2) (intermediate) timestep.
@ PiecewiseConstant
Constant across cell.
@ CellConsLinear
Linear interpolation.
std::string diff_term_name(const std::string &var)
Field name that holds the diffusion term (divtau and laplacian for scalars)
Definition PDEHelpers.H:22
std::string mueff_name(const std::string &var)
Effective viscosity for the transport equation.
Definition PDEHelpers.H:34
std::string src_term_name(const std::string &var)
Field name for all the source terms.
Definition PDEHelpers.H:28
std::string conv_term_name(const std::string &var)
Field name that holds the convective term.
Definition PDEHelpers.H:16
PDEFields create_fields_instance(const SimTime &time, FieldRepo &repo, const FieldInterpolator itype=FieldInterpolator::CellConsLinear)
Definition PDEHelpers.H:49
Definition BCInterface.cpp:7
Definition PDEFields.H:27
Field & src_term
Source term for this PDE.
Definition PDEFields.H:39
Field & mueff
Effective visocity field (e.g., velocity_mueff)
Definition PDEFields.H:36
Field & field
Solution variable (e.g., velocity, temperature)
Definition PDEFields.H:34