ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_UpdateRhoQtSources_SDMCongestus3DCold.H
Go to the documentation of this file.
1  ParmParse pp_prob("prob");
2 
3  Real advection_moisture_rate = 1.0e-8; pp_prob.query("advection_moisture_rate", advection_moisture_rate);
4  Real source_cutoff = 500.0; pp_prob.query("source_cutoff", source_cutoff);
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) at the center of the domain
13  Real xc = 0.5 * (prob_lo[0] + prob_hi[0]);
14  Real yc = 0.5 * (prob_lo[1] + prob_hi[1]);
15 
16  for (MFIter mfi(*qsrc, TilingIfNotGPU()); mfi.isValid(); ++mfi)
17  {
18  const auto &box = mfi.tilebox();
19  const Array4<Real>& qsrc_arr = qsrc->array(mfi);
20  if (box.length(0) != 1)
21  {
22  // Spatially varying source over x,y
23  ParallelFor(box, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
24  {
25  auto x = prob_lo[0] + (i + 0.5) * dx[0];
26  auto y = prob_lo[1] + (j + 0.5) * dx[1];
27  auto z = use_z_phys ? d_zlevels_arr[k] : (k + 0.5) * dx[2];
28 
29  const auto c = 1700.0*1700.0;
30  const auto r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc));
31  const auto rsqr = r*r;
32  qsrc_arr(i, j, k) = (advection_moisture_rate*exp(-rsqr / c))*exp(-z/source_cutoff);
33  });
34  } else {
35  // src is a function over Z only
36  ParallelFor(box, [=] AMREX_GPU_DEVICE(int i, int j, int k) {
37  qsrc_arr(i, j, k) = 0.0;
38  });
39  }
40  }
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::Real Real
Definition: ERF_ShocInterface.H:19
auto prob_lo
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:6
const bool use_z_phys
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:10
Real yc
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:14
ParmParse pp_prob("prob")
Real advection_moisture_rate
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:3
Real xc
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:13
auto prob_hi
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:7
Real source_cutoff
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:4
auto dx
Definition: ERF_UpdateRhoQtSources_SDMCongestus3DCold.H:8