ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_UpdateRhoQtSources_SDMCongestus3D.H
Go to the documentation of this file.
1  ParmParse pp_prob("prob");
2 
3  Real advection_moisture_rate = amrex::Real(1.0e-8); pp_prob.query("advection_moisture_rate" , advection_moisture_rate);
4  Real advection_moisture_rate_base = amrex::Real(1.0e-8); pp_prob.query("advection_moisture_rate_base", advection_moisture_rate_base);
5 
6  auto prob_lo = geom.ProbLoArray();
7  auto prob_hi = geom.ProbHiArray();
8  auto dx = geom.CellSizeArray();
9  // On a mesh other than ConstantDz, take the heights from the levels, not from dx[2]
10  const bool use_z_phys = use_physical_z();
11 
12  // Define a point (xc,yc,zc) at the center of the domain
13  auto xc = myhalf * (prob_lo[0] + prob_hi[0]);
14  auto yc = myhalf * (prob_lo[1] + prob_hi[1]);
15 
16  // Only apply temperature source below nominal inversion height
17  for (MFIter mfi(*qsrc, TilingIfNotGPU()); mfi.isValid(); ++mfi)
18  {
19  const auto &box = mfi.tilebox();
20  const Array4<Real>& qsrc_arr = qsrc->array(mfi);
21  if (box.length(0) != 1)
22  {
23  // if z dimension size is 1, then src is a spatially varying function over x,y at k=0
24  ParallelFor( box, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
25  {
26  auto x = prob_lo[0] + (i + myhalf) * dx[0];
27  auto y = prob_lo[1] + (j + myhalf) * dx[1];
28  auto z = use_z_phys ? d_zlevels_arr[k] : (k + myhalf) * dx[2];
29 
30  //const Real c = two*dx[0];
31  auto c = amrex::Real(1700.0)*amrex::Real(1700.0);
32  auto r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc));
33  auto rsqr = r*r;
34  if (time < 3600) {
35  qsrc_arr(i, j, k) = (advection_moisture_rate_base)*std::exp(-z/100);
36  } else {
37  qsrc_arr(i, j, k) = (advection_moisture_rate*std::exp(-rsqr / c))*std::exp(-z/100);
38  }
39  });
40  } else {
41  // src is a function over Z
42  ParallelFor(box, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
43  qsrc_arr(i, j, k) = zero;
44  });
45  }
46  }
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 zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
auto prob_lo
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:6
const bool use_z_phys
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:10
ParmParse pp_prob("prob")
auto yc
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:14
auto xc
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:13
Real advection_moisture_rate_base
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:4
Real advection_moisture_rate
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:3
auto prob_hi
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:7
auto dx
Definition: ERF_UpdateRhoQtSources_SDMCongestus3D.H:8