ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_MassSource.H
Go to the documentation of this file.
1 #ifndef ERF_MASS_SOURCE_H_
2 #define ERF_MASS_SOURCE_H_
3 
4 #include <functional>
5 #include <cmath>
6 #include <memory>
7 #include <set>
8 #include <sstream>
9 #include <string>
10 
11 #include <AMReX_Geometry.H>
12 #include <AMReX_GpuContainers.H>
13 #include <AMReX_MultiFab.H>
14 #include <AMReX_MultiFabUtil.H>
15 #include <AMReX_ParmParse.H>
16 #include <AMReX_Reduce.H>
17 
18 #include "ERF_IndexDefines.H"
20 
21 /**
22  * A localized source of gas inside the domain (erf.mass_source.*), e.g. the release
23  * from a ruptured pipeline.
24  *
25  * The gas is injected at a total rate mdot(t) [kg/s], spread uniformly over the cells
26  * whose centers lie within erf.mass_source.radius of (center_x, center_y) horizontally
27  * and less than erf.mass_source.height above the local ground. The same source is
28  * added to
29  * - rho, so the mass enters the continuity equation (FullyCompressible only: the
30  * anelastic projection would remove it, and pseudo-incompressible levels do not
31  * support it either),
32  * - rho*theta, at erf.mass_source.theta if given and otherwise at the cell's own theta,
33  * so the injection by itself does not change the potential temperature, and
34  * - the first passive scalar (rho*s, plotted as rhoadv_0) when erf.mass_source.tracer
35  * is true, so that s is the mass fraction of the released gas.
36  * No momentum is added: the gas enters at rest. The gas has the properties of dry air
37  * (in a moist run it carries no water, so it dilutes the mixing ratios of the cells it
38  * enters). The cell volumes include the terrain metric and the map factors. In a
39  * periodic direction the region wraps around the domain. The rate table is in the time
40  * since the start of the run. Unknown erf.mass_source keys stop the run.
41  *
42  * With mesh refinement every level adds the same source density S = mdot / V to its own
43  * cells in the region, where V is the volume of the region on the composite grid: the
44  * cells of each level that the next finer level does not cover. The composite rate is
45  * then mdot however the levels cut the region, and a level without source cells adds
46  * nothing. V, and the height of the ground under each column, are recomputed only when
47  * the grids change.
48  *
49  * Inputs:
50  * erf.mass_source.center = x y [m]
51  * erf.mass_source.radius = r [m]
52  * erf.mass_source.height = h [m above the local ground]
53  * erf.mass_source.rate = mdot [kg/s >= 0] constant, or
54  * erf.mass_source.rate_file = file two columns "t mdot" [s, kg/s >= 0], '#' comments;
55  * linear in between, zero outside the table
56  * erf.mass_source.theta = theta [K > 0] optional
57  * erf.mass_source.tracer = true optional
58  */
59 namespace erf_mass_source {
60 
61 /// Is the center of cell (i,j,k) inside the source region? z is the nodal height z_phys_nd
62 /// and zg the nodal height of the ground under the column (2D, at k = kg). period holds the
63 /// domain length in x and y where the domain is periodic and 0 where it is not: there the
64 /// distance is to the nearest periodic image of the center, so the region wraps around
65 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool
66 in_source (int i, int j, int k,
67  amrex::Array4<amrex::Real const> const& z,
68  amrex::Array4<amrex::Real const> const& zg, int kg,
69  amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& problo,
70  amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& dx,
71  amrex::GpuArray<amrex::Real,2> const& period,
72  amrex::Real x0, amrex::Real y0, amrex::Real r2, amrex::Real hmax) noexcept
73 {
74  amrex::Real ddx = problo[0] + (i + amrex::Real(0.5)) * dx[0] - x0;
75  amrex::Real ddy = problo[1] + (j + amrex::Real(0.5)) * dx[1] - y0;
76  if (period[0] > 0) { ddx -= period[0] * std::floor(ddx / period[0] + amrex::Real(0.5)); }
77  if (period[1] > 0) { ddy -= period[1] * std::floor(ddy / period[1] + amrex::Real(0.5)); }
78  if (ddx * ddx + ddy * ddy > r2) { return false; }
79  const amrex::Real g = amrex::Real(0.25) * (zg(i,j,kg) + zg(i+1,j,kg) + zg(i,j+1,kg) + zg(i+1,j+1,kg));
80  const amrex::Real zc = amrex::Real(0.125) * (z(i,j,k ) + z(i+1,j,k ) + z(i,j+1,k ) + z(i+1,j+1,k ) +
81  z(i,j,k+1) + z(i+1,j,k+1) + z(i,j+1,k+1) + z(i+1,j+1,k+1));
82  return zc - g < hmax;
83 }
84 
85 /// The domain length in x and y where geom is periodic, 0 where it is not
86 inline amrex::GpuArray<amrex::Real,2>
87 periodic_lengths (const amrex::Geometry& geom)
88 {
89  return {geom.isPeriodic(0) ? geom.ProbLength(0) : amrex::Real(0),
90  geom.isPeriodic(1) ? geom.ProbLength(1) : amrex::Real(0)};
91 }
92 
93 } // namespace erf_mass_source
94 
96 {
97 public:
98  /// The source the inputs ask for, or nullptr when no erf.mass_source input is given.
99  /// Stops on an unknown erf.mass_source key (a misspelled one would otherwise be ignored,
100  /// and a misspelled rate would turn the source off) and on inputs without a rate.
101  static std::unique_ptr<MassSource> from_inputs ()
102  {
103  const std::string prefix = "erf.mass_source.";
104  const std::set<std::string> known = {"rate", "rate_file", "center", "radius",
105  "height", "theta", "tracer"};
106  bool any = false;
107  for (const auto& name : amrex::ParmParse::getEntries("erf.mass_source")) {
108  if (name.rfind(prefix, 0) != 0) { continue; }
109  any = true;
110  if (known.count(name.substr(prefix.size())) == 0) {
111  amrex::Abort("erf.mass_source: unknown input " + name + "; the inputs are rate, "
112  "rate_file, center, radius, height, theta and tracer");
113  }
114  }
115  amrex::ParmParse pp("erf.mass_source");
116  if (!pp.contains("rate") && !pp.contains("rate_file")) {
117  if (any) {
118  amrex::Abort("erf.mass_source: inputs are given but neither erf.mass_source.rate "
119  "nor erf.mass_source.rate_file");
120  }
121  return nullptr;
122  }
123  if (pp.contains("rate") && pp.contains("rate_file")) {
124  amrex::Abort("erf.mass_source: give rate or rate_file, not both");
125  }
126 
127  auto ms = std::make_unique<MassSource>();
128  amrex::Vector<amrex::Real> c;
129  pp.getarr("center", c);
130  if (c.size() != 2) { amrex::Abort("erf.mass_source.center must be two values: x y"); }
131  ms->m_x0 = c[0];
132  ms->m_y0 = c[1];
133  pp.get("radius", ms->m_radius);
134  pp.get("height", ms->m_height);
135  if (!(ms->m_radius > 0) || !(ms->m_height > 0)) {
136  amrex::Abort("erf.mass_source.radius and height must be positive");
137  }
138  ms->m_fixed_theta = pp.query("theta", ms->m_theta);
139  if (ms->m_fixed_theta && !(ms->m_theta > 0)) {
140  amrex::Abort("erf.mass_source.theta must be positive");
141  }
142  pp.query("tracer", ms->m_tracer);
143 
144  if (pp.contains("rate")) {
145  amrex::Real r;
146  pp.get("rate", r);
147  if (!(r >= 0)) { amrex::Abort("erf.mass_source.rate must be zero or positive"); }
148  ms->m_t = {amrex::Real(0)};
149  ms->m_mdot = {r};
150  ms->m_constant = true;
151  } else {
152  std::string fname;
153  pp.get("rate_file", fname);
154  ms->read_rate_file(fname);
155  }
156 
157  amrex::Print() << "Mass source: centre (" << ms->m_x0 << ", " << ms->m_y0 << ") m, radius "
158  << ms->m_radius << " m, up to " << ms->m_height << " m above the ground; ";
159  if (ms->m_constant) {
160  amrex::Print() << "constant rate " << ms->m_mdot[0] << " kg/s";
161  } else {
162  amrex::Print() << ms->m_t.size() << "-point rate table, t = " << ms->m_t.front()
163  << " to " << ms->m_t.back() << " s, total "
164  << ms->total_mass() << " kg";
165  }
166  if (ms->m_fixed_theta) {
167  amrex::Print() << "; theta " << ms->m_theta << " K";
168  } else {
169  amrex::Print() << "; at the theta of each cell";
170  }
171  amrex::Print() << (ms->m_tracer ? "; tracer in rhoadv_0" : "") << std::endl;
172  return ms;
173  }
174 
175  [[nodiscard]] amrex::Real x0 () const { return m_x0; }
176  [[nodiscard]] amrex::Real y0 () const { return m_y0; }
177 
178  /// Mass flow rate [kg/s] at time t (since the start of the run)
179  [[nodiscard]] amrex::Real rate (amrex::Real t) const
180  {
181  if (m_constant) { return m_mdot[0]; }
182  if (t < m_t.front() || t > m_t.back()) { return amrex::Real(0); }
183  amrex::Long n = 1;
184  while (n < m_t.size() - 1 && m_t[n] < t) { ++n; }
185  const amrex::Real w = (t - m_t[n-1]) / (m_t[n] - m_t[n-1]);
186  return (amrex::Real(1) - w) * m_mdot[n-1] + w * m_mdot[n];
187  }
188 
189  /// Total mass in the rate table [kg] (trapezoidal)
190  [[nodiscard]] amrex::Real total_mass () const
191  {
192  amrex::Real m = 0;
193  for (amrex::Long n = 1; n < m_t.size(); ++n) {
194  m += amrex::Real(0.5) * (m_mdot[n] + m_mdot[n-1]) * (m_t[n] - m_t[n-1]);
195  }
196  return m;
197  }
198 
199  /**
200  * Bring the ground heights and the composite source volume up to date with the grids:
201  * a no-op unless the BoxArray or DistributionMapping of a level, or the finest level,
202  * has changed since the last call. Aborts if no level has a cell center in the region.
203  * z_phys_nd and detJ must be allocated on every level. fill_ground(lev, slab)
204  * must fill a one-node-thick nodal slab at the bottom of the domain, on the footprint of
205  * every box of the level, with the ground heights (ERF::fill_surface_nodes, which
206  * interpolates them from coarser levels where the level does not reach the ground).
207  */
208  void update_geometry (int finest_level,
209  const amrex::Vector<amrex::Geometry>& geom,
210  const amrex::Vector<amrex::BoxArray>& grids,
211  const amrex::Vector<amrex::DistributionMapping>& dmap,
212  const amrex::Vector<amrex::IntVect>& ref_ratio,
213  const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& z_phys_nd,
214  const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& detJ,
215  const amrex::Vector<const amrex::MultiFab*>& mf_mx,
216  const amrex::Vector<const amrex::MultiFab*>& mf_my,
217  const std::function<void(int, amrex::MultiFab&)>& fill_ground)
218  {
219  bool same = (finest_level + 1 == static_cast<int>(m_lev.size()));
220  for (int lev = 0; same && lev <= finest_level; ++lev) {
221  same = (m_lev[lev].ba == grids[lev]) && (m_lev[lev].dm == dmap[lev]);
222  }
223  if (same) { return; }
224 
225  m_lev.clear();
226  m_lev.resize(finest_level + 1);
227  m_volume = 0;
228  for (int lev = 0; lev <= finest_level; ++lev) {
229  LevelGeometry& lg = m_lev[lev];
230  lg.ba = grids[lev];
231  lg.dm = dmap[lev];
232 
233  // The nodal height of the ground under every column of every box, on the
234  // box's own (i,j) range, so that a box that does not reach the bottom (a patch
235  // aloft, or a grid split in z) can tell how high its cells are
236  const int kg = geom[lev].Domain().smallEnd(2);
237  AMREX_ALWAYS_ASSERT(z_phys_nd[lev] && detJ[lev]);
238  amrex::BoxList bl = z_phys_nd[lev]->boxArray().boxList();
239  for (auto& b : bl) { b.setRange(2, kg); }
240  lg.ground = std::make_unique<amrex::MultiFab>(amrex::BoxArray(std::move(bl)),
241  z_phys_nd[lev]->DistributionMap(), 1, 0);
242  fill_ground(lev, *lg.ground);
243 
244  // Cells not covered by the next finer level count towards the composite volume
245  std::unique_ptr<amrex::iMultiFab> uncovered;
246  if (lev < finest_level) {
247  uncovered = std::make_unique<amrex::iMultiFab>(
248  amrex::makeFineMask(grids[lev], dmap[lev], grids[lev+1], ref_ratio[lev], 1, 0));
249  }
250 
251  const auto dx = geom[lev].CellSizeArray();
252  const auto problo = geom[lev].ProbLoArray();
253  const auto period = erf_mass_source::periodic_lengths(geom[lev]);
254  const amrex::Real x0 = m_x0, y0 = m_y0, r2 = m_radius * m_radius, hmax = m_height;
255  // dx in place of a dy over one cell, and the reverse: on an x-z slice mdot is the
256  // rate per dx of span
257  const auto len = LengthScaleCellSize(geom[lev]);
258  const amrex::Real dV0 = len[0] * len[1] * len[2];
259 
260  amrex::ReduceOps<amrex::ReduceOpSum, amrex::ReduceOpSum> reduce_op;
261  amrex::ReduceData<amrex::Real, amrex::Real> reduce_data(reduce_op);
262  for (amrex::MFIter mfi(grids[lev], dmap[lev]); mfi.isValid(); ++mfi) {
263  const amrex::Box& bx = mfi.validbox();
264  auto z = z_phys_nd[lev]->const_array(mfi);
265  auto zg = lg.ground->const_array(mfi);
266  auto dj = detJ[lev]->const_array(mfi);
267  auto mx = mf_mx[lev]->const_array(mfi);
268  auto my = mf_my[lev]->const_array(mfi);
269  const bool has_mask = (uncovered != nullptr);
270  auto msk = has_mask ? uncovered->const_array(mfi) : amrex::Array4<int const>{};
271  reduce_op.eval(bx, reduce_data,
272  [=] AMREX_GPU_DEVICE (int i, int j, int k) -> amrex::GpuTuple<amrex::Real, amrex::Real>
273  {
274  if (!erf_mass_source::in_source(i,j,k,z,zg,kg,problo,dx,period,x0,y0,r2,hmax)) {
275  return {amrex::Real(0), amrex::Real(0)};
276  }
277  const amrex::Real dV = dV0 * dj(i,j,k) / (mx(i,j,0) * my(i,j,0));
278  const amrex::Real u = (!has_mask || msk(i,j,k) == 1) ? dV : amrex::Real(0);
279  return {dV, u};
280  });
281  }
282  auto hv = reduce_data.value(reduce_op);
283  amrex::Real v[2] = {amrex::get<0>(hv), amrex::get<1>(hv)};
284  amrex::ParallelDescriptor::ReduceRealSum(v, 2);
285  lg.volume = v[0];
286  m_volume += v[1];
287  }
288 
289  if (!(m_volume > 0)) {
290  amrex::Abort("erf.mass_source: no cell centre lies inside the source region on any level; "
291  "make radius or height larger, or check that center is inside the domain");
292  }
293  amrex::Print() << "Mass source: region volume " << m_volume << " m^3 on the composite grid";
294  for (int lev = 0; lev <= finest_level; ++lev) {
295  amrex::Print() << (lev == 0 ? " (" : ", ") << "level " << lev << ": " << m_lev[lev].volume << " m^3";
296  }
297  amrex::Print() << ")" << std::endl;
298  }
299 
300  /**
301  * Add the source at time `time` to cc_src of `level` (per unit physical volume, as the
302  * other cell-centered sources). cons is the current conserved state and z_phys_nd the
303  * nodal heights of the level. update_geometry must have been called for the current grids.
304  */
305  void add_sources (int level,
306  amrex::MultiFab& cc_src,
307  const amrex::MultiFab& cons,
308  const amrex::MultiFab* z_phys_nd,
309  const amrex::Geometry& geom,
310  amrex::Real time) const
311  {
312  AMREX_ALWAYS_ASSERT(level < static_cast<int>(m_lev.size()) && m_volume > 0);
313  const LevelGeometry& lg = m_lev[level];
314  const amrex::Real mdot = rate(time);
315  if (mdot == amrex::Real(0) || lg.volume == amrex::Real(0)) { return; }
316 
317  const auto dx = geom.CellSizeArray();
318  const auto problo = geom.ProbLoArray();
319  const int kg = geom.Domain().smallEnd(2);
320  const auto period = erf_mass_source::periodic_lengths(geom);
321  const amrex::Real x0 = m_x0, y0 = m_y0, r2 = m_radius * m_radius, hmax = m_height;
322  AMREX_ALWAYS_ASSERT(z_phys_nd != nullptr);
323 
324  const amrex::Real S = mdot / m_volume; // [kg/m^3/s]
325  const bool fixed_theta = m_fixed_theta;
326  const amrex::Real theta_src = m_theta;
327  const bool tracer = m_tracer;
328 
329  for (amrex::MFIter mfi(cons); mfi.isValid(); ++mfi) {
330  const amrex::Box& bx = mfi.validbox();
331  auto z = z_phys_nd->const_array(mfi);
332  auto zg = lg.ground->const_array(mfi);
333  auto c = cons.const_array(mfi);
334  auto src = cc_src.array(mfi);
335  amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
336  {
337  if (!erf_mass_source::in_source(i,j,k,z,zg,kg,problo,dx,period,x0,y0,r2,hmax)) { return; }
338  const amrex::Real th = fixed_theta ? theta_src : c(i,j,k,RhoTheta_comp) / c(i,j,k,Rho_comp);
339  src(i,j,k,Rho_comp) += S;
340  src(i,j,k,RhoTheta_comp) += S * th;
341  if (tracer) { src(i,j,k,RhoScalar_comp) += S; }
342  });
343  }
344  }
345 
346 private:
347  void read_rate_file (const std::string& fname)
348  {
349  amrex::Vector<char> chars;
350  amrex::ParallelDescriptor::ReadAndBcastFile(fname, chars);
351  std::istringstream is(std::string(chars.dataPtr()));
352  std::string line;
353  while (std::getline(is, line)) {
354  std::string data = line.substr(0, line.find('#'));
355  if (data.find_first_not_of(" \t\r") == std::string::npos) { continue; } // blank or comment
356  std::istringstream ls(data);
357  amrex::Real t, m;
358  std::string extra;
359  if (!(ls >> t >> m) || (ls >> extra)) {
360  amrex::Abort("erf.mass_source.rate_file " + fname + ": a line is not two numbers, "
361  "time and rate: " + line);
362  }
363  if (!m_t.empty() && t <= m_t.back()) {
364  amrex::Abort("erf.mass_source.rate_file " + fname + ": times must increase strictly");
365  }
366  if (!(m >= 0)) {
367  amrex::Abort("erf.mass_source.rate_file " + fname + ": rates must be zero or positive");
368  }
369  m_t.push_back(t);
370  m_mdot.push_back(m);
371  }
372  if (m_t.size() < 2) {
373  amrex::Abort("erf.mass_source.rate_file " + fname + ": needs at least two rows");
374  }
375  }
376 
377  struct LevelGeometry {
378  amrex::BoxArray ba;
379  amrex::DistributionMapping dm;
380  std::unique_ptr<amrex::MultiFab> ground; // nodal ground height, one k layer per box
381  amrex::Real volume = 0; // source volume of this level's own cells
382  };
383 
384  amrex::Real m_x0 = 0, m_y0 = 0, m_radius = 0, m_height = 0;
385  amrex::Real m_theta = 0;
386  bool m_fixed_theta = false;
387  bool m_tracer = true;
388  bool m_constant = false;
389  amrex::Vector<amrex::Real> m_t, m_mdot;
390 
391  amrex::Vector<LevelGeometry> m_lev;
392  amrex::Real m_volume = 0; // source volume on the composite grid
393 };
394 
395 #endif
GpuArray< Real, AMREX_SPACEDIM > period
Definition: ERF_ActuatorSpreading.cpp:131
GpuArray< Real, AMREX_SPACEDIM > dx
Definition: ERF_ActuatorSpreading.cpp:131
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:65
#define Rho_comp
Definition: ERF_IndexDefines.H:61
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:62
auto problo
Definition: ERF_InitCustomPertVels_ABL.H:36
const Real zc
Definition: ERF_InitCustomPert_ABL.H:112
ParmParse pp("prob")
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
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);})
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:139
Definition: ERF_MassSource.H:96
amrex::Real y0() const
Definition: ERF_MassSource.H:176
amrex::Real m_x0
Definition: ERF_MassSource.H:384
amrex::Real rate(amrex::Real t) const
Mass flow rate [kg/s] at time t (since the start of the run)
Definition: ERF_MassSource.H:179
amrex::Vector< LevelGeometry > m_lev
Definition: ERF_MassSource.H:391
amrex::Real m_volume
Definition: ERF_MassSource.H:392
amrex::Real x0() const
Definition: ERF_MassSource.H:175
amrex::Real m_height
Definition: ERF_MassSource.H:384
void add_sources(int level, amrex::MultiFab &cc_src, const amrex::MultiFab &cons, const amrex::MultiFab *z_phys_nd, const amrex::Geometry &geom, amrex::Real time) const
Definition: ERF_MassSource.H:305
amrex::Real m_y0
Definition: ERF_MassSource.H:384
void read_rate_file(const std::string &fname)
Definition: ERF_MassSource.H:347
amrex::Real m_radius
Definition: ERF_MassSource.H:384
bool m_tracer
Definition: ERF_MassSource.H:387
amrex::Real total_mass() const
Total mass in the rate table [kg] (trapezoidal)
Definition: ERF_MassSource.H:190
bool m_constant
Definition: ERF_MassSource.H:388
amrex::Vector< amrex::Real > m_t
Definition: ERF_MassSource.H:389
amrex::Vector< amrex::Real > m_mdot
Definition: ERF_MassSource.H:389
void update_geometry(int finest_level, const amrex::Vector< amrex::Geometry > &geom, const amrex::Vector< amrex::BoxArray > &grids, const amrex::Vector< amrex::DistributionMapping > &dmap, const amrex::Vector< amrex::IntVect > &ref_ratio, const amrex::Vector< std::unique_ptr< amrex::MultiFab >> &z_phys_nd, const amrex::Vector< std::unique_ptr< amrex::MultiFab >> &detJ, const amrex::Vector< const amrex::MultiFab * > &mf_mx, const amrex::Vector< const amrex::MultiFab * > &mf_my, const std::function< void(int, amrex::MultiFab &)> &fill_ground)
Definition: ERF_MassSource.H:208
static std::unique_ptr< MassSource > from_inputs()
Definition: ERF_MassSource.H:101
amrex::Real m_theta
Definition: ERF_MassSource.H:385
bool m_fixed_theta
Definition: ERF_MassSource.H:386
constexpr int S
Definition: ERF_TwoStreamColumn.H:654
@ cons
Definition: ERF_IndexDefines.H:231
@ t
Definition: ERF_WSM6.H:295
Definition: ERF_MassSource.H:59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool in_source(int i, int j, int k, amrex::Array4< amrex::Real const > const &z, amrex::Array4< amrex::Real const > const &zg, int kg, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &problo, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dx, amrex::GpuArray< amrex::Real, 2 > const &period, amrex::Real x0, amrex::Real y0, amrex::Real r2, amrex::Real hmax) noexcept
Definition: ERF_MassSource.H:66
amrex::GpuArray< amrex::Real, 2 > periodic_lengths(const amrex::Geometry &geom)
The domain length in x and y where geom is periodic, 0 where it is not.
Definition: ERF_MassSource.H:87
real(c_double), parameter g
Definition: ERF_module_model_constants.F90:19
Definition: ERF_MassSource.H:377
amrex::Real volume
Definition: ERF_MassSource.H:381
amrex::DistributionMapping dm
Definition: ERF_MassSource.H:379
std::unique_ptr< amrex::MultiFab > ground
Definition: ERF_MassSource.H:380
amrex::BoxArray ba
Definition: ERF_MassSource.H:378