Skip to content

Commit

Permalink
Merge pull request seahorce-scidac#288 from hklion/outflow_zvel
Browse files Browse the repository at this point in the history
Outflow zvel
  • Loading branch information
hklion authored Nov 9, 2024
2 parents a844009 + eedb58d commit 2fcd4ff
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
1 change: 0 additions & 1 deletion Exec/Channel_Test/inputs_orlanski
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ salt.type = orlanski_rad orlanski_rad orlanski_rad orlanski_rad
scalar.type = orlanski_rad orlanski_rad orlanski_rad orlanski_rad
u.type = orlanski_rad orlanski_rad orlanski_rad orlanski_rad
v.type = orlanski_rad orlanski_rad orlanski_rad orlanski_rad
w.type = outflow outflow outflow outflow
ubar.type = outflow outflow outflow outflow
vbar.type = outflow outflow outflow outflow
zeta.type = outflow outflow outflow outflow
Expand Down
3 changes: 1 addition & 2 deletions Exec/IdealMiniGrid/inputs_cf_orlanski
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ salt.type = orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg orlanski_ra
scalar.type = orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg
u.type = orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg
v.type = orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg
w.type = orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg orlanski_rad_nudg
ubar.type = flather flather flather flather
vbar.type = flather flather flather flather
zeta.type = chapman chapman chapman chapman
tke.type = clamped clamped clamped clamped
tke.type = outflow outflow outflow outflow

# TIME STEP CONTROL
remora.fixed_dt = 200.0 # Timestep size (seconds)
Expand Down
3 changes: 1 addition & 2 deletions Exec/IdealMiniGrid/inputs_chapman_flather
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ salt.type = clamped clamped clamped clamped
scalar.type = clamped clamped clamped clamped
u.type = clamped clamped clamped clamped
v.type = clamped clamped clamped clamped
w.type = clamped clamped clamped clamped
ubar.type = flather flather flather flather
vbar.type = flather flather flather flather
zeta.type = chapman chapman chapman chapman
tke.type = clamped clamped clamped clamped
tke.type = outflow outflow outflow outflow

# TIME STEP CONTROL
remora.fixed_dt = 200.0 # Timestep size (seconds)
Expand Down
24 changes: 18 additions & 6 deletions Source/Initialization/REMORA_init_bcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@ void REMORA::init_bcs ()
auto f_by_var = [this, &f_set_var_bc] (std::string const& varname, int bcvar_type)
{
amrex::Vector<Orientation> orientations = {Orientation(Direction::x,Orientation::low), Orientation(Direction::y,Orientation::high),Orientation(Direction::x,Orientation::high),Orientation(Direction::y,Orientation::low)}; // west, south, east, north [matches ROMS]
std::vector<std::string> bc_types;
std::vector<std::string> bc_types = {"null","null","null","null"};
ParmParse pp(varname);
std::string bc_type_in = "null";
// default zvel to outflow
if (bcvar_type == BCVars::zvel_bc) {
bc_types = {"outflow","outflow","outflow","outflow"};
}
pp.queryarr("type", bc_types);
AMREX_ASSERT(bc_types.size() == 4);
for (int i=0; i<4; i++) {
Expand Down Expand Up @@ -205,17 +209,18 @@ void REMORA::init_bcs ()
Orientation ori = oit();
int dir = ori.coordDir();
Orientation::Side side = ori.faceDir();
for (int i = 0; i < AMREX_SPACEDIM; i++) {
// only do this for xvel and yvel
for (int i = 0; i < 2; i++) {
auto const bct = phys_bc_type[BCVars::xvel_bc+i][ori];
if ( bct == REMORA_BC::symmetry )
{
if (side == Orientation::low) {
domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::reflect_even);
if (i==2)
if (i==1)
domain_bcs_type[BCVars::xvel_bc+dir].setLo(dir, REMORABCType::reflect_odd);
} else {
domain_bcs_type[BCVars::xvel_bc+i].setHi(dir, REMORABCType::reflect_even);
if (i==2)
if (i==1)
domain_bcs_type[BCVars::xvel_bc+dir].setHi(dir, REMORABCType::reflect_odd);
}
}
Expand Down Expand Up @@ -247,14 +252,14 @@ void REMORA::init_bcs ()
{
if (side == Orientation::low) {
domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::foextrap);
if (i==2) {
if (i==1) {
// Only normal direction has ext_dir
domain_bcs_type[BCVars::xvel_bc+dir].setLo(dir, REMORABCType::ext_dir);
}

} else {
domain_bcs_type[BCVars::xvel_bc+i].setHi(dir, REMORABCType::foextrap);
if (i==2) {
if (i==1) {
// Only normal direction has ext_dir
domain_bcs_type[BCVars::xvel_bc+dir].setHi(dir, REMORABCType::ext_dir);
}
Expand Down Expand Up @@ -297,6 +302,13 @@ void REMORA::init_bcs ()
amrex::Abort("Velocity boundary condition not validly specified");
}
}

// Always set zvel_bc to foextrap
if (side == Orientation::low) {
domain_bcs_type[BCVars::zvel_bc].setLo(dir, REMORABCType::foextrap);
} else {
domain_bcs_type[BCVars::zvel_bc].setHi(dir, REMORABCType::foextrap);
}
}
}

Expand Down

0 comments on commit 2fcd4ff

Please sign in to comment.