/home/runner/work/amr-wind/amr-wind/amr-wind/boundary_conditions/BCInterface.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/boundary_conditions/BCInterface.H Source File
AMR-Wind 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
6
7#include "AMReX_BC_TYPES.H"
8
9#include <utility>
10#include "AMReX_REAL.H"
11
12using namespace amrex::literals;
13
29
30namespace amr_wind {
31namespace {
32amrex::Vector<std::string> bcnames = {"xlo", "ylo", "zlo", "xhi", "yhi", "zhi"};
33}
34
43{
44public:
45 using IncfloBC = amrex::GpuArray<BC, AMREX_SPACEDIM * 2>;
46
47 BCIface(Field& field);
48
49 virtual ~BCIface() = default;
50
52 virtual void operator()(amrex::Real value = 0.0_rt);
53
55 amrex::Array<const std::string, 3> get_dirichlet_udfs();
56
57protected:
59 virtual void set_bcrec() = 0;
60
62 virtual void read_values() = 0;
63
65 virtual void read_bctype();
66
68 virtual void set_bcfuncs();
69
71 void set_default_value(amrex::Real value);
72
74 void set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
75 {
76 auto& fbcrec = m_field.bcrec();
77 for (int i = 0; i < m_field.num_comp(); ++i) {
78 fbcrec[i].setLo(dir, bcrec);
79 }
80 }
81
83 void set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
84 {
85 auto& fbcrec = m_field.bcrec();
86 for (int i = 0; i < m_field.num_comp(); ++i) {
87 fbcrec[i].setHi(dir, bcrec);
88 }
89 }
90
93};
94
98class BCVelocity : public BCIface
99{
100public:
101 explicit BCVelocity(Field& field) : BCIface(field) {}
102
103protected:
104 void set_bcrec() override;
105 void read_values() override;
106};
107
111class BCScalar : public BCIface
112{
113public:
114 explicit BCScalar(Field& field) : BCIface(field) {}
115
116protected:
117 void set_bcrec() override;
118 void read_values() override;
119};
120
126class BCPressure : public BCScalar
127{
128public:
129 explicit BCPressure(Field& field) : BCScalar(field) {}
130
131protected:
132 void read_values() override;
133};
134
141class BCSrcTerm : public BCIface
142{
143public:
144 explicit BCSrcTerm(Field& field) : BCIface(field) {}
145
146protected:
147 void set_bcrec() override;
148 void read_values() override
149 {
150 // No values specified for source terms. empty method to satisfy
151 // inheritance
152 }
153};
154
163{
164public:
166 Field& field,
167 amrex::BCType::mathematicalBndryTypes bctype = amrex::BCType::hoextrap)
168 : BCIface(field), m_extrap_type(bctype)
169 {}
170
171protected:
172 void set_bcrec() override;
173 void read_values() override
174 {
175 // No values specified for source terms. empty method to satisfy
176 // inheritance
177 }
178
179 amrex::BCType::mathematicalBndryTypes m_extrap_type;
180};
181
182} // namespace amr_wind
183
184#endif /* BCINTERFACE_H */
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:173
BCFillPatchExtrap(Field &field, amrex::BCType::mathematicalBndryTypes bctype=amrex::BCType::hoextrap)
Definition BCInterface.H:165
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:422
amrex::BCType::mathematicalBndryTypes m_extrap_type
Definition BCInterface.H:179
void set_default_value(amrex::Real value)
Set default BC values for the field.
Definition BCInterface.cpp:26
virtual void set_bcrec()=0
Setup AMReX mathematical BC types.
virtual void set_bcfuncs()
BC functions for Neumann type boundaries.
Definition BCInterface.cpp:98
virtual ~BCIface()=default
virtual void operator()(amrex::Real value=0.0_rt)
Operator that performs init actions and syncs the BC data to device.
Definition BCInterface.cpp:14
Field & m_field
Field instance where BC is being set.
Definition BCInterface.H:92
amrex::GpuArray< BC, AMREX_SPACEDIM *2 > IncfloBC
Definition BCInterface.H:45
void set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the lower boundaries.
Definition BCInterface.H:74
BCIface(Field &field)
Definition BCInterface.cpp:12
virtual void read_values()=0
Read input data for specific fields based on BC types.
amrex::Array< const std::string, 3 > get_dirichlet_udfs()
User-defined functions for Dirichlet-type boundaries.
Definition BCInterface.cpp:118
virtual void read_bctype()
Parse custom BCs specified for this field.
Definition BCInterface.cpp:37
void set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the upper boundaries.
Definition BCInterface.H:83
BCPressure(Field &field)
Definition BCInterface.H:129
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:379
BCScalar(Field &field)
Definition BCInterface.H:114
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:353
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:290
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:397
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:148
BCSrcTerm(Field &field)
Definition BCInterface.H:144
BCVelocity(Field &field)
Definition BCInterface.H:101
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:188
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:270
Definition Field.H:112
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:10