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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/equation_systems/vof/vof_bciface.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
vof_bciface.H
Go to the documentation of this file.
1#ifndef VOF_BCIFACE_H
2#define VOF_BCIFACE_H
3
5
6namespace amr_wind {
7
11
12class BCVOF : public BCIface
13{
14public:
15 explicit BCVOF(Field& field) : BCIface(field) {}
16
17protected:
18 // Only the process of reading BCs needs to be modified
19 void set_bcrec() override
20 {
21 const auto& ibctype = m_field.bc_type();
22
23 for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
24 auto ori = oit();
25 const auto side = ori.faceDir();
26 const auto bct = ibctype[ori];
27 const int dir = ori.coordDir();
28
29 switch (bct) {
30 case BC::periodic:
31 if (side == amrex::Orientation::low) {
32 set_bcrec_lo(dir, amrex::BCType::int_dir);
33 } else {
34 set_bcrec_hi(dir, amrex::BCType::int_dir);
35 }
36 break;
37
38 // For the wall cases, the fillpatch BC is effectively a
39 // contact-line model
44 case BC::slip_wall:
45 case BC::wall_model:
46 if (side == amrex::Orientation::low) {
47 set_bcrec_lo(dir, amrex::BCType::foextrap);
48 } else {
49 set_bcrec_hi(dir, amrex::BCType::foextrap);
50 }
51 break;
52
53 // Never do hoextrap because it is unbounded
54
56 case BC::mass_inflow:
58 if (side == amrex::Orientation::low) {
59 set_bcrec_lo(dir, amrex::BCType::ext_dir);
60 } else {
61 set_bcrec_hi(dir, amrex::BCType::ext_dir);
62 }
63 break;
64
65 // Fixed gradient BC is not allowed for VOF
67 default:
68 amrex::Abort(
69 "Invalid BC type for VOF encountered: fixed_gradient");
70 }
71 }
72 }
73 // Copied from BC interface for scalars
74 void read_values() override
75 {
76 const auto& fname = m_field.name();
77 const auto& bctype = m_field.bc_type();
78 auto& bcval = m_field.bc_values();
79 const int ndim = m_field.num_comp();
80 for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
81 auto ori = oit();
82 const auto& bcid = bcnames[ori];
83 const auto bct = bctype[ori];
84
85 amrex::ParmParse pp(bcid);
86 if (bct == BC::mass_inflow || bct == BC::mass_inflow_outflow) {
87 pp.getarr(fname, bcval[ori], 0, ndim);
88 } else {
89 pp.queryarr(fname, bcval[ori], 0, ndim);
90 }
91 }
92 }
93};
94
95class BCDensityMod : public BCIface
96{
97public:
98 explicit BCDensityMod(Field& field) : BCIface(field) {}
99
100protected:
101 void set_bcrec() override
102 {
103 const auto& ibctype = m_field.bc_type();
104
105 for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
106 auto ori = oit();
107 const auto side = ori.faceDir();
108 const auto bct = ibctype[ori];
109 const int dir = ori.coordDir();
110
111 switch (bct) {
112 case BC::periodic:
113 if (side == amrex::Orientation::low) {
114 set_bcrec_lo(dir, amrex::BCType::int_dir);
115 } else {
116 set_bcrec_hi(dir, amrex::BCType::int_dir);
117 }
118 break;
119
120 // Both extrapolations are consistent between vof and density
123 case BC::no_slip_wall:
125 case BC::slip_wall:
126 case BC::wall_model:
127 if (side == amrex::Orientation::low) {
128 set_bcrec_lo(dir, amrex::BCType::foextrap);
129 } else {
130 set_bcrec_hi(dir, amrex::BCType::foextrap);
131 }
132 break;
133
134 // Never do hoextrap because it is unbounded
135
137 case BC::mass_inflow:
139 if (side == amrex::Orientation::low) {
140 set_bcrec_lo(dir, amrex::BCType::ext_dir);
141 } else {
142 set_bcrec_hi(dir, amrex::BCType::ext_dir);
143 }
144 break;
145
147 default:
148 amrex::Abort(
149 "Invalid BC type for density (vof-compatible) encountered: "
150 "fixed_gradient");
151 }
152 }
153 }
154
155 void read_values() override
156 {
157 const auto& fname = m_field.name();
158 const auto& bctype = m_field.bc_type();
159 auto& bcval = m_field.bc_values();
160 const int ndim = m_field.num_comp();
161 for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
162 auto ori = oit();
163 const auto& bcid = bcnames[ori];
164 const auto bct = bctype[ori];
165
166 amrex::ParmParse pp(bcid);
167 if (bct == BC::mass_inflow || bct == BC::mass_inflow_outflow) {
168 pp.getarr(fname, bcval[ori], 0, ndim);
169 } else {
170 pp.queryarr(fname, bcval[ori], 0, ndim);
171 }
172 }
173 }
174};
175
176} // namespace amr_wind
177
178#endif /* VOF_BCIFACE_H */
BCDensityMod(Field &field)
Definition vof_bciface.H:98
void read_values() override
Read input data for specific fields based on BC types.
Definition vof_bciface.H:155
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition vof_bciface.H:101
Field & m_field
Field instance where BC is being set.
Definition BCInterface.H:91
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
void set_bcrec_hi(int dir, amrex::BCType::mathematicalBndryTypes bcrec)
Set AMReX mathematical boundary types for the upper boundaries.
Definition BCInterface.H:82
void read_values() override
Read input data for specific fields based on BC types.
Definition vof_bciface.H:74
BCVOF(Field &field)
Definition vof_bciface.H:15
void set_bcrec() override
Setup AMReX mathematical BC types.
Definition vof_bciface.H:19
Definition Field.H:116
@ slip_wall
Definition incflo_enums.H:12
@ zero_gradient
Definition incflo_enums.H:10
@ mass_inflow_outflow
Definition incflo_enums.H:9
@ fixed_gradient
Definition incflo_enums.H:14
@ wall_model
Definition incflo_enums.H:13
@ mass_inflow
Definition incflo_enums.H:8
@ wave_generation
Definition incflo_enums.H:16
@ symmetric_wall
Definition incflo_enums.H:17
@ pressure_outflow
Definition incflo_enums.H:7
@ no_slip_wall
Definition incflo_enums.H:11
@ periodic
Definition incflo_enums.H:15
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:7