From 8d3c2aadf7a2edafcb78770e60b5b063e577f9e4 Mon Sep 17 00:00:00 2001 From: Hannah Klion Date: Fri, 8 Nov 2024 15:50:57 -0800 Subject: [PATCH 1/3] zvel boundary conditions default to outflow --- Exec/IdealMiniGrid/inputs_cf_orlanski | 3 +-- Exec/IdealMiniGrid/inputs_chapman_flather | 3 +-- Source/Initialization/REMORA_init_bcs.cpp | 14 +++++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Exec/IdealMiniGrid/inputs_cf_orlanski b/Exec/IdealMiniGrid/inputs_cf_orlanski index 587beef..f6dccbd 100644 --- a/Exec/IdealMiniGrid/inputs_cf_orlanski +++ b/Exec/IdealMiniGrid/inputs_cf_orlanski @@ -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) diff --git a/Exec/IdealMiniGrid/inputs_chapman_flather b/Exec/IdealMiniGrid/inputs_chapman_flather index f7cb640..65dfb8e 100644 --- a/Exec/IdealMiniGrid/inputs_chapman_flather +++ b/Exec/IdealMiniGrid/inputs_chapman_flather @@ -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) diff --git a/Source/Initialization/REMORA_init_bcs.cpp b/Source/Initialization/REMORA_init_bcs.cpp index d8493d7..7486142 100644 --- a/Source/Initialization/REMORA_init_bcs.cpp +++ b/Source/Initialization/REMORA_init_bcs.cpp @@ -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 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 bc_types; + std::vector 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++) { @@ -202,6 +206,7 @@ void REMORA::init_bcs () domain_bcs_type_d.resize(AMREX_SPACEDIM+NCONS+8); for (OrientationIter oit; oit; ++oit) { + bool not_valid_for_zvel = false; Orientation ori = oit(); int dir = ori.coordDir(); Orientation::Side side = ori.faceDir(); @@ -262,6 +267,7 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::periodic) { + if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::int_dir); } else { @@ -270,6 +276,7 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::clamped) { + if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::clamped); } else { @@ -278,6 +285,7 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::orlanski_rad) { + if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::orlanski_rad); } else { @@ -286,6 +294,7 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::orlanski_rad_nudge) { + if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::orlanski_rad_nudge); } else { @@ -296,6 +305,9 @@ void REMORA::init_bcs () { amrex::Abort("Velocity boundary condition not validly specified"); } + if (not_valid_for_zvel) { + amrex::Abort("Z-velocity boundary condition not validly specified"); + } } } } From 06c7763cece2a92af9399140cd10c38ed5182855 Mon Sep 17 00:00:00 2001 From: Hannah Klion Date: Fri, 8 Nov 2024 16:12:45 -0800 Subject: [PATCH 2/3] split out zvel so it's always foextrap --- Source/Initialization/REMORA_init_bcs.cpp | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Initialization/REMORA_init_bcs.cpp b/Source/Initialization/REMORA_init_bcs.cpp index 7486142..92e8a2e 100644 --- a/Source/Initialization/REMORA_init_bcs.cpp +++ b/Source/Initialization/REMORA_init_bcs.cpp @@ -206,21 +206,21 @@ void REMORA::init_bcs () domain_bcs_type_d.resize(AMREX_SPACEDIM+NCONS+8); for (OrientationIter oit; oit; ++oit) { - bool not_valid_for_zvel = false; 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); } } @@ -252,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); } @@ -267,7 +267,6 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::periodic) { - if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::int_dir); } else { @@ -276,7 +275,6 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::clamped) { - if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::clamped); } else { @@ -285,7 +283,6 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::orlanski_rad) { - if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::orlanski_rad); } else { @@ -294,7 +291,6 @@ void REMORA::init_bcs () } else if (bct == REMORA_BC::orlanski_rad_nudge) { - if (i==2) not_valid_for_zvel = true; if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::orlanski_rad_nudge); } else { @@ -305,9 +301,13 @@ void REMORA::init_bcs () { amrex::Abort("Velocity boundary condition not validly specified"); } - if (not_valid_for_zvel) { - amrex::Abort("Z-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); } } } From eedb58d7ebdd423a42db019cfe4101565112f567 Mon Sep 17 00:00:00 2001 From: Hannah Klion Date: Fri, 8 Nov 2024 16:13:55 -0800 Subject: [PATCH 3/3] remove w bc from orlanski test --- Exec/Channel_Test/inputs_orlanski | 1 - 1 file changed, 1 deletion(-) diff --git a/Exec/Channel_Test/inputs_orlanski b/Exec/Channel_Test/inputs_orlanski index 933584d..3869c32 100644 --- a/Exec/Channel_Test/inputs_orlanski +++ b/Exec/Channel_Test/inputs_orlanski @@ -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