11 const int xvel_bc_idx =
xvel_bc();
12 const int yvel_bc_idx =
yvel_bc();
13 const int zvel_bc_idx =
zvel_bc();
14 const int ubar_bc_idx =
ubar_bc();
15 const int vbar_bc_idx =
vbar_bc();
16 const int zeta_bc_idx =
zeta_bc();
17 const int tke_bc_idx =
tke_bc();
26 auto uses_velocity_input = [=] (
int bcvar_type)
noexcept {
27 return bcvar_type == xvel_bc_idx || bcvar_type == yvel_bc_idx || bcvar_type == zvel_bc_idx;
30 auto uses_scalar_input = [=] (
int bcvar_type)
noexcept {
34 auto f_set_var_bc = [
this, uses_velocity_input, uses_scalar_input, xvel_bc_idx, zeta_bc_idx, ubar_bc_idx, vbar_bc_idx]
35 (ParmParse& pp,
int bcvar_type, Orientation ori, std::string bc_type_string) {
44 if (bc_type_string ==
"symmetry")
50 else if (bc_type_string ==
"outflow")
56 else if (bc_type_string ==
"inflow")
62 if (uses_velocity_input(bcvar_type)) {
64 pp.getarr(
"velocity", v, 0, AMREX_SPACEDIM);
66 }
else if (uses_scalar_input(bcvar_type)) {
68 if (pp.queryAdd(
"scalar", scalar_in)) {
73 else if (bc_type_string ==
"noslipwall")
79 if (uses_velocity_input(bcvar_type)) {
84 if (pp.queryarr(
"velocity", v, 0, AMREX_SPACEDIM))
86 v[ori.coordDir()] = 0.0_rt;
91 else if (bc_type_string ==
"slipwall")
97 else if (bc_type_string ==
"clamped")
104 else if (bc_type_string ==
"chapman")
111 if (bcvar_type != zeta_bc_idx) {
112 amrex::Abort(
"Chapman BC can only be applied to zeta");
115 else if (bc_type_string ==
"flather")
122 if (!(bcvar_type == ubar_bc_idx || bcvar_type == vbar_bc_idx)) {
123 amrex::Abort(
"Flather BC can only be applied to ubar or vbar");
126 else if (bc_type_string ==
"orlanski_rad")
132 else if (bc_type_string ==
"orlanski_rad_nudg")
139 else if (bc_type_string ==
"periodic")
141 if (!geom[0].isPeriodic(ori.coordDir())) {
142 amrex::Abort(
"Periodic boundary specified in a non-periodic direction");
154 if (geom[0].isPeriodic(ori.coordDir()))
162 amrex::Abort(
"Wrong BC type for periodic boundary");
168 amrex::Print() <<
"BC Type specified for fac is " << bc_type_string << std::endl;
169 amrex::Abort(
"This BC type is unknown");
173 auto f_by_side = [
this, &f_set_var_bc] (std::string
const& bcid, Orientation ori)
175 ParmParse pp(
"remora.bc."+bcid);
176 std::string bc_type_in =
"null";
178 if (bcid==
"zlo" or bcid==
"zhi") bc_type_in =
"slipwall";
179 pp.queryAdd(
"type", bc_type_in);
180 std::string bc_type = amrex::toLower(bc_type_in);
182 for (
int icomp = 0; icomp <
num_bc_vars(); ++icomp) {
183 f_set_var_bc(pp, icomp, ori, bc_type);
187 auto f_by_var = [
this, &f_set_var_bc, zvel_bc_idx] (std::string
const& varname,
int bcvar_type)
189 amrex::Vector<Orientation> orientations = {Orientation(Direction::x,Orientation::low), Orientation(Direction::y,Orientation::high),Orientation(Direction::x,Orientation::high),Orientation(Direction::y,Orientation::low)};
190 std::vector<std::string> bc_types = {
"null",
"null",
"null",
"null"};
191 ParmParse pp(
"remora.bc."+varname);
192 std::string bc_type_in =
"null";
194 if (bcvar_type == zvel_bc_idx) {
195 bc_types = {
"outflow",
"outflow",
"outflow",
"outflow"};
196 for (
int i=0; i<4; i++) {
197 auto ori = orientations[i];
198 if (geom[0].isPeriodic(ori.coordDir())) {
199 bc_types[i] =
"periodic";
203 pp.queryarr(
"type", bc_types);
204 AMREX_ASSERT(bc_types.size() == 4);
205 for (
int i=0; i<4; i++) {
206 std::string bc_type = amrex::toLower(bc_types[i]);
207 auto ori = orientations[i];
208 f_set_var_bc(pp, bcvar_type, ori, bc_type);
221 for (OrientationIter oit; oit; ++oit) {
222 Orientation ori = oit();
244 ParmParse pp(
"remora");
247 f_by_side(
"xlo", Orientation(Direction::x,Orientation::low));
248 f_by_side(
"xhi", Orientation(Direction::x,Orientation::high));
249 f_by_side(
"ylo", Orientation(Direction::y,Orientation::low));
250 f_by_side(
"yhi", Orientation(Direction::y,Orientation::high));
255 f_by_var(
"scalar", icomp);
257 f_by_var(
"u", xvel_bc_idx);
258 f_by_var(
"v", yvel_bc_idx);
259 f_by_var(
"w", zvel_bc_idx);
260 f_by_var(
"ubar", ubar_bc_idx);
261 f_by_var(
"vbar", vbar_bc_idx);
262 f_by_var(
"zeta", zeta_bc_idx);
263 f_by_var(
"tke", tke_bc_idx);
267 f_by_side(
"zlo", Orientation(Direction::z,Orientation::low));
268 f_by_side(
"zhi", Orientation(Direction::z,Orientation::high));
280 for (OrientationIter oit; oit; ++oit) {
281 Orientation ori = oit();
282 int dir = ori.coordDir();
283 Orientation::Side side = ori.faceDir();
285 for (
int i = 0; i < 2; i++) {
289 if (side == Orientation::low) {
301 if (side == Orientation::low) {
309 if (side == Orientation::low) {
317 if (side == Orientation::low) {
325 if (side == Orientation::low) {
342 if (side == Orientation::low) {
350 if (side == Orientation::low) {
358 if (side == Orientation::low) {
366 if (side == Orientation::low) {
374 amrex::Abort(
"Velocity boundary condition not validly specified");
379 if (side == Orientation::low) {
394 for (OrientationIter oit; oit; ++oit) {
395 Orientation ori = oit();
396 int dir = ori.coordDir();
397 Orientation::Side side = ori.faceDir();
398 for (
int i = 0; i <
ncons; i++) {
402 if (side == Orientation::low) {
410 if (side == Orientation::low) {
418 if (side == Orientation::low) {
426 if (side == Orientation::low) {
434 if (side == Orientation::low) {
442 if (side == Orientation::low) {
450 if (side == Orientation::low) {
458 if (side == Orientation::low) {
466 if (side == Orientation::low) {
474 amrex::Abort(
"Scalar/tracer boundary condition not validly specified");
488 for (OrientationIter oit; oit; ++oit) {
489 Orientation ori = oit();
490 int dir = ori.coordDir();
491 Orientation::Side side = ori.faceDir();
492 for (
int i = 0; i < 2; i++) {
496 if (side == Orientation::low) {
499 if (i==1 and dir!=2) {
506 if (i==1 and dir!=2) {
514 if (side == Orientation::low) {
524 if (side == Orientation::low) {
534 if (side == Orientation::low) {
544 if (side == Orientation::low) {
547 if (i==1 and dir!=2) {
556 if (i==1 and dir!=2) {
565 if (side == Orientation::low) {
575 if (side == Orientation::low) {
585 if (side == Orientation::low) {
588 if (i==1 and dir!=2) {
597 if (i==1 and dir!=2) {
606 if (side == Orientation::low) {
616 if (side == Orientation::low) {
626 amrex::Abort(
"ubar or vbar boundary condition not validly specified");
639 for (OrientationIter oit; oit; ++oit) {
640 Orientation ori = oit();
641 int dir = ori.coordDir();
642 Orientation::Side side = ori.faceDir();
643 for (
int i = 0; i < 2; i++) {
647 if (side == Orientation::low) {
655 if (side == Orientation::low) {
663 if (side == Orientation::low) {
671 if (side == Orientation::low) {
679 if (side == Orientation::low) {
687 if (side == Orientation::low) {
695 if (side == Orientation::low) {
703 if (side == Orientation::low) {
711 if (side == Orientation::low) {
719 if (side == Orientation::low) {
727 amrex::Abort(
"Free surface (zeta) boundary condition not validly specified");
740 for (OrientationIter oit; oit; ++oit) {
741 Orientation ori = oit();
742 int dir = ori.coordDir();
743 Orientation::Side side = ori.faceDir();
744 if (side == Orientation::low) {
758 for (OrientationIter oit; oit; ++oit) {
759 Orientation ori = oit();
760 int dir = ori.coordDir();
761 Orientation::Side side = ori.faceDir();
762 if (side == Orientation::low) {