Skip to content

Commit

Permalink
Merge branch 'development' into simplify-turb-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
baperry2 authored Sep 4, 2024
2 parents 01e233e + 1e6b3ff commit 636f2c6
Show file tree
Hide file tree
Showing 48 changed files with 1,396 additions and 952 deletions.
6 changes: 4 additions & 2 deletions Source/BoundaryConditions/ABLMost.H
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,16 @@ public:
void
update_pblh (const int& lev,
amrex::Vector<amrex::Vector<amrex::MultiFab>>& vars,
amrex::MultiFab* z_phys_cc);
amrex::MultiFab* z_phys_cc,
const int RhoQv_comp, const int RhoQr_comp);

template <typename PBLHeightEstimator>
void
compute_pblh (const int& lev,
amrex::Vector<amrex::Vector<amrex::MultiFab>>& vars,
amrex::MultiFab* z_phys_cc,
const PBLHeightEstimator& est);
const PBLHeightEstimator& est,
const int RhoQv_comp, const int RhoQr_comp);

void
read_custom_roughness (const int& lev,
Expand Down
18 changes: 6 additions & 12 deletions Source/BoundaryConditions/ABLMost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,12 @@ ABLMost::get_lsm_tsurf (const int& lev)
void
ABLMost::update_pblh (const int& lev,
Vector<Vector<MultiFab>>& vars,
MultiFab* z_phys_cc)
MultiFab* z_phys_cc,
int RhoQv_comp, int RhoQr_comp)
{
if (pblh_type == PBLHeightCalcType::MYNN25) {
MYNNPBLH estimator;
compute_pblh(lev, vars, z_phys_cc, estimator);
compute_pblh(lev, vars, z_phys_cc, estimator, RhoQv_comp, RhoQr_comp);
} else if (pblh_type == PBLHeightCalcType::YSU) {
amrex::Error("YSU PBLH calc not implemented yet");
}
Expand All @@ -575,19 +576,12 @@ void
ABLMost::compute_pblh (const int& lev,
Vector<Vector<MultiFab>>& vars,
MultiFab* z_phys_cc,
const PBLHeightEstimator& est)
const PBLHeightEstimator& est,
int RhoQv_comp, int RhoQr_comp)
{
int moist_flag = 0;
int n_qstate = vars[lev][Vars::cons].nComp() - (NVAR_max - NMOIST_max);
if (n_qstate > 3) {
moist_flag = (n_qstate > 3) ? RhoQ4_comp : RhoQ3_comp;
} else if (n_qstate > 0) {
moist_flag = 1;
}

est.compute_pblh(m_geom[lev],z_phys_cc, pblh[lev].get(),
vars[lev][Vars::cons],m_lmask_lev[lev][0],
moist_flag);
RhoQv_comp, RhoQr_comp);
}

void
Expand Down
16 changes: 12 additions & 4 deletions Source/BoundaryConditions/BoundaryConditions_bndryreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ ERF::fill_from_bndryregs (const Vector<MultiFab*>& mfs, const Real time)

ParallelFor(
bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) {
if (bc_ptr[icomp+n].lo(0) == ERFBCType::ext_dir_ingested) {
int bc_comp = (icomp+n >= RhoScalar_comp && icomp+n < RhoScalar_comp+NSCALARS) ?
BCVars::RhoScalar_bc_comp : icomp+n;
if (bc_ptr[bc_comp].lo(0) == ERFBCType::ext_dir_ingested) {
int jb = std::min(std::max(j,dom_lo.y),dom_hi.y);
int kb = std::min(std::max(k,dom_lo.z),dom_hi.z);
dest_arr(i,j,k,icomp+n) = bdatxlo(dom_lo.x-1,jb,kb,bccomp+n);
}
},
bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) {
if (bc_ptr[icomp+n].hi(0) == ERFBCType::ext_dir_ingested) {
int bc_comp = (icomp+n >= RhoScalar_comp && icomp+n < RhoScalar_comp+NSCALARS) ?
BCVars::RhoScalar_bc_comp : icomp+n;
if (bc_ptr[bc_comp].hi(0) == ERFBCType::ext_dir_ingested) {
int jb = std::min(std::max(j,dom_lo.y),dom_hi.y);
int kb = std::min(std::max(k,dom_lo.z),dom_hi.z);
dest_arr(i,j,k,icomp+n) = bdatxhi(dom_hi.x+1,jb,kb,bccomp+n);
Expand All @@ -100,14 +104,18 @@ ERF::fill_from_bndryregs (const Vector<MultiFab*>& mfs, const Real time)

ParallelFor(
bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) {
if (bc_ptr[icomp+n].lo(1) == ERFBCType::ext_dir_ingested) {
int bc_comp = (icomp+n >= RhoScalar_comp && icomp+n < RhoScalar_comp+NSCALARS) ?
BCVars::RhoScalar_bc_comp : icomp+n;
if (bc_ptr[bc_comp].lo(1) == ERFBCType::ext_dir_ingested) {
int ib = std::min(std::max(i,dom_lo.x),dom_hi.x);
int kb = std::min(std::max(k,dom_lo.z),dom_hi.z);
dest_arr(i,j,k,icomp+n) = bdatylo(ib,dom_lo.y-1,kb,bccomp+n);
}
},
bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) {
if (bc_ptr[icomp+n].hi(1) == ERFBCType::ext_dir_ingested) {
int bc_comp = (icomp+n >= RhoScalar_comp && icomp+n < RhoScalar_comp+NSCALARS) ?
BCVars::RhoScalar_bc_comp : icomp+n;
if (bc_ptr[bc_comp].hi(1) == ERFBCType::ext_dir_ingested) {
int ib = std::min(std::max(i,dom_lo.x),dom_hi.x);
int kb = std::min(std::max(k,dom_lo.z),dom_hi.z);
dest_arr(i,j,k,icomp+n) = bdatyhi(ib,dom_hi.y+1,kb,bccomp+n);
Expand Down
Loading

0 comments on commit 636f2c6

Please sign in to comment.