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, const amrex::MultiFab *mf_m_x=nullptr, const amrex::MultiFab *mf_m_y=nullptr)
 
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_momentum_state_update () const
 
bool disables_momentum_transport () const
 
bool owns_scalar_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
 
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
 
int m_advance_calls = 0
 
bool m_prev_turb_valid = false
 

Constructor & Destructor Documentation

◆ ShocDriver()

ShocDriver::ShocDriver ( int  lev,
const SolverChoice &  solver_choice 
)
explicit
309  : m_lev(lev),
310  m_moisture_indices(solver_choice.moisture_indices)
311 {
312  m_opts.transport_mode = solver_choice.shoc_transport_mode;
314 
318 }
void validate_shoc_runtime_options(const ShocRuntimeOptions &opts)
Definition: ERF_ShocTypes.H:205
void read_shoc_runtime_options(ShocRuntimeOptions &opts)
Definition: ERF_ShocTypes.H:153
ShocRuntimeOptions m_opts
Definition: ERF_ShocDriver.H:109
MoistureComponentIndices m_moisture_indices
Definition: ERF_ShocDriver.H:110
int m_lev
Definition: ERF_ShocDriver.H:108
void warn_if_shoc_debug_overrides_active_once(const ShocRuntimeOptions &opts)
Definition: ERF_ShocDriver.cpp:101
ShocTransportMode transport_mode
Definition: ERF_ShocTypes.H:41
ShocMomentumTransport momentum_transport
Definition: ERF_ShocTypes.H:42
ShocTransportMode shoc_transport_mode
Definition: ERF_DataStruct.H:3202
ShocMomentumTransport shoc_momentum_transport
Definition: ERF_DataStruct.H:3203
MoistureComponentIndices moisture_indices
Index map of the moisture data carried by the active scheme: conserved-state components for the speci...
Definition: ERF_DataStruct.H:3504
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
860 {
861  AMREX_ALWAYS_ASSERT(m_cons_ptr != nullptr);
862 
863  amrex::ignore_unused(S_rhs);
864 }
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
amrex::MultiFab * m_cons_ptr
Definition: ERF_ShocDriver.H:147
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
870 {
871  AMREX_ALWAYS_ASSERT(m_cons_ptr != nullptr);
872  amrex::ignore_unused(mfi, tbx, cell_rhs);
873 }
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,
const amrex::MultiFab *  mf_m_x = nullptr,
const amrex::MultiFab *  mf_m_y = nullptr 
)
492 {
493  BL_PROFILE("SHOC::advance");
494 
495  require_full_height_shoc_boxes(cons.boxArray(), geom.Domain());
496 
497  m_cons_ptr = &cons;
498  m_hfx3_ptr = hfx3;
499  m_qfx3_ptr = qfx3;
500  m_tau13_ptr = tau13;
501  m_tau23_ptr = tau23;
502  m_eddy_diffs_ptr = eddy_diffs;
503 
506  if (m_tau13_ptr) {
508  }
509  if (m_tau23_ptr) {
511  }
512 
513  {
514  BL_PROFILE("SHOC::advance::ensure_storage");
515  ensure_storage(cons, xvel, yvel, *eddy_diffs);
516  }
517 
518  std::string error_message;
520  error_message)) {
521  amrex::Abort(error_message.c_str());
522  }
523 
524  // Keep one SHOC column workspace per local box so GPU writeback kernels
525  // can finish reading a box's scratch before it is reused.
526  const amrex::Long n_local = cons.local_size();
527  AMREX_ALWAYS_ASSERT(n_local >= amrex::Long{0});
528  const amrex::Long current_size = static_cast<amrex::Long>(m_column_workspaces.size());
529  if (current_size < n_local) {
530  const amrex::Long old_size = current_size;
531  m_column_workspaces.resize(static_cast<std::size_t>(n_local));
532  for (amrex::Long n = old_size; n < n_local; ++n) {
533  m_column_workspaces[static_cast<std::size_t>(n)] =
534  std::make_unique<ShocColumnWorkspace>();
535  }
536  }
537 
538  amrex::Long local_index = 0;
539  for (MFIter mfi(cons, false); mfi.isValid(); ++mfi, ++local_index) {
541  local_index < static_cast<amrex::Long>(m_column_workspaces.size()));
542  ShocColumnWorkspace& workspace =
543  *m_column_workspaces[static_cast<std::size_t>(local_index)];
544  const Box& vbx = mfi.validbox();
545  const ShocColumnLayout active_layout = make_shoc_layout(vbx, geom);
546  {
547  BL_PROFILE("SHOC::advance::define_column_data");
548  workspace.ensure_capacity(active_layout, amrex::The_Async_Arena(),
550  }
551  ShocColumnData& col = workspace.col;
552  {
553  BL_PROFILE("SHOC::advance::preprocess");
555  hfx3, qfx3, tau13, tau23, z_phys_nd, geom,
557  }
558  // m_x m_y of each column, for the physical cell size of the mixing-length cap
559  {
560  bool has_mf = (mf_m_x && mf_m_y);
561  const auto mx = (has_mf) ? mf_m_x->const_array(mfi) : Array4<const Real> {};
562  const auto my = (has_mf) ? mf_m_y->const_array(mfi) : Array4<const Real> {};
563  auto mf_area = col.mf_area.array();
564  const auto layout = col.layout;
565  ParallelFor(makeSlab(vbx, 2, vbx.smallEnd(2)), [=] AMREX_GPU_DEVICE (int i, int j, int) noexcept
566  {
567  mf_area(shoc_column_index(layout, i, j),0,0) = (has_mf) ? mx(i,j,0) * my(i,j,0) : Real(1.0);
568  });
569  }
570  {
571  BL_PROFILE("SHOC::advance::seed_carried_buoyancy_flux");
572  seed_carried_buoyancy_flux(col, mfi);
573  }
574  {
575  BL_PROFILE("SHOC::advance::seed_carried_turbulence");
576  seed_carried_turbulence(col, mfi, cons, *eddy_diffs);
577  }
578  // The mixing-length cap sqrt(dx dy) takes dx in place of a dy over one cell, and the
579  // reverse; a single column keeps the dx and dy of the inputs
580  const auto dx = LengthScaleCellSize(geom);
581  BL_PROFILE("SHOC::advance::cache_baseline_state");
584  BL_PROFILE("SHOC::advance::implicit");
587  BL_PROFILE("SHOC::advance::finalize");
589  BL_PROFILE("SHOC::advance::debug_bad_column");
590  debug_check_bad_column(col, mfi, z_phys_nd, hfx3, qfx3, tau13, tau23, geom, dt);
591  {
592  BL_PROFILE("SHOC::advance::store_carried_buoyancy_flux");
593  store_carried_buoyancy_flux(col, mfi);
594  }
595  {
596  BL_PROFILE("SHOC::advance::store_carried_turbulence");
597  store_carried_turbulence(col, mfi);
598  }
599 
600  auto tk_arr = m_eddy_coeffs_cc.array(mfi);
601  auto th_tend = m_theta_tend_cc.array(mfi);
602  auto qv_tend = m_qv_tend_cc.array(mfi);
603  auto qc_tend = m_qc_tend_cc.array(mfi);
604  auto qi_tend = m_qi_tend_cc.array(mfi);
605  auto tke_tend = m_tke_tend_cc.array(mfi);
606  auto u_tend_cc = m_u_tend_cc.array(mfi);
607  auto v_tend_cc = m_v_tend_cc.array(mfi);
608  auto pblh_arr = m_pblh_cc.array(mfi);
609  auto consumed_sens_flux_arr = m_consumed_sens_flux_cc.array(mfi);
610  auto consumed_laten_flux_arr = m_consumed_laten_flux_cc.array(mfi);
611  auto shoc_ustar_arr = m_shoc_ustar_cc.array(mfi);
612  auto shoc_olen_arr = m_shoc_olen_cc.array(mfi);
613  auto shoc_cldfrac_arr = m_shoc_cldfrac_cc.array(mfi);
614  auto shoc_ql_arr = m_shoc_ql_cc.array(mfi);
615  auto shoc_ql2_arr = m_shoc_ql2_cc.array(mfi);
616  auto shoc_cond_arr = m_shoc_cond_cc.array(mfi);
617  auto w_sec_arr = m_w_sec_cc.array(mfi);
618  auto wqls_sec_arr = m_wqls_sec_cc.array(mfi);
619  auto wthv_sec_arr = m_wthv_sec_cc.array(mfi);
620  auto thl_sec_arr = m_thl_sec_cc.array(mfi);
621  auto qw_sec_arr = m_qw_sec_cc.array(mfi);
622  auto qwthl_sec_arr = m_qwthl_sec_cc.array(mfi);
623  auto wthl_sec_arr = m_wthl_sec_cc.array(mfi);
624  auto wqw_sec_arr = m_wqw_sec_cc.array(mfi);
625  auto w3_arr = m_w3_cc.array(mfi);
626  auto brunt_arr = m_brunt_cc.array(mfi);
627  auto isotropy_arr = m_isotropy_cc.array(mfi);
628  auto shear_prod_arr = m_shear_prod_cc.array(mfi);
629  auto buoy_prod_arr = m_buoy_prod_cc.array(mfi);
630  auto diss_tke_arr = m_diss_tke_cc.array(mfi);
631 
632  const auto shoc_mix = col.shoc_mix.const_array();
633  const auto pblh = col.pblh.const_array();
634  const auto surf_sens_flux = col.surf_sens_flux.const_array();
635  const auto surf_lat_flux = col.surf_lat_flux.const_array();
636  const auto ustar = col.ustar.const_array();
637  const auto obklen = col.obklen.const_array();
638  const auto shoc_cldfrac = col.shoc_cldfrac.const_array();
639  const auto shoc_ql = col.shoc_ql.const_array();
640  const auto shoc_ql2 = col.shoc_ql2.const_array();
641  const auto shoc_cond = col.shoc_cond.const_array();
642  const auto w_sec = col.w_sec.const_array();
643  const auto wqls_sec = col.wqls_sec.const_array();
644  const auto wthv_sec = col.wthv_sec.const_array();
645  const auto thl_sec = col.thl_sec.const_array();
646  const auto qw_sec = col.qw_sec.const_array();
647  const auto qwthl_sec = col.qwthl_sec.const_array();
648  const auto wthl_sec = col.wthl_sec.const_array();
649  const auto wqw_sec = col.wqw_sec.const_array();
650  const auto w3 = col.w3.const_array();
651  const auto brunt = col.brunt.const_array();
652  const auto isotropy = col.isotropy.const_array();
653  const auto shear_prod = col.shear_prod.const_array();
654  const auto buoy_prod = col.buoy_prod.const_array();
655  const auto diss_tke = col.diss_tke.const_array();
656  const auto tk = col.tk.const_array();
657  const auto tkh = col.tkh.const_array();
658  const auto rho = col.rho.const_array();
659  const auto zt = col.zt.const_array();
660  const auto zi = col.zi.const_array();
661  const auto col_theta_tend = col.theta_tend.const_array();
662  const auto col_qv_tend = col.qv_tend.const_array();
663  const auto col_qc_tend = col.qc_tend.const_array();
664  const auto col_qi_tend = col.qi_tend.const_array();
665  const auto col_tke_tend = col.tke_tend.const_array();
666  const auto col_u_tend = col.u_tend.const_array();
667  const auto col_v_tend = col.v_tend.const_array();
668  const auto layout = col.layout;
669  const Box xy_box = amrex::makeSlab(vbx, 2, layout.kmin);
670  {
671  BL_PROFILE("SHOC::advance::writeback");
672  ParallelFor(xy_box, [=] AMREX_GPU_DEVICE (int i, int j, int) noexcept
673  {
674  const int ic = shoc_column_index(layout, i, j);
675  const int k0 = layout.kmin;
676  const Real rho_sfc = rho(ic,0,0);
677  for (int kk = 0; kk < layout.nlev; ++kk) {
678  const int k = layout.kmin + kk;
679  const Real l = shoc_mix(ic,kk,0);
680  const Real km = tk(ic,kk,0);
681  const Real kh = tkh(ic,kk,0);
682 
683  tk_arr(i,j,k,EddyDiff::Mom_v) = rho(ic,kk,0) * km;
684  tk_arr(i,j,k,EddyDiff::Theta_v) = rho(ic,kk,0) * kh;
685  tk_arr(i,j,k,EddyDiff::KE_v) = rho(ic,kk,0) * kh;
686  tk_arr(i,j,k,EddyDiff::Scalar_v) = rho(ic,kk,0) * kh;
687  tk_arr(i,j,k,EddyDiff::Q_v) = rho(ic,kk,0) * kh;
688  tk_arr(i,j,k,EddyDiff::Turb_lengthscale) = l;
689 
690  th_tend(i,j,k) = col_theta_tend(ic,kk,0);
691  qv_tend(i,j,k) = col_qv_tend(ic,kk,0);
692  qc_tend(i,j,k) = col_qc_tend(ic,kk,0);
693  qi_tend(i,j,k) = col_qi_tend(ic,kk,0);
694  tke_tend(i,j,k) = col_tke_tend(ic,kk,0);
695  u_tend_cc(i,j,k) = col_u_tend(ic,kk,0);
696  v_tend_cc(i,j,k) = col_v_tend(ic,kk,0);
697  }
698  // Motivation: Native SHOC state_update consumes SurfaceLayer
699  // fluxes before the host diffusion path clears the overlapping
700  // SFS arrays. Preserve the consumed conservative fluxes here
701  // so 2D diagnostics report the surface forcing SHOC actually
702  // used, not the cleared host arrays.
703  consumed_sens_flux_arr(i,j,k0) = rho_sfc * surf_sens_flux(ic,0,0);
704  consumed_laten_flux_arr(i,j,k0) = rho_sfc * surf_lat_flux(ic,0,0);
705  shoc_ustar_arr(i,j,k0) = ustar(ic,0,0);
706  shoc_olen_arr(i,j,k0) = obklen(ic,0,0);
707  });
708 
709  // Keep diagnostic writeback in a separate launch so the kernel
710  // argument block fits CUDA's 4 KiB limit on pre-Volta devices.
711  ParallelFor(xy_box, [=] AMREX_GPU_DEVICE (int i, int j, int) noexcept
712  {
713  const int ic = shoc_column_index(layout, i, j);
714  for (int kk = 0; kk < layout.nlev; ++kk) {
715  const int k = layout.kmin + kk;
716  // Native SHOC pblh is diagnosed as meters AGL and is
717  // copied directly into the plotfile diagnostic field.
718  pblh_arr(i,j,k) = pblh(ic,0,0);
719  shoc_cldfrac_arr(i,j,k) = shoc_cldfrac(ic,kk,0);
720  shoc_ql_arr(i,j,k) = shoc_ql(ic,kk,0);
721  shoc_ql2_arr(i,j,k) = shoc_ql2(ic,kk,0);
722  shoc_cond_arr(i,j,k) = shoc_cond(ic,kk,0);
723  w_sec_arr(i,j,k) = w_sec(ic,kk,0);
724  wqls_sec_arr(i,j,k) = wqls_sec(ic,kk,0);
725  wthv_sec_arr(i,j,k) = wthv_sec(ic,kk,0);
726  brunt_arr(i,j,k) = brunt(ic,kk,0);
727  isotropy_arr(i,j,k) = isotropy(ic,kk,0);
728  thl_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
729  thl_sec(ic,kk,0), thl_sec(ic,kk+1,0),
730  zt(ic,kk,0));
731  qw_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
732  qw_sec(ic,kk,0), qw_sec(ic,kk+1,0),
733  zt(ic,kk,0));
734  qwthl_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
735  qwthl_sec(ic,kk,0), qwthl_sec(ic,kk+1,0),
736  zt(ic,kk,0));
737  wthl_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
738  wthl_sec(ic,kk,0), wthl_sec(ic,kk+1,0),
739  zt(ic,kk,0));
740  wqw_sec_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
741  wqw_sec(ic,kk,0), wqw_sec(ic,kk+1,0),
742  zt(ic,kk,0));
743  w3_arr(i,j,k) = weighted_linear_interp(zi(ic,kk,0), zi(ic,kk+1,0),
744  w3(ic,kk,0), w3(ic,kk+1,0),
745  zt(ic,kk,0));
746  shear_prod_arr(i,j,k) = shear_prod(ic,kk,0);
747  buoy_prod_arr(i,j,k) = buoy_prod(ic,kk,0);
748  diss_tke_arr(i,j,k) = diss_tke(ic,kk,0);
749  }
750  });
751  }
752 
753  }
754 
755  {
756  BL_PROFILE("SHOC::advance::tendency_interpolation");
757  m_u_tend_cc.FillBoundary(geom.periodicity());
758  m_v_tend_cc.FillBoundary(geom.periodicity());
759 
760  const auto dom = geom.Domain();
761  const int ilo = dom.smallEnd(0);
762  const int ihi = dom.bigEnd(0);
763  const int jlo = dom.smallEnd(1);
764  const int jhi = dom.bigEnd(1);
765  const bool xper = geom.isPeriodic(0);
766  const bool yper = geom.isPeriodic(1);
767 
768  for (MFIter mfi(m_u_tend_cc, false); mfi.isValid(); ++mfi) {
769  const Box& cc_bx = mfi.validbox();
770  const Box xface_bx = amrex::surroundingNodes(cc_bx, 0);
771  const Box yface_bx = amrex::surroundingNodes(cc_bx, 1);
772  const auto u_cc = m_u_tend_cc.const_array(mfi);
773  const auto v_cc = m_v_tend_cc.const_array(mfi);
774  auto u_fc = m_u_tend_fc.array(mfi);
775  auto v_fc = m_v_tend_fc.array(mfi);
776 
777  ParallelFor(xface_bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
778  {
779  const int il = face_neighbor_cell(i - 1, ilo, ihi, xper);
780  const int ir = face_neighbor_cell(i, ilo, ihi, xper);
781  u_fc(i,j,k) = 0.5_rt * (u_cc(il,j,k) + u_cc(ir,j,k));
782  });
783 
784  ParallelFor(yface_bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
785  {
786  const int jb = face_neighbor_cell(j - 1, jlo, jhi, yper);
787  const int jt = face_neighbor_cell(j, jlo, jhi, yper);
788  v_fc(i,j,k) = 0.5_rt * (v_cc(i,jb,k) + v_cc(i,jt,k));
789  });
790  }
791  }
792 
795 
796  BL_PROFILE("SHOC::advance::state_update");
798 
802  }
803 
804  m_prev_turb_valid = true;
805  ++m_advance_calls;
806  if (m_opts.debug_summary) {
807  BL_PROFILE("SHOC::advance::debug_summary");
809  }
810 }
GpuArray< Real, AMREX_SPACEDIM > dx
Definition: ERF_ActuatorSpreading.cpp:131
@ tau23
Definition: ERF_DataStruct.H:51
@ tau13
Definition: ERF_DataStruct.H:51
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > LengthScaleCellSize(const amrex::Geometry &geom)
Definition: ERF_LengthScaleCellSize.H:28
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:133
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 MoistureComponentIndices &indices, int ncomp, std::string &error_message)
Definition: ERF_ShocDriver.H:26
Definition: ERF_ShocColumnData.H:106
ShocColumnData col
Definition: ERF_ShocColumnData.H:108
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:110
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:130
void print_debug_summary(double dt) const
Definition: ERF_ShocDriver.cpp:1454
bool m_prev_turb_valid
Definition: ERF_ShocDriver.H:155
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:920
amrex::MultiFab m_qw_sec_cc
Definition: ERF_ShocDriver.H:137
amrex::MultiFab m_diss_tke_cc
Definition: ERF_ShocDriver.H:146
amrex::MultiFab m_qwthl_sec_cc
Definition: ERF_ShocDriver.H:138
amrex::MultiFab * m_qfx3_ptr
Definition: ERF_ShocDriver.H:149
int m_advance_calls
Definition: ERF_ShocDriver.H:154
void apply_state_update(amrex::MultiFab &cons, amrex::MultiFab &xvel, amrex::MultiFab &yvel, double dt) const
Definition: ERF_ShocDriver.cpp:894
amrex::MultiFab m_pblh_cc
Definition: ERF_ShocDriver.H:126
amrex::MultiFab m_eddy_coeffs_cc
Definition: ERF_ShocDriver.H:121
amrex::MultiFab m_buoy_prod_cc
Definition: ERF_ShocDriver.H:145
amrex::MultiFab m_wthl_sec_cc
Definition: ERF_ShocDriver.H:139
amrex::MultiFab m_u_tend_fc
Definition: ERF_ShocDriver.H:119
amrex::MultiFab m_wqls_sec_cc
Definition: ERF_ShocDriver.H:134
amrex::MultiFab * m_tau13_ptr
Definition: ERF_ShocDriver.H:150
amrex::MultiFab m_v_tend_fc
Definition: ERF_ShocDriver.H:120
void seed_carried_buoyancy_flux(ShocColumnData &col, const amrex::MFIter &mfi) const
Definition: ERF_ShocDriver.cpp:450
amrex::MultiFab m_w3_cc
Definition: ERF_ShocDriver.H:141
amrex::MultiFab m_shoc_ustar_cc
Definition: ERF_ShocDriver.H:127
void seed_carried_turbulence(ShocColumnData &col, const amrex::MFIter &mfi, const amrex::MultiFab &cons, const amrex::MultiFab &eddy_diffs) const
Definition: ERF_ShocDriver.cpp:418
amrex::MultiFab m_theta_tend_cc
Definition: ERF_ShocDriver.H:112
amrex::MultiFab m_qc_tend_cc
Definition: ERF_ShocDriver.H:114
amrex::MultiFab m_wqw_sec_cc
Definition: ERF_ShocDriver.H:140
amrex::MultiFab m_shoc_olen_cc
Definition: ERF_ShocDriver.H:128
amrex::MultiFab m_consumed_laten_flux_cc
Definition: ERF_ShocDriver.H:125
amrex::MultiFab m_brunt_cc
Definition: ERF_ShocDriver.H:142
amrex::MultiFab m_wthv_sec_cc
Definition: ERF_ShocDriver.H:135
amrex::MultiFab m_shear_prod_cc
Definition: ERF_ShocDriver.H:144
amrex::MultiFab m_w_sec_cc
Definition: ERF_ShocDriver.H:133
void store_carried_buoyancy_flux(const ShocColumnData &col, const amrex::MFIter &mfi)
Definition: ERF_ShocDriver.cpp:466
void store_carried_turbulence(const ShocColumnData &col, const amrex::MFIter &mfi)
Definition: ERF_ShocDriver.cpp:437
void ensure_storage(const amrex::MultiFab &cons, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &eddy_diffs)
Definition: ERF_ShocDriver.cpp:321
bool uses_momentum_state_update() const
Definition: ERF_ShocDriver.cpp:876
amrex::MultiFab m_shoc_cldfrac_cc
Definition: ERF_ShocDriver.H:129
amrex::MultiFab m_tke_tend_cc
Definition: ERF_ShocDriver.H:116
amrex::MultiFab m_qi_tend_cc
Definition: ERF_ShocDriver.H:115
amrex::MultiFab m_thl_sec_cc
Definition: ERF_ShocDriver.H:136
amrex::MultiFab * m_tau23_ptr
Definition: ERF_ShocDriver.H:151
amrex::MultiFab * m_eddy_diffs_ptr
Definition: ERF_ShocDriver.H:152
amrex::MultiFab m_consumed_sens_flux_cc
Definition: ERF_ShocDriver.H:124
amrex::MultiFab m_isotropy_cc
Definition: ERF_ShocDriver.H:143
amrex::MultiFab m_u_tend_cc
Definition: ERF_ShocDriver.H:117
amrex::MultiFab m_v_tend_cc
Definition: ERF_ShocDriver.H:118
amrex::MultiFab m_shoc_ql2_cc
Definition: ERF_ShocDriver.H:131
amrex::MultiFab m_shoc_cond_cc
Definition: ERF_ShocDriver.H:132
amrex::MultiFab m_qv_tend_cc
Definition: ERF_ShocDriver.H:113
amrex::MultiFab * m_hfx3_ptr
Definition: ERF_ShocDriver.H:148
amrex::Vector< std::unique_ptr< ShocColumnWorkspace > > m_column_workspaces
Definition: ERF_ShocDriver.H:153
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:267
@ Turb_lengthscale
Definition: ERF_IndexDefines.H:271
@ Scalar_v
Definition: ERF_IndexDefines.H:269
@ Q_v
Definition: ERF_IndexDefines.H:270
@ Mom_v
Definition: ERF_IndexDefines.H:266
@ KE_v
Definition: ERF_IndexDefines.H:268
@ ustar
Definition: ERF_SLM.H:30
@ rho
Definition: ERF_Kessler.H:25
@ xvel
Definition: ERF_IndexDefines.H:232
@ cons
Definition: ERF_IndexDefines.H:231
@ zvel
Definition: ERF_IndexDefines.H:234
@ yvel
Definition: ERF_IndexDefines.H:233
@ tk
Definition: ERF_AdvanceWDM6.cpp:273
@ zi
Definition: ERF_AdvanceWDM6.cpp:277
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int face_neighbor_cell(int idx, int domlo, int domhi, bool periodic)
Definition: ERF_ShocDriver.cpp:147
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real weighted_linear_interp(Real x0, Real x1, Real y0, Real y1, Real x)
Definition: ERF_ShocDriver.cpp:137
void sync_face_multifab_impl(MultiFab &mf, const Geometry &geom)
Definition: ERF_ShocDriver.cpp:229
void require_full_height_shoc_boxes(const BoxArray &ba, const Box &domain)
Definition: ERF_ShocDriver.cpp:126
InitRunOn default_init_run_on()
Definition: ERF_ShocGpuUtils.H:27
Definition: ERF_ShocTypes.H:70
amrex::FArrayBox qc_tend
Definition: ERF_ShocTypes.H:141
amrex::FArrayBox v_tend
Definition: ERF_ShocTypes.H:144
amrex::FArrayBox shoc_cond
Definition: ERF_ShocTypes.H:116
amrex::FArrayBox buoy_prod
Definition: ERF_ShocTypes.H:109
amrex::FArrayBox diss_tke
Definition: ERF_ShocTypes.H:110
amrex::FArrayBox w_sec
Definition: ERF_ShocTypes.H:128
amrex::FArrayBox tk
Definition: ERF_ShocTypes.H:106
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:127
amrex::FArrayBox surf_lat_flux
Definition: ERF_ShocTypes.H:147
amrex::FArrayBox ustar
Definition: ERF_ShocTypes.H:102
amrex::FArrayBox shoc_mix
Definition: ERF_ShocTypes.H:103
amrex::FArrayBox wthv_sec
Definition: ERF_ShocTypes.H:111
amrex::FArrayBox shear_prod
Definition: ERF_ShocTypes.H:108
amrex::FArrayBox rho
Definition: ERF_ShocTypes.H:79
amrex::FArrayBox wqw_sec
Definition: ERF_ShocTypes.H:123
amrex::FArrayBox shoc_ql
Definition: ERF_ShocTypes.H:113
amrex::FArrayBox pblh
Definition: ERF_ShocTypes.H:100
amrex::FArrayBox isotropy
Definition: ERF_ShocTypes.H:105
amrex::FArrayBox qw_sec
Definition: ERF_ShocTypes.H:120
amrex::FArrayBox tkh
Definition: ERF_ShocTypes.H:107
amrex::FArrayBox tke_tend
Definition: ERF_ShocTypes.H:145
amrex::FArrayBox qi_tend
Definition: ERF_ShocTypes.H:142
amrex::FArrayBox u_tend
Definition: ERF_ShocTypes.H:143
ShocColumnLayout layout
Definition: ERF_ShocTypes.H:71
amrex::FArrayBox zi
Definition: ERF_ShocTypes.H:75
amrex::FArrayBox mf_area
Definition: ERF_ShocTypes.H:97
amrex::FArrayBox surf_sens_flux
Definition: ERF_ShocTypes.H:146
amrex::FArrayBox zt
Definition: ERF_ShocTypes.H:74
amrex::FArrayBox theta_tend
Definition: ERF_ShocTypes.H:139
amrex::FArrayBox obklen
Definition: ERF_ShocTypes.H:101
amrex::FArrayBox wqls_sec
Definition: ERF_ShocTypes.H:115
amrex::FArrayBox qv_tend
Definition: ERF_ShocTypes.H:140
amrex::FArrayBox wthl_sec
Definition: ERF_ShocTypes.H:122
amrex::FArrayBox thl_sec
Definition: ERF_ShocTypes.H:119
amrex::FArrayBox shoc_ql2
Definition: ERF_ShocTypes.H:114
amrex::FArrayBox qwthl_sec
Definition: ERF_ShocTypes.H:121
amrex::FArrayBox brunt
Definition: ERF_ShocTypes.H:104
amrex::FArrayBox shoc_cldfrac
Definition: ERF_ShocTypes.H:112
Definition: ERF_ShocTypes.H:58
bool debug_summary
Definition: ERF_ShocTypes.H:38
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
898 {
899  AMREX_ALWAYS_ASSERT(dt > 0.0);
900 
903  m_qv_tend_cc,
904  m_qc_tend_cc,
905  m_qi_tend_cc,
910  m_opts,
911  dt);
912 
916  }
917 }
void apply_state_update_face_velocity_impl(MultiFab &vel, const MultiFab &vel_tend, double dt_d)
Definition: ERF_ShocDriver.cpp:292
void apply_state_update_cons_impl(MultiFab &cons, const MultiFab &theta_tend_cc, const MultiFab &qv_tend_cc, const MultiFab &qc_tend_cc, const MultiFab &qi_tend_cc, const MultiFab &tke_tend_cc, int qv_comp, int qc_comp, int qi_comp, const ShocRuntimeOptions &opts, double dt_d)
Definition: ERF_ShocDriver.cpp:238
int qi
cloud ice
Definition: ERF_DataStruct.H:292
int qv
water vapor
Definition: ERF_DataStruct.H:290
int qc
cloud liquid water
Definition: ERF_DataStruct.H:291

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
101 { return m_brunt_cc; }

◆ buoy_prod_diagnostics()

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

◆ consumed_laten_flux_diagnostics()

const amrex::MultiFab& ShocDriver::consumed_laten_flux_diagnostics ( ) const
inline
83  {
85  }

Referenced by ERF::surface_flux_sources().

Here is the caller graph for this function:

◆ consumed_sens_flux_diagnostics()

const amrex::MultiFab& ShocDriver::consumed_sens_flux_diagnostics ( ) const
inline
79  {
81  }

Referenced by ERF::surface_flux_sources().

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
929 {
930  amrex::ignore_unused(geom, dt_d);
931 
932  if (!m_opts.debug_bad_column) {
933  return;
934  }
935 
936  AMREX_ALWAYS_ASSERT(m_cons_ptr != nullptr);
938 
939  const auto cons_host = copy_fab_to_host((*m_cons_ptr)[mfi]);
940  const auto z_host = copy_fab_to_host(z_phys_nd[mfi]);
941  const auto theta_tend_host = copy_fab_to_host(col.theta_tend);
942  const auto qv_tend_host = copy_fab_to_host(col.qv_tend);
943  const auto qc_tend_host = copy_fab_to_host(col.qc_tend);
944  const auto qi_tend_host = copy_fab_to_host(col.qi_tend);
945  const auto tke_tend_host = copy_fab_to_host(col.tke_tend);
946  const auto u_tend_host = copy_fab_to_host(col.u_tend);
947  const auto v_tend_host = copy_fab_to_host(col.v_tend);
948  const auto p_mid_host = copy_fab_to_host(col.p_mid);
949  const auto p_int_host = copy_fab_to_host(col.p_int);
950  const auto zt_host = copy_fab_to_host(col.zt);
951  const auto zi_host = copy_fab_to_host(col.zi);
952  const auto dz_host = copy_fab_to_host(col.dz);
953  const auto rho_host = copy_fab_to_host(col.rho);
954  const auto theta_host = copy_fab_to_host(col.theta);
955  const auto thetal_host = copy_fab_to_host(col.thetal);
956  const auto theta_base_host = copy_fab_to_host(col.theta_base);
957  const auto thetal_base_host = copy_fab_to_host(col.thetal_base);
958  const auto qv_base_host = copy_fab_to_host(col.qv_base);
959  const auto qc_base_host = copy_fab_to_host(col.qc_base);
960  const auto qi_base_host = copy_fab_to_host(col.qi_base);
961  const auto tke_base_host = copy_fab_to_host(col.tke_base_state);
962  const auto theta_v_host = copy_fab_to_host(col.theta_v);
963  const auto qv_host = copy_fab_to_host(col.qv);
964  const auto qc_host = copy_fab_to_host(col.qc);
965  const auto qi_host = copy_fab_to_host(col.qi);
966  const auto qw_host = copy_fab_to_host(col.qw);
967  const auto tabs_host = copy_fab_to_host(col.tabs);
968  const auto exner_host = copy_fab_to_host(col.exner);
969  const auto host_dse_host = copy_fab_to_host(col.host_dse);
970  const auto pblh_host = copy_fab_to_host(col.pblh);
971  const auto obklen_host = copy_fab_to_host(col.obklen);
972  const auto ustar_host = copy_fab_to_host(col.ustar);
973  const auto shoc_mix_host = copy_fab_to_host(col.shoc_mix);
974  const auto brunt_host = copy_fab_to_host(col.brunt);
975  const auto isotropy_host = copy_fab_to_host(col.isotropy);
976  const auto tk_host = copy_fab_to_host(col.tk);
977  const auto tkh_host = copy_fab_to_host(col.tkh);
978  const auto shear_prod_host = copy_fab_to_host(col.shear_prod);
979  const auto buoy_prod_host = copy_fab_to_host(col.buoy_prod);
980  const auto diss_tke_host = copy_fab_to_host(col.diss_tke);
981  const auto tke_host = copy_fab_to_host(col.tke);
982  const auto w_sec_host = copy_fab_to_host(col.w_sec);
983  const auto wthv_sec_host = copy_fab_to_host(col.wthv_sec);
984  const auto shoc_cldfrac_host = copy_fab_to_host(col.shoc_cldfrac);
985  const auto shoc_ql_host = copy_fab_to_host(col.shoc_ql);
986  const auto shoc_ql2_host = copy_fab_to_host(col.shoc_ql2);
987  const auto shoc_cond_host = copy_fab_to_host(col.shoc_cond);
988  const auto shoc_evap_host = copy_fab_to_host(col.shoc_evap);
989  const auto wqls_sec_host = copy_fab_to_host(col.wqls_sec);
990  const auto thl_sec_host = copy_fab_to_host(col.thl_sec);
991  const auto qw_sec_host = copy_fab_to_host(col.qw_sec);
992  const auto qwthl_sec_host = copy_fab_to_host(col.qwthl_sec);
993  const auto wthl_sec_host = copy_fab_to_host(col.wthl_sec);
994  const auto wqw_sec_host = copy_fab_to_host(col.wqw_sec);
995  const auto uw_sec_host = copy_fab_to_host(col.uw_sec);
996  const auto vw_sec_host = copy_fab_to_host(col.vw_sec);
997  const auto wtke_sec_host = copy_fab_to_host(col.wtke_sec);
998  const auto w3_host = copy_fab_to_host(col.w3);
999  const auto surf_sens_flux_host = copy_fab_to_host(col.surf_sens_flux);
1000  const auto surf_lat_flux_host = copy_fab_to_host(col.surf_lat_flux);
1001  const auto surf_tau_u_host = copy_fab_to_host(col.surf_tau_u);
1002  const auto surf_tau_v_host = copy_fab_to_host(col.surf_tau_v);
1003  const auto hfx3_host = hfx3 ? copy_fab_to_host((*hfx3)[mfi]) : FArrayBox();
1004  const auto qfx3_host = qfx3 ? copy_fab_to_host((*qfx3)[mfi]) : FArrayBox();
1005  const auto tau13_host = tau13 ? copy_fab_to_host((*tau13)[mfi]) : FArrayBox();
1006  const auto tau23_host = tau23 ? copy_fab_to_host((*tau23)[mfi]) : FArrayBox();
1007 
1008  const auto z_arr = z_host.const_array();
1009  const auto cons_arr = cons_host.const_array();
1010  const auto theta_tend_arr = theta_tend_host.const_array();
1011  const auto qv_tend_arr = qv_tend_host.const_array();
1012  const auto qc_tend_arr = qc_tend_host.const_array();
1013  const auto qi_tend_arr = qi_tend_host.const_array();
1014  const auto tke_tend_arr = tke_tend_host.const_array();
1015  const auto u_tend_arr = u_tend_host.const_array();
1016  const auto v_tend_arr = v_tend_host.const_array();
1017  const auto dz_arr = dz_host.const_array();
1018 
1019  std::vector<ShocBadColumnReport> reports;
1020  reports.reserve(static_cast<std::size_t>(col.layout.ncell * col.layout.nlev));
1021 
1022  auto maybe_add = [&] (int i, int j, int k, int kk, int ic,
1023  const char* name, Real value, Real threshold) {
1024  if (!std::isfinite(value)) {
1025  reports.push_back(ShocBadColumnReport{
1026  std::numeric_limits<Real>::infinity(),
1027  std::string(name) + " nonfinite",
1028  mfi.index(), i, j, k, kk, ic
1029  });
1030  return;
1031  }
1032  const Real abs_value = amrex::Math::abs(value);
1033  const Real ratio = abs_value / threshold;
1034  if (ratio > 1.0_rt) {
1035  std::ostringstream oss;
1036  oss << name << " |value|=" << abs_value << " threshold=" << threshold;
1037  reports.push_back(ShocBadColumnReport{ratio, oss.str(), mfi.index(), i, j, k, kk, ic});
1038  }
1039  };
1040 
1041  auto maybe_add_geom = [&] (int i, int j, int k, int kk, int ic, Real dz_val) {
1042  if (!std::isfinite(dz_val)) {
1043  reports.push_back(ShocBadColumnReport{
1044  std::numeric_limits<Real>::infinity(),
1045  "dz nonfinite",
1046  mfi.index(), i, j, k, kk, ic
1047  });
1048  } else if (dz_val <= 0.0_rt) {
1049  reports.push_back(ShocBadColumnReport{
1050  std::numeric_limits<Real>::infinity(),
1051  "dz <= 0",
1052  mfi.index(), i, j, k, kk, ic
1053  });
1054  } else if (dz_val < m_opts.debug_bad_column_min_dz) {
1055  std::ostringstream oss;
1056  oss << "dz below minimum |dz|=" << dz_val
1057  << " min_dz=" << m_opts.debug_bad_column_min_dz;
1058  reports.push_back(ShocBadColumnReport{
1060  oss.str(),
1061  mfi.index(), i, j, k, kk, ic
1062  });
1063  }
1064  };
1065 
1066  for (int j = col.layout.jmin; j < col.layout.jmin + col.layout.ny; ++j) {
1067  for (int i = col.layout.imin; i < col.layout.imin + col.layout.nx; ++i) {
1068  const int ic = shoc_column_index(col.layout, i, j);
1069  for (int kk = 0; kk < col.layout.nlev; ++kk) {
1070  const int k = col.layout.kmin + kk;
1071  const Real dz_val = dz_arr(ic, kk, 0);
1072  maybe_add_geom(i, j, k, kk, ic, dz_val);
1073 
1074  maybe_add(i, j, k, kk, ic, "theta_tend", theta_tend_arr(ic, kk, 0), m_opts.debug_bad_column_theta_tend_threshold);
1075  maybe_add(i, j, k, kk, ic, "qv_tend", qv_tend_arr(ic, kk, 0), m_opts.debug_bad_column_q_tend_threshold);
1076  maybe_add(i, j, k, kk, ic, "qc_tend", qc_tend_arr(ic, kk, 0), m_opts.debug_bad_column_q_tend_threshold);
1077  maybe_add(i, j, k, kk, ic, "qi_tend", qi_tend_arr(ic, kk, 0), m_opts.debug_bad_column_q_tend_threshold);
1078  maybe_add(i, j, k, kk, ic, "brunt", brunt_host.const_array()(ic, kk, 0), m_opts.debug_bad_column_brunt_threshold);
1079  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);
1080  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);
1081  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);
1082  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);
1083  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);
1084 
1085  // Treat NaN/Inf in the key state and diagnostic fields as bad.
1086  const Real key_values[] = {
1087  rho_host.const_array()(ic, kk, 0),
1088  theta_host.const_array()(ic, kk, 0),
1089  thetal_host.const_array()(ic, kk, 0),
1090  theta_v_host.const_array()(ic, kk, 0),
1091  qv_host.const_array()(ic, kk, 0),
1092  qc_host.const_array()(ic, kk, 0),
1093  qi_host.const_array()(ic, kk, 0),
1094  qw_host.const_array()(ic, kk, 0),
1095  tabs_host.const_array()(ic, kk, 0),
1096  exner_host.const_array()(ic, kk, 0),
1097  p_mid_host.const_array()(ic, kk, 0),
1098  host_dse_host.const_array()(ic, kk, 0),
1099  pblh_host.const_array()(ic, 0, 0),
1100  obklen_host.const_array()(ic, 0, 0),
1101  ustar_host.const_array()(ic, 0, 0),
1102  shoc_mix_host.const_array()(ic, kk, 0),
1103  isotropy_host.const_array()(ic, kk, 0),
1104  tk_host.const_array()(ic, kk, 0),
1105  tkh_host.const_array()(ic, kk, 0),
1106  shear_prod_host.const_array()(ic, kk, 0),
1107  buoy_prod_host.const_array()(ic, kk, 0),
1108  diss_tke_host.const_array()(ic, kk, 0),
1109  w_sec_host.const_array()(ic, kk, 0),
1110  wthv_sec_host.const_array()(ic, kk, 0),
1111  shoc_cldfrac_host.const_array()(ic, kk, 0),
1112  shoc_ql_host.const_array()(ic, kk, 0),
1113  shoc_ql2_host.const_array()(ic, kk, 0),
1114  shoc_cond_host.const_array()(ic, kk, 0),
1115  shoc_evap_host.const_array()(ic, kk, 0),
1116  wqls_sec_host.const_array()(ic, kk, 0),
1117  thl_sec_host.const_array()(ic, kk, 0),
1118  qw_sec_host.const_array()(ic, kk, 0),
1119  qwthl_sec_host.const_array()(ic, kk, 0),
1120  wthl_sec_host.const_array()(ic, kk, 0),
1121  wqw_sec_host.const_array()(ic, kk, 0),
1122  uw_sec_host.const_array()(ic, kk, 0),
1123  vw_sec_host.const_array()(ic, kk, 0),
1124  wtke_sec_host.const_array()(ic, kk, 0),
1125  w3_host.const_array()(ic, kk, 0),
1126  theta_tend_arr(ic, kk, 0),
1127  qv_tend_arr(ic, kk, 0),
1128  qc_tend_arr(ic, kk, 0),
1129  qi_tend_arr(ic, kk, 0),
1130  tke_tend_arr(ic, kk, 0),
1131  u_tend_arr(ic, kk, 0),
1132  v_tend_arr(ic, kk, 0)
1133  };
1134  for (Real value : key_values) {
1135  if (!std::isfinite(value)) {
1136  reports.push_back(ShocBadColumnReport{
1137  std::numeric_limits<Real>::infinity(),
1138  "key field nonfinite",
1139  mfi.index(), i, j, k, kk, ic
1140  });
1141  break;
1142  }
1143  }
1144  }
1145  }
1146  }
1147 
1148  if (reports.empty()) {
1149  return;
1150  }
1151 
1152  std::stable_sort(reports.begin(), reports.end(),
1153  [] (const ShocBadColumnReport& a, const ShocBadColumnReport& b) {
1154  return a.score > b.score;
1155  });
1156 
1157  const int max_reports = std::min(m_opts.debug_bad_column_max_reports,
1158  static_cast<int>(reports.size()));
1159 
1160  const auto rho_arr = rho_host.const_array();
1161  const auto theta_arr = theta_host.const_array();
1162  const auto thetal_arr = thetal_host.const_array();
1163  const auto theta_base_arr = theta_base_host.const_array();
1164  const auto thetal_base_arr = thetal_base_host.const_array();
1165  const auto qv_base_arr = qv_base_host.const_array();
1166  const auto qc_base_arr = qc_base_host.const_array();
1167  const auto qi_base_arr = qi_base_host.const_array();
1168  const auto theta_v_arr = theta_v_host.const_array();
1169  const auto qv_arr = qv_host.const_array();
1170  const auto qc_arr = qc_host.const_array();
1171  const auto qi_arr = qi_host.const_array();
1172  const auto qw_arr = qw_host.const_array();
1173  const auto tabs_arr = tabs_host.const_array();
1174  const auto exner_arr = exner_host.const_array();
1175  const auto p_mid_arr = p_mid_host.const_array();
1176  const auto p_int_arr = p_int_host.const_array();
1177  const auto host_dse_arr = host_dse_host.const_array();
1178  const auto pblh_arr = pblh_host.const_array();
1179  const auto obklen_arr = obklen_host.const_array();
1180  const auto ustar_arr = ustar_host.const_array();
1181  const auto shoc_mix_arr = shoc_mix_host.const_array();
1182  const auto brunt_arr = brunt_host.const_array();
1183  const auto isotropy_arr = isotropy_host.const_array();
1184  const auto tk_arr = tk_host.const_array();
1185  const auto tkh_arr = tkh_host.const_array();
1186  const auto shear_prod_arr = shear_prod_host.const_array();
1187  const auto buoy_prod_arr = buoy_prod_host.const_array();
1188  const auto diss_tke_arr = diss_tke_host.const_array();
1189  const auto tke_state_arr = tke_host.const_array();
1190  const auto tke_base_arr = tke_base_host.const_array();
1191  const auto w_sec_arr = w_sec_host.const_array();
1192  const auto wthv_sec_arr = wthv_sec_host.const_array();
1193  const auto shoc_cldfrac_arr = shoc_cldfrac_host.const_array();
1194  const auto shoc_ql_arr = shoc_ql_host.const_array();
1195  const auto shoc_ql2_arr = shoc_ql2_host.const_array();
1196  const auto shoc_cond_arr = shoc_cond_host.const_array();
1197  const auto shoc_evap_arr = shoc_evap_host.const_array();
1198  const auto wqls_sec_arr = wqls_sec_host.const_array();
1199  const auto thl_sec_arr = thl_sec_host.const_array();
1200  const auto qw_sec_arr = qw_sec_host.const_array();
1201  const auto qwthl_sec_arr = qwthl_sec_host.const_array();
1202  const auto wthl_sec_arr = wthl_sec_host.const_array();
1203  const auto wqw_sec_arr = wqw_sec_host.const_array();
1204  const auto uw_sec_arr = uw_sec_host.const_array();
1205  const auto vw_sec_arr = vw_sec_host.const_array();
1206  const auto wtke_sec_arr = wtke_sec_host.const_array();
1207  const auto w3_arr = w3_host.const_array();
1208  const auto surf_sens_flux_arr = surf_sens_flux_host.const_array();
1209  const auto surf_lat_flux_arr = surf_lat_flux_host.const_array();
1210  const auto surf_tau_u_arr = surf_tau_u_host.const_array();
1211  const auto surf_tau_v_arr = surf_tau_v_host.const_array();
1212  const bool has_hfx3 = hfx3 && hfx3_host.box().ok();
1213  const bool has_qfx3 = qfx3 && qfx3_host.box().ok();
1214  const bool has_tau13 = tau13 && tau13_host.box().ok();
1215  const bool has_tau23 = tau23 && tau23_host.box().ok();
1216 
1217  for (int n = 0; n < max_reports; ++n) {
1218  const auto& rep = reports[static_cast<std::size_t>(n)];
1219  const int i = rep.i;
1220  const int j = rep.j;
1221  const int k = rep.k;
1222  const int kk = rep.kk;
1223  const int ic = rep.ic;
1224 
1225  const auto node_value = [&] (int iii, int jjj, int kkk) -> Real {
1226  const IntVect iv(iii, jjj, kkk);
1227  return z_host.box().contains(iv) ? z_arr(iii, jjj, kkk) : std::numeric_limits<Real>::quiet_NaN();
1228  };
1229 
1230  const Real z_nd_ijk = node_value(i, j, k);
1231  const Real z_nd_ip1jk = node_value(i + 1, j, k);
1232  const Real z_nd_ijp1k = node_value(i, j + 1, k);
1233  const Real z_nd_ip1jp1k = node_value(i + 1, j + 1, k);
1234  const Real z_nd_ijkp1 = node_value(i, j, k + 1);
1235  const Real z_nd_ip1jkp1 = node_value(i + 1, j, k + 1);
1236  const Real z_nd_ijp1kp1 = node_value(i, j + 1, k + 1);
1237  const Real z_nd_ip1jp1kp1 = node_value(i + 1, j + 1, k + 1);
1238  const Real four_node_zlo = 0.25_rt * (z_nd_ijk + z_nd_ip1jk + z_nd_ijp1k + z_nd_ip1jp1k);
1239  const Real four_node_zhi = 0.25_rt * (z_nd_ijkp1 + z_nd_ip1jkp1 + z_nd_ijp1kp1 + z_nd_ip1jp1kp1);
1240  const Real four_node_dz = four_node_zhi - four_node_zlo;
1241  const Real corner_dz = z_nd_ijkp1 - z_nd_ijk;
1242  const Real theta_base_val = theta_base_arr(ic, kk, 0);
1243  const Real theta_new_val = theta_arr(ic, kk, 0);
1244  const Real thetal_base_val = thetal_base_arr(ic, kk, 0);
1245  const Real thetal_new_val = thetal_arr(ic, kk, 0);
1246  const Real qv_base_val = qv_base_arr(ic, kk, 0);
1247  const Real qc_base_val = qc_base_arr(ic, kk, 0);
1248  const Real qi_base_val = qi_base_arr(ic, kk, 0);
1249  const Real qv_new_val = qv_arr(ic, kk, 0);
1250  const Real qc_new_val = qc_arr(ic, kk, 0);
1251  const Real qi_new_val = qi_arr(ic, kk, 0);
1252  const Real ql_base = qc_base_val + qi_base_val;
1253  const Real ql_new = qc_new_val + qi_new_val;
1254  const Real qw_base = qv_base_val + qc_base_val + qi_base_val;
1255  const Real qw_new = qv_new_val + qc_new_val + qi_new_val;
1256  const Real delta_theta = theta_new_val - theta_base_val;
1257  const Real delta_qv = qv_new_val - qv_base_val;
1258  const Real delta_qc = qc_new_val - qc_base_val;
1259  const Real delta_qi = qi_new_val - qi_base_val;
1260  const Real delta_ql = ql_new - ql_base;
1261  const Real delta_qw = qw_new - qw_base;
1262 
1263  const Real dt = static_cast<Real>(dt_d);
1264 
1265  const Real dt_theta_tend = theta_tend_arr(ic, kk, 0) * dt;
1266  const Real dt_qv_tend = qv_tend_arr(ic, kk, 0) * dt;
1267  const Real dt_qc_tend = qc_tend_arr(ic, kk, 0) * dt;
1268  const Real dt_qi_tend = qi_tend_arr(ic, kk, 0) * dt;
1269  const Real dt_tke_tend = tke_tend_arr(ic, kk, 0) * dt;
1270  const Real cond_dt = shoc_cond_arr(ic, kk, 0) * dt;
1271  const Real evap_dt = shoc_evap_arr(ic, kk, 0) * dt;
1272  const Real tke_base_val = tke_base_arr(ic, kk, 0);
1273  std::ostringstream msg;
1274  msg << "NATIVE_SHOC_BAD_COLUMN_BEGIN\n"
1275  << " rank=" << ParallelDescriptor::MyProc()
1276  << " level=" << m_lev
1277  << " shoc_call=" << (m_advance_calls + 1)
1278  << " mfi_index=" << rep.mfi_index
1279  << " box_valid_lo=(" << mfi.validbox().smallEnd(0) << ","
1280  << mfi.validbox().smallEnd(1) << ","
1281  << mfi.validbox().smallEnd(2) << ")"
1282  << " box_valid_hi=(" << mfi.validbox().bigEnd(0) << ","
1283  << mfi.validbox().bigEnd(1) << ","
1284  << mfi.validbox().bigEnd(2) << ")"
1285  << " layout.nx=" << col.layout.nx
1286  << " layout.ny=" << col.layout.ny
1287  << " layout.ncell=" << col.layout.ncell
1288  << " layout.nlev=" << col.layout.nlev
1289  << " layout.imin=" << col.layout.imin
1290  << " layout.jmin=" << col.layout.jmin
1291  << " layout.kmin=" << col.layout.kmin
1292  << " layout.kmax=" << col.layout.kmax
1293  << "\n"
1294  << " i=" << i << " j=" << j << " k=" << k
1295  << " kk=" << kk << " ic=" << ic
1296  << " score=" << rep.score
1297  << " reason=" << rep.reason
1298  << "\n"
1299  << " geometry z_nd(i,j,k)=" << z_nd_ijk
1300  << " z_nd(i+1,j,k)=" << z_nd_ip1jk
1301  << " z_nd(i,j+1,k)=" << z_nd_ijp1k
1302  << " z_nd(i+1,j+1,k)=" << z_nd_ip1jp1k
1303  << " z_nd(i,j,k+1)=" << z_nd_ijkp1
1304  << " z_nd(i+1,j,k+1)=" << z_nd_ip1jkp1
1305  << " z_nd(i,j+1,k+1)=" << z_nd_ijp1kp1
1306  << " z_nd(i+1,j+1,k+1)=" << z_nd_ip1jp1kp1
1307  << "\n"
1308  << " four_node_zlo=" << four_node_zlo
1309  << " four_node_zhi=" << four_node_zhi
1310  << " four_node_dz=" << four_node_dz
1311  << " corner_dz=" << corner_dz
1312  << " dz=" << dz_arr(ic, kk, 0)
1313  << "\n"
1314  << " rho=" << rho_arr(ic, kk, 0)
1315  << " theta=" << theta_arr(ic, kk, 0)
1316  << " thetal=" << thetal_arr(ic, kk, 0)
1317  << " theta_v=" << theta_v_arr(ic, kk, 0)
1318  << " qv=" << qv_arr(ic, kk, 0)
1319  << " qc=" << qc_arr(ic, kk, 0)
1320  << " qi=" << qi_arr(ic, kk, 0)
1321  << " qw=" << qw_arr(ic, kk, 0)
1322  << " tabs=" << tabs_arr(ic, kk, 0)
1323  << " exner=" << exner_arr(ic, kk, 0)
1324  << " p_mid=" << p_mid_arr(ic, kk, 0)
1325  << " p_int_lower=" << p_int_arr(ic, kk, 0)
1326  << " p_int_upper=" << p_int_arr(ic, kk + 1, 0)
1327  << " host_dse=" << host_dse_arr(ic, kk, 0)
1328  << "\n"
1329  << " pblh=" << pblh_arr(ic, 0, 0)
1330  << " obklen=" << obklen_arr(ic, 0, 0)
1331  << " ustar=" << ustar_arr(ic, 0, 0)
1332  << " shoc_mix=" << shoc_mix_arr(ic, kk, 0)
1333  << " Lturb=" << shoc_mix_arr(ic, kk, 0)
1334  << " brunt=" << brunt_arr(ic, kk, 0)
1335  << " isotropy=" << isotropy_arr(ic, kk, 0)
1336  << " tk=" << tk_arr(ic, kk, 0)
1337  << " tkh=" << tkh_arr(ic, kk, 0)
1338  << " shear_prod=" << shear_prod_arr(ic, kk, 0)
1339  << " buoy_prod=" << buoy_prod_arr(ic, kk, 0)
1340  << " diss_tke=" << diss_tke_arr(ic, kk, 0)
1341  << " tke=" << tke_state_arr(ic, kk, 0)
1342  << "\n"
1343  << " w_sec=" << w_sec_arr(ic, kk, 0)
1344  << " wthv_sec=" << wthv_sec_arr(ic, kk, 0)
1345  << " shoc_cldfrac=" << shoc_cldfrac_arr(ic, kk, 0)
1346  << " shoc_ql=" << shoc_ql_arr(ic, kk, 0)
1347  << " shoc_ql2=" << shoc_ql2_arr(ic, kk, 0)
1348  << " shoc_cond=" << shoc_cond_arr(ic, kk, 0)
1349  << " shoc_evap=" << shoc_evap_arr(ic, kk, 0)
1350  << " wqls_sec=" << wqls_sec_arr(ic, kk, 0)
1351  << "\n"
1352  << " thl_sec_lower=" << thl_sec_arr(ic, kk, 0)
1353  << " thl_sec_upper=" << thl_sec_arr(ic, kk + 1, 0)
1354  << " qw_sec_lower=" << qw_sec_arr(ic, kk, 0)
1355  << " qw_sec_upper=" << qw_sec_arr(ic, kk + 1, 0)
1356  << " qwthl_sec_lower=" << qwthl_sec_arr(ic, kk, 0)
1357  << " qwthl_sec_upper=" << qwthl_sec_arr(ic, kk + 1, 0)
1358  << " wthl_sec_lower=" << wthl_sec_arr(ic, kk, 0)
1359  << " wthl_sec_upper=" << wthl_sec_arr(ic, kk + 1, 0)
1360  << " wqw_sec_lower=" << wqw_sec_arr(ic, kk, 0)
1361  << " wqw_sec_upper=" << wqw_sec_arr(ic, kk + 1, 0)
1362  << " w3_lower=" << w3_arr(ic, kk, 0)
1363  << " w3_upper=" << w3_arr(ic, kk + 1, 0)
1364  << " uw_sec_lower=" << uw_sec_arr(ic, kk, 0)
1365  << " uw_sec_upper=" << uw_sec_arr(ic, kk + 1, 0)
1366  << " vw_sec_lower=" << vw_sec_arr(ic, kk, 0)
1367  << " vw_sec_upper=" << vw_sec_arr(ic, kk + 1, 0)
1368  << " wtke_sec_lower=" << wtke_sec_arr(ic, kk, 0)
1369  << " wtke_sec_upper=" << wtke_sec_arr(ic, kk + 1, 0)
1370  << "\n"
1371  << " theta_tend=" << theta_tend_arr(ic, kk, 0)
1372  << " qv_tend=" << qv_tend_arr(ic, kk, 0)
1373  << " qc_tend=" << qc_tend_arr(ic, kk, 0)
1374  << " qi_tend=" << qi_tend_arr(ic, kk, 0)
1375  << " tke_tend=" << tke_tend_arr(ic, kk, 0)
1376  << " u_tend=" << u_tend_arr(ic, kk, 0)
1377  << " v_tend=" << v_tend_arr(ic, kk, 0)
1378  << "\n"
1379  << " baseline theta=" << theta_base_val
1380  << " thetal=" << thetal_base_val
1381  << " qv=" << qv_base_val
1382  << " qc=" << qc_base_val
1383  << " qi=" << qi_base_val
1384  << " ql=" << ql_base
1385  << " qw=" << qw_base
1386  << " tke=" << tke_base_val
1387  << "\n"
1388  << " updated theta=" << theta_new_val
1389  << " thetal=" << thetal_new_val
1390  << " qv=" << qv_new_val
1391  << " qc=" << qc_new_val
1392  << " qi=" << qi_new_val
1393  << " ql=" << ql_new
1394  << " qw=" << qw_new
1395  << " tke=" << tke_state_arr(ic, kk, 0)
1396  << "\n"
1397  << " deltas dtheta=" << delta_theta
1398  << " dqv=" << delta_qv
1399  << " dqc=" << delta_qc
1400  << " dqi=" << delta_qi
1401  << " dql=" << delta_ql
1402  << " dqw=" << delta_qw
1403  << "\n"
1404  << " tend_dt theta=" << dt_theta_tend
1405  << " qv=" << dt_qv_tend
1406  << " qc=" << dt_qc_tend
1407  << " qi=" << dt_qi_tend
1408  << " tke=" << dt_tke_tend
1409  << "\n"
1410  << " consistency dtheta_minus_tenddt=" << (delta_theta - dt_theta_tend)
1411  << " dqv_minus_tenddt=" << (delta_qv - dt_qv_tend)
1412  << " dqc_minus_tenddt=" << (delta_qc - dt_qc_tend)
1413  << " dqi_minus_tenddt=" << (delta_qi - dt_qi_tend)
1414  << "\n"
1415  << " pdf_cloud shoc_ql=" << shoc_ql_arr(ic, kk, 0)
1416  << " shoc_cond_dt=" << cond_dt
1417  << " shoc_evap_dt=" << evap_dt
1418  << " delta_ql=" << delta_ql
1419  << " delta_ql_minus_cond_minus_evap=" << (delta_ql - (cond_dt - evap_dt))
1420  << "\n"
1421  << " surf_sens_flux=" << surf_sens_flux_arr(ic, 0, 0)
1422  << " surf_lat_flux=" << surf_lat_flux_arr(ic, 0, 0)
1423  << " surf_tau_u=" << surf_tau_u_arr(ic, 0, 0)
1424  << " surf_tau_v=" << surf_tau_v_arr(ic, 0, 0)
1425  << " rho_sfc=" << cons_arr(i, j, k, Rho_comp)
1426  << "\n";
1427 
1428  if (has_hfx3) {
1429  msg << " raw hfx3(i,j,klo)=" << hfx3_host.const_array()(rep.i, rep.j, rep.k) << "\n";
1430  }
1431  if (has_qfx3) {
1432  msg << " raw qfx3(i,j,klo)=" << qfx3_host.const_array()(rep.i, rep.j, rep.k) << "\n";
1433  }
1434  if (has_tau13) {
1435  msg << " raw tau13(i,j,klo)=" << tau13_host.const_array()(rep.i, rep.j, rep.k)
1436  << " raw tau13(i+1,j,klo)=" << tau13_host.const_array()(rep.i + 1, rep.j, rep.k)
1437  << "\n";
1438  }
1439  if (has_tau23) {
1440  msg << " raw tau23(i,j,klo)=" << tau23_host.const_array()(rep.i, rep.j, rep.k)
1441  << " raw tau23(i,j+1,klo)=" << tau23_host.const_array()(rep.i, rep.j + 1, rep.k)
1442  << "\n";
1443  }
1444  msg << "NATIVE_SHOC_BAD_COLUMN_END\n";
1445  amrex::AllPrint() << msg.str() << std::flush;
1446  }
1447 
1449  amrex::Abort("Native SHOC debug_bad_column abort: bad SHOC column detected before state update");
1450  }
1451 }
#define Rho_comp
Definition: ERF_IndexDefines.H:61
auto qv_arr
Definition: ERF_InitCustomPert_MultiSpeciesBubble.H:222
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:139
auto rho_arr
Definition: ERF_UpdateWSubsidence_SineMassFlux.H:3
void print_shoc_debug_settings_once(const ShocRuntimeOptions &opts)
Definition: ERF_ShocDriver.cpp:75
FArrayBox copy_fab_to_host(const Fab &src)
Definition: ERF_ShocDriver.cpp:51
amrex::FArrayBox theta_v
Definition: ERF_ShocTypes.H:82
amrex::FArrayBox theta
Definition: ERF_ShocTypes.H:80
amrex::FArrayBox theta_base
Definition: ERF_ShocTypes.H:131
amrex::FArrayBox qi
Definition: ERF_ShocTypes.H:86
amrex::FArrayBox dz
Definition: ERF_ShocTypes.H:76
amrex::FArrayBox vw_sec
Definition: ERF_ShocTypes.H:125
amrex::FArrayBox shoc_evap
Definition: ERF_ShocTypes.H:117
amrex::FArrayBox tke_base_state
Definition: ERF_ShocTypes.H:137
amrex::FArrayBox qv_base
Definition: ERF_ShocTypes.H:132
amrex::FArrayBox uw_sec
Definition: ERF_ShocTypes.H:124
amrex::FArrayBox host_dse
Definition: ERF_ShocTypes.H:93
amrex::FArrayBox qc
Definition: ERF_ShocTypes.H:85
amrex::FArrayBox surf_tau_v
Definition: ERF_ShocTypes.H:149
amrex::FArrayBox tke
Definition: ERF_ShocTypes.H:89
amrex::FArrayBox p_int
Definition: ERF_ShocTypes.H:78
amrex::FArrayBox qi_base
Definition: ERF_ShocTypes.H:134
amrex::FArrayBox exner
Definition: ERF_ShocTypes.H:81
amrex::FArrayBox qc_base
Definition: ERF_ShocTypes.H:133
amrex::FArrayBox tabs
Definition: ERF_ShocTypes.H:88
amrex::FArrayBox qw
Definition: ERF_ShocTypes.H:87
amrex::FArrayBox qv
Definition: ERF_ShocTypes.H:84
amrex::FArrayBox p_mid
Definition: ERF_ShocTypes.H:77
amrex::FArrayBox wtke_sec
Definition: ERF_ShocTypes.H:126
amrex::FArrayBox surf_tau_u
Definition: ERF_ShocTypes.H:148
amrex::FArrayBox thetal_base
Definition: ERF_ShocTypes.H:130
amrex::FArrayBox thetal
Definition: ERF_ShocTypes.H:83
int imin
Definition: ERF_ShocTypes.H:63
int nlev
Definition: ERF_ShocTypes.H:62
int kmax
Definition: ERF_ShocTypes.H:66
int ncell
Definition: ERF_ShocTypes.H:61
int jmin
Definition: ERF_ShocTypes.H:64
int ny
Definition: ERF_ShocTypes.H:60
int nx
Definition: ERF_ShocTypes.H:59
int kmin
Definition: ERF_ShocTypes.H:65
int debug_bad_column_max_reports
Definition: ERF_ShocTypes.H:45
amrex::Real debug_bad_column_q_tend_threshold
Definition: ERF_ShocTypes.H:47
amrex::Real debug_bad_column_scalar_moment_threshold
Definition: ERF_ShocTypes.H:50
amrex::Real debug_bad_column_min_dz
Definition: ERF_ShocTypes.H:49
amrex::Real debug_bad_column_theta_tend_threshold
Definition: ERF_ShocTypes.H:46
bool debug_bad_column
Definition: ERF_ShocTypes.H:43
amrex::Real debug_bad_column_brunt_threshold
Definition: ERF_ShocTypes.H:48
bool debug_bad_column_abort
Definition: ERF_ShocTypes.H:44
Definition: ERF_ShocDriver.cpp:38

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
68 { return m_opts.debug_summary; }

◆ disables_momentum_transport()

bool ShocDriver::disables_momentum_transport ( ) const
883 {
885 }
bool shoc_disables_momentum_transport(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:47
Here is the call graph for this function:

◆ diss_tke_diagnostics()

const amrex::MultiFab& ShocDriver::diss_tke_diagnostics ( ) const
inline
105 { 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
325 {
326  const bool storage_changed =
327  !m_theta_tend_cc.isDefined() ||
328  !m_u_tend_fc.isDefined() ||
329  !m_v_tend_fc.isDefined() ||
330  !m_eddy_coeffs_cc.isDefined() ||
331  m_theta_tend_cc.boxArray() != cons.boxArray() ||
332  m_theta_tend_cc.DistributionMap() != cons.DistributionMap() ||
333  m_u_tend_fc.boxArray() != xvel.boxArray() ||
334  m_u_tend_fc.DistributionMap() != xvel.DistributionMap() ||
335  m_v_tend_fc.boxArray() != yvel.boxArray() ||
336  m_v_tend_fc.DistributionMap() != yvel.DistributionMap() ||
337  m_eddy_coeffs_cc.boxArray() != eddy_diffs.boxArray() ||
338  m_eddy_coeffs_cc.DistributionMap() != eddy_diffs.DistributionMap();
339 
340  if (storage_changed) {
341  m_column_workspaces.clear();
342  m_prev_turb_valid = false;
343  m_theta_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
344  m_qv_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
345  m_qc_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
346  m_qi_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
347  m_tke_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
348  m_u_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 1);
349  m_v_tend_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 1);
350  m_u_tend_fc.define(xvel.boxArray(), xvel.DistributionMap(), 1, 0);
351  m_v_tend_fc.define(yvel.boxArray(), yvel.DistributionMap(), 1, 0);
352  m_eddy_coeffs_cc.define(eddy_diffs.boxArray(), eddy_diffs.DistributionMap(),
353  EddyDiff::NumDiffs, 0);
354  m_prev_turb_cc.define(cons.boxArray(), cons.DistributionMap(), 2, 0);
355  m_prev_wthv_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
356  m_consumed_sens_flux_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
357  m_consumed_laten_flux_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
358  m_pblh_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
359  m_shoc_ustar_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
360  m_shoc_olen_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
361  m_shoc_cldfrac_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
362  m_shoc_ql_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
363  m_shoc_ql2_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
364  m_shoc_cond_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
365  m_w_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
366  m_wqls_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
367  m_wthv_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
368  m_thl_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
369  m_qw_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
370  m_qwthl_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
371  m_wthl_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
372  m_wqw_sec_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
373  m_w3_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
374  m_brunt_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
375  m_isotropy_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
376  m_shear_prod_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
377  m_buoy_prod_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
378  m_diss_tke_cc.define(cons.boxArray(), cons.DistributionMap(), 1, 0);
379  m_prev_turb_cc.setVal(0.0);
380  m_prev_wthv_sec_cc.setVal(0.0);
381  }
382  m_theta_tend_cc.setVal(0.0);
383  m_qv_tend_cc.setVal(0.0);
384  m_qc_tend_cc.setVal(0.0);
385  m_qi_tend_cc.setVal(0.0);
386  m_tke_tend_cc.setVal(0.0);
387  m_u_tend_cc.setVal(0.0);
388  m_v_tend_cc.setVal(0.0);
389  m_u_tend_fc.setVal(0.0);
390  m_v_tend_fc.setVal(0.0);
391  m_eddy_coeffs_cc.setVal(0.0);
392  m_consumed_sens_flux_cc.setVal(0.0);
393  m_consumed_laten_flux_cc.setVal(0.0);
394  m_pblh_cc.setVal(0.0);
395  m_shoc_ustar_cc.setVal(0.0);
396  m_shoc_olen_cc.setVal(0.0);
397  m_shoc_cldfrac_cc.setVal(0.0);
398  m_shoc_ql_cc.setVal(0.0);
399  m_shoc_ql2_cc.setVal(0.0);
400  m_shoc_cond_cc.setVal(0.0);
401  m_w_sec_cc.setVal(0.0);
402  m_wqls_sec_cc.setVal(0.0);
403  m_wthv_sec_cc.setVal(0.0);
404  m_thl_sec_cc.setVal(0.0);
405  m_qw_sec_cc.setVal(0.0);
406  m_qwthl_sec_cc.setVal(0.0);
407  m_wthl_sec_cc.setVal(0.0);
408  m_wqw_sec_cc.setVal(0.0);
409  m_w3_cc.setVal(0.0);
410  m_brunt_cc.setVal(0.0);
411  m_isotropy_cc.setVal(0.0);
412  m_shear_prod_cc.setVal(0.0);
413  m_buoy_prod_cc.setVal(0.0);
414  m_diss_tke_cc.setVal(0.0);
415 }
amrex::MultiFab m_prev_wthv_sec_cc
Definition: ERF_ShocDriver.H:123
amrex::MultiFab m_prev_turb_cc
Definition: ERF_ShocDriver.H:122
@ NumDiffs
Definition: ERF_IndexDefines.H:289

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
71  {
72  return m_consumed_sens_flux_cc.isDefined() && m_consumed_laten_flux_cc.isDefined();
73  }

Referenced by ERF::surface_flux_sources().

Here is the caller graph for this function:

◆ has_native_diagnostics()

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

Referenced by ERF::FillPlot2DVars().

Here is the caller graph for this function:

◆ isotropy_diagnostics()

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

◆ native_diagnostics()

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

◆ owns_scalar_surface_fluxes()

bool ShocDriver::owns_scalar_surface_fluxes ( ) const
889 {
890  return true;
891 }

Referenced by ERF::surface_flux_sources().

Here is the caller graph for this function:

◆ pblh_diagnostics()

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

Referenced by ERF::FillPlot2DVars().

Here is the caller graph for this function:

◆ print_debug_summary()

void ShocDriver::print_debug_summary ( double  dt) const
private
1455 {
1456  BL_PROFILE("SHOC::print_debug_summary");
1457 
1458  auto print_minmax = [] (const char* name, const MultiFab& mf, int comp) {
1459  amrex::Print() << " " << std::setw(12) << std::left << name
1460  << " min=" << mf.min(comp)
1461  << " max=" << mf.max(comp) << "\n";
1462  };
1463 
1464  amrex::Print() << "SHOC debug summary:"
1465  << " level=" << m_lev
1466  << " call=" << m_advance_calls
1467  << " dt=" << dt
1468  << " transport_mode=" << shoc_transport_mode_name(m_opts.transport_mode)
1469  << " momentum_transport=" << shoc_momentum_transport_name(m_opts.momentum_transport)
1470  << " state_update=on"
1471  << "\n";
1473 
1474  print_minmax("Kmv", m_eddy_coeffs_cc, EddyDiff::Mom_v);
1475  print_minmax("Khv", m_eddy_coeffs_cc, EddyDiff::Theta_v);
1476  print_minmax("KE_v", m_eddy_coeffs_cc, EddyDiff::KE_v);
1477  print_minmax("Q_v", m_eddy_coeffs_cc, EddyDiff::Q_v);
1478  print_minmax("l_turb", m_eddy_coeffs_cc, EddyDiff::Turb_lengthscale);
1479  print_minmax("pblh", m_pblh_cc, 0);
1480 
1481  print_minmax("th_tend", m_theta_tend_cc, 0);
1482  print_minmax("qv_tend", m_qv_tend_cc, 0);
1483  print_minmax("qc_tend", m_qc_tend_cc, 0);
1484  print_minmax("qi_tend", m_qi_tend_cc, 0);
1485  print_minmax("tke_tend", m_tke_tend_cc, 0);
1486  print_minmax("u_tend", m_u_tend_fc, 0);
1487  print_minmax("v_tend", m_v_tend_fc, 0);
1488  print_minmax("w_sec", m_w_sec_cc, 0);
1489  print_minmax("thl_sec", m_thl_sec_cc, 0);
1490  print_minmax("qw_sec", m_qw_sec_cc, 0);
1491  print_minmax("qwthl_sec", m_qwthl_sec_cc, 0);
1492  print_minmax("wthl_sec", m_wthl_sec_cc, 0);
1493  print_minmax("wqw_sec", m_wqw_sec_cc, 0);
1494  print_minmax("w3", m_w3_cc, 0);
1495  print_minmax("brunt", m_brunt_cc, 0);
1496  print_minmax("isotropy", m_isotropy_cc, 0);
1497  print_minmax("shear_prod", m_shear_prod_cc, 0);
1498  print_minmax("buoy_prod", m_buoy_prod_cc, 0);
1499  print_minmax("diss_tke", m_diss_tke_cc, 0);
1500  print_minmax("cldfrac", m_shoc_cldfrac_cc, 0);
1501  print_minmax("shoc_ql", m_shoc_ql_cc, 0);
1502  print_minmax("shoc_ql2", m_shoc_ql2_cc, 0);
1503  print_minmax("shoc_cond", m_shoc_cond_cc, 0);
1504  print_minmax("wqls_sec", m_wqls_sec_cc, 0);
1505  print_minmax("wthv_sec", m_wthv_sec_cc, 0);
1506 
1507  if (m_hfx3_ptr) print_minmax("hfx3_in", *m_hfx3_ptr, 0);
1508  if (m_qfx3_ptr) print_minmax("qfx3_in", *m_qfx3_ptr, 0);
1509  if (m_tau13_ptr) print_minmax("tau13_in", *m_tau13_ptr, 0);
1510  if (m_tau23_ptr) print_minmax("tau23_in", *m_tau23_ptr, 0);
1511 }
const char * shoc_transport_mode_name(ShocTransportMode mode)
Definition: ERF_ShocTransportStruct.H:22
const char * shoc_momentum_transport_name(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:31

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
96 { return m_qw_sec_cc; }

◆ qwthl_sec_diagnostics()

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

◆ seed_carried_buoyancy_flux()

void ShocDriver::seed_carried_buoyancy_flux ( ShocColumnData &  col,
const amrex::MFIter &  mfi 
) const
private
452 {
453  if (!m_prev_turb_valid) {
454  return;
455  }
456 
457  const auto carried = m_prev_wthv_sec_cc.const_array(mfi);
458  auto wthv_sec = col.wthv_sec.array();
459  const auto layout = col.layout;
460  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
461 
462  seed_carried_buoyancy_flux_impl(xy_box, layout, carried, wthv_sec);
463 }
void seed_carried_buoyancy_flux_impl(Box const &xy_box, ShocColumnLayout layout, Array4< const Real > const &carried, Array4< Real > const &wthv_sec)
Definition: ERF_ShocDriver.cpp:197

Referenced by advance().

Here is the call graph for this function:
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
422 {
423  const auto rho_host = cons.const_array(mfi);
424  const auto carried = m_prev_turb_cc.const_array(mfi);
425  const auto host_diff = eddy_diffs.const_array(mfi);
426  auto tk = col.tk.array();
427  auto tkh = col.tkh.array();
428  const bool prev_turb_valid = m_prev_turb_valid;
429  const auto layout = col.layout;
430  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
431 
432  seed_carried_turbulence_impl(xy_box, layout, rho_host, carried, host_diff,
433  tk, tkh, prev_turb_valid);
434 }
void seed_carried_turbulence_impl(Box const &xy_box, ShocColumnLayout layout, Array4< const Real > const &rho_host, Array4< const Real > const &carried, Array4< const Real > const &host_diff, Array4< Real > const &tk, Array4< Real > const &tkh, bool prev_turb_valid)
Definition: ERF_ShocDriver.cpp:152

Referenced by advance().

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

◆ set_diff_stresses()

void ShocDriver::set_diff_stresses ( ) const
826 {
827  BL_PROFILE("SHOC::set_diff_stresses");
828 
829  if (!m_hfx3_ptr || !m_qfx3_ptr) {
830  return;
831  }
832 
833  for (MFIter mfi(*m_hfx3_ptr, false); mfi.isValid(); ++mfi) {
834  const Box& vbx_cc = mfi.validbox();
835  const Box& vbx_xz = convert(vbx_cc, IntVect(1,0,1));
836  const Box& vbx_yz = convert(vbx_cc, IntVect(0,1,1));
837  auto hfx = m_hfx3_ptr->array(mfi);
838  auto qfx = m_qfx3_ptr->array(mfi);
839 
840  ParallelFor(vbx_cc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
841  hfx(i,j,k) = 0.0;
842  qfx(i,j,k) = 0.0;
843  });
844 
845  if (m_tau13_ptr && m_tau23_ptr) {
846  auto tau13 = m_tau13_ptr->array(mfi);
847  auto tau23 = m_tau23_ptr->array(mfi);
848  ParallelFor(vbx_xz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
849  tau13(i,j,k) = 0.0;
850  });
851  ParallelFor(vbx_yz, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
852  tau23(i,j,k) = 0.0;
853  });
854  }
855  }
856 }

Referenced by erf_slow_rhs_pre().

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

◆ set_eddy_diffs()

void ShocDriver::set_eddy_diffs ( ) const
814 {
815  BL_PROFILE("SHOC::set_eddy_diffs");
816 
819  m_eddy_diffs_ptr->nGrow());
820  MultiFab::Copy(*m_eddy_diffs_ptr, m_eddy_coeffs_cc,
822 }
constexpr int k_shoc_vertical_diff_count
Definition: ERF_ShocDriver.cpp:35
constexpr int k_shoc_vertical_diff_comp
Definition: ERF_ShocDriver.cpp:34

Referenced by erf_slow_rhs_pre().

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

◆ shear_prod_diagnostics()

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

◆ shoc_cldfrac_diagnostics()

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

◆ shoc_cond_diagnostics()

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

◆ shoc_olen_diagnostics()

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

Referenced by ERF::FillPlot2DVars().

Here is the caller graph for this function:

◆ shoc_ql2_diagnostics()

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

◆ shoc_ql_diagnostics()

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

◆ shoc_ustar_diagnostics()

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

Referenced by ERF::FillPlot2DVars().

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
468 {
469  auto carried = m_prev_wthv_sec_cc.array(mfi);
470  const auto wthv_sec = col.wthv_sec.const_array();
471  const auto layout = col.layout;
472  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
473 
474  store_carried_buoyancy_flux_impl(xy_box, layout, carried, wthv_sec);
475 }
void store_carried_buoyancy_flux_impl(Box const &xy_box, ShocColumnLayout layout, Array4< Real > const &carried, Array4< const Real > const &wthv_sec)
Definition: ERF_ShocDriver.cpp:213

Referenced by advance().

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

◆ store_carried_turbulence()

void ShocDriver::store_carried_turbulence ( const ShocColumnData &  col,
const amrex::MFIter &  mfi 
)
private
439 {
440  auto carried = m_prev_turb_cc.array(mfi);
441  const auto tk = col.tk.const_array();
442  const auto tkh = col.tkh.const_array();
443  const auto layout = col.layout;
444  const Box xy_box = amrex::makeSlab(mfi.validbox(), 2, layout.kmin);
445 
446  store_carried_turbulence_impl(xy_box, layout, carried, tk, tkh);
447 }
void store_carried_turbulence_impl(Box const &xy_box, ShocColumnLayout layout, Array4< Real > const &carried, Array4< const Real > const &tk, Array4< const Real > const &tkh)
Definition: ERF_ShocDriver.cpp:179

Referenced by advance().

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

◆ thl_sec_diagnostics()

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

◆ uses_momentum_state_update()

bool ShocDriver::uses_momentum_state_update ( ) const
877 {
879 }
bool shoc_uses_momentum_state_update(ShocMomentumTransport mode)
Definition: ERF_ShocTransportStruct.H:41

Referenced by advance(), and apply_state_update().

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
100 { return m_w3_cc; }

◆ w_sec_diagnostics()

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

◆ wqls_sec_diagnostics()

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

◆ wqw_sec_diagnostics()

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

◆ wthl_sec_diagnostics()

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

◆ wthv_sec_diagnostics()

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

Referenced by ERF::FillPlot2DVars().

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_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_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: