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();
27 bcvar_names[xvel_bc_idx] =
"u";
28 bcvar_names[yvel_bc_idx] =
"v";
29 bcvar_names[zvel_bc_idx] =
"w";
30 bcvar_names[ubar_bc_idx] =
"ubar";
31 bcvar_names[vbar_bc_idx] =
"vbar";
32 bcvar_names[zeta_bc_idx] =
"zeta";
33 bcvar_names[tke_bc_idx] =
"tke";
38 auto uses_velocity_input = [=] (
int bcvar_type)
noexcept {
39 return bcvar_type == xvel_bc_idx || bcvar_type == yvel_bc_idx || bcvar_type == zvel_bc_idx;
42 auto uses_scalar_input = [=] (
int bcvar_type)
noexcept {
46 auto f_set_var_bc = [
this, uses_velocity_input, uses_scalar_input, xvel_bc_idx, zeta_bc_idx, ubar_bc_idx, vbar_bc_idx, bcvar_names]
47 (ParmParse& pp,
int bcvar_type, Orientation ori, std::string bc_type_string) {
56 if (bc_type_string ==
"symmetry")
62 else if (bc_type_string ==
"outflow")
68 else if (bc_type_string ==
"inflow")
74 if (uses_velocity_input(bcvar_type)) {
76 pp.getarr(
"velocity", v, 0, AMREX_SPACEDIM);
78 }
else if (uses_scalar_input(bcvar_type)) {
80 if (pp.queryAdd(
"scalar", scalar_in)) {
85 else if (bc_type_string ==
"noslipwall")
91 if (uses_velocity_input(bcvar_type)) {
96 if (pp.queryarr(
"velocity", v, 0, AMREX_SPACEDIM))
98 v[ori.coordDir()] = 0.0_rt;
103 else if (bc_type_string ==
"slipwall")
109 else if (bc_type_string ==
"clamped")
116 else if (bc_type_string ==
"chapman")
123 if (bcvar_type != zeta_bc_idx) {
124 amrex::Abort(
"Chapman BC can only be applied to zeta");
127 else if (bc_type_string ==
"flather")
134 if (!(bcvar_type == ubar_bc_idx || bcvar_type == vbar_bc_idx)) {
135 amrex::Abort(
"Flather BC can only be applied to ubar or vbar");
138 else if (bc_type_string ==
"orlanski_rad")
144 else if (bc_type_string ==
"orlanski_rad_nudg")
151 else if (bc_type_string ==
"periodic")
153 if (!geom[0].isPeriodic(ori.coordDir())) {
154 amrex::Abort(
"Periodic boundary specified in a non-periodic direction");
166 if (geom[0].isPeriodic(ori.coordDir()))
174 amrex::Abort(
"Wrong BC type for periodic boundary");
180 amrex::Print() <<
"BC Type specified for variable " << bcvar_names[bcvar_type] <<
" is " << bc_type_string << std::endl;
181 amrex::Abort(
"This BC type is unknown");
185 auto f_by_side = [
this, &f_set_var_bc] (std::string
const& bcid, Orientation ori)
187 ParmParse pp(
"remora.bc."+bcid);
188 std::string bc_type_in =
"null";
190 if (bcid==
"zlo" or bcid==
"zhi") bc_type_in =
"slipwall";
191 pp.queryAdd(
"type", bc_type_in);
192 std::string bc_type = amrex::toLower(bc_type_in);
194 for (
int icomp = 0; icomp <
num_bc_vars(); ++icomp) {
195 f_set_var_bc(pp, icomp, ori, bc_type);
199 auto f_by_var = [
this, &f_set_var_bc, zvel_bc_idx] (std::string
const& varname,
int bcvar_type)
201 amrex::Vector<Orientation> orientations = {Orientation(Direction::x,Orientation::low), Orientation(Direction::y,Orientation::high),Orientation(Direction::x,Orientation::high),Orientation(Direction::y,Orientation::low)};
202 std::vector<std::string> bc_types = {
"null",
"null",
"null",
"null"};
203 ParmParse pp(
"remora.bc."+varname);
204 std::string bc_type_in =
"null";
206 if (bcvar_type == zvel_bc_idx) {
207 bc_types = {
"outflow",
"outflow",
"outflow",
"outflow"};
208 for (
int i=0; i<4; i++) {
209 auto ori = orientations[i];
210 if (geom[0].isPeriodic(ori.coordDir())) {
211 bc_types[i] =
"periodic";
215 pp.queryarr(
"type", bc_types);
216 AMREX_ASSERT(bc_types.size() == 4);
217 for (
int i=0; i<4; i++) {
218 std::string bc_type = amrex::toLower(bc_types[i]);
219 auto ori = orientations[i];
220 f_set_var_bc(pp, bcvar_type, ori, bc_type);
233 for (OrientationIter oit; oit; ++oit) {
234 Orientation ori = oit();
256 ParmParse pp(
"remora");
260 pp.contains(
"bc.salt.type") ||
261 pp.contains(
"bc.scalar.type") ||
262 pp.contains(
"bc.u.type") ||
263 pp.contains(
"bc.v.type") ||
264 pp.contains(
"bc.w.type") ||
265 pp.contains(
"bc.ubar.type") ||
266 pp.contains(
"bc.vbar.type") ||
267 pp.contains(
"bc.zeta.type") ||
268 pp.contains(
"bc.tke.type"))) {
269 amrex::Abort(
"boundary_per_variable set to false, but per-variable boundary conditions are specified. Use bc.{x,y}{lo,hi}.type instead");
272 pp.contains(
"bc.xhi.type") ||
273 pp.contains(
"bc.ylo.type") ||
274 pp.contains(
"bc.yhi.type"))) {
275 amrex::Abort(
"boundary_per_variable set to true, but per-side boundary conditions are specified. Use bc.{temp,salt,etc}.type instead");
278 f_by_side(
"xlo", Orientation(Direction::x,Orientation::low));
279 f_by_side(
"xhi", Orientation(Direction::x,Orientation::high));
280 f_by_side(
"ylo", Orientation(Direction::y,Orientation::low));
281 f_by_side(
"yhi", Orientation(Direction::y,Orientation::high));
286 f_by_var(
"scalar", icomp);
288 f_by_var(
"u", xvel_bc_idx);
289 f_by_var(
"v", yvel_bc_idx);
290 f_by_var(
"w", zvel_bc_idx);
291 f_by_var(
"ubar", ubar_bc_idx);
292 f_by_var(
"vbar", vbar_bc_idx);
293 f_by_var(
"zeta", zeta_bc_idx);
294 f_by_var(
"tke", tke_bc_idx);
298 f_by_side(
"zlo", Orientation(Direction::z,Orientation::low));
299 f_by_side(
"zhi", Orientation(Direction::z,Orientation::high));
311 for (OrientationIter oit; oit; ++oit) {
312 Orientation ori = oit();
313 int dir = ori.coordDir();
314 Orientation::Side side = ori.faceDir();
316 for (
int i = 0; i < 2; i++) {
320 if (side == Orientation::low) {
332 if (side == Orientation::low) {
340 if (side == Orientation::low) {
348 if (side == Orientation::low) {
356 if (side == Orientation::low) {
373 if (side == Orientation::low) {
381 if (side == Orientation::low) {
389 if (side == Orientation::low) {
397 if (side == Orientation::low) {
405 amrex::Abort(
"Velocity boundary condition not validly specified");
410 if (side == Orientation::low) {
425 for (OrientationIter oit; oit; ++oit) {
426 Orientation ori = oit();
427 int dir = ori.coordDir();
428 Orientation::Side side = ori.faceDir();
429 for (
int i = 0; i <
ncons; i++) {
433 if (side == Orientation::low) {
441 if (side == Orientation::low) {
449 if (side == Orientation::low) {
457 if (side == Orientation::low) {
465 if (side == Orientation::low) {
473 if (side == Orientation::low) {
481 if (side == Orientation::low) {
489 if (side == Orientation::low) {
497 if (side == Orientation::low) {
505 amrex::Abort(
"Scalar/tracer boundary condition not validly specified");
519 for (OrientationIter oit; oit; ++oit) {
520 Orientation ori = oit();
521 int dir = ori.coordDir();
522 Orientation::Side side = ori.faceDir();
523 for (
int i = 0; i < 2; i++) {
527 if (side == Orientation::low) {
530 if (i==1 and dir!=2) {
537 if (i==1 and dir!=2) {
545 if (side == Orientation::low) {
555 if (side == Orientation::low) {
565 if (side == Orientation::low) {
575 if (side == Orientation::low) {
578 if (i==1 and dir!=2) {
587 if (i==1 and dir!=2) {
596 if (side == Orientation::low) {
606 if (side == Orientation::low) {
616 if (side == Orientation::low) {
619 if (i==1 and dir!=2) {
628 if (i==1 and dir!=2) {
637 if (side == Orientation::low) {
647 if (side == Orientation::low) {
657 amrex::Abort(
"ubar or vbar boundary condition not validly specified");
670 for (OrientationIter oit; oit; ++oit) {
671 Orientation ori = oit();
672 int dir = ori.coordDir();
673 Orientation::Side side = ori.faceDir();
674 for (
int i = 0; i < 2; i++) {
678 if (side == Orientation::low) {
686 if (side == Orientation::low) {
694 if (side == Orientation::low) {
702 if (side == Orientation::low) {
710 if (side == Orientation::low) {
718 if (side == Orientation::low) {
726 if (side == Orientation::low) {
734 if (side == Orientation::low) {
742 if (side == Orientation::low) {
750 if (side == Orientation::low) {
758 amrex::Abort(
"Free surface (zeta) boundary condition not validly specified");
771 for (OrientationIter oit; oit; ++oit) {
772 Orientation ori = oit();
773 int dir = ori.coordDir();
774 Orientation::Side side = ori.faceDir();
775 if (side == Orientation::low) {
789 for (OrientationIter oit; oit; ++oit) {
790 Orientation ori = oit();
791 int dir = ori.coordDir();
792 Orientation::Side side = ori.faceDir();
793 if (side == Orientation::low) {