/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()(const 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 inline void set_default_value(const amrex::Real value);
72
74 inline void
75 set_bcrec_lo(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
76 {
77 auto& fbcrec = m_field.bcrec();
78 for (int i = 0; i < m_field.num_comp(); ++i) {
79 fbcrec[i].setLo(dir, bcrec);
80 }
81 }
82
84 inline void
85 set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
86 {
87 auto& fbcrec = m_field.bcrec();
88 for (int i = 0; i < m_field.num_comp(); ++i) {
89 fbcrec[i].setHi(dir, bcrec);
90 }
91 }
92
95};
96
100class BCVelocity : public BCIface
101{
102public:
103 explicit BCVelocity(Field& field) : BCIface(field) {}
104
105protected:
106 void set_bcrec() override;
107 void read_values() override;
108};
109
113class BCScalar : public BCIface
114{
115public:
116 explicit BCScalar(Field& field) : BCIface(field) {}
117
118protected:
119 void set_bcrec() override;
120 void read_values() override;
121};
122
128class BCPressure : public BCScalar
129{
130public:
131 explicit BCPressure(Field& field) : BCScalar(field) {}
132
133protected:
134 void read_values() override;
135};
136
143class BCSrcTerm : public BCIface
144{
145public:
146 explicit BCSrcTerm(Field& field) : BCIface(field) {}
147
148protected:
149 void set_bcrec() override;
150 void read_values() override
151 {
152 // No values specified for source terms. empty method to satisfy
153 // inheritance
154 }
155};
156
165{
166public:
168 Field& field,
169 amrex::BCType::mathematicalBndryTypes bctype = amrex::BCType::hoextrap)
170 : BCIface(field), m_extrap_type(bctype)
171 {}
172
173protected:
174 void set_bcrec() override;
175 void read_values() override
176 {
177 // No values specified for source terms. empty method to satisfy
178 // inheritance
179 }
180
181 amrex::BCType::mathematicalBndryTypes m_extrap_type;
182};
183
184} // namespace amr_wind
185
186#endif /* BCINTERFACE_H */
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.H:175
BCFillPatchExtrap(Field &field, amrex::BCType::mathematicalBndryTypes bctype=amrex::BCType::hoextrap)
Definition BCInterface.H:167
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition BCInterface.cpp:422
amrex::BCType::mathematicalBndryTypes m_extrap_type
Definition BCInterface.H:181
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
Field & m_field
Field instance where BC is being set.
Definition BCInterface.H:94
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:75
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
void set_default_value(const amrex::Real value)
Set default BC values for the field.
Definition BCInterface.cpp:26
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:85
virtual void operator()(const amrex::Real value=0.0_rt)
Operator that performs init actions and syncs the BC data to device.
Definition BCInterface.cpp:14
BCPressure(Field &field)
Definition BCInterface.H:131
void read_values() override
Read input data for specific fields based on BC types.
Definition BCInterface.cpp:379
BCScalar(Field &field)
Definition BCInterface.H:116
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:150
BCSrcTerm(Field &field)
Definition BCInterface.H:146
BCVelocity(Field &field)
Definition BCInterface.H:103
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:116
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:10