From 7bf2aac17f98ee7791b3eb1fb15028a70aa2b1cd Mon Sep 17 00:00:00 2001 From: Hannah Klion Date: Wed, 28 Aug 2024 17:47:42 -0700 Subject: [PATCH] Only apply netcdf BCs on clamped sides --- .../BoundaryConditions_cons.cpp | 8 ++-- .../BoundaryConditions_netcdf.cpp | 24 ++++++---- .../BoundaryConditions_xvel.cpp | 8 ++-- .../BoundaryConditions_yvel.cpp | 8 ++-- .../BoundaryConditions_zvel.cpp | 8 ++-- .../BoundaryConditions/REMORA_FillPatch.cpp | 2 +- Source/Initialization/REMORA_init_bcs.cpp | 48 ++++++++++++++----- .../REMORA_init_from_netcdf.cpp | 2 +- .../Initialization/REMORA_make_new_level.cpp | 2 +- Source/REMORA.H | 1 + Source/TimeIntegration/REMORA_advance_3d.cpp | 4 +- 11 files changed, 73 insertions(+), 42 deletions(-) diff --git a/Source/BoundaryConditions/BoundaryConditions_cons.cpp b/Source/BoundaryConditions/BoundaryConditions_cons.cpp index a6ed06e..b97df96 100644 --- a/Source/BoundaryConditions/BoundaryConditions_cons.cpp +++ b/Source/BoundaryConditions/BoundaryConditions_cons.cpp @@ -126,7 +126,7 @@ void REMORAPhysBCFunct::impose_cons_bcs (const Array4& dest_arr, const Box bx_xhi.setBig (2,std::min(dom_hi.z,bx.bigEnd(2))); ParallelFor(bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { int iflip = dom_lo.x - 1 - i; - if (bc_ptr[n].lo(0) == REMORABCType::foextrap) { + if (bc_ptr[n].lo(0) == REMORABCType::foextrap || bc_ptr[n].lo(0) == REMORABCType::clamped) { dest_arr(i,j,k,icomp+n) = dest_arr(dom_lo.x-n_not_fill,j,k,icomp+n); } else if (bc_ptr[n].lo(0) == REMORABCType::reflect_even) { dest_arr(i,j,k,icomp+n) = dest_arr(iflip,j,k,icomp+n); @@ -136,7 +136,7 @@ void REMORAPhysBCFunct::impose_cons_bcs (const Array4& dest_arr, const Box }, bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { int iflip = 2*dom_hi.x + 1 - i; - if (bc_ptr[n].hi(0) == REMORABCType::foextrap) { + if (bc_ptr[n].hi(0) == REMORABCType::foextrap || bc_ptr[n].hi(0) == REMORABCType::clamped) { dest_arr(i,j,k,icomp+n) = dest_arr(dom_hi.x+n_not_fill,j,k,icomp+n); } else if (bc_ptr[n].hi(0) == REMORABCType::reflect_even) { dest_arr(i,j,k,icomp+n) = dest_arr(iflip,j,k,icomp+n); @@ -159,7 +159,7 @@ void REMORAPhysBCFunct::impose_cons_bcs (const Array4& dest_arr, const Box ParallelFor( bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { int jflip = dom_lo.y - 1 - j; - if (bc_ptr[n].lo(1) == REMORABCType::foextrap) { + if (bc_ptr[n].lo(1) == REMORABCType::foextrap || bc_ptr[n].lo(1) == REMORABCType::clamped) { dest_arr(i,j,k,icomp+n) = dest_arr(i,dom_lo.y-n_not_fill,k,icomp+n); } else if (bc_ptr[n].lo(1) == REMORABCType::reflect_even) { dest_arr(i,j,k,icomp+n) = dest_arr(i,jflip,k,icomp+n); @@ -169,7 +169,7 @@ void REMORAPhysBCFunct::impose_cons_bcs (const Array4& dest_arr, const Box }, bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { int jflip = 2*dom_hi.y + 1 - j; - if (bc_ptr[n].hi(1) == REMORABCType::foextrap) { + if (bc_ptr[n].hi(1) == REMORABCType::foextrap || bc_ptr[n].hi(1) == REMORABCType::clamped) { dest_arr(i,j,k,icomp+n) = dest_arr(i,dom_hi.y+n_not_fill,k,icomp+n); } else if (bc_ptr[n].hi(1) == REMORABCType::reflect_even) { dest_arr(i,j,k,icomp+n) = dest_arr(i,jflip,k,icomp+n); diff --git a/Source/BoundaryConditions/BoundaryConditions_netcdf.cpp b/Source/BoundaryConditions/BoundaryConditions_netcdf.cpp index 0430efd..e294168 100644 --- a/Source/BoundaryConditions/BoundaryConditions_netcdf.cpp +++ b/Source/BoundaryConditions/BoundaryConditions_netcdf.cpp @@ -11,7 +11,7 @@ using namespace amrex; */ void -REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const Real time, const int bdy_var_type, const int icomp_to_fill) +REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const Real time, const int bccomp, const int bdy_var_type, const int icomp_to_fill) { int lev = 0; @@ -74,6 +74,12 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const const auto& bdatyhi_n = bdy_data_yhi[n_time ][ivar+icomp].const_array(); const auto& bdatyhi_np1 = bdy_data_yhi[n_time+1][ivar+icomp].const_array(); + const bool apply_east = domain_bcs_type[bccomp+icomp].lo(0) == REMORABCType::clamped; + const bool apply_west = domain_bcs_type[bccomp+icomp].hi(0) == REMORABCType::clamped; + const bool apply_south = domain_bcs_type[bccomp+icomp].lo(1) == REMORABCType::clamped; + const bool apply_north = domain_bcs_type[bccomp+icomp].hi(1) == REMORABCType::clamped; + + #ifdef AMREX_USE_OMP #pragma omp parallel if (Gpu::notInLaunchRegion()) #endif @@ -101,7 +107,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const const Array4& dest_arr = mf_to_fill.array(mfi); const Array4& mask_arr = mf_mask.array(mfi); - if (!xlo.isEmpty()) { + if (!xlo.isEmpty() && apply_east) { ParallelFor(xlo, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = (oma * bdatxlo_n (ubound(xlo).x,j,k,0) @@ -109,7 +115,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const }); } - if (!xhi.isEmpty()) { + if (!xhi.isEmpty() && apply_west) { ParallelFor(xhi, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = (oma * bdatxhi_n (lbound(xhi).x,j,k,0) @@ -117,7 +123,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const }); } - if (!ylo.isEmpty()) { + if (!ylo.isEmpty() && apply_south) { ParallelFor(ylo, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = (oma * bdatylo_n (i,ubound(ylo).y,k,0) @@ -125,7 +131,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const }); } - if (!yhi.isEmpty()) { + if (!yhi.isEmpty() && apply_north) { ParallelFor(yhi, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = (oma * bdatyhi_n (i,lbound(yhi).y,k,0) @@ -133,25 +139,25 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const }); } - if (!xlo_ylo.isEmpty()) { + if (!xlo_ylo.isEmpty() && apply_east && apply_south) { ParallelFor(xlo_ylo, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill) + dest_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill)); }); } - if (!xlo_yhi.isEmpty()) { + if (!xlo_yhi.isEmpty() && apply_east && apply_north) { ParallelFor(xlo_yhi, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill) + dest_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill)); }); } - if (!xhi_ylo.isEmpty()) { + if (!xhi_ylo.isEmpty() && apply_west && apply_south) { ParallelFor(xhi_ylo, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill) + dest_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill)); }); } - if (!xhi_yhi.isEmpty()) { + if (!xhi_yhi.isEmpty() && apply_west && apply_north) { ParallelFor(xhi_yhi, [=] AMREX_GPU_DEVICE (int i, int j, int k) { dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill) + dest_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill)); diff --git a/Source/BoundaryConditions/BoundaryConditions_xvel.cpp b/Source/BoundaryConditions/BoundaryConditions_xvel.cpp index 3124f83..d4007cf 100644 --- a/Source/BoundaryConditions/BoundaryConditions_xvel.cpp +++ b/Source/BoundaryConditions/BoundaryConditions_xvel.cpp @@ -61,7 +61,7 @@ void REMORAPhysBCFunct::impose_xvel_bcs (const Array4& dest_arr, const Box int iflip = dom_lo.x - i; if (bc_ptr[n].lo(0) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][0]*msku(i,j,0); - } else if (bc_ptr[n].lo(0) == REMORABCType::foextrap) { + } else if (bc_ptr[n].lo(0) == REMORABCType::foextrap || bc_ptr[n].lo(0) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k); } else if (bc_ptr[n].lo(0) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(iflip,j,k); @@ -80,7 +80,7 @@ void REMORAPhysBCFunct::impose_xvel_bcs (const Array4& dest_arr, const Box int iflip = 2*(dom_hi.x + 1) - i; if (bc_ptr[n].hi(0) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][3]*msku(i,j,0); - } else if (bc_ptr[n].hi(0) == REMORABCType::foextrap) { + } else if (bc_ptr[n].hi(0) == REMORABCType::foextrap || bc_ptr[n].hi(0) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(dom_hi.x+1,j,k); } else if (bc_ptr[n].hi(0) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(iflip,j,k); @@ -106,7 +106,7 @@ void REMORAPhysBCFunct::impose_xvel_bcs (const Array4& dest_arr, const Box int jflip = dom_lo.y - 1 - j; if (bc_ptr[n].lo(1) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][1]*msku(i,j,0); - } else if (bc_ptr[n].lo(1) == REMORABCType::foextrap) { + } else if (bc_ptr[n].lo(1) == REMORABCType::foextrap || bc_ptr[n].lo(1) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k); } else if (bc_ptr[n].lo(1) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(i,jflip,k); @@ -118,7 +118,7 @@ void REMORAPhysBCFunct::impose_xvel_bcs (const Array4& dest_arr, const Box int jflip = 2*dom_hi.y + 1 - j; if (bc_ptr[n].hi(1) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][4]*msku(i,j,0); - } else if (bc_ptr[n].hi(1) == REMORABCType::foextrap) { + } else if (bc_ptr[n].hi(1) == REMORABCType::foextrap || bc_ptr[n].hi(1) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(i,dom_hi.y,k); } else if (bc_ptr[n].hi(1) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(i,jflip,k); diff --git a/Source/BoundaryConditions/BoundaryConditions_yvel.cpp b/Source/BoundaryConditions/BoundaryConditions_yvel.cpp index e0b9b64..c89d50a 100644 --- a/Source/BoundaryConditions/BoundaryConditions_yvel.cpp +++ b/Source/BoundaryConditions/BoundaryConditions_yvel.cpp @@ -60,7 +60,7 @@ void REMORAPhysBCFunct::impose_yvel_bcs (const Array4& dest_arr, const Box int iflip = dom_lo.x - 1- i; if (bc_ptr[n].lo(0) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][0]*mskv(i,j,0); - } else if (bc_ptr[n].lo(0) == REMORABCType::foextrap) { + } else if (bc_ptr[n].lo(0) == REMORABCType::foextrap || bc_ptr[n].lo(0) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k); } else if (bc_ptr[n].lo(0) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(iflip,j,k); @@ -72,7 +72,7 @@ void REMORAPhysBCFunct::impose_yvel_bcs (const Array4& dest_arr, const Box int iflip = 2*dom_hi.x + 1 - i; if (bc_ptr[n].hi(0) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][3]*mskv(i,j,0); - } else if (bc_ptr[n].hi(0) == REMORABCType::foextrap) { + } else if (bc_ptr[n].hi(0) == REMORABCType::foextrap || bc_ptr[n].hi(0) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(dom_hi.x,j,k); } else if (bc_ptr[n].hi(0) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(iflip,j,k); @@ -96,7 +96,7 @@ void REMORAPhysBCFunct::impose_yvel_bcs (const Array4& dest_arr, const Box int jflip = dom_lo.y-j; if (bc_ptr[n].lo(1) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][1]*mskv(i,j,0); - } else if (bc_ptr[n].lo(1) == REMORABCType::foextrap) { + } else if (bc_ptr[n].lo(1) == REMORABCType::foextrap || bc_ptr[n].lo(1) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k); } else if (bc_ptr[n].lo(1) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(i,jflip,k); @@ -115,7 +115,7 @@ void REMORAPhysBCFunct::impose_yvel_bcs (const Array4& dest_arr, const Box int jflip = 2*(dom_hi.y + 1) - j; if (bc_ptr[n].hi(1) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][4]*mskv(i,j,0); - } else if (bc_ptr[n].hi(1) == REMORABCType::foextrap) { + } else if (bc_ptr[n].hi(1) == REMORABCType::foextrap || bc_ptr[n].hi(1) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(i,dom_hi.y+1,k); } else if (bc_ptr[n].hi(1) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(i,jflip,k); diff --git a/Source/BoundaryConditions/BoundaryConditions_zvel.cpp b/Source/BoundaryConditions/BoundaryConditions_zvel.cpp index 841a2ab..52204fc 100644 --- a/Source/BoundaryConditions/BoundaryConditions_zvel.cpp +++ b/Source/BoundaryConditions/BoundaryConditions_zvel.cpp @@ -64,7 +64,7 @@ void REMORAPhysBCFunct::impose_zvel_bcs (const Array4& dest_arr, const Box int iflip = dom_lo.x - 1 - i; if (bc_ptr[n].lo(0) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][0]*mskr(i,j,0); - } else if (bc_ptr[n].lo(0) == REMORABCType::foextrap) { + } else if (bc_ptr[n].lo(0) == REMORABCType::foextrap || bc_ptr[n].lo(0) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k); } else if (bc_ptr[n].lo(0) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(iflip,j,k); @@ -76,7 +76,7 @@ void REMORAPhysBCFunct::impose_zvel_bcs (const Array4& dest_arr, const Box int iflip = 2*dom_hi.x + 1 - i; if (bc_ptr[n].hi(0) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][3]*mskr(i,j,0); - } else if (bc_ptr[n].hi(0) == REMORABCType::foextrap) { + } else if (bc_ptr[n].hi(0) == REMORABCType::foextrap || bc_ptr[n].hi(0) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(dom_hi.x,j,k); } else if (bc_ptr[n].hi(0) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(iflip,j,k); @@ -96,7 +96,7 @@ void REMORAPhysBCFunct::impose_zvel_bcs (const Array4& dest_arr, const Box int jflip = dom_lo.y - 1 - j; if (bc_ptr[n].lo(1) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][1]*mskr(i,j,0); - } else if (bc_ptr[n].lo(1) == REMORABCType::foextrap) { + } else if (bc_ptr[n].lo(1) == REMORABCType::foextrap || bc_ptr[n].lo(1) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k); } else if (bc_ptr[n].lo(1) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(i,jflip,k); @@ -108,7 +108,7 @@ void REMORAPhysBCFunct::impose_zvel_bcs (const Array4& dest_arr, const Box int jflip = 2*dom_hi.y + 1 - j; if (bc_ptr[n].hi(1) == REMORABCType::ext_dir) { dest_arr(i,j,k) = l_bc_extdir_vals_d[n][4]*mskr(i,j,0); - } else if (bc_ptr[n].hi(1) == REMORABCType::foextrap) { + } else if (bc_ptr[n].hi(1) == REMORABCType::foextrap || bc_ptr[n].hi(1) == REMORABCType::clamped) { dest_arr(i,j,k) = dest_arr(i,dom_hi.y,k); } else if (bc_ptr[n].hi(1) == REMORABCType::reflect_even) { dest_arr(i,j,k) = dest_arr(i,jflip,k); diff --git a/Source/BoundaryConditions/REMORA_FillPatch.cpp b/Source/BoundaryConditions/REMORA_FillPatch.cpp index 60bffe7..fb25dfe 100644 --- a/Source/BoundaryConditions/REMORA_FillPatch.cpp +++ b/Source/BoundaryConditions/REMORA_FillPatch.cpp @@ -125,7 +125,7 @@ REMORA::FillPatch (int lev, Real time, MultiFab& mf_to_fill, Vector c if ( (solverChoice.ic_bc_type == IC_BC_Type::Real) && (lev==0) && (bdy_var_type != BdyVars::null) ) { - fill_from_bdyfiles (mf_to_fill,*mask,time,bdy_var_type, icomp); + fill_from_bdyfiles(mf_to_fill,*mask,time,bccomp,bdy_var_type, icomp); } #endif diff --git a/Source/Initialization/REMORA_init_bcs.cpp b/Source/Initialization/REMORA_init_bcs.cpp index e3067a2..acf3572 100644 --- a/Source/Initialization/REMORA_init_bcs.cpp +++ b/Source/Initialization/REMORA_init_bcs.cpp @@ -89,14 +89,6 @@ void REMORA::init_bcs () amrex::Print() << "BC Type specified for fac is " << bc_type_string << std::endl; amrex::Abort("This BC type is unknown"); } - - if ((ori == Orientation(Direction::x,Orientation::low) || ori == Orientation(Direction::y,Orientation::low) || - ori == Orientation(Direction::x,Orientation::high) || ori == Orientation(Direction::y,Orientation::high)) && - solverChoice.ic_bc_type == IC_BC_Type::Real && - phys_bc_type[bcvar_type][ori] != REMORA_BC::clamped) - { - amrex::Abort("BC type must be clamped in x and y when reading BCs from file"); - } }; auto f_by_side = [this, &f_set_var_bc] (std::string const& bcid, Orientation ori) @@ -197,7 +189,7 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::xvel_bc+dir].setHi(dir, REMORABCType::reflect_odd); } } - else if (bct == REMORA_BC::outflow || bct == REMORA_BC::clamped) + else if (bct == REMORA_BC::outflow) { if (side == Orientation::low) { domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::foextrap); @@ -246,6 +238,14 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::xvel_bc+i].setHi(dir, REMORABCType::int_dir); } } + else if (bct == REMORA_BC::clamped) + { + if (side == Orientation::low) { + domain_bcs_type[BCVars::xvel_bc+i].setLo(dir, REMORABCType::clamped); + } else { + domain_bcs_type[BCVars::xvel_bc+i].setHi(dir, REMORABCType::clamped); + } + } } } } @@ -271,7 +271,7 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::cons_bc+i].setHi(dir, REMORABCType::reflect_even); } } - else if ( bct == REMORA_BC::outflow || bct == REMORA_BC::clamped) + else if ( bct == REMORA_BC::outflow) { if (side == Orientation::low) { domain_bcs_type[BCVars::cons_bc+i].setLo(dir, REMORABCType::foextrap); @@ -311,6 +311,14 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::cons_bc+i].setHi(dir, REMORABCType::int_dir); } } + else if ( bct == REMORA_BC::clamped) + { + if (side == Orientation::low) { + domain_bcs_type[BCVars::cons_bc+i].setLo(dir, REMORABCType::clamped); + } else { + domain_bcs_type[BCVars::cons_bc+i].setHi(dir, REMORABCType::clamped); + } + } } } } @@ -340,7 +348,7 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::ubar_bc+dir].setHi(dir, REMORABCType::reflect_odd); } } - else if (bct == REMORA_BC::outflow || bct == REMORA_BC::clamped) + else if (bct == REMORA_BC::outflow) { if (side == Orientation::low) { domain_bcs_type[BCVars::ubar_bc+i].setLo(dir, REMORABCType::foextrap); @@ -389,6 +397,14 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::ubar_bc+i].setHi(dir, REMORABCType::int_dir); } } + else if (bct == REMORA_BC::clamped) + { + if (side == Orientation::low) { + domain_bcs_type[BCVars::ubar_bc+i].setLo(dir, REMORABCType::clamped); + } else { + domain_bcs_type[BCVars::ubar_bc+i].setHi(dir, REMORABCType::clamped); + } + } } } } @@ -414,7 +430,7 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::zeta_bc+i].setHi(dir, REMORABCType::reflect_even); } } - else if ( bct == REMORA_BC::outflow || bct == REMORA_BC::clamped) + else if ( bct == REMORA_BC::outflow) { if (side == Orientation::low) { domain_bcs_type[BCVars::zeta_bc+i].setLo(dir, REMORABCType::foextrap); @@ -462,6 +478,14 @@ void REMORA::init_bcs () domain_bcs_type[BCVars::zeta_bc+i].setHi(dir, REMORABCType::chapman); } } + else if ( bct == REMORA_BC::clamped) + { + if (side == Orientation::low) { + domain_bcs_type[BCVars::zeta_bc+i].setLo(dir, REMORABCType::clamped); + } else { + domain_bcs_type[BCVars::zeta_bc+i].setHi(dir, REMORABCType::clamped); + } + } } } } diff --git a/Source/Initialization/REMORA_init_from_netcdf.cpp b/Source/Initialization/REMORA_init_from_netcdf.cpp index 5eaeafb..efff777 100644 --- a/Source/Initialization/REMORA_init_from_netcdf.cpp +++ b/Source/Initialization/REMORA_init_from_netcdf.cpp @@ -152,7 +152,7 @@ REMORA::init_zeta_from_netcdf (int lev) } // omp } // idx vec_zeta[lev]->FillBoundary(geom[lev].periodicity()); - (*physbcs[lev])(*vec_zeta[lev],*vec_mskr[lev].get(),0,3,vec_zeta[lev]->nGrowVect(),t_old[lev],BCVars::cons_bc); + (*physbcs[lev])(*vec_zeta[lev],*vec_mskr[lev].get(),0,3,vec_zeta[lev]->nGrowVect(),t_old[lev],BCVars::zeta_bc); } /** * REMORA function that initializes bathymetry from a netcdf file diff --git a/Source/Initialization/REMORA_make_new_level.cpp b/Source/Initialization/REMORA_make_new_level.cpp index ec043f7..62957ea 100644 --- a/Source/Initialization/REMORA_make_new_level.cpp +++ b/Source/Initialization/REMORA_make_new_level.cpp @@ -164,7 +164,7 @@ REMORA::RemakeLevel (int lev, Real time, const BoxArray& ba, const DistributionM FillPatch(lev, time, tmp_h, GetVecOfPtrs(vec_hOfTheConfusingName), BCVars::cons_bc, BdyVars::null,0,false,false); FillPatch(lev, time, tmp_h, GetVecOfPtrs(vec_hOfTheConfusingName), BCVars::cons_bc, BdyVars::null,1,false,false); - FillPatch(lev, time, tmp_Zt_avg1_new, GetVecOfPtrs(vec_Zt_avg1), BCVars::cons_bc, BdyVars::null,0,true,false); + FillPatch(lev, time, tmp_Zt_avg1_new, GetVecOfPtrs(vec_Zt_avg1), BCVars::zeta_bc, BdyVars::null,0,true,false); for (int icomp=0; icomp<3; icomp++) { FillPatch(lev, time, tmp_ubar_new, GetVecOfPtrs(vec_ubar), BCVars::ubar_bc, BdyVars::ubar, icomp,false,false); FillPatch(lev, time, tmp_vbar_new, GetVecOfPtrs(vec_vbar), BCVars::vbar_bc, BdyVars::vbar, icomp,false,false); diff --git a/Source/REMORA.H b/Source/REMORA.H index e3a7173..8fd4966 100644 --- a/Source/REMORA.H +++ b/Source/REMORA.H @@ -684,6 +684,7 @@ public: void fill_from_bdyfiles (amrex::MultiFab& mf_to_fill, const amrex::MultiFab& mf_mask, const amrex::Real time, + const int bccomp, const int bdy_var_type, const int icomp_to_fill); diff --git a/Source/TimeIntegration/REMORA_advance_3d.cpp b/Source/TimeIntegration/REMORA_advance_3d.cpp index 8064cd5..81511f9 100644 --- a/Source/TimeIntegration/REMORA_advance_3d.cpp +++ b/Source/TimeIntegration/REMORA_advance_3d.cpp @@ -158,8 +158,8 @@ REMORA::advance_3d (int lev, MultiFab& mf_cons, // Fill the data which is stored in the boundary data read from netcdf files if ( (solverChoice.ic_bc_type == IC_BC_Type::Real) && (lev==0) ) { - fill_from_bdyfiles (mf_u,*mf_msku,t_old[lev],BdyVars::u,0); - fill_from_bdyfiles (mf_v,*mf_mskv,t_old[lev],BdyVars::v,0); + fill_from_bdyfiles(mf_u,*mf_msku,t_old[lev],BCVars::xvel_bc,BdyVars::u,0); + fill_from_bdyfiles(mf_v,*mf_mskv,t_old[lev],BCVars::yvel_bc,BdyVars::v,0); } #endif