Skip to content

Commit

Permalink
NullMoist doesn't have a mic_fab_var data structure. Prevent touching…
Browse files Browse the repository at this point in the history
… qmoist without a moisture model.
  • Loading branch information
AMLattanzi committed Dec 15, 2023
1 parent 2d820bb commit dc03e05
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Source/BoundaryConditions/ERF_FillPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ERF::FillPatch (int lev, Real time, const Vector<MultiFab*>& mfs, bool fillset)
// We call this even if init_type == real because this routine will fill the vertical bcs
(*physbcs[lev])(mfs,icomp_cons,ncomp_cons,ngvect_cons,ngvect_vels,init_type,cons_only,BCVars::cons_bc,time);

// Update vars and pointers if we have a micro model
// Update vars in the micro model
if (solverChoice.moisture_type != MoistureType::None)
micro.Update_Micro_Vars_Lev(lev, vars_new[lev][Vars::cons]);
}
Expand Down Expand Up @@ -262,7 +262,7 @@ ERF::FillIntermediatePatch (int lev, Real time,
if (!(cons_only && ncomp_cons == 1) && m_most && allow_most_bcs)
m_most->impose_most_bcs(lev,mfs,eddyDiffs_lev[lev].get(),z_phys_nd[lev].get());

// Update vars and pointers if we have a micro model
// Update vars in the micro model
if (solverChoice.moisture_type != MoistureType::None)
micro.Update_Micro_Vars_Lev(lev, vars_new[lev][Vars::cons]);
}
Expand Down
50 changes: 26 additions & 24 deletions Source/TimeIntegration/ERF_advance_dycore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,38 +255,40 @@ void ERF::advance_dycore(int level,

Gpu::DeviceVector<Real> qv_d(ncell), qc_d(ncell), qi_d(ncell);

if (q_size >= 1) {
MultiFab qvapor (*(qmoist[level][0]), make_alias, 0, 1);
PlaneAverage qv_ave(&qvapor, geom[level], solverChoice.ave_plane);
qv_ave.compute_averages(ZDir(), qv_ave.field());
if (solverChoice.moisture_type != MoistureType::None) {
if (q_size >= 1) {
MultiFab qvapor (*(qmoist[level][0]), make_alias, 0, 1);
PlaneAverage qv_ave(&qvapor, geom[level], solverChoice.ave_plane);
qv_ave.compute_averages(ZDir(), qv_ave.field());

Gpu::HostVector <Real> qv_h(ncell);
Gpu::HostVector <Real> qv_h(ncell);

qv_ave.line_average(0, qv_h);
Gpu::copyAsync(Gpu::hostToDevice, qv_h.begin(), qv_h.end(), qv_d.begin());
}
qv_ave.line_average(0, qv_h);
Gpu::copyAsync(Gpu::hostToDevice, qv_h.begin(), qv_h.end(), qv_d.begin());
}

if (q_size >= 2) {
MultiFab qcloud (*(qmoist[level][1]), make_alias, 0, 1);
PlaneAverage qc_ave(&qcloud, geom[level], solverChoice.ave_plane);
qc_ave.compute_averages(ZDir(), qc_ave.field());
if (q_size >= 2) {
MultiFab qcloud (*(qmoist[level][1]), make_alias, 0, 1);
PlaneAverage qc_ave(&qcloud, geom[level], solverChoice.ave_plane);
qc_ave.compute_averages(ZDir(), qc_ave.field());

Gpu::HostVector <Real> qc_h(ncell);
Gpu::HostVector <Real> qc_h(ncell);

qc_ave.line_average(0, qc_h);
Gpu::copyAsync(Gpu::hostToDevice, qc_h.begin(), qc_h.end(), qc_d.begin());
}
qc_ave.line_average(0, qc_h);
Gpu::copyAsync(Gpu::hostToDevice, qc_h.begin(), qc_h.end(), qc_d.begin());
}

if (q_size >= 3) {
MultiFab qice (*(qmoist[level][2]), make_alias, 0, 1);
PlaneAverage qi_ave(&qice , geom[level], solverChoice.ave_plane);
qi_ave.compute_averages(ZDir(), qi_ave.field());
if (q_size >= 3) {
MultiFab qice (*(qmoist[level][2]), make_alias, 0, 1);
PlaneAverage qi_ave(&qice , geom[level], solverChoice.ave_plane);
qi_ave.compute_averages(ZDir(), qi_ave.field());

Gpu::HostVector <Real> qi_h(ncell);
Gpu::HostVector <Real> qi_h(ncell);

qi_ave.line_average(0, qi_h);
Gpu::copyAsync(Gpu::hostToDevice, qi_h.begin(), qi_h.end(), qi_d.begin());
Gpu::streamSynchronize();
qi_ave.line_average(0, qi_h);
Gpu::copyAsync(Gpu::hostToDevice, qi_h.begin(), qi_h.end(), qi_d.begin());
Gpu::streamSynchronize();
}
}

#include "TI_no_substep_fun.H"
Expand Down

0 comments on commit dc03e05

Please sign in to comment.