ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ShocDriver Class Reference

#include <ERF_ShocDriver.H>

Collaboration diagram for ShocDriver:

Public Member Functions

 ShocDriver (int lev, const SolverChoice &solver_choice)
 
void advance (amrex::MultiFab &cons, amrex::MultiFab &xvel, amrex::MultiFab &yvel, amrex::MultiFab &zvel, amrex::MultiFab *tau13, amrex::MultiFab *tau23, amrex::MultiFab *hfx3, amrex::MultiFab *qfx3, amrex::MultiFab *eddy_diffs, amrex::MultiFab &z_phys_nd, const amrex::Geometry &geom, double dt)
 
void set_eddy_diffs () const
 
void set_diff_stresses () const
 
void add_fast_tend (amrex::Vector< amrex::MultiFab > &S_rhs) const
 
void add_slow_tend (const amrex::MFIter &mfi, const amrex::Box &tbx, const amrex::Array4< amrex::Real > &cell_rhs) const
 
bool uses_state_update () const
 
bool uses_host_diffusion () const
 
bool uses_momentum_state_update () const
 
bool uses_momentum_host_diffusion () const
 
bool disables_momentum_transport () const
 
bool owns_scalar_surface_fluxes () const
 
bool owns_momentum_surface_stresses () const
 
bool needs_host_surface_momentum_stresses () const
 
bool owns_surface_fluxes () const
 
bool debug_summary_enabled () const
 
bool has_native_diagnostics () const
 
bool has_consumed_surface_flux_diagnostics () const
 
const amrex::MultiFab & native_diagnostics () const
 
const amrex::MultiFab & pblh_diagnostics () const
 
const amrex::MultiFab & consumed_sens_flux_diagnostics () const
 
const amrex::MultiFab & consumed_laten_flux_diagnostics () const
 
const amrex::MultiFab & shoc_ustar_diagnostics () const
 
const amrex::MultiFab & shoc_olen_diagnostics () const
 
const amrex::MultiFab & shoc_cldfrac_diagnostics () const
 
const amrex::MultiFab & shoc_ql_diagnostics () const
 
const amrex::MultiFab & shoc_ql2_diagnostics () const
 
const amrex::MultiFab & shoc_cond_diagnostics () const
 
const amrex::MultiFab & w_sec_diagnostics () const
 
const amrex::MultiFab & wqls_sec_diagnostics () const
 
const amrex::MultiFab & wthv_sec_diagnostics () const
 
const amrex::MultiFab & thl_sec_diagnostics () const
 
const amrex::MultiFab & qw_sec_diagnostics () const
 
const amrex::MultiFab & qwthl_sec_diagnostics () const
 
const amrex::MultiFab & wthl_sec_diagnostics () const
 
const amrex::MultiFab & wqw_sec_diagnostics () const
 
const amrex::MultiFab & w3_diagnostics () const
 
const amrex::MultiFab & brunt_diagnostics () const
 
const amrex::MultiFab & isotropy_diagnostics () const
 
const amrex::MultiFab & shear_prod_diagnostics () const
 
const amrex::MultiFab & buoy_prod_diagnostics () const
 
const amrex::MultiFab & diss_tke_diagnostics () const
 

Private Member Functions

void ensure_storage (const amrex::MultiFab &cons, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &eddy_diffs)
 
void seed_carried_turbulence (ShocColumnData &col, const amrex::MFIter &mfi, const amrex::MultiFab &cons, const amrex::MultiFab &eddy_diffs) const
 
void store_carried_turbulence (const ShocColumnData &col, const amrex::MFIter &mfi)
 
void seed_carried_buoyancy_flux (ShocColumnData &col, const amrex::MFIter &mfi) const
 
void store_carried_buoyancy_flux (const ShocColumnData &col, const amrex::MFIter &mfi)
 
void apply_state_update (amrex::MultiFab &cons, amrex::MultiFab &xvel, amrex::MultiFab &yvel, double dt) const
 
void debug_check_bad_column (const ShocColumnData &col, const amrex::MFIter &mfi, const amrex::MultiFab &z_phys_nd, const amrex::MultiFab *hfx3, const amrex::MultiFab *qfx3, const amrex::MultiFab *tau13, const amrex::MultiFab *tau23, const amrex::Geometry &geom, double dt) const
 
void print_debug_summary (double dt) const
 

Private Attributes

int m_lev
 
ShocRuntimeOptions m_opts
 
MoistureType m_moisture_type
 
MoistureComponentIndices m_moisture_indices
 
amrex::MultiFab m_theta_tend_cc
 
amrex::MultiFab m_qv_tend_cc
 
amrex::MultiFab m_qc_tend_cc
 
amrex::MultiFab m_qi_tend_cc
 
amrex::MultiFab m_tke_tend_cc
 
amrex::MultiFab m_u_tend_cc
 
amrex::MultiFab m_v_tend_cc
 
amrex::MultiFab m_u_tend_fc
 
amrex::MultiFab m_v_tend_fc
 
amrex::MultiFab m_eddy_coeffs_cc
 
amrex::MultiFab m_prev_turb_cc
 
amrex::MultiFab m_prev_wthv_sec_cc
 
amrex::MultiFab m_consumed_sens_flux_cc
 
amrex::MultiFab m_consumed_laten_flux_cc
 
amrex::MultiFab m_pblh_cc
 
amrex::MultiFab m_shoc_ustar_cc
 
amrex::MultiFab m_shoc_olen_cc
 
amrex::MultiFab m_shoc_cldfrac_cc
 
amrex::MultiFab m_shoc_ql_cc
 
amrex::MultiFab m_shoc_ql2_cc
 
amrex::MultiFab m_shoc_cond_cc
 
amrex::MultiFab m_w_sec_cc
 
amrex::MultiFab m_wqls_sec_cc
 
amrex::MultiFab m_wthv_sec_cc
 
amrex::MultiFab m_thl_sec_cc
 
amrex::MultiFab m_qw_sec_cc
 
amrex::MultiFab m_qwthl_sec_cc
 
amrex::MultiFab m_wthl_sec_cc
 
amrex::MultiFab m_wqw_sec_cc
 
amrex::MultiFab m_w3_cc
 
amrex::MultiFab m_brunt_cc
 
amrex::MultiFab m_isotropy_cc
 
amrex::MultiFab m_shear_prod_cc
 
amrex::MultiFab m_buoy_prod_cc
 
amrex::MultiFab m_diss_tke_cc
 
amrex::MultiFab * m_cons_ptr = nullptr
 
amrex::MultiFab * m_hfx3_ptr = nullptr
 
amrex::MultiFab * m_qfx3_ptr = nullptr
 
amrex::MultiFab * m_tau13_ptr = nullptr
 
amrex::MultiFab * m_tau23_ptr = nullptr
 
amrex::MultiFab * m_eddy_diffs_ptr = nullptr
 
amrex::Vector< std::unique_ptr< ShocColumnWorkspace > > m_column_workspaces
 
const amrex::Geometry * m_geom_ptr = nullptr
 
int m_advance_calls = 0
 
bool m_prev_turb_valid = false
 

Constructor & Destructor Documentation

◆ ShocDriver()

ShocDriver::ShocDriver ( int  lev,
const SolverChoice solver_choice 
)
explicit
347  : m_lev(lev),
348  m_moisture_type(solver_choice.moisture_type),
349  m_moisture_indices(solver_choice.moisture_indices)
350 {
351  m_opts.transport_mode = solver_choice.shoc_transport_mode;
353 
356  warn_if_shoc_debug_overrides_active_once(m_opts);
357 
358  std::string error_message;
360  amrex::Abort(error_message.c_str());
361  }
362 }
bool shoc_driver_host_diffusion_moisture_supported(const ShocRuntimeOptions &opts, MoistureType moisture_type, std::string &error_message)
Definition: ERF_ShocDriver.H:31
void validate_shoc_runtime_options(const ShocRuntimeOptions &opts)
Definition: ERF_ShocTypes.H:210
void read_shoc_runtime_options(ShocRuntimeOptions &opts)
Definition: ERF_ShocTypes.H:164
ShocRuntimeOptions m_opts
Definition: ERF_ShocDriver.H:134
MoistureComponentIndices m_moisture_indices
Definition: ERF_ShocDriver.H:136
int m_lev
Definition: ERF_ShocDriver.H:133
MoistureType m_moisture_type
Definition: ERF_ShocDriver.H:135
ShocTransportMode transport_mode
Definition: ERF_ShocTypes.H:43
ShocMomentumTransport momentum_transport
Definition: ERF_ShocTypes.H:44
MoistureType moisture_type
Moisture or microphysics model.
Definition: ERF_DataStruct.H:2124
ShocTransportMode shoc_transport_mode
Definition: ERF_DataStruct.H:1998
ShocMomentumTransport shoc_momentum_transport
Definition: ERF_DataStruct.H:1999
MoistureComponentIndices moisture_indices
Index map of the moisture data carried by the active scheme: conserved-state components for the speci...
Definition: ERF_DataStruct.H:2144
Here is the call graph for this function:

Member Function Documentation

◆ add_fast_tend()

void ShocDriver::add_fast_tend ( amrex::Vector< amrex::MultiFab > &  S_rhs) const
927 {
928  AMREX_ALWAYS_ASSERT(m_cons_ptr != nullptr);
929 
930  amrex::ignore_unused(S_rhs);
931 }
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
amrex::MultiFab * m_cons_ptr
Definition: ERF_ShocDriver.H:173
Here is the call graph for this function:

◆ add_slow_tend()

void ShocDriver::add_slow_tend ( const amrex::MFIter &  mfi,
const amrex::Box &  tbx,
const amrex::Array4< amrex::Real > &  cell_rhs 
) const
937 {
938  AMREX_ALWAYS_ASSERT(m_cons_ptr != nullptr);
939  amrex::ignore_unused(mfi, tbx, cell_rhs);
940 }
Here is the call graph for this function:

◆ advance()

void ShocDriver::advance ( amrex::MultiFab &  cons,
amrex::MultiFab &  xvel,
amrex::MultiFab &  yvel,
amrex::MultiFab &  zvel,
amrex::MultiFab *  tau13,
amrex::MultiFab *  tau23,
amrex::MultiFab *  hfx3,
amrex::MultiFab *  qfx3,
amrex::MultiFab *  eddy_diffs,
amrex::MultiFab &  z_phys_nd,
const amrex::Geometry &  geom,
double  dt 
)
534 {
535  BL_PROFILE("SHOC::advance");
536 
537  require_full_height_shoc_boxes(cons.boxArray(), geom.Domain());
538 
539  m_cons_ptr = &cons;
540  m_hfx3_ptr = hfx3;
541  m_qfx3_ptr = qfx3;
542  m_tau13_ptr = tau13;
543  m_tau23_ptr = tau23;
544  m_eddy_diffs_ptr = eddy_diffs;
545  m_geom_ptr = &geom;
546 
547  sync_face_multifab_impl(xvel, geom);
548  sync_face_multifab_impl(yvel, geom);
549  if (m_tau13_ptr) {
550  sync_face_multifab_impl(*m_tau13_ptr, geom);
551  }
552  if (m_tau23_ptr) {
553  sync_face_multifab_impl(*m_tau23_ptr, geom);
554  }
555 
556  {
557  BL_PROFILE("SHOC::advance::ensure_storage");
558  ensure_storage(cons, xvel, yvel, *eddy_diffs);
559  }
560 
561  std::string error_message;
563  error_message)) {
564  amrex::Abort(error_message.c_str());
565  }
566 
567  // Keep one SHOC column workspace per local box so GPU writeback kernels
568  // can finish reading a box's scratch before it is reused.
569  const amrex::Long n_local = cons.local_size();
570  AMREX_ALWAYS_ASSERT(n_local >= amrex::Long{0});
571  const amrex::Long current_size = static_cast<amrex::Long>(m_column_workspaces.size());
572  if (current_size < n_local) {
573  const amrex::Long old_size = current_size;
574  m_column_workspaces.resize(static_cast<std::size_t>(n_local));
575  for (amrex::Long n = old_size; n < n_local; ++n) {
576  m_column_workspaces[static_cast<std::size_t>(n)] =
577  std::make_unique<ShocColumnWorkspace>();
578  }
579  }
580 
581  amrex::Long local_index = 0;
582  for (MFIter mfi(cons, false); mfi.isValid(); ++mfi, ++local_index) {
584  local_index < static_cast<amrex::Long>(m_column_workspaces.size()));
585  ShocColumnWorkspace& workspace =
586  *m_column_workspaces[static_cast<std::size_t>(local_index)];
587  const Box& vbx = mfi.validbox();
588  const ShocColumnLayout active_layout = make_shoc_layout(vbx, geom);
589  {
590  BL_PROFILE("SHOC::advance::define_column_data");
591  workspace.ensure_capacity(active_layout, amrex::The_Async_Arena(),
593  }
594  ShocColumnData& col = workspace.col;
595  {
596  BL_PROFILE("SHOC::advance::preprocess");
598  hfx3, qfx3, tau13, tau23, z_phys_nd, geom,
600  }
601  {
602  BL_PROFILE("SHOC::advance::seed_carried_buoyancy_flux");
603  seed_carried_buoyancy_flux(col, mfi);
604  }
605  {
606  BL_PROFILE("SHOC::advance::seed_carried_turbulence");
607  seed_carried_turbulence(col, mfi, cons, *eddy_diffs);
608  }
609  const auto dx = geom.CellSizeArray();
610  if (uses_state_update()) {
611  BL_PROFILE("SHOC::advance::cache_baseline_state");
613  }
615  if (uses_state_update()) {
616  BL_PROFILE("SHOC::advance::implicit");
618  }
620  if (uses_state_update()) {
621  BL_PROFILE("SHOC::advance::finalize");
623  BL_PROFILE("SHOC::advance::debug_bad_column");
624  debug_check_bad_column(col, mfi, z_phys_nd, hfx3, qfx3, tau13, tau23, geom, dt);
625  }
626  {
627  BL_PROFILE("SHOC::advance::store_carried_buoyancy_flux");
628  store_carried_buoyancy_flux(col, mfi);
629  }
630  {
631  BL_PROFILE("SHOC::advance::store_carried_turbulence");
632  store_carried_turbulence(col, mfi);
633  }
634 
635  auto tk_arr = m_eddy_coeffs_cc.array(mfi);
636  auto th_tend = m_theta_tend_cc.array(mfi);
637  auto qv_tend = m_qv_tend_cc.array(mfi);
638  auto qc_tend = m_qc_tend_cc.array(mfi);
639  auto qi_tend = m_qi_tend_cc.array(mfi);
640  auto tke_tend = m_tke_tend_cc.array(mfi);
641  auto u_tend_cc = m_u_tend_cc.array(mfi);
642  auto v_tend_cc = m_v_tend_cc.array(mfi);
643  auto pblh_arr = m_pblh_cc.array(mfi);
644  auto consumed_sens_flux_arr = m_consumed_sens_flux_cc.array(mfi);
645  auto consumed_laten_flux_arr = m_consumed_laten_flux_cc.array(mfi);
646  auto shoc_ustar_arr = m_shoc_ustar_cc.array(mfi);
647  auto shoc_olen_arr = m_shoc_olen_cc.array(mfi);
648  auto shoc_cldfrac_arr = m_shoc_cldfrac_cc.array(mfi);
649  auto shoc_ql_arr = m_shoc_ql_cc.array(mfi);
650  auto shoc_ql2_arr = m_shoc_ql2_cc.array(mfi);
651  auto shoc_cond_arr = m_shoc_cond_cc.array(mfi);
652  auto w_sec_arr = m_w_sec_cc.array(mfi);
653  auto wqls_sec_arr = m_wqls_sec_cc.array(mfi);
654  auto wthv_sec_arr = m_wthv_sec_cc.array(mfi);
655  auto thl_sec_arr = m_thl_sec_cc.array(mfi);
656  auto qw_sec_arr = m_qw_sec_cc.array(mfi);
657  auto qwthl_sec_arr = m_qwthl_sec_cc.array(mfi);
658  auto wthl_sec_arr = m_wthl_sec_cc.array(mfi);
659  auto wqw_sec_arr = m_wqw_sec_cc.array(mfi);
660  auto w3_arr = m_w3_cc.array(mfi);
661  auto brunt_arr = m_brunt_cc.array(mfi);
662  auto isotropy_arr = m_isotropy_cc.array(mfi);
663  auto shear_prod_arr = m_shear_prod_cc.array(mfi);
664  auto buoy_prod_arr = m_buoy_prod_cc.array(mfi);
665  auto diss_tke_arr = m_diss_tke_cc.array(mfi);
666 
667  const auto shoc_mix = col.shoc_mix.const_array();
668  const auto pblh = col.pblh.const_array();
669  const auto surf_sens_flux = col.surf_sens_flux.const_array();
670  const auto surf_lat_flux = col.surf_lat_flux.const_array();
671  const auto ustar = col.ustar.const_array();
672  const auto obklen = col.obklen.const_array();
673  const auto shoc_cldfrac = col.shoc_cldfrac.const_array();
674  const auto shoc_ql = col.shoc_ql.const_array();
675  const auto shoc_ql2 = col.shoc_ql2.const_array();
676  const auto shoc_cond = col.shoc_cond.const_array();
677  const auto w_sec = col.w_sec.const_array();
678  const auto wqls_sec = col.wqls_sec.const_array();
679  const auto wthv_sec = col.wthv_sec.const_array();
680  const auto thl_sec = col.thl_sec.const_array();
681  const auto qw_sec = col.qw_sec.const_array();
682  const auto qwthl_sec = col.qwthl_sec.const_array();
683  const auto wthl_sec = col.wthl_sec.const_array();
684  const auto wqw_sec = col.wqw_sec.const_array();
685  const auto w3 = col.w3.const_array();
686  const auto brunt = col.brunt.const_array();
687  const auto isotropy = col.isotropy.const_array();
688  const auto shear_prod = col.shear_prod.const_array();
689  const auto buoy_prod = col.buoy_prod.const_array();
690  const auto diss_tke = col.diss_tke.const_array();
691  const auto tk = col.tk.const_array();
692  const auto tkh = col.tkh.const_array();
693  const auto rho = col.rho.const_array();
694  const auto zt = col.zt.const_array();
695  const auto zi = col.zi.const_array();
696  const auto col_theta_tend = col.theta_tend.const_array();
697  const auto col_qv_tend = col.qv_tend.const_array();
698  const auto col_qc_tend = col.qc_tend.const_array();
699  const auto col_qi_tend = col.qi_tend.const_array();
700  const auto col_tke_tend = col.tke_tend.const_array();
701  const auto col_u_tend = col.u_tend.const_array();
702  const auto col_v_tend = col.v_tend.const_array();
703  const auto layout = col.layout;
704  const Box xy_box = amrex::makeSlab(vbx, 2, layout.kmin);
705  {
706  BL_PROFILE("SHOC::advance::writeback");
707  ParallelFor(xy_box, [=] AMREX_GPU_DEVICE (int i, int j, int) noexcept
708  {
709  const int ic = shoc_column_index(layout, i, j);
710  const int k0 = layout.kmin;
711  const Real rho_sfc = rho(ic,0,0);
712  for (int kk = 0; kk < layout.nlev; ++kk) {
713  const int k = layout.kmin + kk;
714  const Real l = shoc_mix(ic,kk,0);
715  const Real km = tk(ic,kk,0);
716  const Real kh = tkh(ic,kk,0);
717 
718  tk_arr(i,j,k,EddyDiff::Mom_v) = rho(ic,kk,0) * km;
719  tk_arr(i,j,k,EddyDiff::Theta_v) = rho(ic,kk,0) * kh;
720  tk_arr(i,j,k,EddyDiff::KE_v) = rho(ic,kk,0) * kh;
721  tk_arr(i,j,k,EddyDiff::Scalar_v) = rho(ic,kk,0) * kh;
722  tk_arr(i,j,k,EddyDiff::Q_v) = rho(ic,kk,0) * kh;
723  tk_arr(i,j,k,EddyDiff::Turb_lengthscale) = l;
724 
725  th_tend(i,j,k) = col_theta_tend(ic,kk,0);
726  qv_tend(i,j,k) = col_qv_tend(ic,kk,0);
727  qc_tend(i,j,k) = col_qc_tend(ic,kk,0);
728  qi_tend(i,j,k) = col_qi_tend(ic,kk,0);
729  tke_tend(i,j,k) = col_tke_tend(ic,kk,0);
730  u_tend_cc(i,j,k) = col_u_tend(ic,kk,0);
731  v_tend_cc(i,j,k) = col_v_tend(ic,kk,0);
732  }
733  // Motivation: Native SHOC state_update consumes SurfaceLayer
734  // fluxes before the host diffusion path clears the overlapping
735  // SFS arrays. Preserve the consumed conservative fluxes here
736  // so 2D diagnostics report the surface forcing SHOC actually
737  // used, not the cleared host arrays.
738  consumed_sens_flux_arr(i,j,k0) = rho_sfc * surf_sens_flux(ic,0,0);
739  consumed_laten_flux_arr(i,j,k0) = rho_sfc * surf_lat_flux(ic,0,0);
740  shoc_ustar_arr(i,j,k0) = ustar(ic,0,0);
741  shoc_olen_arr(i,j,k0) = obklen(ic,0,0);
742  });
743 
744  // Keep diagnostic writeback in a separate launch so the kernel
745  // argument block fits CUDA's 4 KiB limit on pre-Volta devices.
746  ParallelFor(xy_box, [=] AMREX_GPU_DEVICE (int i, int j, int) noexcept
747  {
748  const int ic = shoc_column_index(layout, i, j);
749  for (int kk = 0; kk < layout.nlev; ++kk) {
750  const int k = layout.kmin + kk;
751  // Native SHOC pblh is diagnosed as meters AGL and is
752  // copied directly into the plotfile diagnostic field.
753  pblh_arr(i,j,k) = pblh(ic,0,0);
754  shoc_cldfrac_arr(i,j,k) = shoc_cldfrac(ic,kk,0);
755  shoc_ql_arr(i,j,k) = shoc_ql(ic,kk,0);
756  shoc_ql2_arr(i,j,k) = shoc_ql2(ic,kk,0);
757  shoc_cond_arr(i,j,k) = shoc_cond(ic,kk,0);
758  w_sec_arr(i,j,k) = w_sec(ic,kk,0);
759  wqls_sec_arr(i,j,k) = wqls_sec(ic,kk,0);
760  wthv_sec_arr(i,j,k) = wthv_sec(ic,kk,0);
761  brunt_arr(i,j,k) = brunt(ic,kk,0);
762  isotropy_arr(i,j,k) = isotropy(ic,kk,0);
763  thl_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
764  thl_sec(ic,kk,0), thl_sec(ic,kk+1,0),
765  zt(ic,kk,0));
766  qw_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
767  qw_sec(ic,kk,0), qw_sec(ic,kk+1,0),
768  zt(ic,kk,0));
769  qwthl_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
770  qwthl_sec(ic,kk,0), qwthl_sec(ic,kk+1,0),
771  zt(ic,kk,0));
772  wthl_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
773  wthl_sec(ic,kk,0), wthl_sec(ic,kk+1,0),
774  zt(ic,kk,0));
775  wqw_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
776  wqw_sec(ic,kk,0), wqw_sec(ic,kk+1,0),
777  zt(ic,kk,0));
778  w3_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
779  w3(ic,kk,0), w3(ic,kk+1,0),
780  zt(ic,kk,0));
781  shear_prod_arr(i,j,k) = shear_prod(ic,kk,0);
782  buoy_prod_arr(i,j,k) = buoy_prod(ic,kk,0);
783  diss_tke_arr(i,j,k) = diss_tke(ic,kk,0);
784  }
785  });
786  }
787 
788  }
789 
790  {
791  BL_PROFILE("SHOC::advance::tendency_interpolation");
792  m_u_tend_cc.FillBoundary(geom.periodicity());
793  m_v_tend_cc.FillBoundary(geom.periodicity());
794 
795  const auto dom = geom.Domain();
796  const int ilo = dom.smallEnd(0);
797  const int ihi = dom.bigEnd(0);
798  const int jlo = dom.smallEnd(1);
799  const int jhi = dom.bigEnd(1);
800  const bool xper = geom.isPeriodic(0);
801  const bool yper = geom.isPeriodic(1);
802 
803  for (MFIter mfi(m_u_tend_cc, false); mfi.isValid(); ++mfi) {
804  const Box& cc_bx = mfi.validbox();
805  const Box xface_bx = amrex::surroundingNodes(cc_bx, 0);
806  const Box yface_bx = amrex::surroundingNodes(cc_bx, 1);
807  const auto u_cc = m_u_tend_cc.const_array(mfi);
808  const auto v_cc = m_v_tend_cc.const_array(mfi);
809  auto u_fc = m_u_tend_fc.array(mfi);
810  auto v_fc = m_v_tend_fc.array(mfi);
811 
812  ParallelFor(xface_bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
813  {
814  const int il = face_neighbor_cell(i - 1, ilo, ihi, xper);
815  const int ir = face_neighbor_cell(i, ilo, ihi, xper);
816  u_fc(i,j,k) = 0.5_rt * (u_cc(il,j,k) + u_cc(ir,j,k));
817  });
818 
819  ParallelFor(yface_bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
820  {
821  const int jb = face_neighbor_cell(j - 1, jlo, jhi, yper);
822  const int jt = face_neighbor_cell(j, jlo, jhi, yper);
823  v_fc(i,j,k) = 0.5_rt * (v_cc(i,jb,k) + v_cc(i,jt,k));
824  });
825  }
826  }
827 
828  if (uses_state_update()) {
829  sync_face_multifab_impl(m_u_tend_fc, geom);
830  sync_face_multifab_impl(m_v_tend_fc, geom);
831  }
832 
833  if (uses_state_update()) {
834  BL_PROFILE("SHOC::advance::state_update");
836  }
837 
839  sync_face_multifab_impl(xvel, geom);
840  sync_face_multifab_impl(yvel, geom);
841  }
842 
843  m_prev_turb_valid = true;
844  ++m_advance_calls;
845  if (m_opts.debug_summary) {
846  BL_PROFILE("SHOC::advance::debug_summary");
848  }
849 }
@ tau23
Definition: ERF_DataStruct.H:39
@ tau13
Definition: ERF_DataStruct.H:39
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int shoc_column_index(const ShocColumnLayout &layout, int i, int j)
Definition: ERF_ShocColumnData.H:130
ShocColumnLayout make_shoc_layout(const amrex::Box &bx, const amrex::Geometry &geom)
Definition: ERF_ShocColumnData.H:11
bool shoc_driver_state_update_layout_supported(const ShocRuntimeOptions &opts, const MoistureComponentIndices &indices, int ncomp, std::string &error_message)
Definition: ERF_ShocDriver.H:45
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_ShocColumnData.H:103
ShocColumnData col
Definition: ERF_ShocColumnData.H:105
void ensure_capacity(const ShocColumnLayout &layout, amrex::Arena *arena=amrex::The_Async_Arena(), shoc::InitRunOn init_run_on=shoc::default_init_run_on())
Definition: ERF_ShocColumnData.H:107
static void diagnose_pre_implicit(ShocColumnData &col, const ShocRuntimeOptions &opts, amrex::Real dx, amrex::Real dy, double dt)
Definition: ERF_ShocDiagnostics.cpp:6
static void diagnose_post_implicit(ShocColumnData &col, const ShocRuntimeOptions &opts, double dt)
Definition: ERF_ShocDiagnostics.cpp:25
amrex::MultiFab m_shoc_ql_cc
Definition: ERF_ShocDriver.H:156
void print_debug_summary(double dt) const
Definition: ERF_ShocDriver.cpp:1557
bool m_prev_turb_valid
Definition: ERF_ShocDriver.H:182
void debug_check_bad_column(const ShocColumnData &col, const amrex::MFIter &mfi, const amrex::MultiFab &z_phys_nd, const amrex::MultiFab *hfx3, const amrex::MultiFab *qfx3, const amrex::MultiFab *tau13, const amrex::MultiFab *tau23, const amrex::Geometry &geom, double dt) const
Definition: ERF_ShocDriver.cpp:1023
amrex::MultiFab m_qw_sec_cc
Definition: ERF_ShocDriver.H:163
amrex::MultiFab m_diss_tke_cc
Definition: ERF_ShocDriver.H:172
amrex::MultiFab m_qwthl_sec_cc
Definition: ERF_ShocDriver.H:164
amrex::MultiFab * m_qfx3_ptr
Definition: ERF_ShocDriver.H:175
int m_advance_calls
Definition: ERF_ShocDriver.H:181
void apply_state_update(amrex::MultiFab &cons, amrex::MultiFab &xvel, amrex::MultiFab &yvel, double dt) const
Definition: ERF_ShocDriver.cpp:997
amrex::MultiFab m_pblh_cc
Definition: ERF_ShocDriver.H:152
amrex::MultiFab m_eddy_coeffs_cc
Definition: ERF_ShocDriver.H:147
const amrex::Geometry * m_geom_ptr
Definition: ERF_ShocDriver.H:180
amrex::MultiFab m_buoy_prod_cc
Definition: ERF_ShocDriver.H:171
amrex::MultiFab m_wthl_sec_cc
Definition: ERF_ShocDriver.H:165
amrex::MultiFab m_u_tend_fc
Definition: ERF_ShocDriver.H:145
amrex::MultiFab m_wqls_sec_cc
Definition: ERF_ShocDriver.H:160
amrex::MultiFab * m_tau13_ptr
Definition: ERF_ShocDriver.H:176
amrex::MultiFab m_v_tend_fc
Definition: ERF_ShocDriver.H:146
void seed_carried_buoyancy_flux(ShocColumnData &col, const amrex::MFIter &mfi) const
Definition: ERF_ShocDriver.cpp:494
amrex::MultiFab m_w3_cc
Definition: ERF_ShocDriver.H:167
amrex::MultiFab m_shoc_ustar_cc
Definition: ERF_ShocDriver.H:153
void seed_carried_turbulence(ShocColumnData &col, const amrex::MFIter &mfi, const amrex::MultiFab &cons, const amrex::MultiFab &eddy_diffs) const
Definition: ERF_ShocDriver.cpp:462
amrex::MultiFab m_theta_tend_cc
Definition: ERF_ShocDriver.H:138
amrex::MultiFab m_qc_tend_cc
Definition: ERF_ShocDriver.H:140
amrex::MultiFab m_wqw_sec_cc
Definition: ERF_ShocDriver.H:166
amrex::MultiFab m_shoc_olen_cc
Definition: ERF_ShocDriver.H:154
amrex::MultiFab m_consumed_laten_flux_cc
Definition: ERF_ShocDriver.H:151
amrex::MultiFab m_brunt_cc
Definition: ERF_ShocDriver.H:168
amrex::MultiFab m_wthv_sec_cc
Definition: ERF_ShocDriver.H:161
amrex::MultiFab m_shear_prod_cc
Definition: ERF_ShocDriver.H:170
amrex::MultiFab m_w_sec_cc
Definition: ERF_ShocDriver.H:159
void store_carried_buoyancy_flux(const ShocColumnData &col, const amrex::MFIter &mfi)
Definition: ERF_ShocDriver.cpp:510
void store_carried_turbulence(const ShocColumnData &col, const amrex::MFIter &mfi)
Definition: ERF_ShocDriver.cpp:481
bool uses_state_update() const
Definition: ERF_ShocDriver.cpp:949
void ensure_storage(const amrex::MultiFab &cons, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &eddy_diffs)
Definition: ERF_ShocDriver.cpp:365
bool uses_momentum_state_update() const
Definition: ERF_ShocDriver.cpp:955
amrex::MultiFab m_shoc_cldfrac_cc
Definition: ERF_ShocDriver.H:155
amrex::MultiFab m_tke_tend_cc
Definition: ERF_ShocDriver.H:142
amrex::MultiFab m_qi_tend_cc
Definition: ERF_ShocDriver.H:141
amrex::MultiFab m_thl_sec_cc
Definition: ERF_ShocDriver.H:162
amrex::MultiFab * m_tau23_ptr
Definition: ERF_ShocDriver.H:177
amrex::MultiFab * m_eddy_diffs_ptr
Definition: ERF_ShocDriver.H:178
amrex::MultiFab m_consumed_sens_flux_cc
Definition: ERF_ShocDriver.H:150
amrex::MultiFab m_isotropy_cc
Definition: ERF_ShocDriver.H:169
amrex::MultiFab m_u_tend_cc
Definition: ERF_ShocDriver.H:143
amrex::MultiFab m_v_tend_cc
Definition: ERF_ShocDriver.H:144
amrex::MultiFab m_shoc_ql2_cc
Definition: ERF_ShocDriver.H:157
amrex::MultiFab m_shoc_cond_cc
Definition: ERF_ShocDriver.H:158
amrex::MultiFab m_qv_tend_cc
Definition: ERF_ShocDriver.H:139
amrex::MultiFab * m_hfx3_ptr
Definition: ERF_ShocDriver.H:174
amrex::Vector< std::unique_ptr< ShocColumnWorkspace > > m_column_workspaces
Definition: ERF_ShocDriver.H:179
static void advance_implicit_state(ShocColumnData &col, const ShocRuntimeOptions &opts, double dt)
Definition: ERF_ShocImplicit.cpp:166
static void cache_baseline_state(ShocColumnData &col)
Definition: ERF_ShocImplicit.cpp:84
static void finalize_from_pdf(ShocColumnData &col, const ShocRuntimeOptions &opts, double dt)
Definition: ERF_ShocImplicit.cpp:322
static void fill_columns(ShocColumnData &col, const amrex::MFIter &mfi, const amrex::MultiFab &cons, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &zvel, const amrex::MultiFab *hfx3, const amrex::MultiFab *qfx3, const amrex::MultiFab *tau13, const amrex::MultiFab *tau23, const amrex::MultiFab &z_phys_nd, const amrex::Geometry &geom, const MoistureComponentIndices &moisture_indices)
Definition: ERF_ShocPreprocess.cpp:31
@ Theta_v
Definition: ERF_IndexDefines.H:250
@ Turb_lengthscale
Definition: ERF_IndexDefines.H:254
@ Scalar_v
Definition: ERF_IndexDefines.H:252
@ Q_v
Definition: ERF_IndexDefines.H:253
@ Mom_v
Definition: ERF_IndexDefines.H:249
@ KE_v
Definition: ERF_IndexDefines.H:251
@ rho
Definition: ERF_Kessler.H:24
@ xvel
Definition: ERF_IndexDefines.H:215
@ cons
Definition: ERF_IndexDefines.H:214
@ zvel
Definition: ERF_IndexDefines.H:217
@ yvel
Definition: ERF_IndexDefines.H:216
@ tk
Definition: ERF_AdvanceWDM6.cpp:270
@ zi
Definition: ERF_AdvanceWDM6.cpp:274
InitRunOn default_init_run_on()
Definition: ERF_ShocGpuUtils.H:27
Definition: ERF_ShocTypes.H:85
amrex::FArrayBox qc_tend
Definition: ERF_ShocTypes.H:152
amrex::FArrayBox v_tend
Definition: ERF_ShocTypes.H:155
amrex::FArrayBox shoc_cond
Definition: ERF_ShocTypes.H:127
amrex::FArrayBox buoy_prod
Definition: ERF_ShocTypes.H:120
amrex::FArrayBox diss_tke
Definition: ERF_ShocTypes.H:121
amrex::FArrayBox w_sec
Definition: ERF_ShocTypes.H:139
amrex::FArrayBox tk
Definition: ERF_ShocTypes.H:117
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:138
amrex::FArrayBox surf_lat_flux
Definition: ERF_ShocTypes.H:158
amrex::FArrayBox ustar
Definition: ERF_ShocTypes.H:113
amrex::FArrayBox shoc_mix
Definition: ERF_ShocTypes.H:114
amrex::FArrayBox wthv_sec
Definition: ERF_ShocTypes.H:122
amrex::FArrayBox shear_prod
Definition: ERF_ShocTypes.H:119
amrex::FArrayBox rho
Definition: ERF_ShocTypes.H:94
amrex::FArrayBox wqw_sec
Definition: ERF_ShocTypes.H:134
amrex::FArrayBox shoc_ql
Definition: ERF_ShocTypes.H:124
amrex::FArrayBox pblh
Definition: ERF_ShocTypes.H:111
amrex::FArrayBox isotropy
Definition: ERF_ShocTypes.H:116
amrex::FArrayBox qw_sec
Definition: ERF_ShocTypes.H:131
amrex::FArrayBox tkh
Definition: ERF_ShocTypes.H:118
amrex::FArrayBox tke_tend
Definition: ERF_ShocTypes.H:156
amrex::FArrayBox qi_tend
Definition: ERF_ShocTypes.H:153
amrex::FArrayBox u_tend
Definition: ERF_ShocTypes.H:154
ShocColumnLayout layout
Definition: ERF_ShocTypes.H:86
amrex::FArrayBox zi
Definition: ERF_ShocTypes.H:90
amrex::FArrayBox surf_sens_flux
Definition: ERF_ShocTypes.H:157
amrex::FArrayBox zt
Definition: ERF_ShocTypes.H:89
amrex::FArrayBox theta_tend
Definition: ERF_ShocTypes.H:150
amrex::FArrayBox obklen
Definition: ERF_ShocTypes.H:112
amrex::FArrayBox wqls_sec
Definition: ERF_ShocTypes.H:126
amrex::FArrayBox qv_tend
Definition: ERF_ShocTypes.H:151
amrex::FArrayBox wthl_sec
Definition: ERF_ShocTypes.H:133
amrex::FArrayBox thl_sec
Definition: ERF_ShocTypes.H:130
amrex::FArrayBox shoc_ql2
Definition: ERF_ShocTypes.H:125
amrex::FArrayBox qwthl_sec
Definition: ERF_ShocTypes.H:132
amrex::FArrayBox brunt
Definition: ERF_ShocTypes.H:115
amrex::FArrayBox shoc_cldfrac
Definition: ERF_ShocTypes.H:123
Definition: ERF_ShocTypes.H:73
bool debug_summary
Definition: ERF_ShocTypes.H:40
Here is the call graph for this function:

◆ apply_state_update()

void ShocDriver::apply_state_update ( amrex::MultiFab &  cons,
amrex::MultiFab &  xvel,
amrex::MultiFab &  yvel,
double  dt 
) const
private
1001 {
1002  AMREX_ALWAYS_ASSERT(dt > 0.0);
1003 
1004  apply_state_update_cons_impl(cons,
1006  m_qv_tend_cc,
1007  m_qc_tend_cc,
1008  m_qi_tend_cc,
1009  m_tke_tend_cc,
1013  m_opts,
1014  dt);
1015 
1017  apply_state_update_face_velocity_impl(xvel, m_u_tend_fc, dt);
1018  apply_state_update_face_velocity_impl(yvel, m_v_tend_fc, dt);
1019  }
1020 }
int qi
cloud ice
Definition: ERF_DataStruct.H:208
int qv
water vapor
Definition: ERF_DataStruct.H:206
int qc
cloud liquid water
Definition: ERF_DataStruct.H:207

Referenced by advance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ brunt_diagnostics()

const amrex::MultiFab& ShocDriver::brunt_diagnostics ( ) const
inline
126 { return m_brunt_cc; }

◆ buoy_prod_diagnostics()

const amrex::MultiFab& ShocDriver::buoy_prod_diagnostics ( ) const
inline
129 { return m_buoy_prod_cc; }

◆ consumed_laten_flux_diagnostics()

const amrex::MultiFab& ShocDriver::consumed_laten_flux_diagnostics ( ) const
inline
108  {
110  }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ consumed_sens_flux_diagnostics()

const amrex::MultiFab& ShocDriver::consumed_sens_flux_diagnostics ( ) const
inline
104  {
106  }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ debug_check_bad_column()

void ShocDriver::debug_check_bad_column ( const ShocColumnData col,
const amrex::MFIter &  mfi,
const amrex::MultiFab &  z_phys_nd,
const amrex::MultiFab *  hfx3,
const amrex::MultiFab *  qfx3,
const amrex::MultiFab *  tau13,
const amrex::MultiFab *  tau23,
const amrex::Geometry &  geom,
double  dt 
) const
private
1032 {
1033  amrex::ignore_unused(geom, dt_d);
1034 
1035  if (!m_opts.debug_bad_column) {
1036  return;
1037  }
1038 
1039  AMREX_ALWAYS_ASSERT(m_cons_ptr != nullptr);
1040  print_shoc_debug_settings_once(m_opts);
1041 
1042  const auto cons_host = copy_fab_to_host((*m_cons_ptr)[mfi]);
1043  const auto z_host = copy_fab_to_host(z_phys_nd[mfi]);
1044  const auto theta_tend_host = copy_fab_to_host(col.theta_tend);
1045  const auto qv_tend_host = copy_fab_to_host(col.qv_tend);
1046  const auto qc_tend_host = copy_fab_to_host(col.qc_tend);
1047  const auto qi_tend_host = copy_fab_to_host(col.qi_tend);
1048  const auto tke_tend_host = copy_fab_to_host(col.tke_tend);
1049  const auto u_tend_host = copy_fab_to_host(col.u_tend);
1050  const auto v_tend_host = copy_fab_to_host(col.v_tend);
1051  const auto p_mid_host = copy_fab_to_host(col.p_mid);
1052  const auto p_int_host = copy_fab_to_host(col.p_int);
1053  const auto zt_host = copy_fab_to_host(col.zt);
1054  const auto zi_host = copy_fab_to_host(col.zi);
1055  const auto dz_host = copy_fab_to_host(col.dz);
1056  const auto rho_host = copy_fab_to_host(col.rho);
1057  const auto theta_host = copy_fab_to_host(col.theta);
1058  const auto thetal_host = copy_fab_to_host(col.thetal);
1059  const auto theta_base_host = copy_fab_to_host(col.theta_base);
1060  const auto thetal_base_host = copy_fab_to_host(col.thetal_base);
1061  const auto qv_base_host = copy_fab_to_host(col.qv_base);
1062  const auto qc_base_host = copy_fab_to_host(col.qc_base);
1063  const auto qi_base_host = copy_fab_to_host(col.qi_base);
1064  const auto tke_base_host = copy_fab_to_host(col.tke_base_state);
1065  const auto theta_v_host = copy_fab_to_host(col.theta_v);
1066  const auto qv_host = copy_fab_to_host(col.qv);
1067  const auto qc_host = copy_fab_to_host(col.qc);
1068  const auto qi_host = copy_fab_to_host(col.qi);
1069  const auto qw_host = copy_fab_to_host(col.qw);
1070  const auto tabs_host = copy_fab_to_host(col.tabs);
1071  const auto exner_host = copy_fab_to_host(col.exner);
1072  const auto host_dse_host = copy_fab_to_host(col.host_dse);
1073  const auto pblh_host = copy_fab_to_host(col.pblh);
1074  const auto obklen_host = copy_fab_to_host(col.obklen);
1075  const auto ustar_host = copy_fab_to_host(col.ustar);
1076  const auto shoc_mix_host = copy_fab_to_host(col.shoc_mix);
1077  const auto brunt_host = copy_fab_to_host(col.brunt);
1078  const auto isotropy_host = copy_fab_to_host(col.isotropy);
1079  const auto tk_host = copy_fab_to_host(col.tk);
1080  const auto tkh_host = copy_fab_to_host(col.tkh);
1081  const auto shear_prod_host = copy_fab_to_host(col.shear_prod);
1082  const auto buoy_prod_host = copy_fab_to_host(col.buoy_prod);
1083  const auto diss_tke_host = copy_fab_to_host(col.diss_tke);
1084  const auto tke_host = copy_fab_to_host(col.tke);
1085  const auto w_sec_host = copy_fab_to_host(col.w_sec);
1086  const auto wthv_sec_host = copy_fab_to_host(col.wthv_sec);
1087  const auto shoc_cldfrac_host = copy_fab_to_host(col.shoc_cldfrac);
1088  const auto shoc_ql_host = copy_fab_to_host(col.shoc_ql);
1089  const auto shoc_ql2_host = copy_fab_to_host(col.shoc_ql2);
1090  const auto shoc_cond_host = copy_fab_to_host(col.shoc_cond);
1091  const auto shoc_evap_host = copy_fab_to_host(col.shoc_evap);
1092  const auto wqls_sec_host = copy_fab_to_host(col.wqls_sec);
1093  const auto thl_sec_host = copy_fab_to_host(col.thl_sec);
1094  const auto qw_sec_host = copy_fab_to_host(col.qw_sec);
1095  const auto qwthl_sec_host = copy_fab_to_host(col.qwthl_sec);
1096  const auto wthl_sec_host = copy_fab_to_host(col.wthl_sec);
1097  const auto wqw_sec_host = copy_fab_to_host(col.wqw_sec);
1098  const auto uw_sec_host = copy_fab_to_host(col.uw_sec);
1099  const auto vw_sec_host = copy_fab_to_host(col.vw_sec);
1100  const auto wtke_sec_host = copy_fab_to_host(col.wtke_sec);
1101  const auto w3_host = copy_fab_to_host(col.w3);
1102  const auto surf_sens_flux_host = copy_fab_to_host(col.surf_sens_flux);
1103  const auto surf_lat_flux_host = copy_fab_to_host(col.surf_lat_flux);
1104  const auto surf_tau_u_host = copy_fab_to_host(col.surf_tau_u);
1105  const auto surf_tau_v_host = copy_fab_to_host(col.surf_tau_v);
1106  const auto hfx3_host = hfx3 ? copy_fab_to_host((*hfx3)[mfi]) : FArrayBox();
1107  const auto qfx3_host = qfx3 ? copy_fab_to_host((*qfx3)[mfi]) : FArrayBox();
1108  const auto tau13_host = tau13 ? copy_fab_to_host((*tau13)[mfi]) : FArrayBox();
1109  const auto tau23_host = tau23 ? copy_fab_to_host((*tau23)[mfi]) : FArrayBox();
1110 
1111  const auto z_arr = z_host.const_array();
1112  const auto cons_arr = cons_host.const_array();
1113  const auto theta_tend_arr = theta_tend_host.const_array();
1114  const auto qv_tend_arr = qv_tend_host.const_array();
1115  const auto qc_tend_arr = qc_tend_host.const_array();
1116  const auto qi_tend_arr = qi_tend_host.const_array();
1117  const auto tke_tend_arr = tke_tend_host.const_array();
1118  const auto u_tend_arr = u_tend_host.const_array();
1119  const auto v_tend_arr = v_tend_host.const_array();
1120  const auto dz_arr = dz_host.const_array();
1121 
1122  std::vector<ShocBadColumnReport> reports;
1123  reports.reserve(static_cast<std::size_t>(col.layout.ncell * col.layout.nlev));
1124 
1125  auto maybe_add = [&] (int i, int j, int k, int kk, int ic,
1126  const char* name, Real value, Real threshold) {
1127  if (!std::isfinite(value)) {
1128  reports.push_back(ShocBadColumnReport{
1129  std::numeric_limits<Real>::infinity(),
1130  std::string(name) + " nonfinite",
1131  mfi.index(), i, j, k, kk, ic
1132  });
1133  return;
1134  }
1135  const Real abs_value = amrex::Math::abs(value);
1136  const Real ratio = abs_value / threshold;
1137  if (ratio > 1.0_rt) {
1138  std::ostringstream oss;
1139  oss << name << " |value|=" << abs_value << " threshold=" << threshold;
1140  reports.push_back(ShocBadColumnReport{ratio, oss.str(), mfi.index(), i, j, k, kk, ic});
1141  }
1142  };
1143 
1144  auto maybe_add_geom = [&] (int i, int j, int k, int kk, int ic, Real dz_val) {
1145  if (!std::isfinite(dz_val)) {
1146  reports.push_back(ShocBadColumnReport{
1147  std::numeric_limits<Real>::infinity(),
1148  "dz nonfinite",
1149  mfi.index(), i, j, k, kk, ic
1150  });
1151  } else if (dz_val <= 0.0_rt) {
1152  reports.push_back(ShocBadColumnReport{
1153  std::numeric_limits<Real>::infinity(),
1154  "dz <= 0",
1155  mfi.index(), i, j, k, kk, ic
1156  });
1157  } else if (dz_val < m_opts.debug_bad_column_min_dz) {
1158  std::ostringstream oss;
1159  oss << "dz below minimum |dz|=" << dz_val
1160  << " min_dz=" << m_opts.debug_bad_column_min_dz;
1161  reports.push_back(ShocBadColumnReport{
1163  oss.str(),
1164  mfi.index(), i, j, k, kk, ic
1165  });
1166  }
1167  };
1168 
1169  for (int j = col.layout.jmin; j < col.layout.jmin + col.layout.ny; ++j) {
1170  for (int i = col.layout.imin; i < col.layout.imin + col.layout.nx; ++i) {
1171  const int ic = shoc_column_index(col.layout, i, j);
1172  for (int kk = 0; kk < col.layout.nlev; ++kk) {
1173  const int k = col.layout.kmin + kk;
1174  const Real dz_val = dz_arr(ic, kk, 0);
1175  maybe_add_geom(i, j, k, kk, ic, dz_val);
1176 
1177  maybe_add(i, j, k, kk, ic, "theta_tend", theta_tend_arr(ic, kk, 0), m_opts.debug_bad_column_theta_tend_threshold);
1178  maybe_add(i, j, k, kk, ic, "qv_tend", qv_tend_arr(ic, kk, 0), m_opts.debug_bad_column_q_tend_threshold);
1179  maybe_add(i, j, k, kk, ic, "qc_tend", qc_tend_arr(ic, kk, 0), m_opts.debug_bad_column_q_tend_threshold);
1180  maybe_add(i, j, k, kk, ic, "qi_tend", qi_tend_arr(ic, kk, 0), m_opts.debug_bad_column_q_tend_threshold);
1181  maybe_add(i, j, k, kk, ic, "brunt", brunt_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_brunt_threshold);
1182  maybe_add(i, j, k, kk, ic, "thl_sec", thl_sec_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_scalar_moment_threshold);
1183  maybe_add(i, j, k, kk, ic, "qw_sec", qw_sec_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_scalar_moment_threshold);
1184  maybe_add(i, j, k, kk, ic, "qwthl_sec", qwthl_sec_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_scalar_moment_threshold);
1185  maybe_add(i, j, k, kk, ic, "wthl_sec", wthl_sec_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_scalar_moment_threshold);
1186  maybe_add(i, j, k, kk, ic, "wqw_sec", wqw_sec_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_scalar_moment_threshold);
1187 
1188  // Treat NaN/Inf in the key state and diagnostic fields as bad.
1189  const Real key_values[] = {
1190  rho_host.const_array()(ic, kk, 0),
1191  theta_host.const_array()(ic, kk, 0),
1192  thetal_host.const_array()(ic, kk, 0),
1193  theta_v_host.const_array()(ic, kk, 0),
1194  qv_host.const_array()(ic, kk, 0),
1195  qc_host.const_array()(ic, kk, 0),
1196  qi_host.const_array()(ic, kk, 0),
1197  qw_host.const_array()(ic, kk, 0),
1198  tabs_host.const_array()(ic, kk, 0),
1199  exner_host.const_array()(ic, kk, 0),
1200  p_mid_host.const_array()(ic, kk, 0),
1201  host_dse_host.const_array()(ic, kk, 0),
1202  pblh_host.const_array()(ic, 0, 0),
1203  obklen_host.const_array()(ic, 0, 0),
1204  ustar_host.const_array()(ic, 0, 0),
1205  shoc_mix_host.const_array()(ic, kk, 0),
1206  isotropy_host.const_array()(ic, kk, 0),
1207  tk_host.const_array()(ic, kk, 0),
1208  tkh_host.const_array()(ic, kk, 0),
1209  shear_prod_host.const_array()(ic, kk, 0),
1210  buoy_prod_host.const_array()(ic, kk, 0),
1211  diss_tke_host.const_array()(ic, kk, 0),
1212  w_sec_host.const_array()(ic, kk, 0),
1213  wthv_sec_host.const_array()(ic, kk, 0),
1214  shoc_cldfrac_host.const_array()(ic, kk, 0),
1215  shoc_ql_host.const_array()(ic, kk, 0),
1216  shoc_ql2_host.const_array()(ic, kk, 0),
1217  shoc_cond_host.const_array()(ic, kk, 0),
1218  shoc_evap_host.const_array()(ic, kk, 0),
1219  wqls_sec_host.const_array()(ic, kk, 0),
1220  thl_sec_host.const_array()(ic, kk, 0),
1221  qw_sec_host.const_array()(ic, kk, 0),
1222  qwthl_sec_host.const_array()(ic, kk, 0),
1223  wthl_sec_host.const_array()(ic, kk, 0),
1224  wqw_sec_host.const_array()(ic, kk, 0),
1225  uw_sec_host.const_array()(ic, kk, 0),
1226  vw_sec_host.const_array()(ic, kk, 0),
1227  wtke_sec_host.const_array()(ic, kk, 0),
1228  w3_host.const_array()(ic, kk, 0),
1229  theta_tend_arr(ic, kk, 0),
1230  qv_tend_arr(ic, kk, 0),
1231  qc_tend_arr(ic, kk, 0),
1232  qi_tend_arr(ic, kk, 0),
1233  tke_tend_arr(ic, kk, 0),
1234  u_tend_arr(ic, kk, 0),
1235  v_tend_arr(ic, kk, 0)
1236  };
1237  for (Real value : key_values) {
1238  if (!std::isfinite(value)) {
1239  reports.push_back(ShocBadColumnReport{
1240  std::numeric_limits<Real>::infinity(),
1241  "key field nonfinite",
1242  mfi.index(), i, j, k, kk, ic
1243  });
1244  break;
1245  }
1246  }
1247  }
1248  }
1249  }
1250 
1251  if (reports.empty()) {
1252  return;
1253  }
1254 
1255  std::stable_sort(reports.begin(), reports.end(),
1256  [] (const ShocBadColumnReport& a, const ShocBadColumnReport& b) {
1257  return a.score > b.score;
1258  });
1259 
1260  const int max_reports = std::min(m_opts.debug_bad_column_max_reports,
1261  static_cast<int>(reports.size()));
1262 
1263  const auto rho_arr = rho_host.const_array();
1264  const auto theta_arr = theta_host.const_array();
1265  const auto thetal_arr = thetal_host.const_array();
1266  const auto theta_base_arr = theta_base_host.const_array();
1267  const auto thetal_base_arr = thetal_base_host.const_array();
1268  const auto qv_base_arr = qv_base_host.const_array();
1269  const auto qc_base_arr = qc_base_host.const_array();
1270  const auto qi_base_arr = qi_base_host.const_array();
1271  const auto theta_v_arr = theta_v_host.const_array();
1272  const auto qv_arr = qv_host.const_array();
1273  const auto qc_arr = qc_host.const_array();
1274  const auto qi_arr = qi_host.const_array();
1275  const auto qw_arr = qw_host.const_array();
1276  const auto tabs_arr = tabs_host.const_array();
1277  const auto exner_arr = exner_host.const_array();
1278  const auto p_mid_arr = p_mid_host.const_array();
1279  const auto p_int_arr = p_int_host.const_array();
1280  const auto host_dse_arr = host_dse_host.const_array();
1281  const auto pblh_arr = pblh_host.const_array();
1282  const auto obklen_arr = obklen_host.const_array();
1283  const auto ustar_arr = ustar_host.const_array();
1284  const auto shoc_mix_arr = shoc_mix_host.const_array();
1285  const auto brunt_arr = brunt_host.const_array();
1286  const auto isotropy_arr = isotropy_host.const_array();
1287  const auto tk_arr = tk_host.const_array();
1288  const auto tkh_arr = tkh_host.const_array();
1289  const auto shear_prod_arr = shear_prod_host.const_array();
1290  const auto buoy_prod_arr = buoy_prod_host.const_array();
1291  const auto diss_tke_arr = diss_tke_host.const_array();
1292  const auto tke_state_arr = tke_host.const_array();
1293  const auto tke_base_arr = tke_base_host.const_array();
1294  const auto w_sec_arr = w_sec_host.const_array();
1295  const auto wthv_sec_arr = wthv_sec_host.const_array();
1296  const auto shoc_cldfrac_arr = shoc_cldfrac_host.const_array();
1297  const auto shoc_ql_arr = shoc_ql_host.const_array();
1298  const auto shoc_ql2_arr = shoc_ql2_host.const_array();
1299  const auto shoc_cond_arr = shoc_cond_host.const_array();
1300  const auto shoc_evap_arr = shoc_evap_host.const_array();
1301  const auto wqls_sec_arr = wqls_sec_host.const_array();
1302  const auto thl_sec_arr = thl_sec_host.const_array();
1303  const auto qw_sec_arr = qw_sec_host.const_array();
1304  const auto qwthl_sec_arr = qwthl_sec_host.const_array();
1305  const auto wthl_sec_arr = wthl_sec_host.const_array();
1306  const auto wqw_sec_arr = wqw_sec_host.const_array();
1307  const auto uw_sec_arr = uw_sec_host.const_array();
1308  const auto vw_sec_arr = vw_sec_host.const_array();
1309  const auto wtke_sec_arr = wtke_sec_host.const_array();
1310  const auto w3_arr = w3_host.const_array();
1311  const auto surf_sens_flux_arr = surf_sens_flux_host.const_array();
1312  const auto surf_lat_flux_arr = surf_lat_flux_host.const_array();
1313  const auto surf_tau_u_arr = surf_tau_u_host.const_array();
1314  const auto surf_tau_v_arr = surf_tau_v_host.const_array();
1315  const bool has_hfx3 = hfx3 && hfx3_host.box().ok();
1316  const bool has_qfx3 = qfx3 && qfx3_host.box().ok();
1317  const bool has_tau13 = tau13 && tau13_host.box().ok();
1318  const bool has_tau23 = tau23 && tau23_host.box().ok();
1319 
1320  for (int n = 0; n < max_reports; ++n) {
1321  const auto& rep = reports[static_cast<std::size_t>(n)];
1322  const int i = rep.i;
1323  const int j = rep.j;
1324  const int k = rep.k;
1325  const int kk = rep.kk;
1326  const int ic = rep.ic;
1327 
1328  const auto node_value = [&] (int iii, int jjj, int kkk) -> Real {
1329  const IntVect iv(iii, jjj, kkk);
1330  return z_host.box().contains(iv) ? z_arr(iii, jjj, kkk) : std::numeric_limits<Real>::quiet_NaN();
1331  };
1332 
1333  const Real z_nd_ijk = node_value(i, j, k);
1334  const Real z_nd_ip1jk = node_value(i + 1, j, k);
1335  const Real z_nd_ijp1k = node_value(i, j + 1, k);
1336  const Real z_nd_ip1jp1k = node_value(i + 1, j + 1, k);
1337  const Real z_nd_ijkp1 = node_value(i, j, k + 1);
1338  const Real z_nd_ip1jkp1 = node_value(i + 1, j, k + 1);
1339  const Real z_nd_ijp1kp1 = node_value(i, j + 1, k + 1);
1340  const Real z_nd_ip1jp1kp1 = node_value(i + 1, j + 1, k + 1);
1341  const Real four_node_zlo = 0.25_rt * (z_nd_ijk + z_nd_ip1jk + z_nd_ijp1k + z_nd_ip1jp1k);
1342  const Real four_node_zhi = 0.25_rt * (z_nd_ijkp1 + z_nd_ip1jkp1 + z_nd_ijp1kp1 + z_nd_ip1jp1kp1);
1343  const Real four_node_dz = four_node_zhi - four_node_zlo;
1344  const Real corner_dz = z_nd_ijkp1 - z_nd_ijk;
1345  const Real theta_base_val = theta_base_arr(ic, kk, 0);
1346  const Real theta_new_val = theta_arr(ic, kk, 0);
1347  const Real thetal_base_val = thetal_base_arr(ic, kk, 0);
1348  const Real thetal_new_val = thetal_arr(ic, kk, 0);
1349  const Real qv_base_val = qv_base_arr(ic, kk, 0);
1350  const Real qc_base_val = qc_base_arr(ic, kk, 0);
1351  const Real qi_base_val = qi_base_arr(ic, kk, 0);
1352  const Real qv_new_val = qv_arr(ic, kk, 0);
1353  const Real qc_new_val = qc_arr(ic, kk, 0);
1354  const Real qi_new_val = qi_arr(ic, kk, 0);
1355  const Real ql_base = qc_base_val + qi_base_val;
1356  const Real ql_new = qc_new_val + qi_new_val;
1357  const Real qw_base = qv_base_val + qc_base_val + qi_base_val;
1358  const Real qw_new = qv_new_val + qc_new_val + qi_new_val;
1359  const Real delta_theta = theta_new_val - theta_base_val;
1360  const Real delta_qv = qv_new_val - qv_base_val;
1361  const Real delta_qc = qc_new_val - qc_base_val;
1362  const Real delta_qi = qi_new_val - qi_base_val;
1363  const Real delta_ql = ql_new - ql_base;
1364  const Real delta_qw = qw_new - qw_base;
1365 
1366  const Real dt = static_cast<Real>(dt_d);
1367 
1368  const Real dt_theta_tend = theta_tend_arr(ic, kk, 0) * dt;
1369  const Real dt_qv_tend = qv_tend_arr(ic, kk, 0) * dt;
1370  const Real dt_qc_tend = qc_tend_arr(ic, kk, 0) * dt;
1371  const Real dt_qi_tend = qi_tend_arr(ic, kk, 0) * dt;
1372  const Real dt_tke_tend = tke_tend_arr(ic, kk, 0) * dt;
1373  const Real cond_dt = shoc_cond_arr(ic, kk, 0) * dt;
1374  const Real evap_dt = shoc_evap_arr(ic, kk, 0) * dt;
1375  const Real tke_base_val = tke_base_arr(ic, kk, 0);
1376  std::ostringstream msg;
1377  msg << "NATIVE_SHOC_BAD_COLUMN_BEGIN\n"
1378  << " rank=" << ParallelDescriptor::MyProc()
1379  << " level=" << m_lev
1380  << " shoc_call=" << (m_advance_calls + 1)
1381  << " mfi_index=" << rep.mfi_index
1382  << " box_valid_lo=(" << mfi.validbox().smallEnd(0) << ","
1383  << mfi.validbox().smallEnd(1) << ","
1384  << mfi.validbox().smallEnd(2) << ")"
1385  << " box_valid_hi=(" << mfi.validbox().bigEnd(0) << ","
1386  << mfi.validbox().bigEnd(1) << ","
1387  << mfi.validbox().bigEnd(2) << ")"
1388  << " layout.nx=" << col.layout.nx
1389  << " layout.ny=" << col.layout.ny
1390  << " layout.ncell=" << col.layout.ncell
1391  << " layout.nlev=" << col.layout.nlev
1392  << " layout.imin=" << col.layout.imin
1393  << " layout.jmin=" << col.layout.jmin
1394  << " layout.kmin=" << col.layout.kmin
1395  << " layout.kmax=" << col.layout.kmax
1396  << "\n"
1397  << " i=" << i << " j=" << j << " k=" << k
1398  << " kk=" << kk << " ic=" << ic
1399  << " score=" << rep.score
1400  << " reason=" << rep.reason
1401  << "\n"
1402  << " geometry z_nd(i,j,k)=" << z_nd_ijk
1403  << " z_nd(i+1,j,k)=" << z_nd_ip1jk
1404  << " z_nd(i,j+1,k)=" << z_nd_ijp1k
1405  << " z_nd(i+1,j+1,k)=" << z_nd_ip1jp1k
1406  << " z_nd(i,j,k+1)=" << z_nd_ijkp1
1407  << " z_nd(i+1,j,k+1)=" << z_nd_ip1jkp1
1408  << " z_nd(i,j+1,k+1)=" << z_nd_ijp1kp1
1409  << " z_nd(i+1,j+1,k+1)=" << z_nd_ip1jp1kp1
1410  << "\n"
1411  << " four_node_zlo=" << four_node_zlo
1412  << " four_node_zhi=" << four_node_zhi
1413  << " four_node_dz=" << four_node_dz
1414  << " corner_dz=" << corner_dz
1415  << " dz=" << dz_arr(ic, kk, 0)
1416  << "\n"
1417  << " rho=" << rho_arr(ic, kk, 0)
1418  << " theta=" << theta_arr(ic, kk, 0)
1419  << " thetal=" << thetal_arr(ic, kk, 0)
1420  << " theta_v=" << theta_v_arr(ic, kk, 0)
1421  << " qv=" << qv_arr(ic, kk, 0)
1422  << " qc=" << qc_arr(ic, kk, 0)
1423  << " qi=" << qi_arr(ic, kk, 0)
1424  << " qw=" << qw_arr(ic, kk, 0)
1425  << " tabs=" << tabs_arr(ic, kk, 0)
1426  << " exner=" << exner_arr(ic, kk, 0)
1427  << " p_mid=" << p_mid_arr(ic, kk, 0)
1428  << " p_int_lower=" << p_int_arr(ic, kk, 0)
1429  << " p_int_upper=" << p_int_arr(ic, kk + 1, 0)
1430  << " host_dse=" << host_dse_arr(ic, kk, 0)
1431  << "\n"
1432  << " pblh=" << pblh_arr(ic, 0, 0)
1433  << " obklen=" << obklen_arr(ic, 0, 0)
1434  << " ustar=" << ustar_arr(ic, 0, 0)
1435  << " shoc_mix=" << shoc_mix_arr(ic, kk, 0)
1436  << " Lturb=" << shoc_mix_arr(ic, kk, 0)
1437  << " brunt=" << brunt_arr(ic, kk, 0)
1438  << " isotropy=" << isotropy_arr(ic, kk, 0)
1439  << " tk=" << tk_arr(ic, kk, 0)
1440  << " tkh=" << tkh_arr(ic, kk, 0)
1441  << " shear_prod=" << shear_prod_arr(ic, kk, 0)
1442  << " buoy_prod=" << buoy_prod_arr(ic, kk, 0)
1443  << " diss_tke=" << diss_tke_arr(ic, kk, 0)
1444  << " tke=" << tke_state_arr(ic, kk, 0)
1445  << "\n"
1446  << " w_sec=" << w_sec_arr(ic, kk, 0)
1447  << " wthv_sec=" << wthv_sec_arr(ic, kk, 0)
1448  << " shoc_cldfrac=" << shoc_cldfrac_arr(ic, kk, 0)
1449  << " shoc_ql=" << shoc_ql_arr(ic, kk, 0)
1450  << " shoc_ql2=" << shoc_ql2_arr(ic, kk, 0)
1451  << " shoc_cond=" << shoc_cond_arr(ic, kk, 0)
1452  << " shoc_evap=" << shoc_evap_arr(ic, kk, 0)
1453  << " wqls_sec=" << wqls_sec_arr(ic, kk, 0)
1454  << "\n"
1455  << " thl_sec_lower=" << thl_sec_arr(ic, kk, 0)
1456  << " thl_sec_upper=" << thl_sec_arr(ic, kk + 1, 0)
1457  << " qw_sec_lower=" << qw_sec_arr(ic, kk, 0)
1458  << " qw_sec_upper=" << qw_sec_arr(ic, kk + 1, 0)
1459  << " qwthl_sec_lower=" << qwthl_sec_arr(ic, kk, 0)
1460  << " qwthl_sec_upper=" << qwthl_sec_arr(ic, kk + 1, 0)
1461  << " wthl_sec_lower=" << wthl_sec_arr(ic, kk, 0)
1462  << " wthl_sec_upper=" << wthl_sec_arr(ic, kk + 1, 0)
1463  << " wqw_sec_lower=" << wqw_sec_arr(ic, kk, 0)
1464  << " wqw_sec_upper=" << wqw_sec_arr(ic, kk + 1, 0)
1465  << " w3_lower=" << w3_arr(ic, kk, 0)
1466  << " w3_upper=" << w3_arr(ic, kk + 1, 0)
1467  << " uw_sec_lower=" << uw_sec_arr(ic, kk, 0)
1468  << " uw_sec_upper=" << uw_sec_arr(ic, kk + 1, 0)
1469  << " vw_sec_lower=" << vw_sec_arr(ic, kk, 0)
1470  << " vw_sec_upper=" << vw_sec_arr(ic, kk + 1, 0)
1471  << " wtke_sec_lower=" << wtke_sec_arr(ic, kk, 0)
1472  << " wtke_sec_upper=" << wtke_sec_arr(ic, kk + 1, 0)
1473  << "\n"
1474  << " theta_tend=" << theta_tend_arr(ic, kk, 0)
1475  << " qv_tend=" << qv_tend_arr(ic, kk, 0)
1476  << " qc_tend=" << qc_tend_arr(ic, kk, 0)
1477  << " qi_tend=" << qi_tend_arr(ic, kk, 0)
1478  << " tke_tend=" << tke_tend_arr(ic, kk, 0)
1479  << " u_tend=" << u_tend_arr(ic, kk, 0)
1480  << " v_tend=" << v_tend_arr(ic, kk, 0)
1481  << "\n"
1482  << " baseline theta=" << theta_base_val
1483  << " thetal=" << thetal_base_val
1484  << " qv=" << qv_base_val
1485  << " qc=" << qc_base_val
1486  << " qi=" << qi_base_val
1487  << " ql=" << ql_base
1488  << " qw=" << qw_base
1489  << " tke=" << tke_base_val
1490  << "\n"
1491  << " updated theta=" << theta_new_val
1492  << " thetal=" << thetal_new_val
1493  << " qv=" << qv_new_val
1494  << " qc=" << qc_new_val
1495  << " qi=" << qi_new_val
1496  << " ql=" << ql_new
1497  << " qw=" << qw_new
1498  << " tke=" << tke_state_arr(ic, kk, 0)
1499  << "\n"
1500  << " deltas dtheta=" << delta_theta
1501  << " dqv=" << delta_qv
1502  << " dqc=" << delta_qc
1503  << " dqi=" << delta_qi
1504  << " dql=" << delta_ql
1505  << " dqw=" << delta_qw
1506  << "\n"
1507  << " tend_dt theta=" << dt_theta_tend
1508  << " qv=" << dt_qv_tend
1509  << " qc=" << dt_qc_tend
1510  << " qi=" << dt_qi_tend
1511  << " tke=" << dt_tke_tend
1512  << "\n"
1513  << " consistency dtheta_minus_tenddt=" << (delta_theta - dt_theta_tend)
1514  << " dqv_minus_tenddt=" << (delta_qv - dt_qv_tend)
1515  << " dqc_minus_tenddt=" << (delta_qc - dt_qc_tend)
1516  << " dqi_minus_tenddt=" << (delta_qi - dt_qi_tend)
1517  << "\n"
1518  << " pdf_cloud shoc_ql=" << shoc_ql_arr(ic, kk, 0)
1519  << " shoc_cond_dt=" << cond_dt
1520  << " shoc_evap_dt=" << evap_dt
1521  << " delta_ql=" << delta_ql
1522  << " delta_ql_minus_cond_minus_evap=" << (delta_ql - (cond_dt - evap_dt))
1523  << "\n"
1524  << " surf_sens_flux=" << surf_sens_flux_arr(ic, 0, 0)
1525  << " surf_lat_flux=" << surf_lat_flux_arr(ic, 0, 0)
1526  << " surf_tau_u=" << surf_tau_u_arr(ic, 0, 0)
1527  << " surf_tau_v=" << surf_tau_v_arr(ic, 0, 0)
1528  << " rho_sfc=" << cons_arr(i, j, k, Rho_comp)
1529  << "\n";
1530 
1531  if (has_hfx3) {
1532  msg << " raw hfx3(i,j,klo)=" << hfx3_host.const_array()(rep.i, rep.j, rep.k) << "\n";
1533  }
1534  if (has_qfx3) {
1535  msg << " raw qfx3(i,j,klo)=" << qfx3_host.const_array()(rep.i, rep.j, rep.k) << "\n";
1536  }
1537  if (has_tau13) {
1538  msg << " raw tau13(i,j,klo)=" << tau13_host.const_array()(rep.i, rep.j, rep.k)
1539  << " raw tau13(i+1,j,klo)=" << tau13_host.const_array()(rep.i + 1, rep.j, rep.k)
1540  << "\n";
1541  }
1542  if (has_tau23) {
1543  msg << " raw tau23(i,j,klo)=" << tau23_host.const_array()(rep.i, rep.j, rep.k)
1544  << " raw tau23(i,j+1,klo)=" << tau23_host.const_array()(rep.i, rep.j + 1, rep.k)
1545  << "\n";
1546  }
1547  msg << "NATIVE_SHOC_BAD_COLUMN_END\n";
1548  amrex::AllPrint() << msg.str() << std::flush;
1549  }
1550 
1552  amrex::Abort("Native SHOC debug_bad_column abort: bad SHOC column detected before state update");
1553  }
1554 }
#define Rho_comp
Definition: ERF_IndexDefines.H:39
auto qv_arr
Definition: ERF_InitCustomPert_MultiSpeciesBubble.H:210
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:101
auto rho_arr
Definition: ERF_UpdateWSubsidence_SineMassFlux.H:3
amrex::FArrayBox theta_v
Definition: ERF_ShocTypes.H:97
amrex::FArrayBox theta
Definition: ERF_ShocTypes.H:95
amrex::FArrayBox theta_base
Definition: ERF_ShocTypes.H:142
amrex::FArrayBox qi
Definition: ERF_ShocTypes.H:101
amrex::FArrayBox dz
Definition: ERF_ShocTypes.H:91
amrex::FArrayBox vw_sec
Definition: ERF_ShocTypes.H:136
amrex::FArrayBox shoc_evap
Definition: ERF_ShocTypes.H:128
amrex::FArrayBox tke_base_state
Definition: ERF_ShocTypes.H:148
amrex::FArrayBox qv_base
Definition: ERF_ShocTypes.H:143
amrex::FArrayBox uw_sec
Definition: ERF_ShocTypes.H:135
amrex::FArrayBox host_dse
Definition: ERF_ShocTypes.H:108
amrex::FArrayBox qc
Definition: ERF_ShocTypes.H:100
amrex::FArrayBox surf_tau_v
Definition: ERF_ShocTypes.H:160
amrex::FArrayBox tke
Definition: ERF_ShocTypes.H:104
amrex::FArrayBox p_int
Definition: ERF_ShocTypes.H:93
amrex::FArrayBox qi_base
Definition: ERF_ShocTypes.H:145
amrex::FArrayBox exner
Definition: ERF_ShocTypes.H:96
amrex::FArrayBox qc_base
Definition: ERF_ShocTypes.H:144
amrex::FArrayBox tabs
Definition: ERF_ShocTypes.H:103
amrex::FArrayBox qw
Definition: ERF_ShocTypes.H:102
amrex::FArrayBox qv
Definition: ERF_ShocTypes.H:99
amrex::FArrayBox p_mid
Definition: ERF_ShocTypes.H:92
amrex::FArrayBox wtke_sec
Definition: ERF_ShocTypes.H:137
amrex::FArrayBox surf_tau_u
Definition: ERF_ShocTypes.H:159
amrex::FArrayBox thetal_base
Definition: ERF_ShocTypes.H:141
amrex::FArrayBox thetal
Definition: ERF_ShocTypes.H:98
int imin
Definition: ERF_ShocTypes.H:78
int nlev
Definition: ERF_ShocTypes.H:77
int kmax
Definition: ERF_ShocTypes.H:81
int ncell
Definition: ERF_ShocTypes.H:76
int jmin
Definition: ERF_ShocTypes.H:79
int ny
Definition: ERF_ShocTypes.H:75
int nx
Definition: ERF_ShocTypes.H:74
int kmin
Definition: ERF_ShocTypes.H:80
int debug_bad_column_max_reports
Definition: ERF_ShocTypes.H:47
amrex::Real debug_bad_column_q_tend_threshold
Definition: ERF_ShocTypes.H:49
amrex::Real debug_bad_column_scalar_moment_threshold
Definition: ERF_ShocTypes.H:52
amrex::Real debug_bad_column_min_dz
Definition: ERF_ShocTypes.H:51
amrex::Real debug_bad_column_theta_tend_threshold
Definition: ERF_ShocTypes.H:48
bool debug_bad_column
Definition: ERF_ShocTypes.H:45
amrex::Real debug_bad_column_brunt_threshold
Definition: ERF_ShocTypes.H:50
bool debug_bad_column_abort
Definition: ERF_ShocTypes.H:46

Referenced by advance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ debug_summary_enabled()

bool ShocDriver::debug_summary_enabled ( ) const
inline
93 { return m_opts.debug_summary; }

◆ disables_momentum_transport()

bool ShocDriver::disables_momentum_transport ( ) const
968 {
970 }
bool shoc_disables_momentum_transport(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:69

Referenced by set_diff_stresses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diss_tke_diagnostics()

const amrex::MultiFab& ShocDriver::diss_tke_diagnostics ( ) const
inline
130 { return m_diss_tke_cc; }

◆ ensure_storage()

void ShocDriver::ensure_storage ( const amrex::MultiFab &  cons,
const amrex::MultiFab &  xvel,
const amrex::MultiFab &  yvel,
const amrex::MultiFab &  eddy_diffs 
)
private
369 {
370  const bool storage_changed =
371  !m_theta_tend_cc.isDefined() ||
372  !m_u_tend_fc.isDefined() ||
373  !m_v_tend_fc.isDefined() ||
374  !m_eddy_coeffs_cc.isDefined() ||
375  m_theta_tend_cc.boxArray() != cons.boxArray() ||
376  m_theta_tend_cc.DistributionMap() != cons.DistributionMap() ||
377  m_u_tend_fc.boxArray() != xvel.boxArray() ||
378  m_u_tend_fc.DistributionMap() != xvel.DistributionMap() ||
379  m_v_tend_fc.boxArray() != yvel.boxArray() ||
380  m_v_tend_fc.DistributionMap() != yvel.DistributionMap() ||
381  m_eddy_coeffs_cc.boxArray() != eddy_diffs.boxArray() ||
382  m_eddy_coeffs_cc.DistributionMap() != eddy_diffs.DistributionMap();
383 
384  if (storage_changed) {
385  m_column_workspaces.clear();
386  m_prev_turb_valid = false;
387  m_theta_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
388  m_qv_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
389  m_qc_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
390  m_qi_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
391  m_tke_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
392  m_u_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 1);
393  m_v_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 1);
394  m_u_tend_fc.define(xvel.boxArray(), xvel.DistributionMap(), 1, 0);
395  m_v_tend_fc.define(yvel.boxArray(), yvel.DistributionMap(), 1, 0);
396  m_eddy_coeffs_cc.define(eddy_diffs.boxArray(), eddy_diffs.DistributionMap(),
397  EddyDiff::NumDiffs, 0);
398  m_prev_turb_cc.define(cons.boxArray(), cons.DistributionMap(), 2, 0);
399  m_prev_wthv_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
400  m_consumed_sens_flux_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
401  m_consumed_laten_flux_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
402  m_pblh_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
403  m_shoc_ustar_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
404  m_shoc_olen_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
405  m_shoc_cldfrac_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
406  m_shoc_ql_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
407  m_shoc_ql2_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
408  m_shoc_cond_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
409  m_w_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
410  m_wqls_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
411  m_wthv_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
412  m_thl_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
413  m_qw_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
414  m_qwthl_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
415  m_wthl_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
416  m_wqw_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
417  m_w3_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
418  m_brunt_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
419  m_isotropy_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
420  m_shear_prod_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
421  m_buoy_prod_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
422  m_diss_tke_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
423  m_prev_turb_cc.setVal(0.0);
424  m_prev_wthv_sec_cc.setVal(0.0);
425  }
426  m_theta_tend_cc.setVal(0.0);
427  m_qv_tend_cc.setVal(0.0);
428  m_qc_tend_cc.setVal(0.0);
429  m_qi_tend_cc.setVal(0.0);
430  m_tke_tend_cc.setVal(0.0);
431  m_u_tend_cc.setVal(0.0);
432  m_v_tend_cc.setVal(0.0);
433  m_u_tend_fc.setVal(0.0);
434  m_v_tend_fc.setVal(0.0);
435  m_eddy_coeffs_cc.setVal(0.0);
436  m_consumed_sens_flux_cc.setVal(0.0);
437  m_consumed_laten_flux_cc.setVal(0.0);
438  m_pblh_cc.setVal(0.0);
439  m_shoc_ustar_cc.setVal(0.0);
440  m_shoc_olen_cc.setVal(0.0);
441  m_shoc_cldfrac_cc.setVal(0.0);
442  m_shoc_ql_cc.setVal(0.0);
443  m_shoc_ql2_cc.setVal(0.0);
444  m_shoc_cond_cc.setVal(0.0);
445  m_w_sec_cc.setVal(0.0);
446  m_wqls_sec_cc.setVal(0.0);
447  m_wthv_sec_cc.setVal(0.0);
448  m_thl_sec_cc.setVal(0.0);
449  m_qw_sec_cc.setVal(0.0);
450  m_qwthl_sec_cc.setVal(0.0);
451  m_wthl_sec_cc.setVal(0.0);
452  m_wqw_sec_cc.setVal(0.0);
453  m_w3_cc.setVal(0.0);
454  m_brunt_cc.setVal(0.0);
455  m_isotropy_cc.setVal(0.0);
456  m_shear_prod_cc.setVal(0.0);
457  m_buoy_prod_cc.setVal(0.0);
458  m_diss_tke_cc.setVal(0.0);
459 }
amrex::MultiFab m_prev_wthv_sec_cc
Definition: ERF_ShocDriver.H:149
amrex::MultiFab m_prev_turb_cc
Definition: ERF_ShocDriver.H:148
@ NumDiffs
Definition: ERF_IndexDefines.H:264

Referenced by advance().

Here is the caller graph for this function:

◆ has_consumed_surface_flux_diagnostics()

bool ShocDriver::has_consumed_surface_flux_diagnostics ( ) const
inline
96  {
97  return m_consumed_sens_flux_cc.isDefined() && m_consumed_laten_flux_cc.isDefined();
98  }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ has_native_diagnostics()

bool ShocDriver::has_native_diagnostics ( ) const
inline
94 { return m_eddy_coeffs_cc.isDefined(); }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ isotropy_diagnostics()

const amrex::MultiFab& ShocDriver::isotropy_diagnostics ( ) const
inline
127 { return m_isotropy_cc; }

◆ native_diagnostics()

const amrex::MultiFab& ShocDriver::native_diagnostics ( ) const
inline
99 { return m_eddy_coeffs_cc; }

◆ needs_host_surface_momentum_stresses()

bool ShocDriver::needs_host_surface_momentum_stresses ( ) const
986 {
988 }
bool uses_momentum_host_diffusion() const
Definition: ERF_ShocDriver.cpp:961
Here is the call graph for this function:

◆ owns_momentum_surface_stresses()

bool ShocDriver::owns_momentum_surface_stresses ( ) const
980 {
982 }

Referenced by set_diff_stresses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owns_scalar_surface_fluxes()

bool ShocDriver::owns_scalar_surface_fluxes ( ) const
974 {
975  return uses_state_update();
976 }

Referenced by owns_surface_fluxes(), and ERF::Write2DPlotFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owns_surface_fluxes()

bool ShocDriver::owns_surface_fluxes ( ) const
992 {
994 }
bool owns_scalar_surface_fluxes() const
Definition: ERF_ShocDriver.cpp:973
Here is the call graph for this function:

◆ pblh_diagnostics()

const amrex::MultiFab& ShocDriver::pblh_diagnostics ( ) const
inline
101 { return m_pblh_cc; }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ print_debug_summary()

void ShocDriver::print_debug_summary ( double  dt) const
private
1558 {
1559  BL_PROFILE("SHOC::print_debug_summary");
1560 
1561  auto print_minmax = [] (const char* name, const MultiFab& mf, int comp) {
1562  amrex::Print() << " " << std::setw(12) << std::left << name
1563  << " min=" << mf.min(comp)
1564  << " max=" << mf.max(comp) << "\n";
1565  };
1566 
1567  amrex::Print() << "SHOC debug summary:"
1568  << " level=" << m_lev
1569  << " call=" << m_advance_calls
1570  << " dt=" << dt
1571  << " transport_mode=" << shoc_transport_mode_name(m_opts.transport_mode)
1572  << " momentum_transport=" << shoc_momentum_transport_name(m_opts.momentum_transport)
1573  << " state_update=" << (uses_state_update() ? "on" : "off")
1574  << "\n";
1575  print_shoc_debug_settings_once(m_opts);
1576 
1577  print_minmax("Kmv", m_eddy_coeffs_cc, EddyDiff::Mom_v);
1578  print_minmax("Khv", m_eddy_coeffs_cc, EddyDiff::Theta_v);
1579  print_minmax("KE_v", m_eddy_coeffs_cc, EddyDiff::KE_v);
1580  print_minmax("Q_v", m_eddy_coeffs_cc, EddyDiff::Q_v);
1581  print_minmax("l_turb", m_eddy_coeffs_cc, EddyDiff::Turb_lengthscale);
1582  print_minmax("pblh", m_pblh_cc, 0);
1583 
1584  print_minmax("th_tend", m_theta_tend_cc, 0);
1585  print_minmax("qv_tend", m_qv_tend_cc, 0);
1586  print_minmax("qc_tend", m_qc_tend_cc, 0);
1587  print_minmax("qi_tend", m_qi_tend_cc, 0);
1588  print_minmax("tke_tend", m_tke_tend_cc, 0);
1589  print_minmax("u_tend", m_u_tend_fc, 0);
1590  print_minmax("v_tend", m_v_tend_fc, 0);
1591  print_minmax("w_sec", m_w_sec_cc, 0);
1592  print_minmax("thl_sec", m_thl_sec_cc, 0);
1593  print_minmax("qw_sec", m_qw_sec_cc, 0);
1594  print_minmax("qwthl_sec", m_qwthl_sec_cc, 0);
1595  print_minmax("wthl_sec", m_wthl_sec_cc, 0);
1596  print_minmax("wqw_sec", m_wqw_sec_cc, 0);
1597  print_minmax("w3", m_w3_cc, 0);
1598  print_minmax("brunt", m_brunt_cc, 0);
1599  print_minmax("isotropy", m_isotropy_cc, 0);
1600  print_minmax("shear_prod", m_shear_prod_cc, 0);
1601  print_minmax("buoy_prod", m_buoy_prod_cc, 0);
1602  print_minmax("diss_tke", m_diss_tke_cc, 0);
1603  print_minmax("cldfrac", m_shoc_cldfrac_cc, 0);
1604  print_minmax("shoc_ql", m_shoc_ql_cc, 0);
1605  print_minmax("shoc_ql2", m_shoc_ql2_cc, 0);
1606  print_minmax("shoc_cond", m_shoc_cond_cc, 0);
1607  print_minmax("wqls_sec", m_wqls_sec_cc, 0);
1608  print_minmax("wthv_sec", m_wthv_sec_cc, 0);
1609 
1610  if (m_hfx3_ptr) print_minmax("hfx3_in", *m_hfx3_ptr, 0);
1611  if (m_qfx3_ptr) print_minmax("qfx3_in", *m_qfx3_ptr, 0);
1612  if (m_tau13_ptr) print_minmax("tau13_in", *m_tau13_ptr, 0);
1613  if (m_tau23_ptr) print_minmax("tau23_in", *m_tau23_ptr, 0);
1614 }
const char * shoc_transport_mode_name(ShocTransportMode mode)
Definition: ERF_ShocTransportStruct.H:24
const char * shoc_momentum_transport_name(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:34

Referenced by advance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qw_sec_diagnostics()

const amrex::MultiFab& ShocDriver::qw_sec_diagnostics ( ) const
inline
121 { return m_qw_sec_cc; }

◆ qwthl_sec_diagnostics()

const amrex::MultiFab& ShocDriver::qwthl_sec_diagnostics ( ) const
inline
122 { return m_qwthl_sec_cc; }

◆ seed_carried_buoyancy_flux()

void ShocDriver::seed_carried_buoyancy_flux ( ShocColumnData col,
const amrex::MFIter &  mfi 
) const
private
496 {
497  if (!m_prev_turb_valid) {
498  return;
499  }
500 
501  const auto carried = m_prev_wthv_sec_cc.const_array(mfi);
502  auto wthv_sec = col.wthv_sec.array();
503  const auto layout = col.layout;
504  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
505 
506  seed_carried_buoyancy_flux_impl(xy_box, layout, carried, wthv_sec);
507 }

Referenced by advance().

Here is the caller graph for this function:

◆ seed_carried_turbulence()

void ShocDriver::seed_carried_turbulence ( ShocColumnData col,
const amrex::MFIter &  mfi,
const amrex::MultiFab &  cons,
const amrex::MultiFab &  eddy_diffs 
) const
private
466 {
467  const auto rho_host = cons.const_array(mfi);
468  const auto carried = m_prev_turb_cc.const_array(mfi);
469  const auto host_diff = eddy_diffs.const_array(mfi);
470  auto tk = col.tk.array();
471  auto tkh = col.tkh.array();
472  const bool prev_turb_valid = m_prev_turb_valid;
473  const auto layout = col.layout;
474  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
475 
476  seed_carried_turbulence_impl(xy_box, layout, rho_host, carried, host_diff,
477  tk, tkh, prev_turb_valid);
478 }

Referenced by advance().

Here is the caller graph for this function:

◆ set_diff_stresses()

void ShocDriver::set_diff_stresses ( ) const
886 {
887  BL_PROFILE("SHOC::set_diff_stresses");
888 
889  if (uses_host_diffusion()) {
890  // Full host-diffusion mode preserves the existing host-owned lower
891  // boundary fluxes and stresses.
892  return;
893  }
894 
895  if (!m_hfx3_ptr || !m_qfx3_ptr) {
896  return;
897  }
898 
899  for (MFIter mfi(*m_hfx3_ptr, false); mfi.isValid(); ++mfi) {
900  const Box& vbx_cc = mfi.validbox();
901  const Box& vbx_xz = convert(vbx_cc, IntVect(1,0,1));
902  const Box& vbx_yz = convert(vbx_cc, IntVect(0,1,1));
903  auto hfx = m_hfx3_ptr->array(mfi);
904  auto qfx = m_qfx3_ptr->array(mfi);
905 
906  ParallelFor(vbx_cc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
907  hfx(i,j,k) = 0.0;
908  qfx(i,j,k) = 0.0;
909  });
910 
913  auto tau13 = m_tau13_ptr->array(mfi);
914  auto tau23 = m_tau23_ptr->array(mfi);
915  ParallelFor(vbx_xz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
916  tau13(i,j,k) = 0.0;
917  });
918  ParallelFor(vbx_yz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
919  tau23(i,j,k) = 0.0;
920  });
921  }
922  }
923 }
bool uses_host_diffusion() const
Definition: ERF_ShocDriver.cpp:943
bool disables_momentum_transport() const
Definition: ERF_ShocDriver.cpp:967
bool owns_momentum_surface_stresses() const
Definition: ERF_ShocDriver.cpp:979
Here is the call graph for this function:

◆ set_eddy_diffs()

void ShocDriver::set_eddy_diffs ( ) const
853 {
854  BL_PROFILE("SHOC::set_eddy_diffs");
855 
857  m_eddy_diffs_ptr->setVal(0.0, k_shoc_vertical_diff_comp, k_shoc_vertical_diff_count,
858  m_eddy_diffs_ptr->nGrow());
859  MultiFab::Copy(*m_eddy_diffs_ptr, m_eddy_coeffs_cc,
861 
862  if (uses_host_diffusion()) {
863  MultiFab::Copy(*m_eddy_diffs_ptr, m_eddy_coeffs_cc,
864  k_shoc_vertical_diff_comp, k_shoc_vertical_diff_comp,
865  k_shoc_vertical_diff_count, 0);
866  } else if (uses_momentum_host_diffusion()) {
867  MultiFab::Copy(*m_eddy_diffs_ptr, m_eddy_coeffs_cc,
869  }
870  const bool export_host_diff =
872  if (!export_host_diff) {
873  return;
874  }
875 
876  AMREX_ALWAYS_ASSERT(m_geom_ptr != nullptr);
877  const Geometry& geom = *m_geom_ptr;
878  const int comp = uses_host_diffusion() ? k_shoc_vertical_diff_comp : EddyDiff::Mom_v;
879  const int ncomp = uses_host_diffusion() ? k_shoc_vertical_diff_count : 1;
880 
882 }
void shoc_fill_physical_boundary_ghosts(MultiFab &mf, const Geometry &geom, int comp, int ncomp)
Definition: ERF_ShocDriver.cpp:34
Here is the call graph for this function:

◆ shear_prod_diagnostics()

const amrex::MultiFab& ShocDriver::shear_prod_diagnostics ( ) const
inline
128 { return m_shear_prod_cc; }

◆ shoc_cldfrac_diagnostics()

const amrex::MultiFab& ShocDriver::shoc_cldfrac_diagnostics ( ) const
inline
113 { return m_shoc_cldfrac_cc; }

◆ shoc_cond_diagnostics()

const amrex::MultiFab& ShocDriver::shoc_cond_diagnostics ( ) const
inline
116 { return m_shoc_cond_cc; }

◆ shoc_olen_diagnostics()

const amrex::MultiFab& ShocDriver::shoc_olen_diagnostics ( ) const
inline
112 { return m_shoc_olen_cc; }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ shoc_ql2_diagnostics()

const amrex::MultiFab& ShocDriver::shoc_ql2_diagnostics ( ) const
inline
115 { return m_shoc_ql2_cc; }

◆ shoc_ql_diagnostics()

const amrex::MultiFab& ShocDriver::shoc_ql_diagnostics ( ) const
inline
114 { return m_shoc_ql_cc; }

◆ shoc_ustar_diagnostics()

const amrex::MultiFab& ShocDriver::shoc_ustar_diagnostics ( ) const
inline
111 { return m_shoc_ustar_cc; }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

◆ store_carried_buoyancy_flux()

void ShocDriver::store_carried_buoyancy_flux ( const ShocColumnData col,
const amrex::MFIter &  mfi 
)
private
512 {
513  auto carried = m_prev_wthv_sec_cc.array(mfi);
514  const auto wthv_sec = col.wthv_sec.const_array();
515  const auto layout = col.layout;
516  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
517 
518  store_carried_buoyancy_flux_impl(xy_box, layout, carried, wthv_sec);
519 }

Referenced by advance().

Here is the caller graph for this function:

◆ store_carried_turbulence()

void ShocDriver::store_carried_turbulence ( const ShocColumnData col,
const amrex::MFIter &  mfi 
)
private
483 {
484  auto carried = m_prev_turb_cc.array(mfi);
485  const auto tk = col.tk.const_array();
486  const auto tkh = col.tkh.const_array();
487  const auto layout = col.layout;
488  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
489 
490  store_carried_turbulence_impl(xy_box, layout, carried, tk, tkh);
491 }

Referenced by advance().

Here is the caller graph for this function:

◆ thl_sec_diagnostics()

const amrex::MultiFab& ShocDriver::thl_sec_diagnostics ( ) const
inline
120 { return m_thl_sec_cc; }

◆ uses_host_diffusion()

bool ShocDriver::uses_host_diffusion ( ) const
944 {
946 }
bool shoc_uses_host_diffusion(ShocTransportMode mode)
Definition: ERF_ShocTransportStruct.H:51

Referenced by set_diff_stresses(), and set_eddy_diffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uses_momentum_host_diffusion()

bool ShocDriver::uses_momentum_host_diffusion ( ) const
962 {
964 }
bool shoc_uses_momentum_host_diffusion(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:63

Referenced by needs_host_surface_momentum_stresses(), and set_eddy_diffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uses_momentum_state_update()

bool ShocDriver::uses_momentum_state_update ( ) const
956 {
958 }
bool shoc_uses_momentum_state_update(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:57

Referenced by advance(), apply_state_update(), and owns_momentum_surface_stresses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uses_state_update()

bool ShocDriver::uses_state_update ( ) const
950 {
952 }
bool shoc_uses_state_update(ShocTransportMode mode)
Definition: ERF_ShocTransportStruct.H:45

Referenced by advance(), owns_scalar_surface_fluxes(), and print_debug_summary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ w3_diagnostics()

const amrex::MultiFab& ShocDriver::w3_diagnostics ( ) const
inline
125 { return m_w3_cc; }

◆ w_sec_diagnostics()

const amrex::MultiFab& ShocDriver::w_sec_diagnostics ( ) const
inline
117 { return m_w_sec_cc; }

◆ wqls_sec_diagnostics()

const amrex::MultiFab& ShocDriver::wqls_sec_diagnostics ( ) const
inline
118 { return m_wqls_sec_cc; }

◆ wqw_sec_diagnostics()

const amrex::MultiFab& ShocDriver::wqw_sec_diagnostics ( ) const
inline
124 { return m_wqw_sec_cc; }

◆ wthl_sec_diagnostics()

const amrex::MultiFab& ShocDriver::wthl_sec_diagnostics ( ) const
inline
123 { return m_wthl_sec_cc; }

◆ wthv_sec_diagnostics()

const amrex::MultiFab& ShocDriver::wthv_sec_diagnostics ( ) const
inline
119 { return m_wthv_sec_cc; }

Referenced by ERF::Write2DPlotFile().

Here is the caller graph for this function:

Member Data Documentation

◆ m_advance_calls

int ShocDriver::m_advance_calls = 0
private

◆ m_brunt_cc

amrex::MultiFab ShocDriver::m_brunt_cc
private

◆ m_buoy_prod_cc

amrex::MultiFab ShocDriver::m_buoy_prod_cc
private

◆ m_column_workspaces

amrex::Vector<std::unique_ptr<ShocColumnWorkspace> > ShocDriver::m_column_workspaces
private

Referenced by advance(), and ensure_storage().

◆ m_cons_ptr

amrex::MultiFab* ShocDriver::m_cons_ptr = nullptr
private

◆ m_consumed_laten_flux_cc

amrex::MultiFab ShocDriver::m_consumed_laten_flux_cc
private

◆ m_consumed_sens_flux_cc

amrex::MultiFab ShocDriver::m_consumed_sens_flux_cc
private

◆ m_diss_tke_cc

amrex::MultiFab ShocDriver::m_diss_tke_cc
private

◆ m_eddy_coeffs_cc

amrex::MultiFab ShocDriver::m_eddy_coeffs_cc
private

◆ m_eddy_diffs_ptr

amrex::MultiFab* ShocDriver::m_eddy_diffs_ptr = nullptr
private

Referenced by advance(), and set_eddy_diffs().

◆ m_geom_ptr

const amrex::Geometry* ShocDriver::m_geom_ptr = nullptr
private

Referenced by advance(), and set_eddy_diffs().

◆ m_hfx3_ptr

amrex::MultiFab* ShocDriver::m_hfx3_ptr = nullptr
private

◆ m_isotropy_cc

amrex::MultiFab ShocDriver::m_isotropy_cc
private

◆ m_lev

int ShocDriver::m_lev
private

◆ m_moisture_indices

MoistureComponentIndices ShocDriver::m_moisture_indices
private

Referenced by advance(), and apply_state_update().

◆ m_moisture_type

MoistureType ShocDriver::m_moisture_type
private

Referenced by ShocDriver().

◆ m_opts

◆ m_pblh_cc

amrex::MultiFab ShocDriver::m_pblh_cc
private

◆ m_prev_turb_cc

amrex::MultiFab ShocDriver::m_prev_turb_cc
private

◆ m_prev_turb_valid

bool ShocDriver::m_prev_turb_valid = false
private

◆ m_prev_wthv_sec_cc

amrex::MultiFab ShocDriver::m_prev_wthv_sec_cc
private

◆ m_qc_tend_cc

amrex::MultiFab ShocDriver::m_qc_tend_cc
private

◆ m_qfx3_ptr

amrex::MultiFab* ShocDriver::m_qfx3_ptr = nullptr
private

◆ m_qi_tend_cc

amrex::MultiFab ShocDriver::m_qi_tend_cc
private

◆ m_qv_tend_cc

amrex::MultiFab ShocDriver::m_qv_tend_cc
private

◆ m_qw_sec_cc

amrex::MultiFab ShocDriver::m_qw_sec_cc
private

◆ m_qwthl_sec_cc

amrex::MultiFab ShocDriver::m_qwthl_sec_cc
private

◆ m_shear_prod_cc

amrex::MultiFab ShocDriver::m_shear_prod_cc
private

◆ m_shoc_cldfrac_cc

amrex::MultiFab ShocDriver::m_shoc_cldfrac_cc
private

◆ m_shoc_cond_cc

amrex::MultiFab ShocDriver::m_shoc_cond_cc
private

◆ m_shoc_olen_cc

amrex::MultiFab ShocDriver::m_shoc_olen_cc
private

◆ m_shoc_ql2_cc

amrex::MultiFab ShocDriver::m_shoc_ql2_cc
private

◆ m_shoc_ql_cc

amrex::MultiFab ShocDriver::m_shoc_ql_cc
private

◆ m_shoc_ustar_cc

amrex::MultiFab ShocDriver::m_shoc_ustar_cc
private

◆ m_tau13_ptr

amrex::MultiFab* ShocDriver::m_tau13_ptr = nullptr
private

◆ m_tau23_ptr

amrex::MultiFab* ShocDriver::m_tau23_ptr = nullptr
private

◆ m_theta_tend_cc

amrex::MultiFab ShocDriver::m_theta_tend_cc
private

◆ m_thl_sec_cc

amrex::MultiFab ShocDriver::m_thl_sec_cc
private

◆ m_tke_tend_cc

amrex::MultiFab ShocDriver::m_tke_tend_cc
private

◆ m_u_tend_cc

amrex::MultiFab ShocDriver::m_u_tend_cc
private

Referenced by advance(), and ensure_storage().

◆ m_u_tend_fc

amrex::MultiFab ShocDriver::m_u_tend_fc
private

◆ m_v_tend_cc

amrex::MultiFab ShocDriver::m_v_tend_cc
private

Referenced by advance(), and ensure_storage().

◆ m_v_tend_fc

amrex::MultiFab ShocDriver::m_v_tend_fc
private

◆ m_w3_cc

amrex::MultiFab ShocDriver::m_w3_cc
private

◆ m_w_sec_cc

amrex::MultiFab ShocDriver::m_w_sec_cc
private

◆ m_wqls_sec_cc

amrex::MultiFab ShocDriver::m_wqls_sec_cc
private

◆ m_wqw_sec_cc

amrex::MultiFab ShocDriver::m_wqw_sec_cc
private

◆ m_wthl_sec_cc

amrex::MultiFab ShocDriver::m_wthl_sec_cc
private

◆ m_wthv_sec_cc

amrex::MultiFab ShocDriver::m_wthv_sec_cc
private

The documentation for this class was generated from the following files: