/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
27namespace amr_wind {
28namespace {
29amrex::Vector<std::string> bcnames = {"xlo", "ylo", "zlo", "xhi", "yhi", "zhi"};
30}
31
40{
41public:
42 using IncfloBC = amrex::GpuArray<BC, AMREX_SPACEDIM * 2>;
43
44 BCIface(Field& field);
45
46 virtual ~BCIface() = default;
47
49 virtual void operator()(const amrex::Real value = 0.0);
50
52 amrex::Array<const std::string, 3> get_dirichlet_udfs();
53
54protected:
56 virtual void set_bcrec() = 0;
57
59 virtual void read_values() = 0;
60
62 virtual void read_bctype();
63
65 virtual void set_bcfuncs();
66
68 inline void set_default_value(const amrex::Real value);
69
71 inline void
72 set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
73 {
74 auto& fbcrec = m_field.bcrec();
75 for (int i = 0; i < m_field.num_comp(); ++i) {
76 fbcrec[i].setLo(dir, bcrec);
77 }
78 }
79
81 inline void
82 set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
83 {
84 auto& fbcrec = m_field.bcrec();
85 for (int i = 0; i < m_field.num_comp(); ++i) {
86 fbcrec[i].setHi(dir, bcrec);
87 }
88 }
89
92};
93
97class BCVelocity : public BCIface
98{
99public:
100 explicit BCVelocity(Field& field) : BCIface(field) {}
101
102protected:
103 void set_bcrec() override;
104 void read_values() override;
105};
106
110class BCScalar : public BCIface
111{
112public:
113 explicit BCScalar(Field& field) : BCIface(field) {}
114
115protected:
116 void set_bcrec() override;
117 void read_values() override;
118};
119
125class BCPressure : public BCScalar
126{
127public:
128 explicit BCPressure(Field& field) : BCScalar(field) {}
129
130protected:
131 void read_values() override;
132};
133
140class BCSrcTerm : public BCIface
141{
142public:
143 explicit BCSrcTerm(Field& field) : BCIface(field) {}
144
145protected:
146 void set_bcrec() override;
147 void read_values() override
148 {
149 // No values specified for source terms. empty method to satisfy
150 // inheritance
151 }
152};
153
162{
163public:
165 Field& field,
166 amrex::BCType::mathematicalBndryTypes bctype = amrex::BCType::hoextrap)
167 : BCIface(field), m_extrap_type(bctype)
168 {}
169
170protected:
171 void set_bcrec() override;
172 void read_values() override
173 {
174 // No values specified for source terms. empty method to satisfy
175 // inheritance
176 }
177
178 amrex::BCType::mathematicalBndryTypes m_extrap_type;
179};
180
181} // namespace amr_wind
182
183#endif /* BCINTERFACE_H */
Definition BCInterface.H:162
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:172
BCFillPatchExtrap(Field &field, amrex::BCType::mathematicalBndryTypes bctype=amrex::BCType::hoextrap)
Definition BCInterface.H:164
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:419
amrex::BCType::mathematicalBndryTypes m_extrap_type
Definition BCInterface.H:178
Definition BCInterface.H:40
virtual void set_bcrec()=0
Setup AMReX mathematical BC types.
virtual void operator()(const amrex::Real value=0.0)
Operator that performs init actions and syncs the BC data to device.
Definition BCInterface.cpp:11
virtual void set_bcfuncs()
BC functions for Neumann type boundaries.
Definition BCInterface.cpp:95
virtual ~BCIface()=default
Field & m_field
Field instance where BC is being set.
Definition BCInterface.H:91
amrex::GpuArray< BC, AMREX_SPACEDIM *2 > IncfloBC
Definition BCInterface.H:42
void set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the lower boundaries.
Definition BCInterface.H:72
BCIface(Field &field)
Definition BCInterface.cpp:9
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:115
void set_default_value(const amrex::Real value)
Set default BC values for the field.
Definition BCInterface.cpp:23
virtual void read_bctype()
Parse custom BCs specified for this field.
Definition BCInterface.cpp:34
void set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the upper boundaries.
Definition BCInterface.H:82
Definition BCInterface.H:126
BCPressure(Field &field)
Definition BCInterface.H:128
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:376
Definition BCInterface.H:111
BCScalar(Field &field)
Definition BCInterface.H:113
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:350
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:287
Definition BCInterface.H:141
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:394
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:147
BCSrcTerm(Field &field)
Definition BCInterface.H:143
Definition BCInterface.H:98
BCVelocity(Field &field)
Definition BCInterface.H:100
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:185
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:267
Definition Field.H:116
int num_comp() const
Number of components for this field.
Definition Field.H:134
amrex::Vector< amrex::BCRec > & bcrec() const
Return reference to host view of BCRec array.
Definition Field.H:188
Definition BCInterface.cpp:7