/home/runner/work/kynema-sgf/kynema-sgf/src/boundary_conditions/BCInterface.H Source File

Kynema-SGF API: /home/runner/work/kynema-sgf/kynema-sgf/src/boundary_conditions/BCInterface.H Source File
Kynema-SGF API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
BCInterface.H
Go to the documentation of this file.
1#ifndef BCINTERFACE_H
2#define BCINTERFACE_H
3
4#include "src/core/Field.H"
5#include "src/incflo_enums.H"
6
7#include "AMReX_BC_TYPES.H"
8
9#include <utility>
10#include "AMReX_REAL.H"
11
12using namespace amrex::literals;
13
29
30namespace kynema_sgf {
32
33enum class InflowValidationStage : std::uint8_t { configuration, initialized };
34
35namespace {
36amrex::Vector<std::string> bcnames = {"xlo", "ylo", "zlo", "xhi", "yhi", "zhi"};
37}
38
47{
48public:
49 using IncfloBC = amrex::GpuArray<BC, AMREX_SPACEDIM * 2>;
50
51 BCIface(Field& field);
52
53 virtual ~BCIface() = default;
54
56 virtual void operator()(amrex::Real value = 0.0_rt);
57
59 amrex::Array<const std::string, 3> get_dirichlet_udfs();
60
62 static void validate_inflow_values(
63 const FieldRepo& repo,
64 const FieldBoundaryMgr& boundaries,
66
67protected:
69 virtual void set_bcrec() = 0;
70
72 virtual void read_values() = 0;
73
75 virtual void read_bctype();
76
78 virtual void set_bcfuncs();
79
81 void set_default_value(amrex::Real value);
82
83 virtual amrex::Array<const std::string, 3> inflow_udfs()
84 {
85 return get_dirichlet_udfs();
86 }
87
88 void read_inflow_values();
89
91 void set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
92 {
93 auto& fbcrec = m_field.bcrec();
94 for (int i = 0; i < m_field.num_comp(); ++i) {
95 fbcrec[i].setLo(dir, bcrec);
96 }
97 }
98
100 void set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
101 {
102 auto& fbcrec = m_field.bcrec();
103 for (int i = 0; i < m_field.num_comp(); ++i) {
104 fbcrec[i].setHi(dir, bcrec);
105 }
106 }
107
110};
111
115class BCVelocity : public BCIface
116{
117public:
118 explicit BCVelocity(Field& field) : BCIface(field) {}
119
120protected:
121 void set_bcrec() override;
122 void read_values() override;
123};
124
128class BCScalar : public BCIface
129{
130public:
131 explicit BCScalar(Field& field) : BCIface(field) {}
132
133protected:
134 void set_bcrec() override;
135 void read_values() override;
136};
137
143class BCPressure : public BCScalar
144{
145public:
146 explicit BCPressure(Field& field) : BCScalar(field) {}
147
148protected:
149 void read_values() override;
150};
151
158class BCSrcTerm : public BCIface
159{
160public:
161 explicit BCSrcTerm(Field& field) : BCIface(field) {}
162
163protected:
164 void set_bcrec() override;
165 void read_values() override
166 {
167 // No values specified for source terms. empty method to satisfy
168 // inheritance
169 }
170};
171
180{
181public:
183 Field& field,
184 amrex::BCType::mathematicalBndryTypes bctype = amrex::BCType::hoextrap)
185 : BCIface(field), m_extrap_type(bctype)
186 {}
187
188protected:
189 void set_bcrec() override;
190 void read_values() override
191 {
192 // No values specified for source terms. empty method to satisfy
193 // inheritance
194 }
195
196 amrex::BCType::mathematicalBndryTypes m_extrap_type;
197};
198
199} // namespace kynema_sgf
200
201#endif /* BCINTERFACE_H */
amrex::BCType::mathematicalBndryTypes m_extrap_type
Definition BCInterface.H:196
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:460
BCFillPatchExtrap(Field &field, amrex::BCType::mathematicalBndryTypes bctype=amrex::BCType::hoextrap)
Definition BCInterface.H:182
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:190
void set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the upper boundaries.
Definition BCInterface.H:100
virtual amrex::Array< const std::string, 3 > inflow_udfs()
Definition BCInterface.H:83
amrex::Array< const std::string, 3 > get_dirichlet_udfs()
User-defined functions for Dirichlet-type boundaries.
Definition BCInterface.cpp:113
void set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the lower boundaries.
Definition BCInterface.H:91
Field & m_field
Field instance where BC is being set.
Definition BCInterface.H:109
static void validate_inflow_values(const FieldRepo &repo, const FieldBoundaryMgr &boundaries, InflowValidationStage stage=InflowValidationStage::initialized)
Validate configuration before meshing, then actual coverage after setup.
Definition BCInterface.cpp:369
virtual void set_bcrec()=0
Setup AMReX mathematical BC types.
amrex::GpuArray< BC, AMREX_SPACEDIM *2 > IncfloBC
Definition BCInterface.H:49
virtual void read_bctype()
Parse custom BCs specified for this field.
Definition BCInterface.cpp:39
virtual void operator()(amrex::Real value=0.0_rt)
Operator that performs init actions and syncs the BC data to device.
Definition BCInterface.cpp:16
virtual ~BCIface()=default
void set_default_value(amrex::Real value)
Set default BC values for the field.
Definition BCInterface.cpp:28
virtual void set_bcfuncs()
BC functions for Neumann type boundaries.
Definition BCInterface.cpp:100
BCIface(Field &field)
Definition BCInterface.cpp:14
virtual void read_values()=0
Read input data for specific fields based on BC types.
void read_inflow_values()
Definition BCInterface.cpp:344
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:417
BCPressure(Field &field)
Definition BCInterface.H:146
BCScalar(Field &field)
Definition BCInterface.H:131
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:280
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:342
BCSrcTerm(Field &field)
Definition BCInterface.H:161
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:165
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:435
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:183
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:264
BCVelocity(Field &field)
Definition BCInterface.H:118
Definition FieldBoundary.H:66
Definition Field.H:115
Definition FieldRepo.H:86
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:12
InflowValidationStage
Definition BCInterface.H:33
@ initialized
Definition BCInterface.H:33
@ configuration
Definition BCInterface.H:33