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