Skip to content

Commit

Permalink
fix bug in new bc stuff (#1502)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Mar 17, 2024
1 parent e74fe6c commit 63008e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
14 changes: 9 additions & 5 deletions Source/BoundaryConditions/ERF_FillPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,19 @@ ERF::FillPatch (int lev, Real time,
*mfs_vel[Vars::yvel], mfs_vel[Vars::yvel]->nGrowVect(),
*mfs_vel[Vars::zvel], mfs_vel[Vars::zvel]->nGrowVect(),
*mfs_vel[Vars::cons],
*mfs_mom[Vars::xvel], *mfs_mom[Vars::yvel], *mfs_mom[Vars::zvel],
*mfs_mom[IntVars::xmom],
*mfs_mom[IntVars::ymom],
*mfs_mom[IntVars::zmom],
solverChoice.use_NumDiff);
FPr_u[lev-1].FillSet(*mfs_mom[Vars::xvel], time, null_bc, domain_bcs_type);
FPr_v[lev-1].FillSet(*mfs_mom[Vars::yvel], time, null_bc, domain_bcs_type);
FPr_w[lev-1].FillSet(*mfs_mom[Vars::zvel], time, null_bc, domain_bcs_type);
FPr_u[lev-1].FillSet(*mfs_mom[IntVars::xmom], time, null_bc, domain_bcs_type);
FPr_v[lev-1].FillSet(*mfs_mom[IntVars::ymom], time, null_bc, domain_bcs_type);
FPr_w[lev-1].FillSet(*mfs_mom[IntVars::zmom], time, null_bc, domain_bcs_type);

MomentumToVelocity(*mfs_vel[Vars::xvel], *mfs_vel[Vars::yvel], *mfs_vel[Vars::zvel],
*mfs_vel[Vars::cons],
*mfs_mom[Vars::xvel], *mfs_mom[Vars::yvel], *mfs_mom[Vars::zvel]);
*mfs_mom[IntVars::xmom],
*mfs_mom[IntVars::ymom],
*mfs_mom[IntVars::zmom]);
}
}

Expand Down
11 changes: 6 additions & 5 deletions Source/BoundaryConditions/ERF_PhysBCFunct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel,
gdomainz.grow(i, nghost[i]);
}
}
// We want to make sure we impose the z-vels at k=0 if the box includes k=0
if (gdomainz.smallEnd(2) == 0) gdomainz.setSmall(2,1);

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
Expand All @@ -230,9 +232,9 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel,
z_nd_arr = m_z_phys_nd->const_array(mfi);
}

const Array4<const Real> velx_arr = xvel.array(mfi);;
const Array4<const Real> vely_arr = yvel.array(mfi);;
const Array4< Real> 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 All @@ -246,7 +248,6 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel,
impose_vertical_zvel_bcs(velz_arr,velx_arr,vely_arr,zbx,domain,z_nd_arr,dxInv,
bccomp_u, bccomp_v, bccomp_w, m_terrain_type);
}

} // MFIter
} // OpenMP
} // operator()
Expand Down Expand Up @@ -288,7 +289,7 @@ void ERFPhysBCFunct_w_no_terrain::operator() (MultiFab& mf, int /*icomp*/, int /

if (!m_use_real_bcs)
{
const Array4< Real> velz_arr = mf.array(mfi);;
Array4< Real> const& velz_arr = mf.array(mfi);;
if (!gdomainz.contains(zbx))
{
impose_lateral_zvel_bcs(velz_arr,zbx,domain,bccomp);
Expand Down

0 comments on commit 63008e4

Please sign in to comment.