Skip to content

Commit

Permalink
fix bug in fast integrator as well as cosmetic changes (erf-model#1853)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Oct 7, 2024
1 parent 78eb465 commit 11c1678
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Source/BoundaryConditions/ERF_FillPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ ERF::FillIntermediatePatch (int lev, Real time,
Geom(lev).Domain(),
domain_bcs_type);
}

mfs_mom[Vars::cons]->FillBoundary(geom[lev].periodicity());
}

/*
Expand Down
14 changes: 7 additions & 7 deletions Source/BoundaryConditions/ERF_PhysBCFunct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void ERFPhysBCFunct_cons::operator() (MultiFab& mf, int icomp, int ncomp,

if (!gdomain.contains(cbx2))
{
const Array4<Real> cons_arr = mf.array(mfi);;
const Array4<Real> cons_arr = mf.array(mfi);

if (!m_use_real_bcs)
{
Expand Down Expand Up @@ -145,7 +145,7 @@ void ERFPhysBCFunct_u::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/,

if (!gdomainx.contains(xbx2))
{
const Array4<Real> velx_arr = mf.array(mfi);;
const Array4<Real> velx_arr = mf.array(mfi);

if (!m_use_real_bcs)
{
Expand Down Expand Up @@ -220,7 +220,7 @@ void ERFPhysBCFunct_v::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/,

if (!gdomainy.contains(ybx2))
{
const Array4<Real> vely_arr = mf.array(mfi);;
const Array4<Real> vely_arr = mf.array(mfi);

if (!m_use_real_bcs)
{
Expand Down Expand Up @@ -296,9 +296,9 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel,
z_nd_arr = z_nd_mf_loc.const_array(mfi);
}

Array4<const Real> const& velx_arr = xvel.const_array(mfi);;
Array4<const Real> const& vely_arr = yvel.const_array(mfi);;
Array4< Real> const& velz_arr = mf.array(mfi);;
Array4<const Real> const& velx_arr = xvel.const_array(mfi);
Array4<const Real> const& vely_arr = yvel.const_array(mfi);
Array4< Real> const& velz_arr = mf.array(mfi);

if (!m_use_real_bcs)
{
Expand Down Expand Up @@ -353,7 +353,7 @@ void ERFPhysBCFunct_base::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/

if (!gdomain.contains(cbx2))
{
const Array4<Real> cons_arr = mf.array(mfi);;
const Array4<Real> cons_arr = mf.array(mfi);

impose_lateral_basestate_bcs(cons_arr,cbx1,domain);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/DataStructs/ERF_AdvStruct.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct AdvChoice {
pp.query("moistscal_vert_adv_type" , moistscal_vert_adv_string);

if (use_efficient_advection){
amrex::Print() << "Using efficient advection scheme" << std::endl;;
amrex::Print() << "Using efficient advection scheme" << std::endl;
}

if ( (dycore_horiz_adv_string == "Blended_3rd4th") ||
Expand Down
2 changes: 1 addition & 1 deletion Source/ERF_prob_common.H
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public:
const SolverChoice& /*sc*/)
{
amrex::Print() << "No perturbation to background fields supplied for "
<< name() << " problem" << std::endl;;
<< name() << " problem" << std::endl;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Source/Prob/ERF_init_density_hse_dry.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ erf_init_dens_hse (amrex::MultiFab& rho_hse,

amrex::ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int)
{
amrex::Array1D<amrex::Real,0,255> r;;
amrex::Array1D<amrex::Real,0,255> p;;
amrex::Array1D<amrex::Real,0,255> r;
amrex::Array1D<amrex::Real,0,255> p;
HSEutils::init_isentropic_hse_terrain(i,j,rho_local_sfc,Thetabar,&(r(0)),&(p(0)),z_cc_arr,klo,khi);

for (int k = klo; k <= khi; k++) {
Expand Down
8 changes: 4 additions & 4 deletions Source/TimeIntegration/ERF_fast_rhs_N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ void erf_fast_rhs_N (int step, int nrk,

// *********************************************************************
ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
Real xflux_lo = (temp_cur_xmom_arr(i ,j,k) - stage_xmom(i ,j,k)) / mf_u(i ,j,0);;
Real xflux_hi = (temp_cur_xmom_arr(i+1,j,k) - stage_xmom(i+1,j,k)) / mf_u(i+1,j,0);;
Real yflux_lo = (temp_cur_ymom_arr(i,j ,k) - stage_ymom(i,j ,k)) / mf_v(i,j ,0);;
Real yflux_hi = (temp_cur_ymom_arr(i,j+1,k) - stage_ymom(i,j+1,k)) / mf_v(i,j+1,0);;
Real xflux_lo = (temp_cur_xmom_arr(i ,j,k) - stage_xmom(i ,j,k)) / mf_u(i ,j,0);
Real xflux_hi = (temp_cur_xmom_arr(i+1,j,k) - stage_xmom(i+1,j,k)) / mf_u(i+1,j,0);
Real yflux_lo = (temp_cur_ymom_arr(i,j ,k) - stage_ymom(i,j ,k)) / mf_v(i,j ,0);
Real yflux_hi = (temp_cur_ymom_arr(i,j+1,k) - stage_ymom(i,j+1,k)) / mf_v(i,j+1,0);

Real mfsq = mf_m(i,j,0) * mf_m(i,j,0);

Expand Down
8 changes: 4 additions & 4 deletions Source/TimeIntegration/ERF_fast_rhs_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ void erf_fast_rhs_T (int step, int nrk,
( z_nd(i ,j ,k+1) + z_nd(i+1,j ,k+1)
-z_nd(i ,j ,k ) - z_nd(i+1,j ,k ) );

Real xflux_lo = new_drho_u(i ,j,k)*h_zeta_cc_xface_lo / mf_u(i ,j,0);;
Real xflux_hi = new_drho_u(i+1,j,k)*h_zeta_cc_xface_hi / mf_u(i+1,j,0);;
Real yflux_lo = new_drho_v(i,j ,k)*h_zeta_cc_yface_lo / mf_v(i,j ,0);;
Real yflux_hi = new_drho_v(i,j+1,k)*h_zeta_cc_yface_hi / mf_v(i,j+1,0);;
Real xflux_lo = new_drho_u(i ,j,k)*h_zeta_cc_xface_lo / mf_u(i ,j,0);
Real xflux_hi = new_drho_u(i+1,j,k)*h_zeta_cc_xface_hi / mf_u(i+1,j,0);
Real yflux_lo = new_drho_v(i,j ,k)*h_zeta_cc_yface_lo / mf_v(i,j ,0);
Real yflux_hi = new_drho_v(i,j+1,k)*h_zeta_cc_yface_hi / mf_v(i,j+1,0);

Real mfsq = mf_m(i,j,0) * mf_m(i,j,0);

Expand Down
2 changes: 1 addition & 1 deletion Source/TimeIntegration/ERF_slow_rhs_pre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ void erf_slow_rhs_pre (int level, int finest_level,
}
if ( (bx.bigEnd(1) == domain.bigEnd(1)) &&
(bc_ptr_h[BCVars::yvel_bc].hi(1) == ERFBCType::ext_dir) ) {
Box hi_y_dom_face(bx); hi_y_dom_face.setSmall(1,bx.bigEnd(1)+1); hi_y_dom_face.setBig(1,bx.bigEnd(1)+1);;
Box hi_y_dom_face(bx); hi_y_dom_face.setSmall(1,bx.bigEnd(1)+1); hi_y_dom_face.setBig(1,bx.bigEnd(1)+1);
ParallelFor(hi_y_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
rho_v_rhs(i,j,k) = 0.;
});
Expand Down
3 changes: 3 additions & 0 deletions Source/Utils/ERF_TerrainMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ init_which_terrain_grid (int lev, Geometry const& geom, MultiFab& z_phys_nd,
gbx.setBig(2,domhi_z);
} else {
gbx.growHi(2,-1);
if (gbx.bigEnd(2) > domhi_z) {
gbx.setBig(2,domhi_z);
}
}

Array4<Real> const& z_arr = z_phys_nd.array(mfi);
Expand Down

0 comments on commit 11c1678

Please sign in to comment.