Skip to content

Commit

Permalink
patch some things in problem setup and BC application
Browse files Browse the repository at this point in the history
  • Loading branch information
hklion committed Oct 29, 2024
1 parent 5fd126c commit 741c7fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Exec/Channel_Test/inputs_orlanski
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 10

amrex.fpe_trap_invalid = 0
amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 1024 1024 1024

Expand Down Expand Up @@ -33,7 +33,7 @@ zeta.type = outflow outflow outflow outflow
tke.type = outflow outflow outflow outflow

# TIME STEP CONTROL
remora.fixed_dt = 800.0 # Timestep size (seconds)
remora.fixed_dt = 400.0 # Timestep size (seconds)

remora.fixed_ndtfast_ratio = 10

Expand Down
27 changes: 3 additions & 24 deletions Exec/Channel_Test/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,36 +222,15 @@ init_custom_smflux(const Geometry& geom, const Real time, MultiFab& mf_sustr, Mu
bool NSPeriodic = geomdata.isPeriodic(1);

//If we had wind stress and bottom stress we would need to set these:
Real pi = 3.14159265359_rt;
Real tdays=time/Real(24.0*60.0*60.0);
Real dstart=0.0_rt;
Real windamp;
Real userval=0.01_rt;
Real mf_fcor=1.0e-4_rt;
Real air_rho=1.0_rt;
//It's possible these should be set to be nonzero only at the boundaries they affect

// Don't allow doubly periodic in this case
AMREX_ALWAYS_ASSERT( !NSPeriodic || !EWPeriodic);

// Flow in x-direction (EW):
if (NSPeriodic) {
mf_sustr.setVal(0.0_rt);
}
else if (EWPeriodic) {
windamp=userval*std::sin(0.9_rt*mf_fcor*86400.0_rt*(tdays-dstart))/m_solverChoice.rho0;
mf_sustr.setVal(windamp);
}

// Flow in y-direction (NS):
if (NSPeriodic) {
if ((tdays-dstart)<=2.0)
windamp=-0.1_rt*Real(sin(pi*(tdays-dstart)/4.0_rt))/Real(m_solverChoice.rho0);
else
windamp=-0.1_rt/m_solverChoice.rho0;
mf_svstr.setVal(windamp);
}
else if(EWPeriodic) {
mf_svstr.setVal(0.0_rt);
}
Real windamp_u = userval*std::sin(0.9_rt*mf_fcor*86400.0_rt*(tdays-dstart))/m_solverChoice.rho0;
mf_sustr.setVal(windamp_u);
mf_svstr.setVal(0.0_rt);
}
8 changes: 4 additions & 4 deletions Source/BoundaryConditions/BoundaryConditions_cons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ void REMORAPhysBCFunct::impose_cons_bcs (const Array4<Real>& dest_arr, const Box
if (!is_periodic_in_x)
{
Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
bx_xlo.setSmall(1,valid_bx.smallEnd(1)-1); bx_xlo.setBig(1,valid_bx.bigEnd(1)+1);
bx_xlo.setSmall(1,std::max(valid_bx.smallEnd(1)-1,dom_lo.y)); bx_xlo.setBig(1,std::min(valid_bx.bigEnd(1)+1,dom_hi.y));
Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
bx_xhi.setSmall(1,valid_bx.smallEnd(1)-1); bx_xhi.setBig(1,valid_bx.bigEnd(1)+1);
bx_xhi.setSmall(1,std::max(valid_bx.smallEnd(1)-1,dom_lo.y)); bx_xhi.setBig(1,std::min(valid_bx.bigEnd(1)+1,dom_hi.y));
ParallelFor(
bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) {
if (bc_ptr[n].lo(0) == REMORABCType::ext_dir) {
Expand Down Expand Up @@ -109,9 +109,9 @@ void REMORAPhysBCFunct::impose_cons_bcs (const Array4<Real>& dest_arr, const Box
if (!is_periodic_in_y)
{
Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
bx_ylo.setSmall(0,valid_bx.smallEnd(0)-1); bx_ylo.setBig(0,valid_bx.bigEnd(0)+1);
bx_ylo.setSmall(0,std::max(valid_bx.smallEnd(0)-1,dom_lo.x)); bx_ylo.setBig(0,std::min(valid_bx.bigEnd(0)+1,dom_hi.x));
Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1);
bx_yhi.setSmall(0,valid_bx.smallEnd(0)-1); bx_yhi.setBig(0,valid_bx.bigEnd(0)+1);
bx_yhi.setSmall(0,std::max(valid_bx.smallEnd(0)-1,dom_lo.x)); bx_yhi.setBig(0,std::min(valid_bx.bigEnd(0)+1,dom_hi.x));
ParallelFor(
bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) {
if (bc_ptr[n].lo(1) == REMORABCType::ext_dir) {
Expand Down

0 comments on commit 741c7fc

Please sign in to comment.