ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPert_KE.H
Go to the documentation of this file.
1 
2  ParmParse pp("prob");
3 
4  Real KE_0 = zero; pp.query("KE_0", KE_0);
5  Real KE_decay_height = -1; pp.query("KE_decay_height", KE_decay_height);
6  Real KE_decay_order = 1; pp.query("KE_decay_order" , KE_decay_order );
7 
8  const bool use_eb = (sc.terrain_type == TerrainType::EB);
9  const int klo = geomdata.Domain().smallEnd(2);
10  if (KE_decay_height > 0 &&
11  state_pert.nComp() > RhoKE_comp) {
12  amrex::Print() << "Initial KE profile (order " << KE_decay_order
13  << ") will extend up to " << KE_decay_height
14  << std::endl;
15  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(klo == bx.smallEnd(2),
16  "Vertical decomposition with KE initialization is not allowed.");
17  }
18 
19  if (state_pert.nComp() > RhoKE_comp) {
21  "KE_0 must be non-negative.");
22 
23  ParallelFor(bx, [=,one_d=one] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
24  {
25  // Set an initial value for SGS KE
26  state_pert(i, j, k, RhoKE_comp) = r_hse(i,j,k) * KE_0;
27  // scale initial SGS kinetic energy with height
28  if (KE_decay_height > 0) {
29  const Real z_sfc = (use_eb) ? zero :
30  fourth * ( z_nd(i ,j ,klo) + z_nd(i+1,j ,klo)
31  + z_nd(i ,j+1,klo) + z_nd(i+1,j+1,klo) );
32  const Real z_agl = z_cc(i,j,k) - z_sfc;
33  state_pert(i, j, k, RhoKE_comp) *= max(
34  std::pow(1 - min(z_agl/KE_decay_height,one_d), KE_decay_order),
35  amrex::Real(1e-12));
36  }
37  });
38  }
#define RhoKE_comp
Definition: ERF_IndexDefines.H:41
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
const int klo
Definition: ERF_InitCustomPert_KE.H:9
Real KE_0
Definition: ERF_InitCustomPert_KE.H:4
ParmParse pp("prob")
Real KE_decay_order
Definition: ERF_InitCustomPert_KE.H:6
Real KE_decay_height
Definition: ERF_InitCustomPert_KE.H:5
const bool use_eb
Definition: ERF_InitCustomPert_KE.H:8
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);})
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:30
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:35
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:29
amrex::Real Real
Definition: ERF_ShocInterface.H:19