ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF.H
Go to the documentation of this file.
1 #ifndef ERF_H_
2 #define ERF_H_
3 
4 #include <algorithm>
5 #include <string>
6 #include <cstdint>
7 #include <limits>
8 #include <memory>
9 #include <set>
10 #include <vector>
11 
12 #ifdef _OPENMP
13 #include <omp.h>
14 #endif
15 
16 #include <AMReX_AmrCore.H>
17 #include <AMReX_BCRec.H>
18 #include <AMReX_Print.H>
19 
20 #include <AMReX_ParallelDescriptor.H>
21 #include <AMReX_ParmParse.H>
22 #include <AMReX_MultiFabUtil.H>
23 #include <AMReX_FillPatchUtil.H>
24 #include <AMReX_VisMF.H>
25 #include <AMReX_PhysBCFunct.H>
26 #include <AMReX_YAFluxRegister.H>
27 #include <AMReX_ErrorList.H>
28 #include <AMReX_EBFabFactory.H>
29 #include <AMReX_EBMultiFabUtil.H>
30 #include <AMReX_TableData.H>
31 
32 #include <ERF_EB.H>
34 #include "Prob/ERF_CloudChamber.H"
35 
36 #ifdef ERF_USE_FFT
37 #include <AMReX_FFT_Poisson.H>
38 #endif
39 
40 #ifdef AMREX_MEM_PROFILING
41 #include <AMReX_MemProfiler.H>
42 #endif
43 
44 #include "ERF_ProbCommon.H"
45 
46 #include <ERF_NumericalConstants.H>
47 #include <ERF_IndexDefines.H>
48 #include <ERF_DataStruct.H>
50 #include <ERF_TopographicShading.H>
51 #include <ERF_PlotfileSelection.H>
52 #include <ERF_BaseStateParams.H>
53 #include <ERF_TurbPertStruct.H>
54 #include <ERF_InputSoundingData.H>
56 #include <ERF_InputSpongeData.H>
57 #include <ERF_SurfaceLayer.H>
58 #include <ERF_Derive.H>
59 #include <ERF_ReadBndryPlanes.H>
60 #include <ERF_WriteBndryPlanes.H>
61 #include <ERF_MRI.H>
62 #include <ERF_PhysBCFunct.H>
63 #include <ERF_WallScalarBC.H>
64 #include <ERF_FillPatcher.H>
65 #include <ERF_SampleData.H>
66 #include <ERF_StationSampler.H>
67 #include <ERF_ObsNudging.H>
68 #include <ERF_ForestDrag.H>
69 #include <ERF_MassSource.H>
70 #include <ERF_IBFaceSet.H>
71 #include <ERF_Provenance.H>
72 
73 #ifdef ERF_USE_PARTICLES
74 #include "ERF_ParticleData.H"
75 #endif
76 
79 #include "ERF_LandSurface.H"
80 #ifdef ERF_USE_FIRE
81 #include "ERF_FireCoupler.H"
82 #endif
83 #ifdef ERF_USE_FLOOD
84 #include "ERF_FloodCoupler.H"
85 #endif
86 #ifdef ERF_USE_DUST
87 #include "ERF_DustModel.H"
88 #endif
89 #include "ERF_Urban.H"
90 #include "ERF_TwoStreamRadiation.H"
91 #include "ERF_WRFSurfaceFields.H"
93 
94 #ifdef ERF_USE_WINDFARM
95 #include "ERF_WindFarm.H"
96 #endif
97 #ifdef ERF_USE_MOVING_BODIES
98 #include "ERF_StructureModel.H"
99 #include "ERF_ActuatorSampling.H"
100 #endif
101 #include <ERF_SurfaceModel.H>
102 
103 #include <ERF_RadiationModels.H>
104 
105 #include "ERF_ShocDriver.H"
107 
108 #include <iostream>
109 
110 #ifdef AMREX_LAZY
111 #include <AMReX_Lazy.H>
112 #endif
113 
114 #ifndef AMREX_USE_MPI
115 using amrex::MPI_COMM_WORLD;
116 using amrex::MPI_Comm;
117 #endif
118 
119 #ifdef ERF_USE_MULTIBLOCK
120 class MultiBlockContainer;
121 #endif
122 
123 // Describes one component of a 2D plotfile; defined in
124 // IO/ERF_Plotfile2DSampledLevel.H, which ERF.H does not need to include.
126 // Defined in IO/ERF_CheckpointSurfaceTemperature.H
128 namespace erf_sbm {
129 class SBMAMRFluxRegister;
130 class SBMStateManager;
131 class SBMTransport;
132 }
133 
134 /**
135  * Main class in ERF code, instantiated from main.cpp
136 */
137 
138 class ERF
139  : public amrex::AmrCore
140 {
141 public:
142 
143  ////////////////
144  // public member functions
145 
146  // constructor - reads in parameters from inputs file
147  // - sizes multilevel arrays and data structures
148  ERF ();
149  ~ERF () override;
150 
151  void ERF_shared ();
152 
153  // Declare a default move constructor so we ensure the destructor is
154  // not called when we return an object of this class by value
155  ERF (ERF&&) noexcept = delete;
156 
157  // Declare a default move assignment operator
158  ERF& operator= (ERF&& other) noexcept = delete;
159 
160  // Delete the copy constructor
161  ERF (const ERF& other) = delete;
162  //
163  // Delete the copy assignment operator
164  ERF& operator= (const ERF& other) = delete;
165 
166  // Advance solution to final time
167  void Evolve ();
168  double EvolveOneStep (double time, double dt_request);
169 
170  void ConfigureDriverAtmosToOceanCoupling (bool use_coupling_driver,
171  bool use_two_way_coupling,
172  bool use_state_contract);
173  void SetDriverAtmosToOceanStateContract (bool use_state_contract);
174  // Driver currently consumes BoxArray/DistributionMapping only. If we later
175  // need exact copy semantics, promote this to expose IndexType/ngrow
176  // explicitly or return the underlying MultiFab pointer/reference instead.
177  void GetOceanToAtmosSurfaceLayout (amrex::BoxArray& ba,
178  amrex::DistributionMapping& dm);
179  // Returns pointers to level-0 lon_m/lat_m coordinate MultiFabs (populated
180  // by the WRF-grid init paths, e.g. ERF_InitFromWRFInput.cpp/ERF_InitFromMetgrid.cpp)
181  // used to build ocean->atmos remap weights. Sets both to nullptr if
182  // unavailable (e.g. idealized/non-WRF configurations).
183  //
184  // Staggering contract: both MultiFabs carry CELL index type and hold
185  // mass-point values whichever init path filled them -- init_from_wrfinput
186  // reads WRF's XLONG / XLAT and init_from_metgrid reads XLONG_M / XLAT_M.
187  // Ghost cells at the domain boundary are clamped copies of the edge cell,
188  // not extrapolations. These are not corners: a caller building a corner
189  // mesh must derive the corners itself. The name says cell centers so that a
190  // caller written against the old edge-staggered contract fails to compile
191  // instead of silently building its mesh half a cell off.
192  void GetOceanToAtmosCellCenterLonLat (const amrex::MultiFab*& lon_cc,
193  const amrex::MultiFab*& lat_cc) const;
194 
195  // Returns the level-0, current-time land mask (1 = land, 0 = water) used
196  // by the driver to exclude land cells from atmos->ocean remap stencils.
197  // Sets lmask to nullptr if unavailable.
198  void GetLandMask (const amrex::iMultiFab*& lmask) const;
199 
200  // True when a radiation model is *configured* at level 0. A coupling driver
201  // needs this to know whether the SWrad/LWrad lanes it would hand an ocean
202  // model carry real values or just zeros: passing zeros is worse than passing
203  // nothing, because the ocean model then suppresses its own radiative forcing
204  // in favor of them.
205  //
206  // Note this is a configuration predicate, not a data-validity one. rad_fluxes
207  // is allocated and zero-filled as soon as solverChoice.rad_type != None, so
208  // this returns true from level-0 allocation onward - including before the
209  // first AdvanceRadiation, when the fluxes are still exactly zero. A caller
210  // that needs "the lanes hold real radiation" must additionally know that a
211  // radiation step has run.
212  //
213  // RadiationType::Simple is excluded: it computes only a net upward LW flux,
214  // not the (SW up, SW down, LW up, LW down) components, so its rad_fluxes
215  // stay zero and must not be handed to an ocean model.
216  [[nodiscard]] bool HasRadiation () const {
217  return (!rad_fluxes.empty() && rad_fluxes[0] != nullptr) &&
218  (solverChoice.rad_type != RadiationType::Simple);
219  }
220 
221  // Whether ERF can pack cloud fraction on the atmos->ocean Cloud lane. The
222  // pack fills that lane only when moisture is active AND the moisture model
223  // carries cloud liquid or ice, so this mirrors that condition exactly; a
224  // driver that handed the lane over regardless would be passing its own
225  // prefill as though it were an ERF value.
226  //
227  // Like HasRadiation, this is a configuration predicate rather than a
228  // data-validity one: it says the lane will be filled, not that any moisture
229  // step has run yet.
230  [[nodiscard]] bool HasCloudWater () const {
234  }
235 
236  // Which atmos->ocean lanes PackAtmosphericStates actually writes here, as
237  // 0/1 in that routine's slot order: the 9-lane state view when
238  // state_contract, else the 8-lane flux view.
239  //
240  // A lane reported 0 is one the pack leaves untouched, so handing it over
241  // would pass the driver's own prefill off as an atmospheric value.
242  // HasRadiation()/HasCloudWater() answer this for two lanes; this covers all
243  // of them, and lives beside the pack so the gates cannot drift apart.
244  void GetFillableAtmosToOceanLanes (bool state_contract,
245  amrex::Vector<int>& can_fill) const;
246 
247  // Every lane is remapped from ERF's level-0 cell centers to REMORA's rho points with
248  // the one set of weights weight_mf/index_mf the driver builds for that pair of grids.
249  // The vectors (Uwind/Vwind and tau_x/tau_y) are sent as their eastward and northward
250  // components, turned from the grid axes with the grid orientation from lat_m/lon_m,
251  // so that the ocean can turn them to its own axes; the stress is averaged from the
252  // faces to the cell centers first.
253  // dst_mskr is REMORA's wet/dry mask (1 = wet, 0 = land) on the rho layout, applied
254  // to the scalar lanes (Patm, Tair, cloud) and to the flux lanes, tau_x/tau_y
255  // included, but deliberately NOT to Uwind/Vwind, so the wind lanes carry live
256  // atmospheric values over REMORA land while Patm/Tair carry fallbacks there. REMORA
257  // re-masks on its own side, so this asymmetry is currently harmless. Pass nullptr to
258  // skip masking.
259  void PackAtmosphericStates (amrex::Vector<amrex::MultiFab*>& states, double time,
260  const amrex::MultiFab& weight_mf,
261  const amrex::iMultiFab& index_mf,
262  int max_stencil_size,
263  const amrex::MultiFab* dst_mskr = nullptr);
264  // Apply ocean-model sea-surface temperature, and with erf.use_coupled_currents the
265  // surface current, to the ERF lower boundary.
266  //
267  // state[0] carries SST in Kelvin, and state[1] and state[2] the eastward and
268  // northward surface current in m/s, on the layout reported by
269  // GetOceanToAtmosSurfaceLayout. erf_coverage is the per-cell coverage flag on
270  // that same layout: nonzero where the driver's remap found at least one
271  // ocean donor for that ERF cell. A cell without one is at rest.
272  //
273  // Coverage is a contract, not a hint. Where erf_coverage is zero the ocean
274  // supplied nothing and state[0] holds the remap's zero fill, which is
275  // indistinguishable from a computed zero; ERF keeps its own wrflowinp SST
276  // there instead. Passing erf_coverage = nullptr therefore means "no cell is
277  // covered", not "every cell is covered" -- a driver that has coverage
278  // information must pass it.
279  void ApplyOceanSurfaceState (const amrex::Vector<amrex::MultiFab*>& state,
280  double time,
281  const amrex::iMultiFab* erf_coverage = nullptr);
282 
283  // Tag cells for refinement
284  void ErrorEst (int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow) override;
285 
286  // Fill mf (one component, one ghost cell) at level levc with the refinement field named
287  // field; returns whether its ghost cells were filled too
288  bool compute_tag_field (int levc, const std::string& field, amrex::Real time,
289  amrex::MultiFab& mf, amrex::TagBoxArray& tags);
290 
291  // Tag cells in a given box
292  void read_box_for_refinement (std::string& ref_prefix, int& lev_for_box, amrex::RealBox& real_box);
293  void update_box_for_refinement (std::string& ref_prefix, int& lev_for_box, amrex::RealBox& real_box, const double time);
294  void refinement_box_offset (const std::string& ref_prefix, const double time,
295  amrex::Real& offset_x, amrex::Real& offset_y);
296 
297  // Refinement criteria for hurricanes
298  void HurricaneTracker (int lev,
299  double time,
300  const amrex::MultiFab& cc_vel,
301  const amrex::Real velmag_threshold,
302  amrex::TagBoxArray* tags = nullptr);
303 
304  bool FindInitialEye (int lev,
305  const amrex::MultiFab& cc_vel,
306  const amrex::Real velmag_threshold,
307  amrex::Real& eye_x, amrex::Real& eye_y);
308 
309  // Hurricane track line output as VTKPolyline
310  amrex::Vector<std::array<amrex::Real, 2>> hurricane_track_xy;
311  amrex::Vector<std::array<amrex::Real, 2>> hurricane_eye_track_xy,
317  amrex::Vector<amrex::MultiFab> weather_forecast_data_1, weather_forecast_data_2;
318  amrex::Vector<amrex::Vector<amrex::MultiFab>> forecast_state_1,
321  amrex::Vector<amrex::MultiFab> surface_state_1,
324 
325  amrex::Vector<amrex::Vector<amrex::MultiFab>> bckgnd_state;
326 
327  amrex::Vector<amrex::MultiFab> mfvec_surface_fluxes;
328 
329  std::string MakeVTKFilename (int nstep);
330  std::string MakeVTKFilename_TrackerCircle (int nstep);
331  std::string MakeVTKFilename_EyeTracker_xy (int nstep);
332  std::string MakeFilename_EyeTracker_latlon (int nstep);
333  std::string MakeFilename_EyeTracker_maxvel (int nstep);
334  std::string MakeFilename_EyeTracker_minpressure (int nstep);
335  std::string MakeFilename_EyeTracker_surface_fluxes (int nstep);
336 
337  void WriteVTKPolyline (const std::string& filename,
338  const amrex::Vector<std::array<amrex::Real, 2>>& points_xy);
339 
340  void WriteLinePlot (const std::string& filename,
341  amrex::Vector<std::array<amrex::Real, 2>>& points_xy);
342 
344  const amrex::MultiFab& mf_cc_vel,
345  int& hurricane_eye_i_glob,
346  int& hurricane_eye_j_glob,
347  amrex::Real& hurricane_eye_latitude,
348  amrex::Real& hurricane_eye_longitude);
349 
351  const amrex::Geometry& geom,
352  const amrex::Vector<amrex::MultiFab>& S_data,
353  int& hurricane_eye_i_glob,
354  int& hurricane_eye_j_glob,
355  amrex::Real& hurricane_eye_latitude,
356  amrex::Real& hurricane_eye_longitude);
357 
359  const amrex::Geometry& geom,
360  const amrex::MultiFab& mf_cc_vel,
361  const amrex::Vector<amrex::MultiFab>& S_data,
362  int& hurricane_eye_i_glob,
363  int& hurricane_eye_j_glob,
364  amrex::Real& hurricane_eye_latitude,
365  amrex::Real& hurricane_eye_longitude);
366 
367  void ComputeGlobalMinLocation (const SolverChoice& sc,
368  const amrex::Geometry& geom,
369  const amrex::Vector<amrex::MultiFab>& S_data,
370  amrex::Real* d_val_min_ptr,
371  int* d_i_min_ptr,
372  int* d_j_min_ptr,
373  amrex::Real& global_val_min,
374  int& global_i_min,
375  int& global_j_min,
376  amrex::Real& hurricane_eye_latitude,
377  amrex::Real& hurricane_eye_longitude);
378 
379  void HurricaneMaxVelTracker (const amrex::Geometry& geom,
380  const amrex::MultiFab& mf_cc_vel,
381  const double& time);
382 
383  void HurricaneMinPressureTracker (MoistureType moisture_type,
384  const amrex::Geometry& geom,
385  const amrex::MultiFab& mf_cons_var,
386  const double& time);
387 
388  void HurricaneSurfaceFluxesTracker (const int& hurricane_eye_i_glob,
389  const int& hurricane_eye_j_glob,
390  const amrex::Real& hurricane_eye_latitude,
391  const amrex::Real& hurricane_eye_longitude,
392  const amrex::Real time);
393 
394  void HurricaneTrackerCircle ();
395 
396  void ReadStormTrackerRestart ();
397 
398  // Initialize multilevel data
399  void InitData ();
400 
401  // Initialize multilevel data before MultiBlock
402  void InitData_pre ();
403 
404  // Initialize multilevel data after MultiBlock
405  void InitData_post ();
406 
407  // Interpolate 2D arrays lat_m, lon_m, sinPhi, cosPhi
408  void Interp2DArrays (int lev, const amrex::BoxArray& my_ba2d, const amrex::DistributionMapping& my_dm);
409 
410  // Fill one time slice of a 2D time-series field (sst_lev or tsk_lev) at lev from lev-1
411  void Interp2DTimeSlice (int lev, int n,
412  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>>& field_lev,
413  const amrex::BoxArray& my_ba2d, const amrex::DistributionMapping& my_dm);
414 
415  // Fill the map factors at lev by interpolation from lev-1
416  void interp_mapfac_from_coarse (int lev);
417 
418  // Fill the surface pressure at lev by interpolation from lev-1
419  void interp_psfc_from_coarse (int lev);
420 
421  // Fill the land mask and the land / soil types at lev by injection from lev-1
422  void interp_land_masks_from_coarse (int lev);
423 
424  // True if this level read its own initialization file, so its map factors
425  // came from that file rather than from its parent
426  bool has_own_init_file (int lev) const;
427 
428  // Did the user supply a wrflowinp file for this level (erf.nc_low_file_<lev>, lev > 0)?
429  bool has_own_low_file (int lev) const;
430 
431  // Fill the coarse/fine ghost cells of the state (rho and the given components) and momenta
432  // used by an implicit vertical solve with coarse data at the given time; all other cells
433  // are left alone. Public because it launches device lambdas (CUDA requires it)
434  void FillCoarseFineGhostsForImplicit (int lev, double time,
435  amrex::MultiFab& cons,
436  const amrex::Vector<int>& cons_comps,
437  const amrex::Vector<amrex::MultiFab*>& mom);
438 
439  // Average the coarse level's recorded coarse/fine face fluxes over one substep of level lev
440  // (ERF_CFFluxHistory.cpp). Public because it launches device lambdas (CUDA requires it)
441  void cf_flux_history_targets (int lev, amrex::Real t_beg, amrex::Real t_end);
442 
443  // The reflux of the pressure impulse on the coarse/fine faces normal to the momentum
444  // (ERF_MomentumReflux.cpp, erf.momentum_reflux). Public because they launch device lambdas
445  // (CUDA requires it)
446  bool momentum_reflux_enabled () const;
447  amrex::MultiFab* momentum_reflux_pressure (int lev);
448  void momentum_reflux_add_slow (int lev, amrex::MultiFab& P, const amrex::MultiFab& cons,
449  const amrex::MultiFab& p0, const amrex::MultiFab& qt,
450  bool moist, amrex::Real dt_stage);
451  void momentum_reflux (int crse_lev);
452  void momentum_reflux_add_sources (int lev, amrex::MultiFab& xmom_src, amrex::MultiFab& ymom_src);
453  void momentum_reflux_reset ();
454  // The impulse still to be given, to and from a checkpoint
455  void write_momentum_reflux_checkpoint (const std::string& checkpointname) const;
456  void read_momentum_reflux_checkpoint (int lev);
457 
459 
460  // Compute the divergence -- whether EB, no-terrain, flat terrain or general terrain
461  void compute_divergence (int lev, amrex::MultiFab& rhs,
462  amrex::Array<amrex::MultiFab const*,AMREX_SPACEDIM> rho0_u_const,
463  amrex::MultiFab const& mf_mx, amrex::MultiFab const& mf_my,
464  amrex::MultiFab const& mf_vx, amrex::MultiFab const& mf_uy,
465  amrex::MultiFab const& ax_in, amrex::MultiFab const& ay_in,
466  amrex::MultiFab const& dJ_in,
467  amrex::Geometry const& geom_at_lev);
468 
469  // Does any map factor at this level differ from one?
470  bool has_nonunit_mapfac (int lev) const;
471 
472  // Does the projection at this level use the terrain Poisson solver? Always on a
473  // terrain-fitted mesh, on a flat mesh whose map factors are not all one (#4903),
474  // and at a pseudo-incompressible level (variable-coefficient operator)
475  bool projection_uses_terrain_solver (int lev) const;
476 
477  // Project the velocities to satisfy the level's divergence constraint -- this is only relevant
478  // at an anelastic or pseudo-incompressible level, or with erf.project_initial_velocity
479  void project_initial_velocity (int lev, double time, double dt);
480  void project_momenta (int lev, double l_time, double l_dt, amrex::Vector<amrex::MultiFab >& vars,
481  bool apply_if_drag);
482 
483  //! Face coefficients sigma = 1 / (1 + dt rate) of the implicit immersed drag in the projection
484  //! (erf.if_implicit_projection); 1 on faces on the boundary of the level's grids
485  void make_if_projection_sigma (int lev, amrex::Real l_dt, amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& sigma);
486 
487  // A refined level that stops inside the domain in z (ERF_CoarseFineFaces.cpp)
488  void cf_zface_coarse_at (int lev, double tc, bool conserved_rho,
489  const amrex::MultiFab& pz, const amrex::MultiFab& pmu, const amrex::MultiFab& pmv,
490  amrex::MultiFab& cOm, amrex::MultiFab& cRu, amrex::MultiFab& cRv);
491  bool cf_zface_coarse_data (int lev, double time, bool conserved_rho,
492  amrex::MultiFab& omega_t, amrex::MultiFab& rhou_g, amrex::MultiFab& rhov_g,
493  amrex::Vector<int>& slab_box);
494  void set_cf_zghost_projection (int lev, double time, amrex::MultiFab& xmom, amrex::MultiFab& ymom,
495  amrex::MultiFab& omega_t, amrex::Vector<int>& slab_box);
496  void set_cf_zface_omega (int lev, amrex::MultiFab& omega, const amrex::MultiFab& omega_t,
497  const amrex::Vector<int>& slab_box);
498  bool cf_interp_mass_flux (int lev) const;
499  bool cf_flat_mapfac (int lev) const;
500  void RegisterCoarseMomentumCF (int levc, const amrex::MultiFab& xold, const amrex::MultiFab& xnew,
501  const amrex::MultiFab& yold, const amrex::MultiFab& ynew,
502  const amrex::Vector<double>& times);
503  void RegisterCoarseZMomentumCF (int levc, const amrex::MultiFab& wold, const amrex::MultiFab& wnew,
504  const amrex::Vector<double>& times);
505  // Anelastic and pseudo-incompressible coarse/fine faces in time (ERF_CoarseFineFaces.cpp)
506  bool cf_anelastic_flux_match (int lev) const;
507  void cf_anelastic_record (int levc, int nrk);
508  void cf_anelastic_stage_registration (int lev, int nrk);
509  void average_down_mass_flux (int crse_lev);
510  bool cf_anelastic_stage1 (int lev) const;
511  // Whether each fine level is in the first stage of its step (cf_anelastic_stage_registration)
512  amrex::Vector<int> m_cf_stage1;
513  // The horizontal mass flux the level's last step applied (cf_anelastic_record)
514  amrex::Vector<amrex::Array<amrex::MultiFab, 2>> m_cf_step_flux;
515  // ... and its vertical flux, as Omega
516  amrex::Vector<amrex::MultiFab> m_cf_step_zflux;
517  void FillSetHorizontalMomentaCF (int lev, double time, amrex::MultiFab& xmom, amrex::MultiFab& ymom);
518  void FillSetZMomentumCF (int lev, double time, amrex::MultiFab& zmom);
519  // Give the face fills of level lev the log-law share of the wall coarse face's flux
520  // (erf.cf_loglaw_fill) for the set fills that follow, or clear it (on = false)
521  void set_cf_fill_options (int lev, bool on);
522  // Warn where a lateral coarse/fine boundary of level lev crosses the immersed surface so that
523  // the two levels describe it differently (erf.if_cf_mismatch_warning)
524  void check_if_cf_mismatch (int lev);
525  void FillSetMomentaCF (int lev, double time, amrex::MultiFab& xmom, amrex::MultiFab& ymom,
526  amrex::MultiFab& zmom);
527  void fill_surface_nodes (int lev, amrex::MultiFab& znd_surf);
528  // The stretched dz of a solve region's own layers
529  amrex::Gpu::DeviceVector<amrex::Real> make_sub_dz (int lev, const amrex::Box& subdomain);
530 
531  // Project the velocities to be divergence-free with a thin body
532  void project_velocity_tb (int lev, double dt, amrex::Vector<amrex::MultiFab >& vars);
533 
534  // Calculate wall distance by solving a Poisson equation
535  void poisson_wall_dist (int lev);
536 
537  // The RANS wall distance at this level (poisson_wall_dist plus the thin-body
538  // correction); called when the level is made and again whenever a regrid
539  // remakes or adds it, since init_stuff resets the field on new grids
540  void make_wall_dist (int lev);
541  //! Build the wall-face masks of the fraction-stress immersed wall law at this level
542  //! (erf.if_wall_form = fraction_stress; make_wall_dist calls it, so regrids rebuild them)
543  void make_ib_wall_face_masks_lev (int lev);
544 
545  void make_subdomains (const amrex::BoxList& ba, amrex::Vector<amrex::BoxArray>& bins);
546 
547 #ifdef ERF_USE_FFT
548  void build_fft_solvers (int lev);
549  void solve_with_fft (int lev, int isub, const amrex::Box& subdomain,
550  amrex::MultiFab& rhs, amrex::MultiFab& p,
551  amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& fluxes);
552 #endif
553  void solve_with_terrain_mlmg (int lev, const amrex::Box& subdomain,
554  amrex::MultiFab& rhs, amrex::MultiFab& p,
555  amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& fluxes,
556  amrex::MultiFab& ax_sub, amrex::MultiFab& ay_sub,
557  amrex::MultiFab& az_sub,
558  amrex::MultiFab& dJ_sub, amrex::MultiFab& znd_sub,
559  bool use_gmres);
560  //! The equation solve_with_terrain_mlmg solves, on a region of a flat mesh whose boxes
561  //! need not make a rectangle
562  void solve_with_flat_mlmg (int lev, const amrex::Box& subdomain,
563  amrex::MultiFab& rhs, amrex::MultiFab& phi,
564  amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& fluxes,
565  const amrex::MultiFab& ax_sub, const amrex::MultiFab& ay_sub,
566  const amrex::MultiFab& az_sub,
567  const amrex::MultiFab& dJ_sub, const amrex::MultiFab& znd_sub);
568  //! FFT-preconditioned GMRES solve of div(sigma grad phi) = rhs (erf.if_implicit_projection);
569  //! fluxes = -grad phi, without sigma
570  void solve_with_if_gmres (int lev, const amrex::Box& subdomain,
571  amrex::MultiFab& rhs, amrex::MultiFab& phi,
572  amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& fluxes,
573  amrex::Array<amrex::MultiFab const*,AMREX_SPACEDIM> const& sigma);
574  //! Multigrid solve of div(sigma grad phi) = rhs (erf.if_implicit_projection) where the FFT
575  //! preconditioner is not available; fluxes = -grad phi, without sigma
576  void solve_with_if_mlmg (int lev, amrex::Vector<amrex::MultiFab>& rhs, amrex::Vector<amrex::MultiFab>& phi,
577  amrex::Vector<amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>>& fluxes,
578  amrex::Array<amrex::MultiFab const*,AMREX_SPACEDIM> const& sigma);
579  void solve_with_gmres (int lev, const amrex::Box& subdomain,
580  amrex::MultiFab& rhs, amrex::MultiFab& p,
581  amrex::Array<amrex::MultiFab,AMREX_SPACEDIM>& fluxes,
582  amrex::MultiFab& ax_sub, amrex::MultiFab& ay_sub,
583  amrex::MultiFab& az_sub,
584  amrex::MultiFab& /*dJ_sub*/, amrex::MultiFab& znd_sub,
585  const amrex::MultiFab& mfux_sub, const amrex::MultiFab& mfvy_sub);
586 
587  void ImposeBCsOnPhi (int lev, amrex::MultiFab& phi, const amrex::Box& subdomain);
588 
589  // Init (NOT restart or regrid)
590  void init_only (int lev, double time);
591 
592  // Restart
593  void restart ();
594 
595  // Check for NaNs and other bad stuff
596  void check_state_for_nans (amrex::MultiFab const& S);
597  void check_vels_for_nans (amrex::MultiFab const& xvel, amrex::MultiFab const& yvel, amrex::MultiFab const& zvel);
598  void check_for_negative_theta (amrex::MultiFab& S);
599  void check_for_low_temp (amrex::MultiFab& S);
600 
602 
603  // Max of (buoyancy - vertical gradient of perturbational pressure);
604  // this is identically zero if the state is in HSE and buoyancy_type = 1
606 
607  void check_mesh_type (int lev);
608 
609  // Is it time to write a plotfile or checkpoint?
610  // Note that "cur_time" is always in double precision
611  bool writeNow (double cur_time, const int nstep, const int plot_int,
612  const double plot_per, const double dt_0, double& last_file_time);
613 
614  //! True when a level cannot sweep radiation itself -- no box on it holds a whole
615  //! column -- and so takes its radiation fields by interpolation from its parent.
616  [[nodiscard]] bool rad_level_needs_interpolation (int lev) const;
617 
618  //! Check a level's grids against radiation's need for whole columns when the level is
619  //! built: abort on a level 0 that is split in z, and warn on a fine level whose grids
620  //! reach both domain ends but are cut in z, since its radiation is then interpolated
621  //! from the parent.
622  void check_rad_level_grids (int lev, const amrex::BoxArray& ba);
623 
624  //! Fill a newly built level's two-stream SEB state from its parent
625  void fill_seb_from_coarse (int lev);
626 
627  //! With erf.radiation.seb_init_skin_from_file, start the two-stream SEB skin
628  //! temperature of the land columns of level lev from the initial file's TSK or SKINTEMP
629  void init_seb_skin_from_file (int lev);
630 
631  //! With erf.radiation.seb_init_t_deep_from_file, start the two-stream SEB deep
632  //! (restoring) temperature of the land columns of level lev from the initial file's TMN
633  void init_seb_t_deep_from_file (int lev);
634 
635  //! With erf.radiation.seb_init_soil_moisture_from_file, start the two-stream SEB soil
636  //! water (q_s and q_deep) of the land columns of level lev from the initial file's
637  //! SMOIS, averaged over the depths of the balance with the layer thicknesses DZS
638  void init_seb_soil_moisture_from_file (int lev);
639 
640  //! With erf.radiation.seb_surface_layer_uses_skin, hand the two-stream surface energy
641  //! balance's skin temperature of level lev to the zlo surface layer before it
642  //! computes its fluxes
643  void set_surface_layer_skin (int lev);
644 
645  //! Start-up checks of the two-stream balance's coupling with the zlo surface layer:
646  //! warnings for a scalar default the surface layer's flux replaces and for rotated
647  //! surface fluxes, aborts for erf.radiation.seb_surface_layer_uses_skin conflicts
648  void check_seb_surface_layer ();
649 
650  //! check_seb_surface_layer has run
652 
653  //! Per level: the "takes its radiation from its parent, no skin coupling" warning
654  //! of set_surface_layer_skin has been printed since the level last coupled
655  amrex::Vector<int> m_skin_uncoupled_warned;
656 
657  //! Per level: check_rad_level_grids has warned that the level's grids reach both domain
658  //! ends but are cut in z, since the level last stopped being so
659  amrex::Vector<int> m_rad_cut_in_z_warned;
660 
661  //! The zlo surface layer's applied heat and moisture fluxes for the two-stream
662  //! surface energy balance's H and LE, or nullptr where it applies none
663  void seb_surface_layer_fluxes (int lev,
664  const amrex::MultiFab*& sens_flux,
665  const amrex::MultiFab*& laten_flux) const;
666 
667  //! The conservative surface heat and moisture fluxes (z faces) applied to level
668  //! lev, or nullptr where there is none. The sensible_heat_flux/latent_heat_flux
669  //! 2D outputs and the two-stream surface energy balance both read them here.
670  void surface_flux_sources (int lev,
671  const amrex::MultiFab*& sens_flux,
672  const amrex::MultiFab*& laten_flux) const;
673 
674  // Called after every level 0 timestep
675  void post_timestep (int nstep, double time, double dt_lev);
676 
677  // Defined only in ERF_SBM_AMR_QUALIFICATION builds
678  // (Microphysics/SBM/ERF_SBMAMRQualification.cpp); public because they
679  // launch device lambdas.
682  void sbm_qualification_check_step (int nstep, amrex::Real correction_linf,
683  std::uint64_t reflux_calls,
684  std::uint64_t reflux_syncs);
685  void sbm_qualification_check_regrid (int lev, amrex::Long cells,
686  amrex::Long retained,
687  amrex::Long prolonged,
688  amrex::Long released,
689  const std::vector<amrex::Real>& inventory_before,
690  const std::vector<std::uint64_t>& phase_bytes);
691  [[nodiscard]] std::vector<amrex::Real>
693 
694  // SBM leaf-domain inventory and its boundary budget
695  // (Microphysics/SBM/ERF_SBMAMRCoupling.cpp); public because they launch device lambdas.
696  [[nodiscard]] std::vector<amrex::Real> sbm_composite_inventory () const;
698  void sbm_check_budget (int nstep);
699 
700  // Do whatever writing needs to be done at intermediate times
701  void WriteAtIntermediateTime (int nstep, double time);
702 
703  // Do whatever writing needs to be done after time-stepping is complete
704  void WriteAtFinalTime ();
705 
706  // Diagnostics
707  void sum_integrated_quantities (double time);
708  void sum_derived_quantities (double time);
709  void sum_energy_quantities (double time);
710 
711  void write_1D_profiles (double time);
712  void write_1D_profiles_stag (double time);
713 
714  // Fill the ghost cells the boundary planes read, then write the planes
715  void write_bndry_planes (int step, double time);
716 
717  amrex::Real cloud_fraction (double time);
718 
719  // Fill the physical boundary conditions for cell-centered velocity (diagnostic only)
720  void FillBdyCCVels (amrex::MultiFab& mf_cc_vel, amrex::Geometry& lev_geom);
721 
722  // Sample and write the lines of sampler, with the stresses and heat flux of each level
723  void run_line_sampler (LineSampler& sampler);
724  // The volume fraction of each level for line and plane sampling, or nullptr without
725  // immersed terrain
726  amrex::Vector<const amrex::MultiFab*> sampling_volfrac () const;
727  // The ground of each level for line sampling (station_ground), or nullptr where the
728  // sampler does not need it
729  amrex::Vector<const amrex::MultiFab*> sampling_ground (const LineSampler& sampler);
730 
731  void derive_diag_profiles (double time,
732  amrex::Gpu::HostVector<amrex::Real>& h_avg_u , amrex::Gpu::HostVector<amrex::Real>& h_avg_v,
733  amrex::Gpu::HostVector<amrex::Real>& h_avg_w , amrex::Gpu::HostVector<amrex::Real>& h_avg_rho,
734  amrex::Gpu::HostVector<amrex::Real>& h_avg_th , amrex::Gpu::HostVector<amrex::Real>& h_avg_ksgs,
735  amrex::Gpu::HostVector<amrex::Real>& h_avg_Kmv , amrex::Gpu::HostVector<amrex::Real>& h_avg_Khv,
736  amrex::Gpu::HostVector<amrex::Real>& h_avg_qv , amrex::Gpu::HostVector<amrex::Real>& h_avg_qc,
737  amrex::Gpu::HostVector<amrex::Real>& h_avg_qr ,
738  amrex::Gpu::HostVector<amrex::Real>& h_avg_wqv , amrex::Gpu::HostVector<amrex::Real>& h_avg_wqc,
739  amrex::Gpu::HostVector<amrex::Real>& h_avg_wqr ,
740  amrex::Gpu::HostVector<amrex::Real>& h_avg_qi , amrex::Gpu::HostVector<amrex::Real>& h_avg_qs,
741  amrex::Gpu::HostVector<amrex::Real>& h_avg_qg ,
742  amrex::Gpu::HostVector<amrex::Real>& h_avg_uu , amrex::Gpu::HostVector<amrex::Real>& h_avg_uv,
743  amrex::Gpu::HostVector<amrex::Real>& h_avg_uw,
744  amrex::Gpu::HostVector<amrex::Real>& h_avg_vv , amrex::Gpu::HostVector<amrex::Real>& h_avg_vw,
745  amrex::Gpu::HostVector<amrex::Real>& h_avg_ww,
746  amrex::Gpu::HostVector<amrex::Real>& h_avg_uth , amrex::Gpu::HostVector<amrex::Real>& h_avg_vth,
747  amrex::Gpu::HostVector<amrex::Real>& h_avg_wth, amrex::Gpu::HostVector<amrex::Real>& h_avg_thth,
748  amrex::Gpu::HostVector<amrex::Real>& h_avg_ku, amrex::Gpu::HostVector<amrex::Real>& h_avg_kv,
749  amrex::Gpu::HostVector<amrex::Real>& h_avg_kw,
750  amrex::Gpu::HostVector<amrex::Real>& h_avg_p,
751  amrex::Gpu::HostVector<amrex::Real>& h_avg_pu, amrex::Gpu::HostVector<amrex::Real>& h_avg_pv,
752  amrex::Gpu::HostVector<amrex::Real>& h_avg_pw, amrex::Gpu::HostVector<amrex::Real>& h_avg_wthv,
753  amrex::Gpu::HostVector<amrex::Real>& h_avg_thv);
754  void derive_diag_profiles_stag (double time,
755  amrex::Gpu::HostVector<amrex::Real>& h_avg_u , amrex::Gpu::HostVector<amrex::Real>& h_avg_v,
756  amrex::Gpu::HostVector<amrex::Real>& h_avg_w , amrex::Gpu::HostVector<amrex::Real>& h_avg_rho,
757  amrex::Gpu::HostVector<amrex::Real>& h_avg_th , amrex::Gpu::HostVector<amrex::Real>& h_avg_ksgs,
758  amrex::Gpu::HostVector<amrex::Real>& h_avg_Kmv , amrex::Gpu::HostVector<amrex::Real>& h_avg_Khv,
759  amrex::Gpu::HostVector<amrex::Real>& h_avg_qv , amrex::Gpu::HostVector<amrex::Real>& h_avg_qc,
760  amrex::Gpu::HostVector<amrex::Real>& h_avg_qr ,
761  amrex::Gpu::HostVector<amrex::Real>& h_avg_wqv , amrex::Gpu::HostVector<amrex::Real>& h_avg_wqc,
762  amrex::Gpu::HostVector<amrex::Real>& h_avg_wqr ,
763  amrex::Gpu::HostVector<amrex::Real>& h_avg_qi , amrex::Gpu::HostVector<amrex::Real>& h_avg_qs,
764  amrex::Gpu::HostVector<amrex::Real>& h_avg_qg ,
765  amrex::Gpu::HostVector<amrex::Real>& h_avg_uu , amrex::Gpu::HostVector<amrex::Real>& h_avg_uv,
766  amrex::Gpu::HostVector<amrex::Real>& h_avg_uw,
767  amrex::Gpu::HostVector<amrex::Real>& h_avg_vv , amrex::Gpu::HostVector<amrex::Real>& h_avg_vw,
768  amrex::Gpu::HostVector<amrex::Real>& h_avg_ww,
769  amrex::Gpu::HostVector<amrex::Real>& h_avg_uth , amrex::Gpu::HostVector<amrex::Real>& h_avg_vth,
770  amrex::Gpu::HostVector<amrex::Real>& h_avg_wth, amrex::Gpu::HostVector<amrex::Real>& h_avg_thth,
771  amrex::Gpu::HostVector<amrex::Real>& h_avg_ku, amrex::Gpu::HostVector<amrex::Real>& h_avg_kv,
772  amrex::Gpu::HostVector<amrex::Real>& h_avg_kw,
773  amrex::Gpu::HostVector<amrex::Real>& h_avg_p,
774  amrex::Gpu::HostVector<amrex::Real>& h_avg_pu, amrex::Gpu::HostVector<amrex::Real>& h_avg_pv,
775  amrex::Gpu::HostVector<amrex::Real>& h_avg_pw, amrex::Gpu::HostVector<amrex::Real>& h_avg_wthv,
776  amrex::Gpu::HostVector<amrex::Real>& h_avg_thv);
777 
778  void derive_stress_profiles (amrex::Gpu::HostVector<amrex::Real>& h_avg_tau11, amrex::Gpu::HostVector<amrex::Real>& h_avg_tau12,
779  amrex::Gpu::HostVector<amrex::Real>& h_avg_tau13, amrex::Gpu::HostVector<amrex::Real>& h_avg_tau22,
780  amrex::Gpu::HostVector<amrex::Real>& h_avg_tau23, amrex::Gpu::HostVector<amrex::Real>& h_avg_tau33,
781  amrex::Gpu::HostVector<amrex::Real>& h_avg_hfx3, amrex::Gpu::HostVector<amrex::Real>& h_avg_q1fx3,
782  amrex::Gpu::HostVector<amrex::Real>& h_avg_q2fx3, amrex::Gpu::HostVector<amrex::Real>& h_avg_diss);
783  void derive_stress_profiles_stag (amrex::Gpu::HostVector<amrex::Real>& h_avg_tau11, amrex::Gpu::HostVector<amrex::Real>& h_avg_tau12,
784  amrex::Gpu::HostVector<amrex::Real>& h_avg_tau13, amrex::Gpu::HostVector<amrex::Real>& h_avg_tau22,
785  amrex::Gpu::HostVector<amrex::Real>& h_avg_tau23, amrex::Gpu::HostVector<amrex::Real>& h_avg_tau33,
786  amrex::Gpu::HostVector<amrex::Real>& h_avg_hfx3, amrex::Gpu::HostVector<amrex::Real>& h_avg_q1fx3,
787  amrex::Gpu::HostVector<amrex::Real>& h_avg_q2fx3, amrex::Gpu::HostVector<amrex::Real>& h_avg_diss);
788 
789  void derive_forcing_profiles_stag (amrex::Gpu::HostVector<amrex::Real>& h_avg_ttend, amrex::Gpu::HostVector<amrex::Real>& h_avg_qtend,
790  amrex::Gpu::HostVector<amrex::Real>& h_avg_wsub, amrex::Gpu::HostVector<amrex::Real>& h_avg_thtend,
791  amrex::Gpu::HostVector<amrex::Real>& h_avg_qhtend, amrex::Gpu::HostVector<amrex::Real>& h_avg_tvtend,
792  amrex::Gpu::HostVector<amrex::Real>& h_avg_qvtend, amrex::Gpu::HostVector<amrex::Real>& h_avg_qcvtend,
793  amrex::Gpu::HostVector<amrex::Real>& h_avg_tnudge, amrex::Gpu::HostVector<amrex::Real>& h_avg_qnudge,
794  amrex::Gpu::HostVector<amrex::Real>& h_avg_unudge, amrex::Gpu::HostVector<amrex::Real>& h_avg_vnudge);
795 
796  // Perform the volume-weighted sum
797  amrex::Real
798  volWgtSumMF (int lev, const amrex::MultiFab& mf, int comp,
799  const amrex::MultiFab& dJ, const amrex::MultiFab& mfx, const amrex::MultiFab& mfy,
800  bool finemask, bool local = true);
801 
802  void
803  volWgtColumnSum (int lev, const amrex::MultiFab& mf, int comp,
804  amrex::MultiFab& mf_2d, const amrex::MultiFab& dJ);
805 
806  // Decide if it is time to take an action
807  static bool is_it_time_for_action (int nstep, double time, double dt,
808  int action_interval, double action_per);
809 
810  // Make a new level using provided BoxArray and DistributionMapping and
811  // fill with interpolated coarse level data.
812  // overrides the pure virtual function in AmrCore
813  void MakeNewLevelFromCoarse (int lev, amrex::Real time, const amrex::BoxArray& ba,
814  const amrex::DistributionMapping& dm) override;
815 
816  // Remake an existing level using provided BoxArray and DistributionMapping and
817  // fill with existing fine and coarse data.
818  // overrides the pure virtual function in AmrCore
819  void RemakeLevel (int lev, amrex::Real time, const amrex::BoxArray& ba,
820  const amrex::DistributionMapping& dm) override;
821 
822  // Delete level data
823  // overrides the pure virtual function in AmrCore
824  void ClearLevel (int lev) override;
825 
826  // Make a new level from scratch using provided BoxArray and DistributionMapping.
827  // Only used during initialization.
828  // overrides the pure virtual function in AmrCore
829  void MakeNewLevelFromScratch (int lev, amrex::Real time, const amrex::BoxArray& ba,
830  const amrex::DistributionMapping& dm) override;
831 
832  // What estTimeStep finds on a level besides the dt it returns
833  struct DtEstimateInfo {
834  // inverse dt at a Courant number of one behind the adaptive dt (compressible or
835  // anelastic, terrain aware); zero if the level does not constrain dt
836  double cfl_rate = 0.0;
837  // compressible dt estimate at erf.cfl, for the substep ratio (ComputeSubstepRatio)
838  double estdt_acoustic = 0.0;
839  // limits a fixed dt must respect whatever erf.cfl, checked by ComputeDt after the CFL
840  // limit of the fixed dt (CheckFixedDtHardLimits): the largest SBM donor outgoing rate
841  // (zero without SBM) and whether it includes particle mixing, and the cloud-chamber
842  // wall-transfer dt and rate
843  amrex::Real sbm_rate = amrex::Real(0.0);
844  bool sbm_mixing = false;
845  double wall_dt = std::numeric_limits<double>::infinity();
846  amrex::Real wall_rate = amrex::Real(0.0);
847  };
848 
849  // compute dt from CFL considerations; with cfl_rate_only, return after info.cfl_rate is set;
850  // sbm_mixing_density is required when SBM mixes particles (fill_sbm_mixing_density)
851  // unless cfl_rate_only
852  double estTimeStep (int lev, long& dt_fast_ratio, DtEstimateInfo& info,
853  const amrex::MultiFab* sbm_mixing_density,
854  bool cfl_rate_only = false) const;
855 
856  // CFL limit of a fixed dt on the levels lev_min to finest_level that have a new set of grids,
857  // and a warning, once per set of grids, on a level whose fixed dt exceeds erf.cfl; returns
858  // whether the fixed dt was lowered (ComputeDt, and CheckFixedDtCFLLimitAfterRegrid)
859  bool CheckFixedDtCFLLimit (const amrex::Vector<double>& cfl_rate, int lev_min, bool after_regrid);
860 
861  // CFL limit of a fixed dt on the levels a regrid of level lev just made or remade (timeStep)
862  void CheckFixedDtCFLLimitAfterRegrid (int lev);
863 
864  // abort if the fixed dt of level lev exceeds the SBM donor-positivity or cloud-chamber
865  // wall-transfer limit found by estTimeStep (ComputeDt, after the CFL limit of the fixed dt)
866  void CheckFixedDtHardLimits (int lev, const DtEstimateInfo& info) const;
867 
868  // ratio of slow to fast dt on a level with implicit acoustic substepping, from the
869  // compressible dt estimate of estTimeStep
870  void ComputeSubstepRatio (int lev, double estdt_comp_T, long& dt_fast_ratio) const;
871 
872  // largest explicit diffusion rates (eddy and molecular, 1/s) on level lev, momentum and scalars, for the
873  // diffusive time-step check (erf.diffusive_dt_check / erf.diffusive_dt_limit)
874  void ComputeDiffusiveRates (int lev, amrex::Real& rate_mom, amrex::Real& rate_scal) const;
875 
876  // print the largest terrain slope factor alpha = h dx/dz on level lev: always when force is
877  // true (new grids), otherwise only if it changed by more than 1 % since the last report
878  void ReportTerrainSlopeFactor (int lev, bool force);
879 
880  // with implicit substepping on a terrain-fitted mesh, turn on erf.use_variable_beta_s (unless
881  // the inputs set it) if erf.beta_s is below min(sigma^2, 1) on a w-face of level lev; called by
882  // ComputeDt and after a regrid for every new set of grids, and every step on a moving terrain
883  void CheckVariableBetaS (int lev);
884 
885  // return the largest terrain slope sigma^2 = h_xi^2 + h_eta^2 over the w-faces of level lev
886  amrex::Real ComputeMaxTerrainSlope (int lev);
887 
888  // on a terrain-fitted mesh, warn when the terrain next to an inflow or outflow face of
889  // level lev is steeper than erf_terrain_file::open_face_slope_warn and no steep-terrain
890  // option is on; called by ComputeDt for every new set of grids
891  void WarnSteepTerrainAtOpenFaces (int lev);
892 
893 #ifdef ERF_USE_WW3_COUPLING
894  //amrex::Print() << " About to call send_to_ww3 from ERF.H" << std::endl;
895  void send_to_ww3 (int lev);
896  //amrex::Print() << " About to call read_waves from ERF.H" << std::endl;
897  void read_waves (int lev);
898  //void send_to_ww3 (int lev);
899  //void read_waves (int lev);
900 
901  //void send_to_ww3 (int lev);
902 #endif
903 
904  // Interface for advancing the data at one level by one "slow" timestep
905  void advance_dycore (int level,
906  amrex::Vector<amrex::MultiFab>& state_old,
907  amrex::Vector<amrex::MultiFab>& state_new,
908  amrex::MultiFab& xvel_old, amrex::MultiFab& yvel_old, amrex::MultiFab& zvel_old,
909  amrex::MultiFab& xvel_new, amrex::MultiFab& yvel_new, amrex::MultiFab& zvel_new,
910  amrex::MultiFab& source, amrex::MultiFab& xmom_src,
911  amrex::MultiFab& ymom_src, amrex::MultiFab& zmom_src,
912  amrex::MultiFab& buoyancy, amrex::Geometry fine_geom,
913  double dt, double time);
914 
915  void advance_microphysics (int lev,
916  amrex::MultiFab& cons_in,
917  const double& dt_advance,
918  const int& iteration,
919  const double& time);
920 
921  // Set the surface precipitation accumulators of level lev under its finer level's
922  // ground-touching patches to the average of the finer level's (TwoWay coupling)
923  void average_down_precip_accumulators (int lev);
924 
925  void advance_lsm (int lev,
926  amrex::MultiFab& cons_in,
927  amrex::MultiFab& xvel_in,
928  amrex::MultiFab& yvel_in,
929  const double& time,
930  const double& dt_advance);
931 
932  void advance_urban (int lev,
933  amrex::MultiFab& cons_in,
934  amrex::MultiFab& u_in,
935  amrex::MultiFab& v_in,
936  const amrex::Real& dt_advance,
937  const amrex::Geometry& geom,
938  const amrex::MultiFab* z_phys_nd,
939  amrex::MultiFab& eddyDiffs_in);
940 
941  void advance_radiation (int lev,
942  amrex::MultiFab& cons_in,
943  const double& dt_advance);
944 
945  void compute_native_shoc_tendencies (int lev,
946  amrex::MultiFab* cons,
947  amrex::MultiFab* xvel,
948  amrex::MultiFab* yvel,
949  amrex::MultiFab* zvel,
950  amrex::Real* w_subsid,
951  amrex::MultiFab* tau13,
952  amrex::MultiFab* tau23,
953  amrex::MultiFab* hfx3,
954  amrex::MultiFab* qfx3,
955  amrex::MultiFab* eddyDiffs,
956  amrex::MultiFab* z_phys_nd,
957  const double& dt_advance);
958 
959  void build_fine_mask (int lev, amrex::MultiFab& fine_mask);
960 
961  void MakeHorizontalAverages ();
962  void MakeDiagnosticAverage (amrex::Vector<amrex::Real>& h_havg, amrex::MultiFab& S, int n);
963  void derive_upwp (amrex::Vector<amrex::Real>& h_havg);
964 
965  // Write plotfile to disk
966  bool Write3DPlotFile (int which, PlotFileType plotfile_type, amrex::Vector<std::string> plot_var_names);
967  void WriteEBLevelSet ();
968  void Write2DPlotFile (int which, PlotFileType plotfile_type, amrex::Vector<std::string> plot_var_names);
969  void ResetIntervalMeansAfter3DPlotfileBatch (int plotfiles_written,
970  bool interval_diagnostic_consumed);
971  void ResetIntervalMeans ();
972 
973  // Write subvolume of data into a different "plotfile"
974  void WriteSubvolume (int isub, amrex::Vector<std::string> subvol_var_names);
975 
976  void WriteMultiLevelPlotfileWithTerrain (const std::string &plotfilename,
977  int nlevels,
978  const amrex::Vector<const amrex::MultiFab*> &mf,
979  const amrex::Vector<const amrex::MultiFab*> &mf_nd,
980  const amrex::Vector<std::string> &varnames,
981  const amrex::Vector<amrex::Geometry>& my_geom,
982  double time,
983  const amrex::Vector<int> &level_steps,
984  const amrex::Vector<amrex::IntVect>& my_ref_ratio,
985  const std::string &versionName = "HyperCLaw-V1.1",
986  const std::string &levelPrefix = "Level_",
987  const std::string &mfPrefix = "Cell",
988  const amrex::Vector<std::string>& extra_dirs = amrex::Vector<std::string>()) const;
989 
990 
991  void WriteGenericPlotfileHeaderWithTerrain (std::ostream &HeaderFile,
992  int nlevels,
993  const amrex::Vector<amrex::BoxArray> &bArray,
994  const amrex::Vector<std::string> &varnames,
995  const amrex::Vector<amrex::Geometry>& my_geom,
996  double time,
997  const amrex::Vector<int> &level_steps,
998  const amrex::Vector<amrex::IntVect>& my_ref_ratio,
999  const std::string &versionName,
1000  const std::string &levelPrefix,
1001  const std::string &mfPrefix) const;
1002 
1003  // Filling the plot variables, and the station sampling that reuses it. Split
1004  // out of the plotfile writers so that a station column and the corresponding
1005  // plotfile component are produced the same way. Private for the same reason
1006  // canonicalizePlot3DVariables above is: this is output machinery rather than
1007  // something ERF offers a caller.
1008 
1009  // Per-level scratch needed to evaluate the 3D plot variables. Held by the
1010  // caller so that the work is done once for a set of variables and then
1011  // reused for every level that is filled.
1013  {
1014  amrex::Vector<amrex::MultiFab> mf_cc_vel; // cell-centered velocity, 1 ghost
1015  amrex::Vector<amrex::MultiFab> mf_cc_tau; // cell-centered stress tensor
1016  amrex::Vector<amrex::MultiFab> mf_cc_fx; // cell-centered SFS fluxes
1017  };
1018 
1019  void FillPlot2DVars (int lev,
1020  const amrex::Vector<std::string>& plot_var_names,
1021  const amrex::Vector<std::string>& varnames,
1022  const amrex::Vector<plotfile2d::Plotfile2DOutputDescriptor>& output_descriptors,
1023  amrex::MultiFab& mf_dst,
1024  int ncomp_mf);
1025 
1026  void FillPlot3DVars (int lev,
1027  const amrex::Vector<std::string>& plot_var_names,
1028  Plot3DScratch& scratch,
1029  amrex::MultiFab& mf_dst,
1030  int ncomp_mf,
1031  amrex::Real tnew);
1032 
1033  // max_lev caps the levels whose scratch is built, -1 meaning every level: a
1034  // caller that reads only the coarse levels should not pay for the fine ones.
1035  // sync_solution allows the microphysics average-down, which the plotfile
1036  // writer wants but a diagnostic that runs at every step must not do, since
1037  // it changes the coarse solution.
1038  void BuildPlot3DScratch (const amrex::Vector<std::string>& plot_var_names,
1039  Plot3DScratch& scratch,
1040  int max_lev = -1,
1041  bool sync_solution = true);
1042 
1043  // Station time-series output
1044  void init_stations ();
1045  void resolve_station_positions ();
1046  void resolve_station_stencils ();
1047  void sample_stations (amrex::Real time);
1048  void flush_stations () const;
1049  // The nodes a station's terrain elevation is read from, at k = the bottom of
1050  // the domain: z_phys_nd, or with immersed-forcing terrain the immersed surface
1051  const amrex::MultiFab& station_ground (int lev);
1052 
1053  // Nudging towards observations at stations
1054  void init_obs_nudging ();
1055 
1056  void erf_enforce_hse (int lev,
1057  amrex::MultiFab& dens, amrex::MultiFab& pres, amrex::MultiFab& pi,
1058  amrex::MultiFab& th, amrex::MultiFab& qv,
1059  std::unique_ptr<amrex::MultiFab>& z_cc);
1060 
1061  void init_from_input_sounding (int lev);
1062 
1063  /**
1064  * Build the hydrostatic base state of level lev from the input sounding, as a fresh
1065  * start does: the profile sampled at this level's heights, rebalanced column by
1066  * column, with p_0 and pi_0 recomputed. The lateral ghost cells are built the same
1067  * way as the valid cells, so each holds the column it would hold were it valid, and
1068  * the base state is one field in balance everywhere, whichever box a cell is a
1069  * ghost cell of. Not for SoundingType::ConstantDensity, whose base state comes from
1070  * initHSE.
1071  */
1072  void build_base_state_from_input_sounding (int lev, amrex::MultiFab& base_state_mf);
1073 
1074  // The input-sounding base state on the boxes of bs_g at the resolution of level lev
1075  void build_base_state_from_input_sounding_on (int lev, amrex::MultiFab& bs_g,
1076  const amrex::MultiFab& z_nd_g,
1077  const amrex::MultiFab* z_cc_g);
1078 
1079  /**
1080  * Whether the base state of level lev is the average of the base state of the mesh at
1081  * max_level resolution over its columns, with the cell-center heights placed so that it is
1082  * in discrete hydrostatic balance (ERF_NestedBaseState.cpp). The levels' base states then
1083  * nest: the mass, (rho theta) and (rho qv) of the base state in a coarse cell are those of
1084  * the fine cells it holds, as its volume is their volume (metrics_from_finest).
1085  */
1086  bool nested_base_state (int lev);
1087 
1088  // Build the nested base state of level lev in bs (on lev's grids) and place z_phys_cc[lev]
1089  void build_nested_base_state (int lev, amrex::MultiFab& bs);
1090 
1091  // The nodal heights of a flat mesh at level lev's resolution on the boxes of z_nd
1092  void flat_heights (int lev, amrex::MultiFab& z_nd);
1093 
1094  /**
1095  * Rebuild level lev's base state from the input sounding after a regrid made or
1096  * remade the level, replacing the interpolation from the coarser level that the
1097  * regrid filled it with. The state is not touched. Next to the bottom and top
1098  * walls that interpolation has no vertical slope, which puts p_0 out of hydrostatic
1099  * balance by about rho_0 g dz there (erf-model/ERF#5236).
1100  */
1101  void rebuild_base_state_from_input_sounding (int lev, amrex::MultiFab& base_state_mf);
1102 
1103  // Rebuild base_state[lev] after a regrid made or remade level lev, by the construction
1104  // the run was initialized with where it can be repeated and from the coarser level
1105  // otherwise, then check it (erf-model/ERF#5228, #5236)
1106  void rebuild_base_state (int lev);
1107 
1108  // Rebuild base_state[lev] in hydrostatic balance from the coarser level alone
1109  void rebuild_base_state_from_coarse (int lev);
1110 
1111  // A copy of bs, a base state of level lev, on the boxes of bs's BoxArray grown laterally
1112  // by grow, with ng ghost cells, and level lev's heights on the same boxes (z_nd_g nodal,
1113  // z_cc_g cell-centered, both with ng ghost cells). Building a base state there builds
1114  // bs's ghost cells as valid cells: grow + ng must not exceed bs's lateral ghost cells.
1115  void make_base_state_on_grown_boxes (int lev, const amrex::MultiFab& bs, int grow,
1116  const amrex::IntVect& ng, amrex::MultiFab& bs_g,
1117  std::unique_ptr<amrex::MultiFab>& z_nd_g,
1118  std::unique_ptr<amrex::MultiFab>& z_cc_g);
1119 
1120  // Copy a base state built on the grown boxes of make_base_state_on_grown_boxes back into bs
1121  void copy_base_state_from_grown_boxes (int lev, amrex::MultiFab& bs, const amrex::MultiFab& bs_g);
1122 
1123  // Abort (or, with abort_if_fail false, warn) if base_state[lev] is out of discrete
1124  // hydrostatic balance in the valid region
1125  void check_base_state_hse (int lev, const std::string& when, bool abort_if_fail = true);
1126 
1127  /**
1128  * The input sounding sampled at the cell centers of level lev. Level 0 is
1129  * input_sounding_data itself; a finer level gets its own copy, resampled at
1130  * geom[lev] / zlevels_stag[lev], so that its profile index k is its own cell k
1131  * and no fine cell blends in the surface line of the sounding.
1132  */
1133  const InputSoundingData& sounding_at_level (int lev);
1134 
1135  /**
1136  * The large-scale forcing profiles interpolated to the cell centers of level lev.
1137  * Level 0 is lsf itself; a finer level gets its own copy, interpolated at
1138  * geom[lev] / zlevels_stag[lev] against sounding_at_level(lev), so that its profile
1139  * index k is its own cell k.
1140  */
1141  const LargeScaleForcingData& lsf_at_level (int lev);
1142 
1143  void init_immersed_forcing (int lev);
1144 
1145  // Immersed-boundary surface energy balance (Source/ImmersedBoundarySEB)
1146  void init_ibseb ();
1147  void ibseb_check_refined_levels () const;
1148  void ibseb_check_sun_matches_two_stream () const;
1149  void ibseb_check_two_stream_provider () const;
1150  void ibseb_check_two_stream_buildings () const;
1151  void ibseb_give_ground_walls (int lev);
1152  void ibseb_give_roofs (int lev);
1153  [[nodiscard]] bool ibseb_two_stream_buildings () const {
1154  return ibseb_params.enable && ibseb_params.two_stream_buildings && solverChoice.rad_type == RadiationType::TwoStream;
1155  }
1156  [[nodiscard]] bool ibseb_after_radiation () const {
1157  return ibseb_params.enable && ibseb_params.radiation == "two_stream";
1158  }
1159  void ibseb_set_two_stream_sun (int lev, amrex::Real time);
1160  void ibseb_write_checkpoint (const std::string& checkpointname, int lev) const;
1161  void ibseb_report (int nstep, amrex::Real time);
1162  amrex::Real ibseb_bulk_richardson_height (int lev, const amrex::MultiFab& cons,
1163  const amrex::MultiFab& xvel, const amrex::MultiFab& yvel);
1164  void ibseb_advance (int lev, amrex::Real time, amrex::Real dt_lev, const amrex::MultiFab& cons,
1165  const amrex::MultiFab& xvel, const amrex::MultiFab& yvel, const amrex::MultiFab& zvel);
1166 
1167  void input_sponge (int lev);
1168 
1169  void init_from_hse (int lev);
1170 
1171  void init_thin_body (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm);
1172 
1173  void FillForecastStateMultiFabs (const int lev,
1174  const std::string& filename,
1175  const std::unique_ptr<amrex::MultiFab>& z_phys_nd,
1176  amrex::Vector<amrex::Vector<amrex::MultiFab>>& forecast_state);
1177 
1178  void FillSurfaceStateMultiFabs (const int lev,
1179  const std::string& filename,
1180  amrex::Vector<amrex::MultiFab>& surface_state);
1181 
1182 
1183  void WeatherDataInterpolation (const int nlevs,
1184  const double time,
1185  amrex::Vector<std::unique_ptr<amrex::MultiFab>>& z_phys_nd,
1186  bool regrid_forces_file_read);
1187 
1188  void SurfaceDataInterpolation (const int nlevs,
1189  const double time,
1190  amrex::Vector<std::unique_ptr<amrex::MultiFab>>& z_phys_nd,
1191  bool regrid_forces_file_read);
1192 
1194  amrex::MultiFab& mf_cc_pert,
1195  amrex::MultiFab& cons_pert,
1196  amrex::MultiFab& xvel_pert,
1197  amrex::MultiFab& yvel_pert,
1198  amrex::MultiFab& zvel_pert);
1199 
1200  void create_random_perturbations (const int lev,
1201  amrex::MultiFab& mf_cc_pert);
1202 
1203  void apply_gaussian_smoothing_to_perturbations (const int lev,
1204  amrex::MultiFab& mf_cc_pert);
1205 
1206  void ComputeAndWriteEnsemblePerturbations (const int da_iter);
1207 
1208  void PerformDataAssimilation (int da_iter);
1209 
1210  void SetDirsForPlotfilesAndCheckpointsForDA (const int da_iter, const int ens_no);
1211 
1212  void GetEnsembleCheckpointName (int da_iter, int ens_no);
1213 
1214  void init_custom (int lev);
1215  // Set rho = rho0 theta0 / theta on a pseudo-incompressible level, keeping the mixing ratios
1217 
1218 #ifdef ERF_USE_MULTIBLOCK
1219  // constructor used when ERF is created by a multiblock driver
1220  // calls AmrCore constructor -> AmrMesh constructor
1221  ERF (const amrex::RealBox& rb, int max_level_in,
1222  const amrex::Vector<int>& n_cell_in, int coord,
1223  const amrex::Vector<amrex::IntVect>& ref_ratio,
1224  const amrex::Array<int,AMREX_SPACEDIM>& is_per,
1225  std::string prefix);
1226 
1227  // Advance a block specified number of time steps
1228  void Evolve_MB (int MBstep, int max_block_step);
1229 
1230  // Set parmparse prefix for MultiBlock
1231  void SetParmParsePrefix (std::string name) { pp_prefix = name; }
1232 
1233  // Set 'this' from multiblock container
1234  void SetMultiBlockPointer (MultiBlockContainer *mbc) { m_mbc = mbc; }
1235 
1236  // Public data copy for MB
1237  std::vector<amrex::Box> domain_p;
1238 
1239  // Primary solution data data containers
1240  amrex::Vector<amrex::Vector<amrex::MultiFab> > vars_new;
1241  amrex::Vector<amrex::Vector<amrex::MultiFab> > vars_old;
1242 
1243  // Pressure gradient at each level
1244  amrex::Vector<amrex::Vector<amrex::MultiFab> > gradp;
1245 
1246  // Velocity time averaged field
1247  amrex::Vector<std::unique_ptr<amrex::MultiFab>> vel_t_avg;
1248  amrex::Vector<double> t_avg_cnt;
1249 
1250  // Interval first and second moments used by mean/fluctuation plot fields
1251  amrex::Vector<std::unique_ptr<amrex::MultiFab>> interval_means;
1252  amrex::Vector<double> t_mean_cnt;
1253  // The configured time reset is one global, one-shot event. Keep this
1254  // separate from the per-level accumulation storage so regridding a level
1255  // cannot re-arm an event that has already happened.
1257 #endif
1258 
1259  std::string pp_prefix {"erf"};
1260 
1261  // The inputs table as the user wrote it, captured at the top of
1262  // ReadParameters before anything in ERF can add to it. ParmParse::queryAdd
1263  // inserts the default it was handed whenever a key is absent, so by the time
1264  // initialization is under way the table no longer distinguishes a key the
1265  // user typed from a key some other query defaulted (see
1266  // has_surface_layer_inputs).
1267  std::set<std::string> user_specified_inputs;
1268 
1269  void fill_from_bndryregs (int lev,
1270  const amrex::Vector<amrex::MultiFab*>& mfs,
1271  double time,
1272  bool cons_only = false);
1273 
1274 #ifdef ERF_USE_NETCDF
1275  // Version in which we always set the velocity values but don't set theta
1276  void fill_from_realbdy (const amrex::Vector<amrex::MultiFab*>& mfs,
1277  double time,
1278  bool cons_only,
1279  int icomp_cons,
1280  int ncomp_cons,
1281  amrex::IntVect ngvect_cons,
1282  amrex::IntVect ngvect_vels);
1283 #endif
1284 
1285 #ifdef ERF_USE_NETCDF
1286  // Read a wrfinput file at this level.
1287  //
1288  // With read_atmos_state = true (the default) this reads the full state: the
1289  // atmospheric fields (U, V, W, THM, the density triple and the moisture species)
1290  // as well as the surface fields, and it remaps the state onto the ERF vertical
1291  // grid, builds the base state and reads the boundary data.
1292  //
1293  // With read_atmos_state = false only the surface fields are read -- terrain,
1294  // surface pressure, surface and skin temperatures, the land/soil masks, the map
1295  // factors, the lat/lon fields and the LSM variables -- and the terrain and metric
1296  // terms are built from them. The atmospheric state is left untouched for the
1297  // caller to fill by interpolation from the coarse level (see the
1298  // erf.interp_atmos_from_coarse path in MakeNewLevelFromCoarse), which is also
1299  // responsible for calling rebuild_base_state_from_wrfinput afterwards.
1300  void init_from_wrfinput (int lev, amrex::MultiFab& mf_PSFC, bool read_atmos_state = true);
1301  void init_from_metgrid (int lev);
1302  // Fill SLM's inputs from the land fields of a met_em file (see ERF_InitLandFromMetgrid.cpp)
1303  void init_lsm_from_metgrid (int lev, const std::string& fname, const std::string& date);
1304  void init_from_ncfile (int lev);
1305 
1306  // Rebuild the WRF base state on the grids of base_state_mf at this level, using the
1307  // level-0 reference parameters (wrf_bsp) and this level's z_phys_cc. This is the same
1308  // construction init_from_wrfinput performs at initialization, factored out so that a
1309  // level remade by a regrid gets the same base state rather than one interpolated from
1310  // its parent. Requires z_phys_cc[lev] and wrf_bsp to be valid.
1311  void rebuild_base_state_from_wrfinput (int lev, amrex::MultiFab& base_state_mf);
1312 
1313  // Re-read the six reference parameters that define the WRF base state from the level-0
1314  // wrfinput file. These are read at initialization but are not part of the checkpoint,
1315  // so on restart wrf_bsp would otherwise be left unset -- and the first regrid that has
1316  // to rebuild a base state would abort in init_base_state_from_wrfinput.
1317  void restore_base_state_params_on_restart ();
1318 #endif // ERF_USE_NETCDF
1319 
1320 #ifdef ERF_USE_WINDFARM
1321  void init_windfarm (int lev);
1322  void fill_windfarm_markers (int lev);
1323  void advance_windfarm (const amrex::Geometry& a_geom,
1324  const double& dt_advance,
1325  amrex::MultiFab& cons_in,
1326  amrex::MultiFab& U_old,
1327  amrex::MultiFab& V_old,
1328  amrex::MultiFab& W_old,
1329  amrex::MultiFab& mf_vars_windfarm,
1330  const amrex::MultiFab& mf_Nturb,
1331  const amrex::MultiFab& mf_SMark,
1332  const amrex::MultiFab* z_phys_nd,
1333  const amrex::MultiFab* z_phys_cc,
1334  const double& time);
1335 #endif
1336 
1338  void make_eb_box ();
1340 
1341  // more flexible version of AverageDown() that lets you average down across multiple levels
1342  void AverageDownTo (int crse_lev,
1343  int scomp,
1344  int ncomp,
1345  bool do_full_state_and_momenta = true); // NOLINT
1346 
1347  /*! \brief Conservation-preserving fine-to-coarse average of RhoTheta and
1348  * the active moist conserved components using detJ/mfac weighting, reusing
1349  * AverageDownTo with the full-state component checks and the momentum average-down disabled. */
1350  void AverageDownMoistStateTo (int crse_lev);
1351 
1352  /*! \brief Set detJ_cc of level crse_lev under level crse_lev+1 so that each covered coarse
1353  * cell's volume detJ/(m_x m_y) is the mean of the fine volumes over it. */
1354  void average_down_detJ (int crse_lev);
1355  bool fine_volume_average (int crse_lev) const;
1356 
1357  /*! \brief Average-down of the cell-centered state used by AverageDownTo when
1358  * erf.perturbational_average_down is set: averages the perturbation from the base state in
1359  * Rho_comp, RhoTheta_comp and RhoQ1_comp and adds back the coarse base state. */
1360  void AverageDownConsPerturbational (int crse_lev, int scomp, int ncomp);
1361 
1362  // Write checkpoint file to disk
1363  void WriteCheckpointFile () const;
1364 
1365  // Read checkpoint file from disk
1366  void ReadCheckpointFile ();
1367 
1368  // Read only velocities from checkpoint file
1369  void ReadVelsOnlyFromCheckpointFile (int lev_to_fill, std::string& chkfile);
1370 
1371  // read checkpoint file from disk -- called after instantiating m_SurfaceLayer
1373 
1374  // Rebuild precip_accum, and for some schemes rain_accum, at a level read from a
1375  // checkpoint that predates precip_accum. Public because it launches a GPU lambda.
1376  void convert_legacy_precip_accumulations (int lev);
1377 
1378  // Convert the SST and TSK of a level read from a checkpoint that holds them as
1379  // potential temperature to absolute temperature, as planned from the provenance of the
1380  // checkpoint; psfc_recovered flags, per level, a recovered wrfinput surface pressure.
1381  // Public because it launches a GPU lambda.
1383  int lev,
1385  amrex::Vector<int>& psfc_recovered);
1386 
1387  // Automatic inflow perturbation update on a nested level.
1388  // Public because it launches a GPU lambda.
1389  void turbPert_update_automatic (int lev, double time);
1390 
1391  void fill_terrain_surface (int lev, amrex::MultiFab& z_phys, double elapsed_time);
1392  void build_zphys_nd (int lev, const amrex::MultiFab* crse_znd, amrex::MultiFab& dst, double time);
1393  void init_zphys (int lev, double elapsed_time);
1394  void remake_zphys (int lev, amrex::Real time, std::unique_ptr<amrex::MultiFab>& temp_zphys_nd);
1395  void update_terrain_arrays (int lev);
1396  bool metrics_from_finest (int lev);
1397  void make_metrics_from_finest (int lev);
1398  void update_zsfc_nd (int lev);
1399  void make_terrain_blanking (int lev);
1400 
1401  [[nodiscard]] bool immersed_forcing_active (int lev) const noexcept
1402  {
1403  return solverChoice.terrain_type == TerrainType::ImmersedForcing ||
1405  }
1406 
1410 
1411  // Coupled sea-surface temperature and its per-cell coverage flag, on the
1412  // layout reported by GetOceanToAtmosSurfaceLayout. Allocated on the first
1413  // ApplyOceanSurfaceState call and handed to the SurfaceLayer as borrowed
1414  // pointers, so ERF must outlive the SurfaceLayer's use of them. Level 0
1415  // only: the coupler exchanges on the base grid.
1416  std::unique_ptr<amrex::MultiFab> m_coupled_sst;
1417  std::unique_ptr<amrex::iMultiFab> m_coupled_sst_valid;
1418 
1419  // The orientation of the level-0 grid (cosine and sine of the angle of its x axis
1420  // from east) on ba2d[0], from lat_m and lon_m, for turning the vectors the coupler
1421  // exchanges between the grid axes and east/north. Made by SetCouplerGridRotation, and
1422  // made again when level 0's layout changes; null without lat/lon, where the grid is
1423  // taken to be aligned with east.
1424  std::unique_ptr<amrex::MultiFab> m_coupler_cos_alpha;
1425  std::unique_ptr<amrex::MultiFab> m_coupler_sin_alpha;
1427  void SetCouplerGridRotation ();
1428  // The coupler's last eastward and northward surface current and its coverage, on the
1429  // layout of GetOceanToAtmosSurfaceLayout, made again when that changes. The
1430  // SurfaceLayer borrows them, and sets the current from them again when level 0 is
1431  // remade.
1432  std::unique_ptr<amrex::MultiFab> m_coupled_current_east;
1433  std::unique_ptr<amrex::MultiFab> m_coupled_current_north;
1434  std::unique_ptr<amrex::iMultiFab> m_coupled_current_valid;
1435 
1436  // One-shot latch so a misconfigured deck says so once rather than every step.
1439  // The coupled-SST diagnostics run on the first ApplyOceanSurfaceState call,
1440  // then only at erf.v >= 2.
1442  // Out-of-range report: the worst extremes and NaN count already reported;
1443  // at erf.v >= 2 it repeats only when a later call is worse. Start at the bounds.
1444  amrex::Real m_warned_coupled_sst_min = amrex::Real(260.0);
1445  amrex::Real m_warned_coupled_sst_max = amrex::Real(320.0);
1446  amrex::Long m_warned_coupled_sst_nan = 0;
1447 
1448  // The atmos->ocean rain lane is a rate, but the microphysics keeps only a
1449  // cumulative surface accumulation, so PackAtmosphericStates differences it
1450  // against the snapshot below. Level 0 only, on ba2d[0]:
1451  // m_a2o_precip_accum total liquid-equivalent accumulation [kg m^-2] at
1452  // m_a2o_precip_time (ERF's t_new[0], not the driver's clock)
1453  // m_a2o_precip_rate mean rate between the last two snapshots [kg m^-2 s^-1]
1454  // EvolveOneStep allocates them before its first step, so the first rate
1455  // covers this run's first step, on a cold start and on a restart alike.
1456  std::unique_ptr<amrex::MultiFab> m_a2o_precip_accum;
1457  std::unique_ptr<amrex::MultiFab> m_a2o_precip_rate;
1458  amrex::Real m_a2o_precip_time = amrex::Real(0.0);
1459  // Whether the level-0 microphysics keeps any surface precipitation accumulator
1460  [[nodiscard]] bool HasA2OPrecipSource () const;
1461  // The total liquid-equivalent surface accumulation [kg m^-2] per column, on ba2d[0].
1462  // Public because nvcc rejects extended __device__ lambdas in private members.
1463  void SampleA2OPrecipAccumulation (amrex::MultiFab& accum_2d) const;
1464 
1465 private:
1466 
1467  ///////////////////////////
1468  // private member functions
1469  ///////////////////////////
1470 
1471  // read in some parameters from inputs file
1472  void ReadParameters ();
1473  void ParameterSanityChecks ();
1474 
1475  [[nodiscard]] bool has_surface_layer_inputs (const std::string& prefix) const;
1476 
1477  [[nodiscard]] bool use_eb_surface_layer () const;
1478 
1479  // 0 unless ori is a lateral inflow (1) or inflow_outflow (2) face that gives a primitive
1480  // theta in a run with a pseudo-incompressible level (see set_pi_inflow_faces)
1481  [[nodiscard]] int pi_theta_inflow_face (const amrex::Orientation& ori) const;
1482 
1483  // Build and fill the custom rhotheta, moisture and subsidence forcing of one level
1484  void init_custom_forcing (int lev, amrex::Real time);
1485 
1486  // set covered coarse cells/faces to be the average of overlying fine cells/faces
1487  void AverageDown ();
1488 
1489  void update_diffusive_arrays (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm);
1490 
1491  void make_flux_register (int lev);
1492 
1493  // SBM coarse/fine coupling (Microphysics/SBM/ERF_SBMAMRCoupling.cpp)
1494  void make_sbm_flux_register (int lev);
1495  void bind_sbm_amr_flux_registers (int lev);
1496  void init_sbm_level_from_coarse (int lev, amrex::Real time,
1497  const amrex::BoxArray& ba,
1498  const amrex::DistributionMapping& dm);
1499  void remake_sbm_level (int lev, amrex::Real time,
1500  const amrex::BoxArray& ba,
1501  const amrex::DistributionMapping& dm);
1502  void sbm_synchronize_levels (int nstep);
1504  // Rho and RhoTheta of a level for the SBM particle-mixing timestep
1505  // estimate, Rho's ghost cell filled as ERF fills a stage's state
1506  void fill_sbm_mixing_density (int lev, amrex::MultiFab& density);
1507 
1508  void Construct_ERFFillPatchers (int lev);
1509 
1510  void Define_ERFFillPatchers (int lev);
1511 
1512  void init1DArrays ();
1513 
1514  void init_bcs ();
1515  void init_phys_bcs (bool& read_prim_theta);
1516 
1517  // The EB factories of a level on the grids (ba, dm), built before init_stuff needs them
1518  void make_eb_factories (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm);
1519 
1520  void init_stuff (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm,
1521  amrex::Vector<amrex::MultiFab>& lev_new, amrex::Vector<amrex::MultiFab>& lev_old,
1522  amrex::MultiFab& tmp_base_state,
1523  std::unique_ptr<amrex::MultiFab>& tmp_zphys_nd);
1524 
1525  // Initialize the Turbulent perturbation
1526  void turbPert_update (const int lev, const double dt);
1527  void turbPert_update_uniform_wind (int lev, double time);
1528  void turbPert_amplitude (const int lev);
1529  void turbPert_amplitude_w (const int lev);
1530 
1531  // Initialize the integrator object
1532  void initialize_integrator (int lev, amrex::MultiFab& cons_mf, amrex::MultiFab& vel_mf);
1533 
1534  // Create the physbcs objects
1535  void make_physbcs (int lev);
1536 
1537  // (Re)build the land surface model on this level's current grids
1538  void make_lsm_at_level (int lev, bool from_regrid = false,
1539  int source_lev = -1, bool source_is_raw_input = false,
1540  bool initialize_now = false);
1541 
1542  // Initialize the microphysics object
1543  void initializeMicrophysics (const int&);
1544 
1545  // Initialize the fire coupling and its engine (erf.fire.enable)
1546  void initializeFire (const int&);
1547 
1548  // Initialize the flood coupling and its engine (erf.flood.enable)
1549  void initializeFlood (const int&);
1550 
1551 #ifdef ERF_USE_WINDFARM
1552  // Initialize the windfarm object
1553  void initializeWindFarm (const int&);
1554 #endif
1555 
1556  // Initialize embedded boundary geometries
1557  void initializeEB ();
1558 
1559  // Compute a vector of new MultiFabs by copying from valid region and filling ghost cells
1560  //
1561  // NOTE: FillPatch takes in an empty MF, and returns cell-centered + velocities (not momenta)
1562  //
1563  // This one works only at level = 0 (base state does not change)
1564  void FillPatchCrseLevel (int lev, double time,
1565  const amrex::Vector<amrex::MultiFab*>& mfs_vel,
1566  bool cons_only=false);
1567 
1568  // This one works only at level > 0 (base state does change)
1569  //
1570  // allow_perturbational = false keeps the fill of the conserved state from coarse
1571  // full-state even with erf.perturbational_interpolation: for a destination that is not
1572  // on the layout of base_state[lev], as when RemakeLevel fills the new grids
1573  void FillPatchFineLevel (int lev, double time,
1574  const amrex::Vector<amrex::MultiFab*>& mfs_vel,
1575  const amrex::Vector<amrex::MultiFab*>& mfs_mom,
1576  bool fillset=true, bool cons_only=false,
1577  bool allow_perturbational=true, bool volume_weighted=false);
1578 
1579  // Whether the fills that make a level's grids (regrid, new level) interpolate the
1580  // conserved state weighted by detJ: on a terrain-fitted VariableDz mesh
1581  bool volume_weighted_interp () const;
1582 
1583  // FillPatchTwoLevels for the cell-centered conserved state, perturbational in
1584  // Rho_comp, RhoTheta_comp and RhoQ1_comp when perturbational_interp and perturbational
1585  void FillPatchTwoLevelsCons (int lev, amrex::MultiFab& mf, const amrex::IntVect& nghost,
1586  amrex::Real time,
1587  const amrex::Vector<amrex::MultiFab*>& cmf,
1588  const amrex::Vector<amrex::Real>& ctime,
1589  const amrex::Vector<amrex::MultiFab*>& fmf,
1590  const amrex::Vector<amrex::Real>& ftime,
1591  int scomp, int dcomp, int ncomp, int bccomp,
1592  bool perturbational = true, bool volume_weighted = false);
1593 
1594  // InterpFromCoarseLevel for the whole cell-centered conserved state of a level made from
1595  // the coarser one, perturbational in Rho_comp, RhoTheta_comp and RhoQ1_comp when perturbational_interp
1596  void InterpFromCoarseLevelCons (int lev, amrex::MultiFab& mf, const amrex::IntVect& nghost,
1597  const amrex::MultiFab& cmf, bool volume_weighted = false);
1598 
1599 
1600  // Compute new multifabs by copying data from valid region and filling ghost cells.
1601  // Unlike FillPatch, FillIntermediatePatch will use the supplied multifabs instead of fine level data.
1602  // This is to support filling boundary cells at an intermediate time between old/new times
1603  // on the fine level when valid data at a specific time is already available (such as
1604  // at each RK stage when integrating between initial and final times at a given level).
1605  //
1606  // NOTE: FillIntermediatePatch takes in updated momenta, and returns both updated velocity and momenta
1607  //
1608  void FillIntermediatePatch (int lev, double time,
1609  const amrex::Vector<amrex::MultiFab*>& mfs_vel,
1610  const amrex::Vector<amrex::MultiFab*>& mfs_mom,
1611  int ng_cons, int ng_vel, bool cons_only, int icomp_cons, int ncomp_cons);
1612 
1613  // Fill all multifabs (and all components) in a vector of multifabs corresponding to the
1614  // grid variables defined in vars_old and vars_new just as FillCoarsePatch.
1615  void FillCoarsePatch (int lev, double time);
1616 
1617  // advance a level by dt
1618  // includes a recursive call for finer levels
1619  void timeStep (int lev, double time, int iteration);
1620 
1621  // advance a single level for a single time step
1622  void Advance (int lev, double time, double dt_lev, int iteration, int ncycle);
1623 
1624  //! Initialize HSE
1625  void initHSE ();
1626  void initHSE (int lev);
1627 
1628  // Fill base_state[lev] by conservative interpolation from base_state[lev-1], then apply
1629  // the base-state physical bc's. This is how the part of a fine level that lies inside
1630  // the domain but outside the fine grids -- and the fine ghost cells -- get their values,
1631  // so it must run before any construction that overwrites only the fine grids.
1632  void interp_base_state_from_coarse (int lev);
1633 
1634  //! Initialize Rayleigh damping profiles at a level
1635  void initRayleigh_at_level (const int& lev);
1636 
1637  //! Initialize sponge profiles at every level that exists
1638  void initSponge ();
1639 
1640  //! Allocate the sponge profiles at a level
1641  void initSponge_at_level (int lev);
1642 
1643  //! Set Rayleigh mean profiles at a level from the input sounding
1644  void setRayleighRefFromSounding_at_level (int lev);
1645 
1646  //! Set sponge mean profiles from the input sponge file at every level that exists
1647  void setSpongeRefFromSounding (bool restarting);
1648 
1649  //! Set sponge mean profiles at a level from the input sponge file (already read)
1650  void setSpongeRef_at_level (int lev);
1651 
1652  // a wrapper for estTimeStep()
1653  void ComputeDt (int step = -1, double cur_time_d = 0.0);
1654 
1655  // get plotfile name
1656  [[nodiscard]] std::string PlotFileName (int lev) const;
1657 
1658  // set plotfile variable names
1659  static amrex::Vector<std::string> PlotFileVarNames (amrex::Vector<std::string> plot_var_names);
1660 
1661  // set which variables and derived quantities go into plotfiles
1662  void setPlotVariables (const std::string& pp_plot_var_names, amrex::Vector<std::string>& plot_var_names);
1663  void canonicalizePlot3DVariables (amrex::Vector<std::string>& plot_var_names);
1664  void appendPlot3DVariables (const amrex::Vector<std::string>& plot_var_names,
1665  amrex::Vector<std::string>& a_plot_var_names);
1666  void setPlotVariables2D (const std::string& pp_plot_var_names, amrex::Vector<std::string>& plot_var_names);
1667  // append variables to plot
1668  void appendPlotVariables (const std::string& pp_plot_var_names, amrex::Vector<std::string>& plot_var_names);
1669 
1670  void setSubVolVariables (const std::string& pp_subvol_var_names, amrex::Vector<std::string>& subvol_var_names);
1671 
1672 #ifdef ERF_USE_NETCDF
1673  // Copy from the NC*fabs into the MultiFabs holding the boundary data
1674  void init_from_wrfbdy (amrex::Vector<amrex::FArrayBox*> x_vel_lateral,
1675  amrex::Vector<amrex::FArrayBox*> y_vel_lateral,
1676  amrex::Vector<amrex::FArrayBox*> z_vel_lateral,
1677  amrex::Vector<amrex::FArrayBox*> T_lateral);
1678 
1679  static double start_bdy_time;
1680  static double final_bdy_time;
1681  static bool use_theta_m_bdy;
1682 
1683  static double start_low_time;
1684  static double final_low_time;
1685 
1686  static double bdy_time_interval;
1687  static double low_time_interval;
1688 
1689  // *** *** FArrayBox's for holding the SURFACE data
1690  // amrex::IArrayBox NC_IVGTYP_fab; // Vegetation type (IVGTYP); Discrete numbers;
1691  // amrex::FArrayBox NC_z0_fab; // Surface Roughness, z0 = z0 (IVGTYP)
1692  // amrex::FArrayBox NC_PSFC_fab; // Surface pressure
1693 
1694  // TODO: Clarify the relation between SST and TSK
1695  // amrex::FArrayBox NC_SST_fab; // Sea Surface Temperature; Defined even for land area
1696  // amrex::FArrayBox NC_TSK_fab; // Surface Skin Temperature; Appears to be same as SST...
1697 
1698  // Vectors (over time) of Vector (over variables) of FArrayBoxs for holding the data read from the wrfbdy NetCDF file
1699  amrex::Vector<amrex::Vector<amrex::FArrayBox>> bdy_data_xlo;
1700  amrex::Vector<amrex::Vector<amrex::FArrayBox>> bdy_data_xhi;
1701  amrex::Vector<amrex::Vector<amrex::FArrayBox>> bdy_data_ylo;
1702  amrex::Vector<amrex::Vector<amrex::FArrayBox>> bdy_data_yhi;
1703 
1704  amrex::Vector<amrex::Vector<amrex::FArrayBox>> low_data_zlo;
1705 
1706  // SST/TSK time slices at a level > 0 that read its own init file, when level 0 reads a
1707  // wrflowinp file: from the level's own wrflowinp file if it has one, else from its parent
1708  void init_fine_low_slices (int lev, bool restarting);
1709 
1710  // Read time slice itime of this level's own wrflowinp file into sst_lev[lev], tsk_lev[lev]
1711  void read_own_low_slice (int lev, int itime, std::unique_ptr<SurfaceLayer>& SurfLayer);
1712 
1713  // Check that this level's wrflowinp file has the same times as level 0's
1714  void check_own_low_file_times (int lev);
1715 
1716  // Read local PSFC regions from a level's first WRFInput file for legacy checkpoint
1717  // temperature migration; this is not an input to ongoing SST/TSK updates.
1718  bool read_psfc_from_own_init_file (int lev, bool allow_uncovered);
1719 
1720  // The full WRF file box in ERF's global index space, including all ancestor nest offsets;
1721  // optionally return the requested refined file's parent-grid ratio
1722  amrex::Box wrfinput_file_box (int lev, int file_index, int* ratio_out = nullptr,
1723  amrex::Box* file_local_box = nullptr) const;
1724 
1725  // The cells at a level > 0 that its own init file covers
1726  amrex::Box nest_box_from_own_init_file (int lev);
1727 
1728  // Maximum value of terrain read in from wrfinput at level 0
1729  amrex::Real z_top = zero;
1730 
1731 #endif // ERF_USE_NETCDF
1732 
1733  // Latitude and Longitude on the grid, always at cell centers: the wrfinput
1734  // path reads XLAT / XLONG and the metgrid path reads XLAT_M / XLONG_M, both
1735  // of which are mass-point values, so a consumer that wants the mass point
1736  // can use these directly.
1737  amrex::Vector<std::unique_ptr<amrex::MultiFab>> lat_m, lon_m;
1738 
1739  // The land and soil fields of the wrfinput file that no land model takes (LAI, VEGFRA,
1740  // TMN, ZNT, ALBEDO, ALBBCK, SEAICE, SNOW, SNOWH, TSLB, SMOIS, ZS, DZS), as read at the initial
1741  // time. Filled by init_from_wrfinput when the two-stream force-restore balance runs
1742  // without a land model; empty otherwise. Written to the checkpoint and read back on a
1743  // restart; carried onto the new grids by RemakeLevel.
1745 
1746  amrex::Vector<std::unique_ptr<amrex::MultiFab>> sinPhi_m, cosPhi_m; // Coriolis factors on the grid
1747 
1748  // Struct for working with the sounding data we take as an input. Its profiles are
1749  // sampled at the level-0 cell centers; use sounding_at_level for any other level.
1751 
1752  // The sounding sampled at the cell centers of each level > 0, built on first use
1753  // from input_sounding_data (index 0 is unused)
1754  amrex::Vector<std::unique_ptr<InputSoundingData>> input_sounding_data_fine;
1755 
1756  // Struct for working with the sponge data we take as an input
1758 
1759  // Vector (6 planes) of DeviceVectors (ncell in plane) for Dirichlet BC data
1760  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real>> xvel_bc_data;
1761  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real>> yvel_bc_data;
1762  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real>> zvel_bc_data;
1763  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real>> th_bc_data;
1764 
1765  // Terrain-following inflow profiles per face (xlo.inflow_profile = log_law or file)
1766  amrex::Array<InflowProfile, 2*AMREX_SPACEDIM> m_inflow_profiles;
1767 
1768  // Planar averages for immersed forcing (computed on slow step, used in slow and fast steps)
1769  amrex::Vector<amrex::TableData<amrex::Real, 1>> r_plane_avg; // density planar average per level
1770  amrex::Vector<amrex::TableData<amrex::Real, 1>> t_plane_avg; // RhoTheta planar average per level
1771 
1772  // Function to read and populate above vectors (if input file exists)
1773  bool init_Dirichlet_bc_data (const std::string input_file);
1774 
1775  // Build the terrain-following inflow profile of face ori (xlo.inflow_profile)
1776  void init_inflow_profile (const std::string& bcid, amrex::Orientation ori,
1777  const std::string& kind, amrex::ParmParse& pp);
1778 
1779  // Read the file passed to amr.restart and use it as an initial condition for
1780  // the current simulation. Supports a different number of components and
1781  // ghost cells.
1783 
1784  // Initialize the new-time data at a level from the initial_data MultiFab
1785  void InitializeLevelFromData (int lev, const amrex::MultiFab& initial_data);
1786 
1787  // utility to skip to next line in Header
1788  static void GotoNextLine (std::istream& is);
1789 
1790  // Single level functions called by advance()
1791  void post_update (amrex::MultiFab& state_mf, double time, const amrex::Geometry& geom);
1792  void fill_rhs (amrex::MultiFab& rhs_mf, const amrex::MultiFab& state_mf, double time, const amrex::Geometry& geom);
1793 
1794  ////////////////
1795  // private data members
1796 
1797  std::unique_ptr<ProblemBase> prob = nullptr; // problem-specific functions
1798 
1799  amrex::Vector<int> num_boxes_at_level; // how many boxes specified at each level by tagging criteria
1800  amrex::Vector<int> num_files_at_level; // how many wrfinput files specified at each level
1801  amrex::Vector<amrex::Vector<amrex::Box>> boxes_at_level; // the boxes specified at each level by tagging criteria
1802 
1803  amrex::Vector<int> istep; // which step?
1804  int m_restart_step = -1; // level-0 step of the checkpoint we restarted from (-1: none)
1805  amrex::Vector<int> nsubsteps; // how many substeps on each level?
1806 
1807  // One entry per level: set when that level has just been built by the
1808  // erf.interp_atmos_from_coarse path, whose atmospheric state comes from FillCoarsePatch
1809  // and is not yet thermodynamically consistent (rho, theta and qv are interpolated
1810  // independently). advance_radiation interpolates the radiation fields from the parent
1811  // rather than running RRTMGP on that state, and clears the entry once it has done so, so
1812  // exactly one step is skipped per level creation.
1813  //
1814  // NOTE: this is deliberately a flag owned by the level's lifetime rather than a test on
1815  // istep[lev]. istep is sized once in ReadParameters and is never reset when a
1816  // level is removed, so it carries over from a level's previous life: a level that
1817  // ran for fifty steps, was de-refined, and was then re-created would have
1818  // istep[lev] == 50 and would silently miss the skip.
1819  //
1820  // (using int instead of bool to avoid the std::vector<bool> specialization)
1822 
1823  // keep track of old time, new time, and time step at each level
1824  amrex::Vector<double> t_new;
1825  amrex::Vector<double> t_old;
1826  amrex::Vector<double> dt;
1827  amrex::Vector<long> dt_mri_ratio;
1828 
1829 #ifndef ERF_USE_MULTIBLOCK
1830  // Array of multifabs to store the solution at each level of refinement;
1831  // after advancing a level we use "swap".
1832  amrex::Vector<amrex::Vector<amrex::MultiFab> > vars_new;
1833  amrex::Vector<amrex::Vector<amrex::MultiFab> > vars_old;
1834 
1835  // Pressure gradient at each level
1836  amrex::Vector<amrex::Vector<amrex::MultiFab> > gradp;
1837 
1838  // Velocity time averaged field
1839  amrex::Vector<std::unique_ptr<amrex::MultiFab>> vel_t_avg;
1840  amrex::Vector<double> t_avg_cnt;
1841 
1842  // Interval first and second moments used by mean/fluctuation plot fields
1843  amrex::Vector<std::unique_ptr<amrex::MultiFab>> interval_means;
1844  amrex::Vector<double> t_mean_cnt;
1845  // Global one-shot time-reset state; interval_means remains per level.
1847 #endif
1848  amrex::Vector<std::unique_ptr<MRISplitIntegrator<amrex::Vector<amrex::MultiFab> > > > mri_integrator_mem;
1849 
1850  // Used for anelastic or pseudo-incompressible levels, or when we impose an initial projection
1851  amrex::Vector<amrex::MultiFab> pp_inc;
1852 
1853  // Pseudo-incompressible (non-EB) levels: the upwind direction on each face (+1, -1, or 0 for
1854  // a zero momentum, which selects the centered blend), the sign of the momentum the latest
1855  // projection on the level started from. The projection maps rho0 theta0 / rho onto the
1856  // faces with it, and the advection of the cell-centered scalars from the projected state
1857  // picks its upwind side from it rather than from the sign of the projected mass flux, so
1858  // that with rho theta = rho0 theta0 the advective flux of (rho theta) is the flux the
1859  // projection made divergence-free, even where the projection reverses the flow.
1860  // pi_upw_dir_stage is the copy an RK stage advects with: the stage's projection overwrites
1861  // pi_upw_dir before erf_slow_rhs_post advects the remaining scalars.
1862  amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>,AMREX_SPACEDIM>> pi_upw_dir;
1863  amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>,AMREX_SPACEDIM>> pi_upw_dir_stage;
1864 
1865  //! Define pi_upw_dir[lev] and pi_upw_dir_stage[lev] on the level's faces (zero) if needed
1866  void define_pi_upw_dir (int lev);
1867 
1868  // Pseudo-incompressible (non-EB) levels: the advective part of the (rho theta) RHS of the
1869  // latest stage (pi_adv_rt), and the rest of that RHS (pi_src: diffusion, implicit diffusion
1870  // and the sources in cc_src), the non-advective tendency Q of (rho theta). The projection
1871  // at the end of the stage imposes div(rho0 theta0 u) = Q + the drift correction, so that the
1872  // next update keeps rho theta = rho0 theta0 (see project_momenta)
1873  amrex::Vector<std::unique_ptr<amrex::MultiFab>> pi_adv_rt;
1874  amrex::Vector<std::unique_ptr<amrex::MultiFab>> pi_src;
1875 
1876  // Used only for fast substepping
1877  amrex::Vector<amrex::MultiFab> lagged_delta_rt;
1878  amrex::Vector<amrex::MultiFab> avg_xmom;
1879  amrex::Vector<amrex::MultiFab> avg_ymom;
1880  amrex::Vector<amrex::MultiFab> avg_zmom;
1881 
1882  // Vector over levels of routines to impose physical boundary conditions
1883  amrex::Vector<std::unique_ptr<ERFPhysBCFunct_cons>> physbcs_cons;
1884  amrex::Vector<std::unique_ptr<ERFPhysBCFunct_u>> physbcs_u;
1885  amrex::Vector<std::unique_ptr<ERFPhysBCFunct_v>> physbcs_v;
1886  amrex::Vector<std::unique_ptr<ERFPhysBCFunct_w>> physbcs_w;
1887  amrex::Vector<std::unique_ptr<ERFPhysBCFunct_base>> physbcs_base;
1888  // The same on the mesh at the end of the stage, z_phys_nd_new (MovingFittedMesh only)
1889  amrex::Vector<std::unique_ptr<ERFPhysBCFunct_base>> physbcs_base_new;
1890 
1891  // Store primitive variable for MOST BC
1892  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Theta_prim;
1893  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Qv_prim;
1894  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Qr_prim;
1895 
1896  // Scratch space for time integrator
1897  amrex::Vector<amrex::MultiFab> rU_old;
1898  amrex::Vector<amrex::MultiFab> rU_new;
1899  amrex::Vector<amrex::MultiFab> rV_old;
1900  amrex::Vector<amrex::MultiFab> rV_new;
1901  amrex::Vector<amrex::MultiFab> rW_old;
1902  amrex::Vector<amrex::MultiFab> rW_new;
1903 
1904  // amrex::Vector<amrex::MultiFab> xmom_crse_rhs;
1905  // amrex::Vector<amrex::MultiFab> ymom_crse_rhs;
1906  amrex::Vector<amrex::MultiFab> zmom_crse_rhs;
1907 
1908  std::unique_ptr<Microphysics> micro;
1909  std::unique_ptr<erf_sbm::SBMStateManager> sbm_state_manager;
1910  // Declared before SBMTransport so the non-owning interface references in
1911  // transport are destroyed before these register owners.
1912  amrex::Vector<std::unique_ptr<erf_sbm::SBMAMRFluxRegister>> sbm_amr_flux_regs;
1913  std::vector<amrex::Real> sbm_qualification_initial_inventory;
1914  // Leaf inventory, cumulative outward boundary transfer and its gross scale
1915  // at the previous erf.sbm_budget_check (or the start or restart).
1916  std::vector<amrex::Real> sbm_budget_reference_inventory;
1917  std::vector<double> sbm_budget_reference_outward;
1918  std::vector<double> sbm_budget_reference_gross;
1919  std::uint64_t sbm_budget_reference_terms{0};
1920  // Declared after the state manager so its non-owning layout reference is
1921  // destroyed before the authoritative SBM owner.
1922  std::unique_ptr<erf_sbm::SBMTransport> sbm_transport;
1923  std::unique_ptr<erf_auxiliary::AuxiliaryInertTracer> auxiliary_inert_tracer;
1924  std::unique_ptr<CloudChamberBudget> cloud_chamber_budget;
1926  amrex::Vector<amrex::Vector<amrex::MultiFab*>> qmoist; // (lev,ncomp) rain_accum, snow_accum, graupel_accum, precip_accum
1927  amrex::Vector<std::unique_ptr<amrex::MultiFab>> precip; // SLM precipitation-rate scratch
1928 
1929  // Variables for wind farm parametrization models
1930 
1931 #ifdef ERF_USE_WINDFARM
1932  std::unique_ptr<WindFarm> windfarm;
1933  amrex::Vector<amrex::MultiFab> Nturb;
1934  amrex::Vector<amrex::MultiFab> vars_windfarm; // Fitch: Vabs, Vabsdt, dudt, dvdt, dTKEdt
1935  // EWP: dudt, dvdt, dTKEdt
1936 
1937  amrex::Vector<amrex::MultiFab> SMark; // A multifab that holds an integer corresponding
1938  // to the number of the wind turbine to sample
1939  // velocity upstream of the turbine
1940 #endif
1941 
1942  std::unique_ptr<SurfaceModel> m_SurfaceModel = nullptr;
1943 
1946  amrex::Vector<std::string> lsm_data_name; // (ncomp) -- e.g., sw_dn_dir/dif_vis/nir, lw_dn, cos_zen
1947  amrex::Vector<amrex::Vector<amrex::MultiFab*>> lsm_data; // (lev,ncomp) Data for LSM coupling
1948  amrex::Vector<std::string> lsm_flux_name; // (ncomp) -- e.g., hfx3, q1fx3, tau13, tau23
1949  amrex::Vector<amrex::Vector<amrex::MultiFab*>> lsm_flux; // (lev,ncomp) Fluxes from LSM needed by DYCORE
1950  amrex::Vector<amrex::Vector<amrex::MultiFab*>> urban_data; // (lev,ncomp) Data for urban coupling
1951  amrex::Vector<std::string> urban_data_name; // (ncomp) Urban coupling field names
1952  amrex::Vector<amrex::Vector<amrex::MultiFab*>> urban_flux; // (lev,ncomp) Fluxes from urban model
1953 
1955 
1956  // The large-scale forcing profiles on each level > 0, built on first use from lsf
1957  // (index 0 is unused)
1958  amrex::Vector<std::unique_ptr<LargeScaleForcingData>> lsf_fine;
1959  amrex::Vector<std::unique_ptr<amrex::MultiFab>> nudge_data; // holds nudging inputs: tnudge, qnudge, unudge, vnudge
1960  amrex::Vector<std::unique_ptr<amrex::MultiFab>> lsf_data; // holds large scale forcing tendencies: ttend, qtend, wsub
1961 
1962  amrex::Vector<std::unique_ptr<IRadiation>> rad; // Radiation model at each level
1963  amrex::Vector<std::unique_ptr<amrex::MultiFab>> qheating_rates; // radiation heating rate source terms (SW, LW) (DYCORE)
1964  // Radiation fluxes (SW up, SW down, LW up, LW down) [W/m^2] at the
1965  // interfaces (OUTPUT ONLY). Index k holds the lower interface of layer k
1966  // (k = klo is the surface); the top-of-atmosphere interface is stored in
1967  // the z-ghost cell k = khi + 1, so the array has one ghost cell in z.
1968  // Both RRTMGP and the two-stream model fill all nz + 1 levels.
1969  amrex::Vector<std::unique_ptr<amrex::MultiFab>> rad_fluxes;
1970 
1971  amrex::Real solar_declin = 0.0;
1972  amrex::Real calday = 0.0;
1973 
1974  // Two-stream radiation model (erf.radiation_model = TwoStream): owns its
1975  // surface and SEB state; every call from ERF is behind a test of
1976  // solverChoice.rad_type == RadiationType::TwoStream.
1979 
1980  amrex::Vector<std::unique_ptr<ShocDriver>> native_shoc_driver; // Native SHOC model at each level
1981 
1982  bool plot_rad = false;
1984 
1985  // Fillpatcher classes for coarse-fine boundaries
1986  int cf_width{0};
1988 
1989  // erf.perturbational_interpolation: fill rho, rho theta and (with moisture) rho qv from the
1990  // coarser level (the c/f ghost cells, and the cells a regrid newly covers) by interpolating
1991  // rho - rho0, rho theta - rho0 theta0 and rho qv - rho0 qv0 and adding back the fine base
1992  // state. On by default; false interpolates rho, rho theta and rho qv themselves.
1994 
1995  // erf.perturbational_average_down: average down rho - rho0, rho theta - rho0 theta0 and (with
1996  // moisture) rho qv - rho0 qv0 and add back the coarse base state, so that a fine level in
1997  // its base state averages to the coarse base state whatever the two levels' heights.
1998  // Off by default.
2000  amrex::Vector<ERFFillPatcher> FPr_c;
2001  amrex::Vector<ERFFillPatcher> FPr_u;
2002  amrex::Vector<ERFFillPatcher> FPr_v;
2003  amrex::Vector<ERFFillPatcher> FPr_w;
2004 
2005  // Diffusive stresses and Smag
2006  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>> Tau;
2007  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>> Tau_corr; // correction to tau for implicit
2008  amrex::Vector<std::unique_ptr<amrex::MultiFab>> eddyDiffs_lev;
2009  amrex::Vector<std::unique_ptr<amrex::MultiFab>> SmnSmn_lev;
2010 
2011  // Sea Surface Temps, Skin Temperature and Land Masks (lev, ntimes)
2012  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>> sst_lev;
2013  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>> tsk_lev;
2014  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::iMultiFab>>> lmask_lev;
2015 
2016  // Land grid types and urban fraction
2017  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::iMultiFab>>> land_type_lev;
2018  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::iMultiFab>>> soil_type_lev;
2019  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>> urb_frac_lev;
2020 
2021  // Other SFS terms
2022  amrex::Vector<std::unique_ptr<amrex::MultiFab>> SFS_hfx1_lev, SFS_hfx2_lev, SFS_hfx3_lev;
2023  amrex::Vector<std::unique_ptr<amrex::MultiFab>> SFS_diss_lev;
2024  amrex::Vector<std::unique_ptr<amrex::MultiFab>> SFS_q1fx1_lev, SFS_q1fx2_lev, SFS_q1fx3_lev;
2025  amrex::Vector<std::unique_ptr<amrex::MultiFab>> SFS_q2fx3_lev;
2026 
2027  // Diffusive fluxes for EB
2028  // Tau_EB[level][component][grid_type]
2029  amrex::Vector<amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>>> Tau_EB;
2030  amrex::Vector<std::unique_ptr<amrex::MultiFab>> hfx3_EB;
2031  amrex::Vector<std::unique_ptr<amrex::MultiFab>> qfx3_EB;
2032 
2033  // Grid stretching
2034  amrex::Vector<amrex::Vector<amrex::Real>> zlevels_stag; // nominal height levels
2035 
2036  // Data structures for terrain-fitted coordinates
2037  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_phys_nd;
2038  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_phys_cc;
2039 
2040  // Height of the bottom of the domain at each node, like z_phys_nd at its bottom: on
2041  // ba2d[lev] made nodal in x and y, with z_phys_nd's ghost cells in x and y; see update_zsfc_nd
2042  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_sfc_nd;
2043 
2044  amrex::Vector<std::unique_ptr<amrex::MultiFab>> detJ_cc;
2045  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ax;
2046  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ay;
2047 
2048  // Layout of the coarse/fine z-face data of each level that stops inside the domain in z
2049  // (cf_zface_layout), kept until the level's grids or distribution change, so that every
2050  // fill reuses the same plane BoxArrays and DistributionMapping (and their copy patterns)
2051  struct CFZFaceLayout {
2052  amrex::BoxArray fba; // the grids it was made for
2053  amrex::DistributionMapping fdm;
2054  std::map<int, amrex::Vector<amrex::Box>> patches; // coarse/fine w-faces, per box
2055  amrex::Vector<int> slab_box; // box of the level each slab belongs to
2056  amrex::DistributionMapping sdm; // the slabs' (and planes') distribution
2057  amrex::BoxArray ba_r, ba_ru, ba_rv, ba_rw, ba_rz; // coarse planes: cells, faces, nodes
2058  amrex::BoxArray ba_mu, ba_mv; // coarse planes: map factors (2D)
2059  amrex::BoxArray ba_cf, ba_cx, ba_cy; // coarse Omega, (rho u), (rho v)
2060  amrex::BoxArray ba_f, ba_x, ba_y; // fine slabs
2061  };
2062  const CFZFaceLayout& cf_zface_layout (int lev);
2063  std::map<int, CFZFaceLayout> m_cf_zface_cache;
2064 
2065  // The coarse level's fluxes through the coarse/fine faces of level lev over each acoustic
2066  // substep of its last RK stage (ERF_CFFluxHistory.cpp). The fast step of level lev takes
2067  // their average over each of its own substeps, so that what crosses its boundary adds up to
2068  // what the coarse level moved across it.
2069  struct CFFluxHistory {
2070  amrex::BoxArray fba; // the grids it was made for
2071  amrex::DistributionMapping fdm;
2072  amrex::Array<amrex::BoxArray, AMREX_SPACEDIM> sba; // coarse face slabs, per direction
2073  amrex::Array<amrex::DistributionMapping, AMREX_SPACEDIM> sdm;
2074  amrex::Array<amrex::Vector<int>, AMREX_SPACEDIM> slab_box; // box of level lev of each slab
2075  amrex::Array<amrex::Vector<amrex::Box>, AMREX_SPACEDIM> slab_faces; // its coarse/fine faces (fine index)
2076  amrex::Array<amrex::Vector<amrex::MultiFab>, AMREX_SPACEDIM> flux; // per coarse substep
2077  amrex::Vector<amrex::MultiFab> rho_w; // (rho w), Omega with terrain, at the substep times
2078  amrex::Vector<amrex::Real> time; // the coarse substep times
2079  bool complete = false;
2080  amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> tgt; // the fine faces' fluxes (CFFaceFluxes)
2081  amrex::MultiFab tgt_w;
2082  };
2083  amrex::Vector<CFFluxHistory> m_cf_flux_hist;
2084 
2085  // Per level, the time integral of the pressure its x- and y-momenta have seen in each cell
2086  // since the start of the coarse step of level 0 (ERF_MomentumReflux.cpp); whether it has been
2087  // added to since, and whether the level's grids changed while it was
2088  amrex::Vector<amrex::MultiFab> m_mom_reflux_p;
2089  amrex::Vector<int> m_mom_reflux_used;
2090  amrex::Vector<int> m_mom_reflux_stale;
2091  // Per coarse level, the momentum impulse on its coarse/fine faces (x and y) still to be given
2092  amrex::Vector<std::array<amrex::MultiFab,2>> m_mom_reflux_src;
2093  static bool cf_flux_history_enabled ();
2094  bool cf_flux_history_active (int crse_lev) const;
2095  CFFluxHistory& cf_flux_history (int lev);
2096  void cf_flux_history_record (int crse_lev, int fast_step, int n_sub,
2097  amrex::Real t_beg, amrex::Real t_end,
2098  const amrex::Array<amrex::MultiFab, AMREX_SPACEDIM>& rec,
2099  const amrex::MultiFab& rho_w_old, const amrex::MultiFab& rho_w_new);
2100  amrex::Vector<std::unique_ptr<amrex::MultiFab>> az;
2101 
2102  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_phys_nd_src;
2103  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_phys_cc_src;
2104  amrex::Vector<std::unique_ptr<amrex::MultiFab>> detJ_cc_src;
2105  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ax_src;
2106  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ay_src;
2107  amrex::Vector<std::unique_ptr<amrex::MultiFab>> az_src;
2108 
2109  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_phys_nd_new;
2110  amrex::Vector<std::unique_ptr<amrex::MultiFab>> detJ_cc_new;
2111 
2112  amrex::Vector<std::unique_ptr<amrex::MultiFab>> z_t_rk;
2113 
2114  // Immersed-boundary surface energy balance: inputs and one face set per level
2116  amrex::Vector<std::unique_ptr<IBFaceSet>> m_ibseb;
2117  TwoStreamRadiation::OrbitalCache ibseb_orbit; ///< Orbit of the year for erf.ibseb.sun_mode = two_stream
2118  amrex::Real ibseb_z_i_level0 = 0.0; ///< Level 0's bulk-Richardson depth of its current step, for the refined levels
2119 
2120  // Data structures for terrain immersed forcing
2121  amrex::Vector<std::unique_ptr<amrex::MultiFab>> terrain_blanking;
2122  amrex::Vector<std::unique_ptr<amrex::MultiFab>> terrain_blanking_xface;
2123  amrex::Vector<std::unique_ptr<amrex::MultiFab>> terrain_blanking_yface;
2124  amrex::Vector<std::unique_ptr<amrex::MultiFab>> terrain_blanking_zface;
2125  // Wall-face masks of the fraction-stress immersed wall law (erf.if_wall_form = fraction_stress):
2126  // zero on the bottom face of the wall cell of each x-face (xz edges) and y-face (yz edges) column,
2127  // the spacing factor on the face above it, one elsewhere
2128  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_face13;
2129  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_face23;
2130  // and the same for the cell columns (z faces), applied to the vertical diffusive fluxes of theta and TKE
2131  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_face33;
2132  // kinematic wall heat flux -u* theta* of the fraction-stress law in the wall cell (zero elsewhere),
2133  // written by the immersed scalar forcing, read as the TKE buoyancy flux on the wall face
2134  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_hfx;
2135  // kinematic wall moisture flux -u* q* of the fraction-stress law in the wall cell (zero elsewhere;
2136  // allocated with a moisture model that carries water vapor), written by the immersed scalar
2137  // forcing, read as the water vapor flux on the wall face (qfx1_z: the moist TKE buoyancy, the output)
2138  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_qfx;
2139  // wall value of the k-eqn TKE in the wall cell (erf.if_wall_tke; -1 elsewhere), written by the
2140  // immersed scalar forcing; with erf.if_wall_tke_time_factor = 1 the cell is held at it after
2141  // every stage and in the implicit TKE solve
2142  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_ktarget;
2143  // Height the immersed wall distance is measured from in each column (fraction-stress law with
2144  // RANS), on the level's BoxArray flattened to its bottom cell; a fine box that does not see the
2145  // surface of a column takes it from the coarser level
2146  amrex::Vector<std::unique_ptr<amrex::MultiFab>> ib_wall_height;
2147 
2148  // Wall distance function
2149  amrex::Vector<std::unique_ptr<amrex::MultiFab>> walldist;
2150 
2151  // Map scale factors -- vector across levels of vector across types
2152  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>> mapfac;
2153 
2154  // Mask to be used to identify cells covered by finer level (if level > 0)
2155  amrex::Vector<std::unique_ptr<amrex::MultiFab>> fine_mask;
2156 
2157  amrex::Vector<amrex::Vector<amrex::Real>> stretched_dz_h;
2158  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real>> stretched_dz_d;
2159 
2160  amrex::Vector<amrex::MultiFab> base_state;
2161  amrex::Vector<amrex::MultiFab> base_state_new;
2162 
2163  // Wave coupling data
2164  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Hwave;
2165  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Lwave;
2166  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Hwave_onegrid;
2167  amrex::Vector<std::unique_ptr<amrex::MultiFab>> Lwave_onegrid;
2168  bool finished_wave = false;
2169 
2170  // array of flux registers
2171  amrex::Vector<std::unique_ptr<amrex::YAFluxRegister>> advflux_reg;
2172 
2173  // A BCRec is essentially a 2*DIM integer array storing the boundary
2174  // condition type at each lo/hi walls in each direction. We have one BCRec
2175  // for each component of the cell-centered variables and each velocity component.
2176  amrex::Vector <amrex::BCRec> domain_bcs_type;
2177  amrex::Gpu::DeviceVector<amrex::BCRec> domain_bcs_type_d;
2178 
2179  // We store these so that we can print them out in the job_info file
2180  amrex::Array<std::string,2*AMREX_SPACEDIM> domain_bc_type;
2181 
2182  // These hold the Dirichlet values at walls which need them ...
2183  amrex::Array<amrex::Array<amrex::Real, AMREX_SPACEDIM*2>, AMREX_SPACEDIM+NBCVAR_max> m_bc_extdir_vals;
2184 
2185  // These hold the Neumann values at walls which need them ...
2186  amrex::Array<amrex::Array<amrex::Real, AMREX_SPACEDIM*2>, AMREX_SPACEDIM+NBCVAR_max> m_bc_neumann_vals;
2187 
2188  // Host-side, face-local metadata for solid-wall scalar inputs. This is
2189  // deliberately separate from the values copied into device ghost-fill
2190  // kernels so explicit zero values remain distinguishable from omission.
2191  amrex::Array<amrex::Array<erf_wall_scalar_bc::WallScalarBCIntent, AMREX_SPACEDIM*2>, NBCVAR_max>
2193 
2194  // Per-face flag: non-reflecting inflow (extrapolate RhoTheta instead of prescribing)
2195  amrex::Array<bool, AMREX_SPACEDIM*2> m_bc_nonreflecting = {{false}};
2196  // Per face: whether its Dirichlet theta comes from a dirichlet_file, and in which form
2197  // (0: not from a file, 1: the file holds rho*theta, 2: the file holds theta)
2198  amrex::Array<int, AMREX_SPACEDIM*2> m_th_file_face = {{0}};
2199  // Per conserved BC component and face: 1 where an anelastic or pseudo-incompressible inflow or inflow_outflow face
2200  // was given a primitive value (<face>.theta, scalar, qv, qc, KE). m_bc_extdir_vals then
2201  // holds that primitive value, made conserved with the interior density
2202  amrex::Array<amrex::Array<int, AMREX_SPACEDIM*2>, NBCVAR_max> m_bc_prim_given{};
2203 
2204  // These are the "physical" boundary condition types (e.g. "inflow")
2205  amrex::GpuArray<ERF_BC, AMREX_SPACEDIM*2> phys_bc_type;
2206 
2207  // These are the masks for the thin immersed body
2208  amrex::Vector<std::unique_ptr<amrex::iMultiFab>> xflux_imask;
2209  amrex::Vector<std::unique_ptr<amrex::iMultiFab>> yflux_imask;
2210  amrex::Vector<std::unique_ptr<amrex::iMultiFab>> zflux_imask;
2211  //amrex::Vector<std::unique_ptr<amrex::iMultiFab>> overset_imask;
2212 
2213  // These are the body forces that result from the thin immersed body
2214  amrex::Vector<std::unique_ptr<amrex::MultiFab>> thin_xforce;
2215  amrex::Vector<std::unique_ptr<amrex::MultiFab>> thin_yforce;
2216  amrex::Vector<std::unique_ptr<amrex::MultiFab>> thin_zforce;
2217 
2223 
2224  // Despite the names, the *_time trackers (and last_subvol_time, last_fire_plot_time)
2225  // hold the time the NEXT output with a period is due: writeNow() fires once the time
2226  // reaches it (less 0.1*dt), and each write then adds one period
2231  static double last_check_file_time;
2232 
2233 #ifdef ERF_USE_FIRE
2234  static double last_fire_plot_time; // double: writeNow() takes double&, as for the other plot times
2235 #endif
2236 #ifdef ERF_USE_FLOOD
2237  static double last_flood_plot_time; // double: writeNow() takes double&, as for the other plot times
2238 #endif
2239 
2240  amrex::Vector<int> last_subvol_step;
2241  amrex::Vector<double> last_subvol_time;
2242 
2244 
2245  // Output control
2246  const int datwidth = 14;
2247  const int datprecision = 6;
2248  const int timeprecision = 13; // e.g., 1-yr LES: 31,536,000 s with dt ~ amrex::Real(0.01) ==> min prec = 10
2249  // epoch time for 2030-01-01 00:00:00 is 1,893,456,000 s with dt ~ amrex::Real(0.01) ==> min prec = 12
2250 
2251  ////////////////
2252  // runtime parameters
2253 
2254  // Maximum number of steps
2255  int max_step = -1;
2256 
2257  // Start and stop times
2258  static double start_time;
2259  static double stop_time;
2260 
2261  bool use_datetime = false;
2262  const std::string datetime_format = "%Y-%m-%d %H:%M:%S"; // ISO 8601 standard
2263 
2264  // if >= 0 we restart from a checkpoint
2265  std::string restart_chkfile = "";
2266 
2267  // Host-only metadata shared by all native output paths. It never enters
2268  // device code or changes the model state read from a checkpoint.
2270 
2271  // Time step controls
2272  static amrex::Real cfl;
2273  static amrex::Real sub_cfl;
2274  static amrex::Real init_shrink;
2275  static amrex::Real change_max;
2276  static double dt_max_initial;
2277  static double dt_max;
2278 
2279  // Explicit eddy-diffusion time-step check (opt-in): warn when dt * rate exceeds
2280  // diffusive_cfl (diffusive_dt_check) and optionally limit an adaptive dt to it
2281  static bool diffusive_dt_check;
2282  static bool diffusive_dt_limit;
2283  static amrex::Real diffusive_cfl;
2284  // true until the first ComputeDt of this run has finished (restart hold of the limit)
2286  // largest Fourier number already reported per level (warnings repeat only when it grows)
2287  amrex::Vector<amrex::Real> diffusive_fourier_warned;
2288  // grids on which, and value at which, the terrain slope factor was last reported, per level
2289  amrex::Vector<amrex::BoxArray> slope_report_grids;
2290  // grids on which the open-face terrain slope was last checked, and the faces already
2291  // reported, per level (WarnSteepTerrainAtOpenFaces)
2292  amrex::Vector<amrex::BoxArray> openface_grids;
2293  amrex::Vector<amrex::Array<bool,4>> openface_warned;
2294  // grids on which the CFL limit of a fixed dt was last checked, per level, and whether the
2295  // fixed dt was since reported above erf.cfl on them (CheckFixedDtCFLLimit)
2296  amrex::Vector<amrex::BoxArray> fixed_dt_check_grids;
2297  amrex::Vector<int> fixed_dt_cfl_warned;
2298  // grids on which the stability of the constant beta_s was last checked, per level
2299  // (CheckVariableBetaS)
2300  amrex::Vector<amrex::BoxArray> beta_s_check_grids;
2301  amrex::Vector<amrex::Real> slope_report_alpha;
2302 
2303  // Fixed dt at each level (only used if positive)
2304  amrex::Vector<double> fixed_dt;
2305  amrex::Vector<double> fixed_fast_dt;
2306  // The fixed dt and fixed fast dt at each level as the inputs give them, before the CFL limit
2307  // lowers them (written to the checkpoint with the lowered values)
2308  amrex::Vector<double> fixed_dt_input;
2309  amrex::Vector<double> fixed_fast_dt_input;
2311  // Lower a fixed dt that exceeds the CFL limit erf.cfl to the Courant number min(erf.cfl, 0.8)
2312  // (erf.fixed_dt_cfl_limit, default true; ComputeDt)
2313  static bool fixed_dt_cfl_limit;
2314 
2315  // how often each level regrids the higher levels of refinement
2316  // (after a level advances that many time steps)
2317  int regrid_int = -1;
2318 
2319  // Should we regrid level 0 after restart if Ngrids < Nprocs or
2320  // max_grid_size has changed?
2322 
2323  //
2324  // The grids each level's checkpoint was written on, and whether level 0's grids actually
2325  // moved when it was read. ReadCheckpointFile decides the level-0 grids before it builds
2326  // the levels, so every field is read on the grids in the file and redistributed onto the
2327  // grids the run will use; these carry the former. Empty away from a restart.
2328  //
2329  amrex::Vector<amrex::BoxArray> ba_chkfile;
2330  amrex::Vector<amrex::DistributionMapping> dm_chkfile;
2332 
2333  //
2334  // Read one checkpoint MultiFab and deposit it into dst, which may live on different grids.
2335  //
2336  // The source is read into an undefined MultiFab, which VisMF::Read then defines on the
2337  // BoxArray recorded in the file, so no caller needs to know the checkpoint's grids. Only
2338  // the VALID cells of the source are offered by default: a file's ghost cells are not
2339  // guaranteed to agree with its valid data, and ParallelCopy intersects the grown source
2340  // with the grown destination without any ordering guarantee between overlapping sources,
2341  // so offering them can land stale values in valid cells (issue 4225). Pass
2342  // src_ghosts = true only for a field whose halo the checkpoint carries deliberately and
2343  // whose exterior halo cannot be rebuilt -- the terrain heights are the case that needs it.
2344  //
2345  void read_checkpoint_mf (amrex::MultiFab& dst,
2346  const std::string& mf_name,
2347  int lev,
2348  int scomp, int dcomp, int ncomp,
2349  const amrex::IntVect& dst_ghosts,
2350  bool src_ghosts = false);
2351 
2352  //
2353  // As above, returning false instead of aborting when the file is not there, for fields a
2354  // older checkpoint may not carry.
2355  //
2356  bool read_checkpoint_mf_if_present (amrex::MultiFab& dst,
2357  const std::string& mf_name,
2358  int lev,
2359  int scomp, int dcomp, int ncomp,
2360  const amrex::IntVect& dst_ghosts,
2361  bool src_ghosts = false);
2362 
2363  // plotfile prefix and frequency
2364  std::string plot3d_file_1 {"plt_1_"};
2365  std::string plot3d_file_2 {"plt_2_"};
2366  std::string plot2d_file_1 {"plt2d_1_"};
2367  std::string plot2d_file_2 {"plt2d_2_"};
2368  std::string subvol_file {"subvol"};
2369  int m_plot3d_int_1 = -1;
2370  int m_plot3d_int_2 = -1;
2371  int m_plot2d_int_1 = -1;
2372  int m_plot2d_int_2 = -1;
2373 
2374  amrex::Vector<int> m_subvol_int;
2375  amrex::Vector<double> m_subvol_per;
2376 
2377  double m_plot3d_per_1 = -1.0;
2378  double m_plot3d_per_2 = -1.0;
2379  double m_plot2d_per_1 = -1.0;
2380  double m_plot2d_per_2 = -1.0;
2381  bool m_plot_face_vels = false;
2383 
2384  bool plot_lsm = false;
2385  bool plot_surfmodel = false;
2386 
2387  // other sampling output control
2388  int profile_int = -1;
2389  bool destag_profiles = true;
2390 
2391  // Checkpoint type, prefix and frequency
2392  std::string check_file {"chk"};
2393  int m_check_int = -1;
2394  double m_check_per = -1.0;
2395 
2396  amrex::Vector<std::string> subvol3d_var_names;
2397 
2398  amrex::Vector<std::string> plot3d_var_names_1;
2399  amrex::Vector<std::string> plot3d_var_names_2;
2400  amrex::Vector<std::string> plot2d_var_names_1;
2401  amrex::Vector<std::string> plot2d_var_names_2;
2402  // erf.plot2d.cloud_optics.*, read and checked at startup; the resolved values
2403  // are printed once, when a Plot2D stream or a station first needs them
2406  // Raw conserved-state names in component order; the list and its
2407  // name-to-component map live together in IO/ERF_PlotfileSelection.H
2408  const amrex::Vector<std::string> cons_names = erf_plotfile::plot3d_conserved_state_names();
2409 
2410  // **************************************************************************************
2411  // NOTE: The order of variable names here **MUST MATCH THE ORDER** in IO/ERF_Plotfile.cpp
2412  // **************************************************************************************
2413  const amrex::Vector<std::string> derived_names {"temp", "theta", "KE", "scalar", "soundspeed",
2414  "reflectivity","max_reflectivity", "precipitable", "mucape",
2415  "vorticity_x","vorticity_y","vorticity_z",
2416  "helicity", "local_helicity", "vort_stretching",
2417  "magvel", "divU",
2418  "pres_hse", "dens_hse", "theta_hse", "pi_hse", "qv_hse",
2419  "pressure", "pert_pres", "pert_dens",
2420  "buoyancy", "eq_pot_temp", "VPD",
2421 #ifdef ERF_USE_WINDFARM
2422  "num_turb", "SMark0", "SMark1",
2423 #endif
2424  "dpdx", "dpdy", "dpdz", "pres_hse_x", "pres_hse_y",
2425  "z_phys", "detJ", "h_xi", "h_eta", "h_zeta",
2426  "mapfac", "lat_m", "lon_m",
2427  // Time averaged velocity
2428  "u_t_avg", "v_t_avg", "w_t_avg", "umag_t_avg",
2429  // Interval means and resolved turbulence moments
2430  "u_mean", "v_mean", "w_mean", "theta_mean",
2431  "uu_mean", "vv_mean", "ww_mean", "uw_mean", "vw_mean", "wtheta_mean",
2432  "uu_fluct", "vv_fluct", "ww_fluct", "uw_fluct", "vw_fluct", "wtheta_fluct", "tke_resolved",
2433  // eddy viscosity
2434  "nut",
2435  // eddy diffusivity of momentum
2436  "Kmv","Kmh",
2437  // eddy diffusivity of heat
2438  "Khv","Khh",
2439  // turbulence lengthscale
2440  "Lturb",
2441  // k-eqn RANS: smoothed turbulent Richardson number and stability functions
2442  "Rt", "cmu", "cmu_prime",
2443  // k-eqn RANS: eddy viscosity over its realizability cap
2444  "cap_ratio",
2445  // native SHOC diagnostics
2446  "pblh", "shoc_cldfrac", "shoc_ql", "shoc_ql2", "shoc_cond",
2447  "wqls_sec", "wthv_sec", "w_sec",
2448  "thl_sec", "qw_sec", "qwthl_sec", "wthl_sec", "wqw_sec", "w3",
2449  "brunt", "isotropy", "shear_prod", "buoy_prod", "diss_tke",
2450  // wall distance
2451  "walldist",
2452  // dissipation
2453  "diss",
2454  // moisture vars
2455  "moist_density", "qv", "qc", "qi", "qrain", "qsnow", "qgraup",
2456  "qt", "qn", "qp", "qsat", "nc", "ni", "nr", "ns", "ng", "nn",
2457  "rain_accum", "snow_accum", "graupel_accum", "precip_accum",
2458  "rel_humidity", "condensation_rate",
2459  // Terrain IB mask
2460  "terrain_IB_mask",
2461  "ibseb_nfaces", "ibseb_tskin",
2462  "ibseb_sw_abs", "ibseb_shadow",
2463  "ibseb_lw_net", "ibseb_f_sky", "ibseb_H", "ibseb_G",
2464  // EB variables
2465  "volfrac"
2466  ,"qsrc_sw", "qsrc_lw",
2467  "Tau11", "Tau12", "Tau13", "Tau21", "Tau22", "Tau23", "Tau31", "Tau32", "Tau33",
2468  "hfx1", "hfx2", "hfx3", "q1fx1", "q1fx2", "q1fx3", "q2fx3"
2469  };
2470 
2471  // **************************************************************************************
2472  // NOTE: This is the set of derived variables that WriteSubvolume knows how to fill; it
2473  // is an unordered allow-list, since setSubVolVariables walks "derived_names" and
2474  // keeps the entries found here. That means the names are selected in
2475  // "derived_names" order, which is the order WriteSubvolume must compute them in.
2476  // **************************************************************************************
2477  const amrex::Vector<std::string> derived_subvol_names {"soundspeed", "temp", "theta", "KE", "scalar",
2478  "precipitable", "mucape"};
2479 
2480  // algorithm choices
2482 
2483  // Turbulent perturbation structure
2485 
2486 #ifdef ERF_USE_PARTICLES
2487  // Particle container with all particle species
2488  ParticleData particleData;
2489 
2490  // variables and functions for tracers particles
2491  bool m_use_tracer_particles; /*!< tracer particles that advect with flow with optional sedimentation */
2492 
2493  /*! Read tracer and hydro particles parameters */
2494  void readTracersParams ();
2495 
2496  /*! Initialize tracer and hydro particles */
2497  void initializeTracers ( amrex::ParGDBBase*,
2498  const amrex::Vector<std::unique_ptr<amrex::MultiFab>>&,
2499  const double time);
2500 
2501  /*! Restart tracer and hydro particles */
2502  void restartTracers ( amrex::ParGDBBase*, const std::string& );
2503 
2504  /*! Evolve tracers and hydro particles */
2505  void evolveTracers ( int,
2506  double,
2507  amrex::Vector<amrex::Vector<amrex::MultiFab>>&,
2508  const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& );
2509 
2510 #endif
2511 
2512 #ifdef ERF_USE_MULTIBLOCK
2513  MultiBlockContainer *m_mbc = nullptr;
2514 #endif
2515 
2516  static int verbose;
2517  static int mg_verbose;
2518  static bool use_fft;
2519 
2520  static int check_for_nans;
2521 
2522  // Diagnostic output interval
2523  static int sum_interval;
2524  static int pert_interval;
2525  static double sum_per;
2526 
2527  // Write in native AMReX or NetCDF format for each plotfile
2528  static PlotFileType plotfile3d_type_1;
2529  static PlotFileType plotfile3d_type_2;
2530  static PlotFileType plotfile2d_type_1;
2531  static PlotFileType plotfile2d_type_2;
2532 
2535 
2536  // NetCDF initialization (wrfinput) file
2537  static amrex::Vector<amrex::Vector<std::string>> nc_init_file;
2538  static amrex::Vector<amrex::Vector<int>> have_read_nc_init_file;
2539 
2540  // NetCDF initialization (wrfbdy/met_em) file
2541  static std::string nc_bdy_file;
2542  int real_width{0};
2543  bool real_extrap_w{true};
2544 
2545  // NetCDF initialization of zlo boundary values
2546  static std::string nc_low_file;
2547 
2548  // Per-level wrflowinp files (erf.nc_low_file_<lev>) for levels > 0 that read their own
2549  // init file; entry 0 is unused (level 0 always uses nc_low_file)
2550  static amrex::Vector<std::string> nc_low_file_at_level;
2551 
2552  // Options for vertical interpolation of met_em*.nc data.
2555  bool metgrid_debug_dry{false};
2556  bool metgrid_debug_psfc{false};
2557  bool metgrid_debug_msf{false};
2561  bool metgrid_use_sfc{true};
2562  bool metgrid_retain_sfc{false};
2563  amrex::Real metgrid_proximity{amrex::Real(500.0)};
2566 
2567  // Options for ERF boundary files for real simulations.
2568  bool write_erfbdy{false}; // User-settable: write erfbdy during initialization
2569  bool use_erfbdy{false}; // User-settable for wrfinput: read erfbdy instead of
2570  // nc_bdy_file. Set internally for metgrid and on restart.
2571  std::string erfbdy_file{"erfbdy"}; // User-settable: erfbdy file name
2572  int nvars_erfbdy{0}; // Internal: number of variables in erfbdy
2573 
2574  amrex::Vector<amrex::BoxArray> ba1d;
2575  amrex::Vector<amrex::BoxArray> ba2d;
2576 
2577  // Vertical extent of the grid column over each (i,j), stored on ba2d (so the
2578  // compressed z index is 0) with one ghost cell in x and y so that a box can also
2579  // read the extent of the column on the other side of each of its faces.
2580  // component 0 : smallEnd(2) of the box covering this column
2581  // component 1 : bigEnd(2) of the box covering this column
2582  // Ghost entries that no box covers keep the "unconstraining" sentinels below.
2583  // This is well defined only because grids may not be split in the vertical --
2584  // see ERF::grids_are_split_in_z. Used by the implicit vertical diffusion solves.
2585  amrex::Vector<std::unique_ptr<amrex::iMultiFab>> column_kextent;
2586 
2587  // Masks of the coarse/fine ghost cells (1 there, 0 elsewhere) used by
2588  // FillCoarseFineGhostsForImplicit: entry 0 is cell-centered with two ghost cells, entries
2589  // 1-3 are on the x-, y- and z-faces with one ghost cell. Built on first use
2590  // and rebuilt whenever the grids they were built on change.
2591  amrex::Vector<amrex::Array<std::unique_ptr<amrex::iMultiFab>,AMREX_SPACEDIM+1>> cf_implicit_mask;
2592 
2593  const amrex::iMultiFab& get_cf_implicit_mask (int lev, int which, const amrex::BoxArray& ba,
2594  const amrex::DistributionMapping& dm,
2595  const amrex::IntVect& ng);
2596 
2597  static constexpr int column_kextent_lo_sentinel = std::numeric_limits<int>::min()/2;
2598  static constexpr int column_kextent_hi_sentinel = std::numeric_limits<int>::max()/2;
2599 
2600  void define_column_kextent (int lev, const amrex::BoxArray& ba,
2601  const amrex::DistributionMapping& dm);
2602 
2603  static bool grids_are_split_in_z (const amrex::BoxArray& ba);
2604 
2605  // The six parameters defining the WRF analytic reference profile, plus the layer
2606  // interfaces derived from them. These are read from the LEVEL 0 wrfinput file only
2607  // and then shared by every level: the levels of an AMR hierarchy must be built from
2608  // one reference profile, or their base states cannot agree across the coarse/fine
2609  // interface. (A nested wrfinput file that disagrees produces a warning.)
2611 
2612  std::unique_ptr<amrex::MultiFab> wrf_C1H;
2613  std::unique_ptr<amrex::MultiFab> wrf_C2H;
2614  // Hybrid coefficients on full (w) levels, used to decouple the wrfbdy geopotential
2615  std::unique_ptr<amrex::MultiFab> wrf_C1F;
2616  std::unique_ptr<amrex::MultiFab> wrf_C2F;
2617  std::unique_ptr<amrex::MultiFab> wrf_MUB;
2618  std::unique_ptr<amrex::MultiFab> wrf_RDNW;
2619  std::unique_ptr<amrex::MultiFab> wrf_PHB; // Base geopotential
2620 
2621  amrex::Vector<std::unique_ptr<amrex::MultiFab>> mf_PSFC;
2622 
2623  // 2D BndryRegister output (for ingestion in AMR-Wind)
2628 
2629  // 2D BndryRegister input
2631 
2632  static int ng_dens_hse;
2633  static int ng_pres_hse;
2634 
2635  // Custom source terms
2636  amrex::Vector<std::unique_ptr<amrex::MultiFab>> rhotheta_src;
2637  amrex::Vector<std::unique_ptr<amrex::MultiFab>> rhoqt_src;
2638 
2639  amrex::Vector< amrex::Vector<amrex::Real> > h_w_subsid;
2640  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_w_subsid;
2641 
2642  amrex::Vector< amrex::Vector<amrex::Real> > h_u_geos;
2643  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_u_geos;
2644 
2645  amrex::Vector< amrex::Vector<amrex::Real> > h_v_geos;
2646  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_v_geos;
2647 
2648  // Function to read and populate above host vectors (if input file exists)
2649  void init_geo_wind_profile (const std::string input_file,
2650  amrex::Vector<amrex::Real>& u_geos,
2651  amrex::Gpu::DeviceVector<amrex::Real>& u_geos_d,
2652  amrex::Vector<amrex::Real>& v_geos,
2653  amrex::Gpu::DeviceVector<amrex::Real>& v_geos_d,
2654  const amrex::Geometry& lgeom,
2655  const amrex::Vector<amrex::Real>& zlev_stag);
2656 
2657  // This is a vector over levels of vectors across quantities of Vectors
2658  amrex::Vector<amrex::Vector<amrex::Vector<amrex::Real> > > h_rayleigh_ptrs;
2659  amrex::Vector<amrex::Vector<amrex::Vector<amrex::Real> > > h_sponge_ptrs;
2660 
2661  // These are vectors over levels of Vectors
2662  amrex::Vector<amrex::Vector<amrex::Real> > h_sinesq_ptrs;
2663  amrex::Vector<amrex::Vector<amrex::Real> > h_sinesq_stag_ptrs;
2664 
2665  // This is a vector over levels of vectors across quantities of DeviceVectors
2666  amrex::Vector<amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > > d_rayleigh_ptrs;
2667  amrex::Vector<amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > > d_sponge_ptrs;
2668 
2669  // These are vectors over levels of DeviceVectors
2670  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_sinesq_ptrs;
2671  amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_sinesq_stag_ptrs;
2672 
2673  amrex::Vector<amrex::Real> h_havg_density;
2674  amrex::Vector<amrex::Real> h_havg_temperature;
2675  amrex::Vector<amrex::Real> h_havg_pressure;
2676  amrex::Vector<amrex::Real> h_havg_qv;
2677  amrex::Vector<amrex::Real> h_havg_qc;
2678 
2679  amrex::Gpu::DeviceVector<amrex::Real> d_havg_density;
2680  amrex::Gpu::DeviceVector<amrex::Real> d_havg_temperature;
2681  amrex::Gpu::DeviceVector<amrex::Real> d_havg_pressure;
2682  amrex::Gpu::DeviceVector<amrex::Real> d_havg_qv;
2683  amrex::Gpu::DeviceVector<amrex::Real> d_havg_qc;
2684 
2685  void refinement_criteria_setup ();
2686 
2687  std::unique_ptr<WriteBndryPlanes> m_w2d = nullptr;
2688  std::unique_ptr<ReadBndryPlanes> m_r2d = nullptr;
2689  amrex::Vector<std::unique_ptr<SurfaceLayer>> m_SurfaceLayer;
2690  amrex::Vector<std::unique_ptr<ForestDrag>> m_forest_drag;
2691 
2692  /// A localized source of gas (erf.mass_source.*); nullptr unless one is given
2693  std::unique_ptr<MassSource> m_mass_source = nullptr;
2694 
2695 #ifdef ERF_USE_FIRE
2696  /// The fire coupling (atmosphere side) and the engine it owns (erf.fire.engine)
2697  std::unique_ptr<FireCoupler> m_fire_coupler = nullptr;
2698  FireCouplingParams m_fire_params;
2699  std::string m_fire_plot_file {"plt_fire_"};
2700  int m_fire_plot_int = -1;
2701  amrex::Real m_fire_plot_per = -1.0;
2702 #endif
2703 
2704 #ifdef ERF_USE_FLOOD
2705  /// The flood coupling (atmosphere side) and the engine it owns (erf.flood.engine)
2706  std::unique_ptr<FloodCoupler> m_flood_coupler = nullptr;
2707  FloodCouplingParams m_flood_params;
2708  std::string m_flood_plot_file {"plt_flood_"};
2709  int m_flood_plot_int = -1;
2710  amrex::Real m_flood_plot_per = -1.0;
2711 #endif
2712 
2713 #ifdef ERF_USE_DUST
2714  /// The dust model erf.dust.model selects (ERF_DustModel.H); nullptr unless erf.dust.enable = true
2715  std::unique_ptr<DustModel> m_dust_model = nullptr;
2716 
2717  /// Make and set up the dust model, once, in InitData_post; zero the dust scalars on a fresh start
2718  void initialize_dust_model ();
2719 
2720  /// Advance the dust model over the step of level 0 just taken (from step, at time, by dt[0])
2721  void advance_dust_model (int step, double time);
2722 #endif
2723 
2724 #ifdef ERF_USE_MOVING_BODIES
2725  /// The structure model erf.structures.model selects (ERF_StructureModel.H); nullptr when the key is not set
2726  std::unique_ptr<StructureModel> m_structure_model = nullptr;
2727 
2728  /// Hand the structure model the mesh and the initial (or restart) state, once, in InitData_post
2729  void initialize_structure_model ();
2730 
2731  /// The structure model has been initialized (initialize_structure_model)
2732  bool m_structure_model_initialized = false;
2733 
2734  /// Advance the structure model over this step of level lev, then check its support() against level lev+1
2735  void advance_structure_model (int lev, double time, double dt_lev,
2736  const amrex::MultiFab& U_old, const amrex::MultiFab& V_old,
2737  const amrex::MultiFab& W_old, const amrex::MultiFab& S_old);
2738 
2739  /// Whether every map factor of level lev is 1 (the actuator core assumes so); a collective
2740  bool structure_unit_map_factors (int lev) const;
2741 
2742  /// Restrict the structure model's latest source onto level lev < level(), for lev's next step
2743  void make_structure_coarse_sources (int lev);
2744 
2745  /// The structure model's source restricted onto a coarser level (x, y, z faces); undefined when unset
2746  amrex::Vector<std::array<amrex::MultiFab,AMREX_SPACEDIM>> m_structure_crse_src;
2747 
2748  /// The grids of the model's level at its last advance(): the source add_momentum_sources() returns lives there
2749  amrex::BoxArray m_structure_src_ba;
2750  amrex::DistributionMapping m_structure_src_dm;
2751 
2752  /// After a restart, until the model's first advance(): its source on its level when the checkpoint was written
2753  std::array<amrex::MultiFab,AMREX_SPACEDIM> m_structure_chk_src;
2754 
2755  /// Write the model's current source on its level under checkpointname/StructureCoarseSource (TwoWay, level() > 0)
2756  void write_structure_coarse_source_checkpoint (const std::string& checkpointname) const;
2757 
2758  /// Read what write_structure_coarse_source_checkpoint wrote, for the model on level L, into m_structure_chk_src
2759  void read_structure_coarse_source_checkpoint (int L);
2760 
2761  /// The node heights of the level above the model's, for the check of its support(): kept until that level's boxes change
2762  erf_actuator::LevelHeights m_structure_fine_heights;
2763 #endif
2764 
2765  //
2766  // Tagging criteria read from erf.refinement_indicators. Not every indicator creates one
2767  // (e.g. "storm_tracker" does not), so these do not correspond one-to-one with that list;
2768  // each carries the name of the indicator that created it.
2769  //
2770  static amrex::Vector<RefinementCriterion> ref_criteria;
2771 
2772  amrex::Vector<amrex::Vector<amrex::BoxArray>> subdomains;
2773 
2774  amrex::Vector<amrex::Real> dz_min;
2775 
2776  static AMREX_FORCE_INLINE
2777  int
2779  {
2780  // We never have fewer than 2 ghost cells
2781  int ngrow = 2;
2782 
2783  // This sets the minimum to 3 if using num_diff but we might still need more
2784  if (sc.use_num_diff) {
2785  ngrow = 3;
2786  }
2787 
2788  // With EB we always have 4 so no need to do further tests
2789  if (sc.terrain_type == TerrainType::EB) {
2790  ngrow = 4;
2791  return ngrow;
2792  }
2793 
2794  // Ghost cells each advection scheme needs; the largest over the six scheme choices
2795  // (dycore, dry and moist scalars, each horizontal and vertical) is taken, so no
2796  // choice can be missed and a wider scheme is never masked by a narrower one
2797  auto adv_ghost_cells = [] (AdvType t) {
2798  switch (t) {
2799  case AdvType::Centered_6th:
2800  case AdvType::Upwind_5th:
2801  case AdvType::Weno_5:
2802  case AdvType::Weno_5Z: return 3;
2803  // WENO7 and WENO_Z7 read i-4..i+3, so the momentum fluxes reach four
2804  // cells beyond the faces of a tile in the velocities
2805  case AdvType::Weno_7:
2806  case AdvType::Weno_7Z: return 4;
2807  default: return 2;
2808  }
2809  };
2810  const auto& ac = sc.advChoice;
2811  for (const AdvType t : {ac.dycore_horiz_adv_type, ac.dycore_vert_adv_type,
2812  ac.dryscal_horiz_adv_type, ac.dryscal_vert_adv_type,
2813  ac.moistscal_horiz_adv_type, ac.moistscal_vert_adv_type}) {
2814  ngrow = std::max(ngrow, adv_ghost_cells(t));
2815  }
2816 
2817  return ngrow;
2818  }
2819 
2820  AMREX_FORCE_INLINE
2821  amrex::YAFluxRegister* getAdvFluxReg (int lev)
2822  {
2823  // The register on the lev-1 / lev interface holds the grids of both levels, so a level
2824  // made or remade after it was built must have rebuilt it; one built from an earlier
2825  // BoxArray would be indexed with the wrong boxes (erf-model/ERF#4988). The BoxArray
2826  // comparison is a pointer comparison when the register is current.
2827  if (advflux_reg[lev]) {
2829  advflux_reg[lev]->getCrseData().boxArray() == grids[lev-1] &&
2830  advflux_reg[lev]->getCrseData().DistributionMap() == dmap[lev-1],
2831  "The advective flux register was built from an earlier BoxArray of its coarse level");
2832  }
2833  return advflux_reg[lev].get();
2834  }
2835 
2836  AMREX_FORCE_INLINE
2837  std::ostream&
2838  DataLog (int i)
2839  {
2840  return *datalog[i];
2841  }
2842 
2843  AMREX_FORCE_INLINE
2844  std::ostream&
2845  DerDataLog (int i)
2846  {
2847  return *der_datalog[i];
2848  }
2849 
2850  AMREX_FORCE_INLINE
2851  int
2852  NumDataLogs () noexcept
2853  {
2854  return static_cast<int>(datalog.size());
2855  }
2856 
2857  AMREX_FORCE_INLINE
2858  int
2859  NumDerDataLogs () noexcept
2860  {
2861  return static_cast<int>(der_datalog.size());
2862  }
2863 
2864 
2865  static double startCPUTime;
2866  static double previousCPUTimeUsed;
2867 
2868  static double
2870  {
2871  int numCores = amrex::ParallelDescriptor::NProcs();
2872 #ifdef _OPENMP
2873  numCores = numCores * omp_get_max_threads();
2874 #endif
2875 
2876  double T =
2877  numCores * (amrex::ParallelDescriptor::second() - startCPUTime) +
2879 
2880  return T;
2881  }
2882 
2883  void setRecordDataInfo (int i, const std::string& filename) // NOLINT
2884  {
2885  if (amrex::ParallelDescriptor::IOProcessor())
2886  {
2887  datalog[i] = std::make_unique<std::fstream>();
2888  datalog[i]->open(filename.c_str(),std::ios::out|std::ios::app);
2889  if (!datalog[i]->good()) {
2890  amrex::FileOpenFailed(filename);
2891  }
2892  }
2893  amrex::ParallelDescriptor::Barrier("ERF::setRecordDataInfo");
2894  }
2895 
2896  void setRecordDerDataInfo (int i, const std::string& filename) // NOLINT
2897  {
2898  if (amrex::ParallelDescriptor::IOProcessor())
2899  {
2900  der_datalog[i] = std::make_unique<std::fstream>();
2901  der_datalog[i]->open(filename.c_str(),std::ios::out|std::ios::app);
2902  if (!der_datalog[i]->good()) {
2903  amrex::FileOpenFailed(filename);
2904  }
2905  }
2906  amrex::ParallelDescriptor::Barrier("ERF::setRecordDerDataInfo");
2907  }
2908 
2909  void setRecordEnergyDataInfo (int i, const std::string& filename) // NOLINT
2910  {
2911  if (amrex::ParallelDescriptor::IOProcessor())
2912  {
2913  tot_e_datalog[i] = std::make_unique<std::fstream>();
2914  tot_e_datalog[i]->open(filename.c_str(),std::ios::out|std::ios::app);
2915  if (!tot_e_datalog[i]->good()) {
2916  amrex::FileOpenFailed(filename);
2917  }
2918  }
2919  amrex::ParallelDescriptor::Barrier("ERF::setRecordEnergyDataInfo");
2920  }
2921 
2922  // Data sampler for line and plane output
2925  amrex::Real line_sampling_per = -one;
2926  amrex::Real plane_sampling_per = -one;
2927  std::unique_ptr<LineSampler> line_sampler = nullptr;
2928  // erf.sample_line / erf.sample_line_real: full-depth columns on level 0, written to logs
2929  // at the cadence of the other logs (erf.sum_interval / erf.sum_per)
2930  std::unique_ptr<LineSampler> sample_line_sampler = nullptr;
2931  // erf.sample_point / _real / _latlon: single cells, written to logs at the same cadence
2932  std::unique_ptr<LineSampler> sample_point_sampler = nullptr;
2933  std::unique_ptr<PlaneSampler> plane_sampler = nullptr;
2934 
2935  // Station time-series output
2937  amrex::Real station_sampling_per = -one;
2938  std::unique_ptr<StationSampler> station_sampler = nullptr;
2939  // The 3D and 2D plot variables the stations need, in the order the fill
2940  // routines produce their components
2941  amrex::Vector<std::string> station_vars_3d;
2942  amrex::Vector<std::string> station_vars_2d;
2943  // The immersed-forcing terrain surface under each level's grids, for the stations
2944  amrex::Vector<std::unique_ptr<amrex::MultiFab>> station_ib_ground;
2945 
2946  // Nudging towards observations at stations; built only when
2947  // solverChoice.nudging_from_observations is true
2948  std::unique_ptr<ObsNudging> obs_nudging = nullptr;
2949 
2950  amrex::Vector<std::unique_ptr<std::fstream> > datalog;
2951  amrex::Vector<std::unique_ptr<std::fstream> > der_datalog;
2952  amrex::Vector<std::unique_ptr<std::fstream> > tot_e_datalog;
2953  amrex::Vector<std::string> datalogname;
2954  amrex::Vector<std::string> der_datalogname;
2955  amrex::Vector<std::string> tot_e_datalogname;
2956 
2957  //! The filename of the ith datalog file.
2958  [[nodiscard]] std::string DataLogName (int i) const noexcept { return datalogname[i]; }
2959  [[nodiscard]] std::string DerDataLogName (int i) const noexcept { return der_datalogname[i]; }
2960 
2961  // array of EB objects
2962  amrex::Vector<std::unique_ptr<eb_>> eb;
2963 
2964  // Keep EB geometry construction, factories, and face-mask allocation in agreement.
2965  // Immersed buildings on a static fitted mesh default to cell-centered blanking.
2966  [[nodiscard]] bool use_native_fc_factories () const noexcept {
2967  return USE_FC_FACTORY &&
2968  !(solverChoice.buildings_type == BuildingsType::ImmersedForcing &&
2969  solverChoice.terrain_type == TerrainType::StaticFittedMesh &&
2971  }
2972 
2973  [[nodiscard]] eb_ const& get_eb (int lev) const noexcept {
2974  AMREX_ASSERT(lev >= 0 && lev < eb.size() && eb[lev] != nullptr);
2975  return *eb[lev];
2976  }
2977 
2978  //
2979  // NOTE: this dereferences the cell-centered EB factory, which is only built when
2980  // we are using EB or immersed forcing -- see ERF::MakeNewLevelFromScratch.
2981  // Calling this in any other case is undefined behavior, so we assert here
2982  // rather than relying on the (build-dependent) libstdc++ hardening check.
2983  //
2984  [[nodiscard]] amrex::EBFArrayBoxFactory const&
2985  EBFactory (int lev) const noexcept {
2986  AMREX_ASSERT(lev >= 0 && lev < eb.size() && eb[lev] != nullptr);
2987  AMREX_ASSERT(eb[lev]->get_const_factory() != nullptr);
2988  return *(eb[lev]->get_const_factory());
2989  }
2990 
2991  [[nodiscard]] static int nghost_eb_basic ()
2992  { return 5; }
2993 
2994  // We need 5 for doing StateRedistribution; otherwise 4 would be enough
2995  [[nodiscard]] static int nghost_eb_volume ()
2996  { return 5; }
2997 
2998  [[nodiscard]] static int nghost_eb_full ()
2999  { return 4; }
3000 
3001 #ifdef ERF_USE_FFT
3002  // Vector over levels of Vector over subdomains of solvers
3003  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::FFT::Poisson<amrex::MultiFab>>>> m_3D_poisson;
3004  amrex::Vector<amrex::Vector<std::unique_ptr<amrex::FFT::PoissonHybrid<amrex::MultiFab>>>> m_2D_poisson;
3005 #endif
3006 
3007 public:
3008  void writeJobInfo (const std::string& dir,
3009  erf_provenance::ArtifactType artifact_type,
3010  int artifact_step,
3011  double artifact_time_seconds) const;
3012  static void writeBuildInfo (std::ostream& os);
3013  static void writeBuildInfoJSON (std::ostream& os);
3014  static void writeBuildInfoYAML (std::ostream& os);
3015 
3016  static void print_banner (MPI_Comm /*comm*/, std::ostream& /*out*/);
3017  static void print_usage (MPI_Comm /*comm*/, std::ostream& /*out*/);
3018  static void print_error (MPI_Comm /*comm*/, const std::string& msg);
3019  static void print_summary (std::ostream&);
3020  static void print_tpls (std::ostream& /*out*/);
3021 };
3022 
3023 #endif
@ tau23
Definition: ERF_DataStruct.H:51
@ tau13
Definition: ERF_DataStruct.H:51
The interface between ERF and a dust model.
Declares the embedded-boundary factory manager used by ERF levels.
#define USE_FC_FACTORY
Select native AMReX face-centered factories instead of ERF auxiliary factories.
Definition: ERF_EB.H:88
Contains the Eulerian microphysics class.
The atmosphere side of the fire coupling, shared by every fire engine.
The atmosphere side of the flood coupling, shared by every flood engine.
Compact list of the wall faces of resolved buildings on one AMR level.
#define NBCVAR_max
Definition: ERF_IndexDefines.H:50
AdvType
Definition: ERF_IndexDefines.H:329
@ Centered_6th
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(axis >=0 &&axis< AMREX_SPACEDIM, "prob.axis must be 0, 1 or 2")
ParmParse pp("prob")
amrex::Real sigma
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:11
Contains the Lagrangian microphysics class.
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:139
The interface between ERF and a model of structures in the flow.
amrex::Vector< std::string > station_vars_3d
Definition: ERF.H:2941
void MakeHorizontalAverages()
Definition: ERF.cpp:5351
amrex::Vector< amrex::MultiFab > rU_new
Definition: ERF.H:1898
void solve_with_if_mlmg(int lev, amrex::Vector< amrex::MultiFab > &rhs, amrex::Vector< amrex::MultiFab > &phi, amrex::Vector< amrex::Array< amrex::MultiFab, AMREX_SPACEDIM >> &fluxes, amrex::Array< amrex::MultiFab const *, AMREX_SPACEDIM > const &sigma)
Definition: ERF_SolveWithMLMG.cpp:353
static int last_check_file_step
Definition: ERF.H:2222
amrex::Vector< std::unique_ptr< amrex::MultiFab > > walldist
Definition: ERF.H:2149
void average_down_precip_accumulators(int lev)
Definition: ERF_AdvanceMicrophysics.cpp:218
void ConfigureDriverAtmosToOceanCoupling(bool use_coupling_driver, bool use_two_way_coupling, bool use_state_contract)
Definition: ERF_to_REMORA.cpp:306
void sbm_qualification_apply_initial_profile(int lev)
Definition: ERF_SBMAMRQualification.cpp:576
std::unique_ptr< amrex::MultiFab > wrf_C1F
Definition: ERF.H:2615
amrex::Vector< amrex::Vector< amrex::Vector< amrex::Real > > > h_sponge_ptrs
Definition: ERF.H:2659
amrex::Array< int, AMREX_SPACEDIM *2 > m_th_file_face
Definition: ERF.H:2198
void GetOceanToAtmosSurfaceLayout(amrex::BoxArray &ba, amrex::DistributionMapping &dm)
Definition: ERF_to_REMORA.cpp:322
bool metgrid_basic_linear
Definition: ERF.H:2559
amrex::Vector< amrex::Vector< amrex::Box > > boxes_at_level
Definition: ERF.H:1801
void MakeEBGeometry()
void ReportTerrainSlopeFactor(int lev, bool force)
Definition: ERF_ComputeTimestep.cpp:302
int max_step
Definition: ERF.H:2255
amrex::Vector< amrex::Array< std::unique_ptr< amrex::MultiFab >, AMREX_SPACEDIM > > pi_upw_dir_stage
Definition: ERF.H:1863
void HurricaneTracker(int lev, double time, const amrex::MultiFab &cc_vel, const amrex::Real velmag_threshold, amrex::TagBoxArray *tags=nullptr)
Definition: ERF_RefineHurricane.cpp:147
amrex::Vector< std::unique_ptr< amrex::MultiFab > > pi_src
Definition: ERF.H:1874
bool metgrid_debug_msf
Definition: ERF.H:2557
AMREX_FORCE_INLINE std::ostream & DerDataLog(int i)
Definition: ERF.H:2845
void ibseb_give_ground_walls(int lev)
Definition: ERF_IBSEB.cpp:557
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > mapfac
Definition: ERF.H:2152
static bool diffusive_dt_limit
Definition: ERF.H:2282
void init_only(int lev, double time)
Definition: ERF.cpp:4176
bool plot_surfmodel
Definition: ERF.H:2385
void BuildPlot3DScratch(const amrex::Vector< std::string > &plot_var_names, Plot3DScratch &scratch, int max_lev=-1, bool sync_solution=true)
Definition: ERF_Plotfile.cpp:488
bool fine_volume_average(int crse_lev) const
Definition: ERF_AverageDown.cpp:608
void turbPert_amplitude_w(const int lev)
Definition: ERF_InitTurbPert.cpp:509
amrex::Vector< std::unique_ptr< MRISplitIntegrator< amrex::Vector< amrex::MultiFab > > > > mri_integrator_mem
Definition: ERF.H:1848
amrex::Vector< std::unique_ptr< amrex::iMultiFab > > column_kextent
Definition: ERF.H:2585
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > d_sinesq_stag_ptrs
Definition: ERF.H:2671
void check_vels_for_nans(amrex::MultiFab const &xvel, amrex::MultiFab const &yvel, amrex::MultiFab const &zvel)
Definition: ERF.cpp:5646
void refinement_box_offset(const std::string &ref_prefix, const double time, amrex::Real &offset_x, amrex::Real &offset_y)
Definition: ERF_RefineBox.cpp:372
void ibseb_write_checkpoint(const std::string &checkpointname, int lev) const
Definition: ERF_IBSEB.cpp:709
void Evolve()
Definition: ERF.cpp:167
amrex::Vector< amrex::MultiFab > avg_xmom
Definition: ERF.H:1878
amrex::Vector< std::string > urban_data_name
Definition: ERF.H:1951
amrex::Vector< amrex::MultiFab > pp_inc
Definition: ERF.H:1851
void make_eb_box()
amrex::Real m_warned_coupled_sst_max
Definition: ERF.H:1445
void cf_flux_history_record(int crse_lev, int fast_step, int n_sub, amrex::Real t_beg, amrex::Real t_end, const amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &rec, const amrex::MultiFab &rho_w_old, const amrex::MultiFab &rho_w_new)
Definition: ERF_CFFluxHistory.cpp:167
void momentum_reflux_reset()
Definition: ERF_MomentumReflux.cpp:383
amrex::Vector< ERFFillPatcher > FPr_u
Definition: ERF.H:2001
std::unique_ptr< SurfaceModel > m_SurfaceModel
Definition: ERF.H:1942
void solve_with_gmres(int lev, const amrex::Box &subdomain, amrex::MultiFab &rhs, amrex::MultiFab &p, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &fluxes, amrex::MultiFab &ax_sub, amrex::MultiFab &ay_sub, amrex::MultiFab &az_sub, amrex::MultiFab &, amrex::MultiFab &znd_sub, const amrex::MultiFab &mfux_sub, const amrex::MultiFab &mfvy_sub)
Definition: ERF_SolveWithGMRES.cpp:30
amrex::Vector< std::string > subvol3d_var_names
Definition: ERF.H:2396
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_q1fx3_lev
Definition: ERF.H:2024
void make_pseudo_incompressible_initial_state(int lev)
Definition: ERF_InitCustomPertState.cpp:227
amrex::Vector< double > t_new
Definition: ERF.H:1824
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Hwave_onegrid
Definition: ERF.H:2166
amrex::Vector< amrex::Vector< amrex::MultiFab > > vars_new
Definition: ERF.H:1832
void set_cf_fill_options(int lev, bool on)
Definition: ERF_CoarseFineFaces.cpp:1264
void FillCoarsePatch(int lev, double time)
Definition: ERF_FillCoarsePatch.cpp:20
void WriteAtIntermediateTime(int nstep, double time)
Definition: ERF.cpp:294
bool momentum_reflux_enabled() const
Definition: ERF_MomentumReflux.cpp:90
void Interp2DTimeSlice(int lev, int n, amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab >>> &field_lev, const amrex::BoxArray &my_ba2d, const amrex::DistributionMapping &my_dm)
Definition: ERF.cpp:3855
void SetCouplerGridRotation()
Definition: ERF_to_REMORA.cpp:874
ERF(ERF &&) noexcept=delete
bool writeNow(double cur_time, const int nstep, const int plot_int, const double plot_per, const double dt_0, double &last_file_time)
Definition: ERF.cpp:5558
static constexpr int column_kextent_hi_sentinel
Definition: ERF.H:2598
static double startCPUTime
Definition: ERF.H:2865
void FillBdyCCVels(amrex::MultiFab &mf_cc_vel, amrex::Geometry &lev_geom)
Definition: ERF_FillBdyCCVels.cpp:17
static double last_plot2d_file_time_1
Definition: ERF.H:2229
static void print_tpls(std::ostream &)
Definition: ERF_ConsoleIO.cpp:148
amrex::Vector< amrex::Real > dz_min
Definition: ERF.H:2774
void update_zsfc_nd(int lev)
Definition: ERF_MakeNewArrays.cpp:1473
void HurricaneEyeTracker(const SolverChoice &solverChoice, const amrex::MultiFab &mf_cc_vel, int &hurricane_eye_i_glob, int &hurricane_eye_j_glob, amrex::Real &hurricane_eye_latitude, amrex::Real &hurricane_eye_longitude)
Definition: ERF_HurricaneDiagnostics.cpp:947
void init_custom_forcing(int lev, amrex::Real time)
Definition: ERF.cpp:5898
amrex::Vector< amrex::MultiFab > lagged_delta_rt
Definition: ERF.H:1877
void init_seb_skin_from_file(int lev)
Definition: ERF.cpp:817
amrex::Real plane_sampling_per
Definition: ERF.H:2926
std::string DataLogName(int i) const noexcept
The filename of the ith datalog file.
Definition: ERF.H:2958
void make_lsm_at_level(int lev, bool from_regrid=false, int source_lev=-1, bool source_is_raw_input=false, bool initialize_now=false)
Definition: ERF_MakeNewLevel.cpp:2027
std::string plot2d_file_2
Definition: ERF.H:2367
void RegisterCoarseZMomentumCF(int levc, const amrex::MultiFab &wold, const amrex::MultiFab &wnew, const amrex::Vector< double > &times)
Definition: ERF_CoarseFineFaces.cpp:632
double m_plot3d_per_2
Definition: ERF.H:2378
static double bndry_output_planes_per
Definition: ERF.H:2626
amrex::Vector< std::unique_ptr< amrex::MultiFab > > thin_yforce
Definition: ERF.H:2215
void SetDriverAtmosToOceanStateContract(bool use_state_contract)
Definition: ERF_to_REMORA.cpp:316
void ErrorEst(int lev, amrex::TagBoxArray &tags, amrex::Real time, int ngrow) override
Definition: ERF_Tagging.cpp:81
bool cf_anelastic_stage1(int lev) const
Definition: ERF_CoarseFineFaces.cpp:972
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_hfx3_lev
Definition: ERF.H:2022
amrex::Vector< amrex::Vector< amrex::Real > > h_w_subsid
Definition: ERF.H:2639
static void print_banner(MPI_Comm, std::ostream &)
Definition: ERF_ConsoleIO.cpp:65
void volWgtColumnSum(int lev, const amrex::MultiFab &mf, int comp, amrex::MultiFab &mf_2d, const amrex::MultiFab &dJ)
Definition: ERF_VolWgtSum.cpp:104
amrex::Vector< int > m_rad_cut_in_z_warned
Definition: ERF.H:659
bool projection_uses_terrain_solver(int lev) const
Definition: ERF_PoissonSolve.cpp:155
amrex::Vector< std::unique_ptr< ShocDriver > > native_shoc_driver
Definition: ERF.H:1980
amrex::Vector< std::unique_ptr< std::fstream > > datalog
Definition: ERF.H:2950
std::string MakeFilename_EyeTracker_maxvel(int nstep)
Definition: ERF_TrackerOutput.cpp:70
BaseStateParams wrf_bsp
Definition: ERF.H:2610
amrex::Vector< ERFFillPatcher > FPr_v
Definition: ERF.H:2002
std::unique_ptr< amrex::MultiFab > m_coupled_current_north
Definition: ERF.H:1433
int cf_set_width
Definition: ERF.H:1987
void initializeEB()
Definition: ERF_EBInit.cpp:23
static void writeBuildInfoJSON(std::ostream &os)
Definition: ERF_BuildDescription.cpp:232
void FillPatchTwoLevelsCons(int lev, amrex::MultiFab &mf, const amrex::IntVect &nghost, amrex::Real time, const amrex::Vector< amrex::MultiFab * > &cmf, const amrex::Vector< amrex::Real > &ctime, const amrex::Vector< amrex::MultiFab * > &fmf, const amrex::Vector< amrex::Real > &ftime, int scomp, int dcomp, int ncomp, int bccomp, bool perturbational=true, bool volume_weighted=false)
Definition: ERF_FillPatch.cpp:601
std::unique_ptr< amrex::MultiFab > wrf_MUB
Definition: ERF.H:2617
void momentum_reflux(int crse_lev)
Definition: ERF_MomentumReflux.cpp:204
void setPlotVariables(const std::string &pp_plot_var_names, amrex::Vector< std::string > &plot_var_names)
Definition: ERF_Plotfile.cpp:148
amrex::Gpu::DeviceVector< amrex::Real > d_havg_temperature
Definition: ERF.H:2680
void post_timestep(int nstep, double time, double dt_lev)
Definition: ERF.cpp:1166
std::unique_ptr< amrex::MultiFab > wrf_C1H
Definition: ERF.H:2612
std::string erfbdy_file
Definition: ERF.H:2571
void setRayleighRefFromSounding_at_level(int lev)
Set Rayleigh mean profiles at a level from the input sounding.
Definition: ERF_InitRayleigh.cpp:103
void init_obs_nudging()
Definition: ERF.cpp:3335
static int last_plot2d_file_step_2
Definition: ERF.H:2221
int station_sampling_interval
Definition: ERF.H:2936
void copy_base_state_from_grown_boxes(int lev, amrex::MultiFab &bs, const amrex::MultiFab &bs_g)
Definition: ERF_RebuildBaseState.cpp:194
int pi_theta_inflow_face(const amrex::Orientation &ori) const
Definition: ERF_InitBCs.cpp:1273
bool ibseb_after_radiation() const
Definition: ERF.H:1156
bool init_Dirichlet_bc_data(const std::string input_file)
Definition: ERF_InitBCs.cpp:1046
IBSEBParams ibseb_params
Definition: ERF.H:2115
bool cf_flux_history_active(int crse_lev) const
Definition: ERF_CFFluxHistory.cpp:65
const int timeprecision
Definition: ERF.H:2248
bool cf_zface_coarse_data(int lev, double time, bool conserved_rho, amrex::MultiFab &omega_t, amrex::MultiFab &rhou_g, amrex::MultiFab &rhov_g, amrex::Vector< int > &slab_box)
Definition: ERF_CoarseFineFaces.cpp:366
amrex::Vector< amrex::Vector< amrex::MultiFab * > > urban_data
Definition: ERF.H:1950
void define_pi_upw_dir(int lev)
Define pi_upw_dir[lev] and pi_upw_dir_stage[lev] on the level's faces (zero) if needed.
Definition: ERF_PoissonSolve.cpp:243
void setRecordDataInfo(int i, const std::string &filename)
Definition: ERF.H:2883
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_hfx1_lev
Definition: ERF.H:2022
void canonicalizePlot3DVariables(amrex::Vector< std::string > &plot_var_names)
Definition: ERF_Plotfile.cpp:186
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_eye_track_xy
Definition: ERF.H:311
void SurfaceDataInterpolation(const int nlevs, const double time, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &z_phys_nd, bool regrid_forces_file_read)
Definition: ERF_SurfaceDataInterpolation.cpp:186
amrex::Vector< amrex::BoxArray > ba2d
Definition: ERF.H:2575
void make_ib_wall_face_masks_lev(int lev)
Definition: ERF_PoissonWallDist.cpp:738
amrex::Array< amrex::Array< amrex::Real, AMREX_SPACEDIM *2 >, AMREX_SPACEDIM+NBCVAR_max > m_bc_extdir_vals
Definition: ERF.H:2183
void turbPert_update_automatic(int lev, double time)
Definition: ERF_InitTurbPert.cpp:147
void momentum_reflux_add_sources(int lev, amrex::MultiFab &xmom_src, amrex::MultiFab &ymom_src)
Definition: ERF_MomentumReflux.cpp:365
void init_stations()
Definition: ERF_StationSampler.cpp:717
void init_from_input_sounding(int lev)
Definition: ERF_InitFromInputSounding.cpp:152
void erf_enforce_hse(int lev, amrex::MultiFab &dens, amrex::MultiFab &pres, amrex::MultiFab &pi, amrex::MultiFab &th, amrex::MultiFab &qv, std::unique_ptr< amrex::MultiFab > &z_cc)
Definition: ERF_Init1D.cpp:279
void make_base_state_on_grown_boxes(int lev, const amrex::MultiFab &bs, int grow, const amrex::IntVect &ng, amrex::MultiFab &bs_g, std::unique_ptr< amrex::MultiFab > &z_nd_g, std::unique_ptr< amrex::MultiFab > &z_cc_g)
Definition: ERF_RebuildBaseState.cpp:76
amrex::Vector< amrex::Vector< amrex::MultiFab > > gradp
Definition: ERF.H:1836
bool has_own_low_file(int lev) const
Definition: ERF.cpp:3376
std::string plot3d_file_1
Definition: ERF.H:2364
bool immersed_forcing_active(int lev) const noexcept
Definition: ERF.H:1401
eb_ const & get_eb(int lev) const noexcept
Definition: ERF.H:2973
amrex::Gpu::DeviceVector< amrex::Real > d_havg_qv
Definition: ERF.H:2682
amrex::Vector< std::unique_ptr< amrex::MultiFab > > qfx3_EB
Definition: ERF.H:2031
static bool plot_file_on_restart
Definition: ERF.H:2243
amrex::Vector< amrex::Vector< amrex::MultiFab > > bckgnd_state
Definition: ERF.H:325
amrex::Long m_warned_coupled_sst_nan
Definition: ERF.H:1446
static int mg_verbose
Definition: ERF.H:2517
double m_check_per
Definition: ERF.H:2394
void ReadParameters()
Definition: ERF.cpp:4368
static double sum_per
Definition: ERF.H:2525
void rebuild_base_state_from_coarse(int lev)
Definition: ERF_RebuildBaseState.cpp:307
static amrex::Vector< std::string > PlotFileVarNames(amrex::Vector< std::string > plot_var_names)
Definition: ERF_Plotfile.cpp:466
amrex::Vector< amrex::Vector< amrex::MultiFab > > forecast_state_interp
Definition: ERF.H:320
bool FindInitialEye(int lev, const amrex::MultiFab &cc_vel, const amrex::Real velmag_threshold, amrex::Real &eye_x, amrex::Real &eye_y)
Definition: ERF_RefineHurricane.cpp:31
void InitializeFromFile()
std::vector< amrex::Real > sbm_qualification_initial_inventory
Definition: ERF.H:1913
amrex::Vector< std::unique_ptr< ERFPhysBCFunct_cons > > physbcs_cons
Definition: ERF.H:1883
amrex::Vector< double > dt
Definition: ERF.H:1826
static double stop_time
Definition: ERF.H:2259
static void writeBuildInfoYAML(std::ostream &os)
Definition: ERF_BuildDescription.cpp:237
void advance_lsm(int lev, amrex::MultiFab &cons_in, amrex::MultiFab &xvel_in, amrex::MultiFab &yvel_in, const double &time, const double &dt_advance)
Definition: ERF_AdvanceLSM.cpp:51
amrex::Vector< std::unique_ptr< amrex::MultiFab > > mf_PSFC
Definition: ERF.H:2621
void flush_stations() const
Definition: ERF_StationSampler.cpp:1656
ERF()
Definition: ERF_Constructors.cpp:323
~ERF() override
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_phys_nd_src
Definition: ERF.H:2102
amrex::Vector< std::unique_ptr< amrex::MultiFab > > detJ_cc
Definition: ERF.H:2044
void seb_surface_layer_fluxes(int lev, const amrex::MultiFab *&sens_flux, const amrex::MultiFab *&laten_flux) const
Definition: ERF.cpp:712
amrex::Vector< std::string > lsm_flux_name
Definition: ERF.H:1948
void cf_anelastic_record(int levc, int nrk)
Definition: ERF_CoarseFineFaces.cpp:929
void WriteMyEBSurface()
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_phys_cc
Definition: ERF.H:2038
amrex::Vector< amrex::BoxArray > slope_report_grids
Definition: ERF.H:2289
amrex::Vector< std::unique_ptr< eb_ > > eb
Definition: ERF.H:2962
amrex::Vector< std::unique_ptr< amrex::MultiFab > > eddyDiffs_lev
Definition: ERF.H:2008
static SolverChoice solverChoice
Definition: ERF.H:2481
static constexpr int column_kextent_lo_sentinel
Definition: ERF.H:2597
amrex::Vector< std::unique_ptr< amrex::MultiFab > > hfx3_EB
Definition: ERF.H:2030
int mean_vars_time_reset_done
Definition: ERF.H:1846
amrex::Vector< int > m_cf_stage1
Definition: ERF.H:512
amrex::Vector< ERFFillPatcher > FPr_c
Definition: ERF.H:2000
amrex::Real m_a2o_precip_time
Definition: ERF.H:1458
void WriteGenericPlotfileHeaderWithTerrain(std::ostream &HeaderFile, int nlevels, const amrex::Vector< amrex::BoxArray > &bArray, const amrex::Vector< std::string > &varnames, const amrex::Vector< amrex::Geometry > &my_geom, double time, const amrex::Vector< int > &level_steps, const amrex::Vector< amrex::IntVect > &my_ref_ratio, const std::string &versionName, const std::string &levelPrefix, const std::string &mfPrefix) const
Definition: ERF_Plotfile.cpp:2599
void update_box_for_refinement(std::string &ref_prefix, int &lev_for_box, amrex::RealBox &real_box, const double time)
Definition: ERF_RefineBox.cpp:434
void advance_urban(int lev, amrex::MultiFab &cons_in, amrex::MultiFab &u_in, amrex::MultiFab &v_in, const amrex::Real &dt_advance, const amrex::Geometry &geom, const amrex::MultiFab *z_phys_nd, amrex::MultiFab &eddyDiffs_in)
Definition: ERF_AdvanceUrban.cpp:9
amrex::Vector< amrex::DistributionMapping > dm_chkfile
Definition: ERF.H:2330
bool plot_rad
Definition: ERF.H:1982
TwoStreamRadiation two_stream_rad
Definition: ERF.H:1977
amrex::Vector< amrex::Real > diffusive_fourier_warned
Definition: ERF.H:2287
void sbm_check_budget(int nstep)
Definition: ERF_SBMAMRCoupling.cpp:270
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_tracker_circle
Definition: ERF.H:315
static bool use_fft
Definition: ERF.H:2518
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_face13
Definition: ERF.H:2128
void SampleA2OPrecipAccumulation(amrex::MultiFab &accum_2d) const
Definition: ERF_to_REMORA.cpp:366
bool m_plot_face_vels
Definition: ERF.H:2381
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_maxvel_vs_time
Definition: ERF.H:313
void turbPert_update(const int lev, const double dt)
Definition: ERF_InitTurbPert.cpp:454
void sum_derived_quantities(double time)
Definition: ERF_WriteScalarProfiles.cpp:294
amrex::Array< amrex::Array< int, AMREX_SPACEDIM *2 >, NBCVAR_max > m_bc_prim_given
Definition: ERF.H:2202
amrex::Vector< amrex::MultiFab > base_state_new
Definition: ERF.H:2161
std::unique_ptr< MassSource > m_mass_source
A localized source of gas (erf.mass_source.*); nullptr unless one is given.
Definition: ERF.H:2693
std::string plot3d_file_2
Definition: ERF.H:2365
void ibseb_set_two_stream_sun(int lev, amrex::Real time)
Definition: ERF_IBSEB.cpp:580
amrex::Vector< std::unique_ptr< amrex::MultiFab > > az
Definition: ERF.H:2100
int regrid_int
Definition: ERF.H:2317
amrex::Vector< std::unique_ptr< ERFPhysBCFunct_base > > physbcs_base_new
Definition: ERF.H:1889
bool ibseb_two_stream_buildings() const
Definition: ERF.H:1153
void sample_stations(amrex::Real time)
Definition: ERF_StationSampler.cpp:1340
void RegisterCoarseMomentumCF(int levc, const amrex::MultiFab &xold, const amrex::MultiFab &xnew, const amrex::MultiFab &yold, const amrex::MultiFab &ynew, const amrex::Vector< double > &times)
Definition: ERF_CoarseFineFaces.cpp:657
bool write_erfbdy
Definition: ERF.H:2568
amrex::Vector< amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > > d_sponge_ptrs
Definition: ERF.H:2667
amrex::Vector< std::unique_ptr< amrex::MultiFab > > precip
Definition: ERF.H:1927
amrex::Vector< long > dt_mri_ratio
Definition: ERF.H:1827
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > Tau
Definition: ERF.H:2006
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vel_t_avg
Definition: ERF.H:1839
std::vector< double > sbm_budget_reference_outward
Definition: ERF.H:1917
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_q2fx3_lev
Definition: ERF.H:2025
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab > > > lmask_lev
Definition: ERF.H:2014
static amrex::Vector< RefinementCriterion > ref_criteria
Definition: ERF.H:2770
void build_nested_base_state(int lev, amrex::MultiFab &bs)
Definition: ERF_NestedBaseState.cpp:90
void GetFillableAtmosToOceanLanes(bool state_contract, amrex::Vector< int > &can_fill) const
Definition: ERF_to_REMORA.cpp:412
amrex::Vector< amrex::Real > h_havg_pressure
Definition: ERF.H:2675
void update_diffusive_arrays(int lev, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm)
Definition: ERF_MakeNewArrays.cpp:792
bool regrid_level_0_on_restart_in_effect
Definition: ERF.H:2331
std::unique_ptr< amrex::MultiFab > m_a2o_precip_accum
Definition: ERF.H:1456
std::unique_ptr< amrex::MultiFab > wrf_PHB
Definition: ERF.H:2619
bool metrics_from_finest(int lev)
Definition: ERF_MakeNewArrays.cpp:1358
static int verbose
Definition: ERF.H:2516
std::unique_ptr< amrex::MultiFab > m_a2o_precip_rate
Definition: ERF.H:1457
amrex::Vector< amrex::Real > h_havg_qc
Definition: ERF.H:2677
amrex::Vector< std::unique_ptr< ERFPhysBCFunct_w > > physbcs_w
Definition: ERF.H:1886
static int nghost_eb_basic()
Definition: ERF.H:2991
void derive_diag_profiles_stag(double time, amrex::Gpu::HostVector< amrex::Real > &h_avg_u, amrex::Gpu::HostVector< amrex::Real > &h_avg_v, amrex::Gpu::HostVector< amrex::Real > &h_avg_w, amrex::Gpu::HostVector< amrex::Real > &h_avg_rho, amrex::Gpu::HostVector< amrex::Real > &h_avg_th, amrex::Gpu::HostVector< amrex::Real > &h_avg_ksgs, amrex::Gpu::HostVector< amrex::Real > &h_avg_Kmv, amrex::Gpu::HostVector< amrex::Real > &h_avg_Khv, amrex::Gpu::HostVector< amrex::Real > &h_avg_qv, amrex::Gpu::HostVector< amrex::Real > &h_avg_qc, amrex::Gpu::HostVector< amrex::Real > &h_avg_qr, amrex::Gpu::HostVector< amrex::Real > &h_avg_wqv, amrex::Gpu::HostVector< amrex::Real > &h_avg_wqc, amrex::Gpu::HostVector< amrex::Real > &h_avg_wqr, amrex::Gpu::HostVector< amrex::Real > &h_avg_qi, amrex::Gpu::HostVector< amrex::Real > &h_avg_qs, amrex::Gpu::HostVector< amrex::Real > &h_avg_qg, amrex::Gpu::HostVector< amrex::Real > &h_avg_uu, amrex::Gpu::HostVector< amrex::Real > &h_avg_uv, amrex::Gpu::HostVector< amrex::Real > &h_avg_uw, amrex::Gpu::HostVector< amrex::Real > &h_avg_vv, amrex::Gpu::HostVector< amrex::Real > &h_avg_vw, amrex::Gpu::HostVector< amrex::Real > &h_avg_ww, amrex::Gpu::HostVector< amrex::Real > &h_avg_uth, amrex::Gpu::HostVector< amrex::Real > &h_avg_vth, amrex::Gpu::HostVector< amrex::Real > &h_avg_wth, amrex::Gpu::HostVector< amrex::Real > &h_avg_thth, amrex::Gpu::HostVector< amrex::Real > &h_avg_ku, amrex::Gpu::HostVector< amrex::Real > &h_avg_kv, amrex::Gpu::HostVector< amrex::Real > &h_avg_kw, amrex::Gpu::HostVector< amrex::Real > &h_avg_p, amrex::Gpu::HostVector< amrex::Real > &h_avg_pu, amrex::Gpu::HostVector< amrex::Real > &h_avg_pv, amrex::Gpu::HostVector< amrex::Real > &h_avg_pw, amrex::Gpu::HostVector< amrex::Real > &h_avg_wthv, amrex::Gpu::HostVector< amrex::Real > &h_avg_thv)
Definition: ERF_Write1DProfiles_stag.cpp:366
void post_update(amrex::MultiFab &state_mf, double time, const amrex::Geometry &geom)
void ComputeSubstepRatio(int lev, double estdt_comp_T, long &dt_fast_ratio) const
Definition: ERF_ComputeTimestep.cpp:1109
void AverageDownMoistStateTo(int crse_lev)
Conservation-preserving fine-to-coarse average of RhoTheta and the active moist conserved components ...
Definition: ERF_AverageDown.cpp:585
void solve_with_flat_mlmg(int lev, const amrex::Box &subdomain, amrex::MultiFab &rhs, amrex::MultiFab &phi, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &fluxes, const amrex::MultiFab &ax_sub, const amrex::MultiFab &ay_sub, const amrex::MultiFab &az_sub, const amrex::MultiFab &dJ_sub, const amrex::MultiFab &znd_sub)
Definition: ERF_SolveWithMLMG.cpp:232
amrex::Vector< amrex::Array< amrex::MultiFab, 2 > > m_cf_step_flux
Definition: ERF.H:514
void fill_sbm_mixing_density(int lev, amrex::MultiFab &density)
Definition: ERF_SBMAMRCoupling.cpp:162
amrex::Vector< double > last_subvol_time
Definition: ERF.H:2241
void FillForecastStateMultiFabs(const int lev, const std::string &filename, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, amrex::Vector< amrex::Vector< amrex::MultiFab >> &forecast_state)
Definition: ERF_WeatherDataInterpolation.cpp:72
amrex::Vector< int > m_mom_reflux_stale
Definition: ERF.H:2090
amrex::Vector< std::unique_ptr< amrex::MultiFab > > terrain_blanking
Definition: ERF.H:2121
amrex::Vector< std::unique_ptr< amrex::MultiFab > > terrain_blanking_xface
Definition: ERF.H:2122
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_sfc_nd
Definition: ERF.H:2042
std::unique_ptr< Microphysics > micro
Definition: ERF.H:1908
void surface_flux_sources(int lev, const amrex::MultiFab *&sens_flux, const amrex::MultiFab *&laten_flux) const
Definition: ERF_Plotfile2D.cpp:177
int m_plot2d_int_2
Definition: ERF.H:2372
amrex::Vector< amrex::MultiFab > base_state
Definition: ERF.H:2160
void fill_rhs(amrex::MultiFab &rhs_mf, const amrex::MultiFab &state_mf, double time, const amrex::Geometry &geom)
void sbm_qualification_check_step(int nstep, amrex::Real correction_linf, std::uint64_t reflux_calls, std::uint64_t reflux_syncs)
Definition: ERF_SBMAMRQualification.cpp:651
void GetEnsembleCheckpointName(int da_iter, int ens_no)
AMREX_FORCE_INLINE amrex::YAFluxRegister * getAdvFluxReg(int lev)
Definition: ERF.H:2821
int m_plot3d_int_1
Definition: ERF.H:2369
amrex::Vector< amrex::Real > h_havg_density
Definition: ERF.H:2673
amrex::Vector< int > m_skin_uncoupled_warned
Definition: ERF.H:655
static double last_plot2d_file_time_2
Definition: ERF.H:2230
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_phys_nd_new
Definition: ERF.H:2109
void create_background_state_for_ensemble(int lev, amrex::MultiFab &mf_cc_pert, amrex::MultiFab &cons_pert, amrex::MultiFab &xvel_pert, amrex::MultiFab &yvel_pert, amrex::MultiFab &zvel_pert)
Definition: ERF_InitForEnsemble.cpp:740
void initSponge_at_level(int lev)
Allocate the sponge profiles at a level.
Definition: ERF_InitSponge.cpp:52
const amrex::Vector< std::string > derived_subvol_names
Definition: ERF.H:2477
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_minpressure_vs_time
Definition: ERF.H:314
bool metgrid_retain_sfc
Definition: ERF.H:2562
amrex::Vector< amrex::BoxArray > beta_s_check_grids
Definition: ERF.H:2300
void AverageDownTo(int crse_lev, int scomp, int ncomp, bool do_full_state_and_momenta=true)
Definition: ERF_AverageDown.cpp:103
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Qv_prim
Definition: ERF.H:1893
static int sum_interval
Definition: ERF.H:2523
static int pert_interval
Definition: ERF.H:2524
amrex::Real line_sampling_per
Definition: ERF.H:2925
void restart()
Definition: ERF.cpp:4096
void ibseb_report(int nstep, amrex::Real time)
Definition: ERF_IBSEB.cpp:730
void check_if_cf_mismatch(int lev)
Definition: ERF_MakeNewArrays.cpp:1588
amrex::Vector< double > t_avg_cnt
Definition: ERF.H:1840
static int last_plot3d_file_step_2
Definition: ERF.H:2219
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_q1fx2_lev
Definition: ERF.H:2024
amrex::Vector< double > fixed_fast_dt
Definition: ERF.H:2305
void build_fine_mask(int lev, amrex::MultiFab &fine_mask)
Definition: ERF_VolWgtSum.cpp:159
void HurricaneMaxVelTracker(const amrex::Geometry &geom, const amrex::MultiFab &mf_cc_vel, const double &time)
Definition: ERF_HurricaneDiagnostics.cpp:673
amrex::Real station_sampling_per
Definition: ERF.H:2937
amrex::Real calday
Definition: ERF.H:1972
int file_name_digits
Definition: ERF.H:2533
amrex::Vector< amrex::MultiFab > rV_new
Definition: ERF.H:1900
std::string PlotFileName(int lev) const
static bool diffusive_dt_check
Definition: ERF.H:2281
void ComputeGlobalMinLocation(const SolverChoice &sc, const amrex::Geometry &geom, const amrex::Vector< amrex::MultiFab > &S_data, amrex::Real *d_val_min_ptr, int *d_i_min_ptr, int *d_j_min_ptr, amrex::Real &global_val_min, int &global_i_min, int &global_j_min, amrex::Real &hurricane_eye_latitude, amrex::Real &hurricane_eye_longitude)
Definition: ERF_HurricaneDiagnostics.cpp:82
void initialize_integrator(int lev, amrex::MultiFab &cons_mf, amrex::MultiFab &vel_mf)
Definition: ERF_MakeNewArrays.cpp:1491
amrex::Vector< std::unique_ptr< amrex::MultiFab > > thin_zforce
Definition: ERF.H:2216
amrex::Vector< std::string > plot3d_var_names_2
Definition: ERF.H:2399
void WeatherDataInterpolation(const int nlevs, const double time, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &z_phys_nd, bool regrid_forces_file_read)
Definition: ERF_WeatherDataInterpolation.cpp:400
amrex::Vector< amrex::BCRec > domain_bcs_type
Definition: ERF.H:2176
TopographicShading topographic_radiation
Definition: ERF.H:1978
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Qr_prim
Definition: ERF.H:1894
void ibseb_check_refined_levels() const
Definition: ERF_IBSEB.cpp:262
amrex::Vector< std::unique_ptr< amrex::MultiFab > > pi_adv_rt
Definition: ERF.H:1873
void resolve_station_stencils()
Definition: ERF_StationSampler.cpp:1005
void apply_gaussian_smoothing_to_perturbations(const int lev, amrex::MultiFab &mf_cc_pert)
Definition: ERF_InitForEnsemble.cpp:119
std::string pp_prefix
Definition: ERF.H:1259
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > sst_lev
Definition: ERF.H:2012
amrex::Vector< amrex::TableData< amrex::Real, 1 > > t_plane_avg
Definition: ERF.H:1770
amrex::Vector< std::string > plot2d_var_names_1
Definition: ERF.H:2400
void rebuild_base_state(int lev)
Definition: ERF_RebuildBaseState.cpp:248
void init_phys_bcs(bool &read_prim_theta)
Definition: ERF_InitBCs.cpp:26
amrex::Vector< std::unique_ptr< amrex::MultiFab > > thin_xforce
Definition: ERF.H:2214
void WriteEBLevelSet()
Definition: ERF_Plotfile.cpp:130
static bool grids_are_split_in_z(const amrex::BoxArray &ba)
Definition: ERF_MakeNewArrays.cpp:703
void build_zphys_nd(int lev, const amrex::MultiFab *crse_znd, amrex::MultiFab &dst, double time)
Definition: ERF_MakeNewArrays.cpp:1003
bool metgrid_use_sfc
Definition: ERF.H:2561
amrex::Vector< std::unique_ptr< amrex::YAFluxRegister > > advflux_reg
Definition: ERF.H:2171
bool m_warned_coupler_no_latlon
Definition: ERF.H:1426
void ComputeAndWriteEnsemblePerturbations(const int da_iter)
void setPlotVariables2D(const std::string &pp_plot_var_names, amrex::Vector< std::string > &plot_var_names)
Definition: ERF_Plotfile2D.cpp:119
void interp_psfc_from_coarse(int lev)
Definition: ERF.cpp:3507
void init_custom(int lev)
Definition: ERF_InitCustomPertState.cpp:26
amrex::Vector< std::unique_ptr< IRadiation > > rad
Definition: ERF.H:1962
bool cf_flat_mapfac(int lev) const
Definition: ERF_CoarseFineFaces.cpp:552
std::unique_ptr< ProblemBase > prob
Definition: ERF.H:1797
amrex::Vector< int > num_files_at_level
Definition: ERF.H:1800
void ibseb_advance(int lev, amrex::Real time, amrex::Real dt_lev, const amrex::MultiFab &cons, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &zvel)
Definition: ERF_IBSEB.cpp:621
static double last_plot3d_file_time_2
Definition: ERF.H:2228
void init_bcs()
Definition: ERF_InitBCs.cpp:408
int profile_int
Definition: ERF.H:2388
erf_cloud_chamber::Config cloud_chamber_config
Definition: ERF.H:1925
bool metgrid_debug_quiescent
Definition: ERF.H:2553
amrex::Vector< std::unique_ptr< ERFPhysBCFunct_u > > physbcs_u
Definition: ERF.H:1884
bool destag_profiles
Definition: ERF.H:2389
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > stretched_dz_d
Definition: ERF.H:2158
void AverageDownConsPerturbational(int crse_lev, int scomp, int ncomp)
Average-down of the cell-centered state used by AverageDownTo when erf.perturbational_average_down is...
Definition: ERF_AverageDown.cpp:467
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > th_bc_data
Definition: ERF.H:1763
void FillPlot2DVars(int lev, const amrex::Vector< std::string > &plot_var_names, const amrex::Vector< std::string > &varnames, const amrex::Vector< plotfile2d::Plotfile2DOutputDescriptor > &output_descriptors, amrex::MultiFab &mf_dst, int ncomp_mf)
Definition: ERF_Plotfile2D.cpp:214
std::string DerDataLogName(int i) const noexcept
Definition: ERF.H:2959
void make_terrain_blanking(int lev)
Definition: ERF_MakeNewArrays.cpp:1241
void compute_max_pressure_gradient_diagnostic(int lev)
Definition: ERF_Diagnostics.cpp:14
void remake_zphys(int lev, amrex::Real time, std::unique_ptr< amrex::MultiFab > &temp_zphys_nd)
Definition: ERF_MakeNewArrays.cpp:1167
int m_check_int
Definition: ERF.H:2393
void flat_heights(int lev, amrex::MultiFab &z_nd)
Definition: ERF_NestedBaseState.cpp:348
void FillPatchFineLevel(int lev, double time, const amrex::Vector< amrex::MultiFab * > &mfs_vel, const amrex::Vector< amrex::MultiFab * > &mfs_mom, bool fillset=true, bool cons_only=false, bool allow_perturbational=true, bool volume_weighted=false)
Definition: ERF_FillPatch.cpp:29
void ReadVelsOnlyFromCheckpointFile(int lev_to_fill, std::string &chkfile)
Definition: ERF_Checkpoint.cpp:2851
std::vector< amrex::Real > sbm_composite_inventory() const
Definition: ERF_SBMAMRCoupling.cpp:200
void set_surface_layer_skin(int lev)
Definition: ERF.cpp:536
amrex::Vector< std::unique_ptr< amrex::MultiFab > > terrain_blanking_zface
Definition: ERF.H:2124
void appendPlot3DVariables(const amrex::Vector< std::string > &plot_var_names, amrex::Vector< std::string > &a_plot_var_names)
Definition: ERF_Plotfile.cpp:348
std::unique_ptr< amrex::iMultiFab > m_coupled_sst_valid
Definition: ERF.H:1417
static double last_plot3d_file_time_1
Definition: ERF.H:2227
double m_plot2d_per_2
Definition: ERF.H:2380
amrex::Vector< amrex::MultiFab > surface_state_1
Definition: ERF.H:321
std::unique_ptr< amrex::MultiFab > wrf_C2F
Definition: ERF.H:2616
void average_down_mass_flux(int crse_lev)
Definition: ERF_CoarseFineFaces.cpp:690
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_diss_lev
Definition: ERF.H:2023
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > d_sinesq_ptrs
Definition: ERF.H:2670
amrex::Vector< amrex::MultiFab > rU_old
Definition: ERF.H:1897
amrex::Vector< amrex::MultiFab > m_mom_reflux_p
Definition: ERF.H:2088
static amrex::Vector< std::string > nc_low_file_at_level
Definition: ERF.H:2550
amrex::Vector< std::unique_ptr< InputSoundingData > > input_sounding_data_fine
Definition: ERF.H:1754
bool HasRadiation() const
Definition: ERF.H:216
void ibseb_check_sun_matches_two_stream() const
Definition: ERF_IBSEB.cpp:344
amrex::Array< bool, AMREX_SPACEDIM *2 > m_bc_nonreflecting
Definition: ERF.H:2195
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Theta_prim
Definition: ERF.H:1892
void ibseb_give_roofs(int lev)
Definition: ERF_IBSEB.cpp:535
static double getCPUTime()
Definition: ERF.H:2869
void write_1D_profiles(double time)
Definition: ERF_Write1DProfiles.cpp:23
void init1DArrays()
void convert_legacy_precip_accumulations(int lev)
Definition: ERF_Checkpoint.cpp:1000
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_t_rk
Definition: ERF.H:2112
void WriteVTKPolyline(const std::string &filename, const amrex::Vector< std::array< amrex::Real, 2 >> &points_xy)
Definition: ERF_TrackerOutput.cpp:112
static int check_for_nans
Definition: ERF.H:2520
void make_subdomains(const amrex::BoxList &ba, amrex::Vector< amrex::BoxArray > &bins)
Group a list of boxes into subdomains based on adjacency.
Definition: ERF_MakeSubdomains.cpp:11
std::string MakeVTKFilename(int nstep)
Definition: ERF_TrackerOutput.cpp:15
void initRayleigh_at_level(const int &lev)
Initialize Rayleigh damping profiles at a level.
Definition: ERF_InitRayleigh.cpp:16
Urban urban
Definition: ERF.H:1945
void FillSetZMomentumCF(int lev, double time, amrex::MultiFab &zmom)
Definition: ERF_CoarseFineFaces.cpp:1148
bool m_warned_coupled_current_declined
Definition: ERF.H:1438
void appendPlotVariables(const std::string &pp_plot_var_names, amrex::Vector< std::string > &plot_var_names)
Definition: ERF_Plotfile.cpp:312
void read_box_for_refinement(std::string &ref_prefix, int &lev_for_box, amrex::RealBox &real_box)
Definition: ERF_RefineBox.cpp:13
amrex::Vector< int > rad_interp_from_coarse_pending
Definition: ERF.H:1821
int nvars_erfbdy
Definition: ERF.H:2572
amrex::Vector< std::unique_ptr< ERFPhysBCFunct_v > > physbcs_v
Definition: ERF.H:1885
void SetDirsForPlotfilesAndCheckpointsForDA(const int da_iter, const int ens_no)
bool cf_interp_mass_flux(int lev) const
Definition: ERF_CoarseFineFaces.cpp:536
amrex::Real m_warned_coupled_sst_min
Definition: ERF.H:1444
bool compute_tag_field(int levc, const std::string &field, amrex::Real time, amrex::MultiFab &mf, amrex::TagBoxArray &tags)
Definition: ERF_Tagging.cpp:473
amrex::Vector< double > t_old
Definition: ERF.H:1825
amrex::Vector< amrex::BoxArray > fixed_dt_check_grids
Definition: ERF.H:2296
amrex::Vector< std::string > tot_e_datalogname
Definition: ERF.H:2955
void make_sbm_flux_register(int lev)
Definition: ERF_SBMAMRCoupling.cpp:319
void PackAtmosphericStates(amrex::Vector< amrex::MultiFab * > &states, double time, const amrex::MultiFab &weight_mf, const amrex::iMultiFab &index_mf, int max_stencil_size, const amrex::MultiFab *dst_mskr=nullptr)
Definition: ERF_to_REMORA.cpp:485
amrex::Vector< double > fixed_dt_input
Definition: ERF.H:2308
void FillIntermediatePatch(int lev, double time, const amrex::Vector< amrex::MultiFab * > &mfs_vel, const amrex::Vector< amrex::MultiFab * > &mfs_mom, int ng_cons, int ng_vel, bool cons_only, int icomp_cons, int ncomp_cons)
Definition: ERF_FillIntermediatePatch.cpp:29
static int output_bndry_planes
Definition: ERF.H:2624
void InterpFromCoarseLevelCons(int lev, amrex::MultiFab &mf, const amrex::IntVect &nghost, const amrex::MultiFab &cmf, bool volume_weighted=false)
Definition: ERF_FillPatch.cpp:703
void project_velocity_tb(int lev, double dt, amrex::Vector< amrex::MultiFab > &vars)
Definition: ERF_PoissonSolve_tb.cpp:35
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_face23
Definition: ERF.H:2129
std::unique_ptr< LineSampler > sample_point_sampler
Definition: ERF.H:2932
bool m_seb_surface_layer_checked
check_seb_surface_layer has run
Definition: ERF.H:651
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > d_v_geos
Definition: ERF.H:2646
void update_terrain_arrays(int lev)
Definition: ERF_MakeNewArrays.cpp:1326
bool HasCloudWater() const
Definition: ERF.H:230
static std::string nc_bdy_file
Definition: ERF.H:2541
bool metgrid_interp_theta
Definition: ERF.H:2558
static amrex::Vector< amrex::Vector< std::string > > nc_init_file
Definition: ERF.H:2537
void cf_anelastic_stage_registration(int lev, int nrk)
Definition: ERF_CoarseFineFaces.cpp:987
bool read_checkpoint_mf_if_present(amrex::MultiFab &dst, const std::string &mf_name, int lev, int scomp, int dcomp, int ncomp, const amrex::IntVect &dst_ghosts, bool src_ghosts=false)
Definition: ERF_Checkpoint.cpp:973
static int input_bndry_planes
Definition: ERF.H:2630
TwoStreamRadiation::OrbitalCache ibseb_orbit
Orbit of the year for erf.ibseb.sun_mode = two_stream.
Definition: ERF.H:2117
LargeScaleForcingData lsf
Definition: ERF.H:1954
amrex::Gpu::DeviceVector< amrex::Real > d_havg_qc
Definition: ERF.H:2683
amrex::Real cloud_fraction(double time)
Definition: ERF_WriteScalarProfiles.cpp:587
void AverageDown()
Definition: ERF_AverageDown.cpp:86
std::set< std::string > user_specified_inputs
Definition: ERF.H:1267
amrex::Vector< amrex::Vector< amrex::Real > > h_v_geos
Definition: ERF.H:2645
bool regrid_level_0_on_restart
Definition: ERF.H:2321
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Lwave_onegrid
Definition: ERF.H:2167
void advance_microphysics(int lev, amrex::MultiFab &cons_in, const double &dt_advance, const int &iteration, const double &time)
Definition: ERF_AdvanceMicrophysics.cpp:124
InputSoundingData input_sounding_data
Definition: ERF.H:1750
void convert_legacy_surface_temperature(int lev, const erf_checkpoint_surface_temperature::SurfaceTemperatureMigrationPlan &plan, amrex::Vector< int > &psfc_recovered)
Definition: ERF_Checkpoint.cpp:1083
void write_1D_profiles_stag(double time)
Definition: ERF_Write1DProfiles_stag.cpp:30
amrex::Vector< amrex::Vector< amrex::Real > > h_sinesq_ptrs
Definition: ERF.H:2662
void create_random_perturbations(const int lev, amrex::MultiFab &mf_cc_pert)
Definition: ERF_InitForEnsemble.cpp:35
void Write2DPlotFile(int which, PlotFileType plotfile_type, amrex::Vector< std::string > plot_var_names)
Definition: ERF_Plotfile2D.cpp:978
amrex::Gpu::DeviceVector< amrex::Real > d_havg_density
Definition: ERF.H:2679
void cf_flux_history_targets(int lev, amrex::Real t_beg, amrex::Real t_end)
Definition: ERF_CFFluxHistory.cpp:219
amrex::Vector< std::unique_ptr< amrex::MultiFab > > rhotheta_src
Definition: ERF.H:2636
void HurricaneEyeTrackerNotInitial(const SolverChoice &sc, const amrex::Geometry &geom, const amrex::MultiFab &mf_cc_vel, const amrex::Vector< amrex::MultiFab > &S_data, int &hurricane_eye_i_glob, int &hurricane_eye_j_glob, amrex::Real &hurricane_eye_latitude, amrex::Real &hurricane_eye_longitude)
Definition: ERF_HurricaneDiagnostics.cpp:381
void init_from_hse(int lev)
Definition: ERF_InitFromHSE.cpp:32
CFFluxHistory & cf_flux_history(int lev)
Definition: ERF_CFFluxHistory.cpp:85
const std::string datetime_format
Definition: ERF.H:2262
void FillSetMomentaCF(int lev, double time, amrex::MultiFab &xmom, amrex::MultiFab &ymom, amrex::MultiFab &zmom)
Definition: ERF_CoarseFineFaces.cpp:1190
void run_line_sampler(LineSampler &sampler)
Definition: ERF_WriteScalarProfiles.cpp:701
void define_column_kextent(int lev, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm)
Definition: ERF_MakeNewArrays.cpp:727
void init_seb_soil_moisture_from_file(int lev)
Definition: ERF.cpp:1010
void check_mesh_type(int lev)
Definition: ERF.cpp:5816
void FillSetHorizontalMomentaCF(int lev, double time, amrex::MultiFab &xmom, amrex::MultiFab &ymom)
Definition: ERF_CoarseFineFaces.cpp:1130
erf_provenance::ExecutionProvenance execution_provenance
Definition: ERF.H:2269
const amrex::MultiFab & station_ground(int lev)
Definition: ERF_StationSampler.cpp:1628
int metgrid_force_sfc_k
Definition: ERF.H:2565
void setSubVolVariables(const std::string &pp_subvol_var_names, amrex::Vector< std::string > &subvol_var_names)
Definition: ERF_WriteSubvolume.cpp:13
static int ng_pres_hse
Definition: ERF.H:2633
void read_momentum_reflux_checkpoint(int lev)
Definition: ERF_MomentumReflux.cpp:429
bool real_extrap_w
Definition: ERF.H:2543
void project_momenta(int lev, double l_time, double l_dt, amrex::Vector< amrex::MultiFab > &vars, bool apply_if_drag)
Definition: ERF_PoissonSolve.cpp:267
void build_base_state_from_input_sounding(int lev, amrex::MultiFab &base_state_mf)
Definition: ERF_InitFromInputSounding.cpp:266
static amrex::Real cfl
Definition: ERF.H:2272
void compute_max_buoyancy_gradp_diagnostic(int lev)
Definition: ERF_Diagnostics.cpp:307
amrex::Vector< std::unique_ptr< amrex::MultiFab > > fine_mask
Definition: ERF.H:2155
std::vector< amrex::Real > sbm_budget_reference_inventory
Definition: ERF.H:1916
amrex::Gpu::DeviceVector< amrex::BCRec > domain_bcs_type_d
Definition: ERF.H:2177
amrex::Vector< double > t_mean_cnt
Definition: ERF.H:1844
amrex::Vector< std::unique_ptr< ForestDrag > > m_forest_drag
Definition: ERF.H:2690
const int datwidth
Definition: ERF.H:2246
void setSpongeRef_at_level(int lev)
Set sponge mean profiles at a level from the input sponge file (already read)
Definition: ERF_InitSponge.cpp:101
amrex::Vector< amrex::BoxArray > ba1d
Definition: ERF.H:2574
InputSpongeData input_sponge_data
Definition: ERF.H:1757
amrex::Vector< amrex::Vector< amrex::BoxArray > > subdomains
Definition: ERF.H:2772
void check_state_for_nans(amrex::MultiFab const &S)
Definition: ERF.cpp:5579
bool diffusive_first_call
Definition: ERF.H:2285
std::string restart_chkfile
Definition: ERF.H:2265
bool metgrid_use_below_sfc
Definition: ERF.H:2560
double estTimeStep(int lev, long &dt_fast_ratio, DtEstimateInfo &info, const amrex::MultiFab *sbm_mixing_density, bool cfl_rate_only=false) const
Definition: ERF_ComputeTimestep.cpp:445
amrex::Vector< amrex::MultiFab > m_cf_step_zflux
Definition: ERF.H:516
void ibseb_check_two_stream_provider() const
Definition: ERF_IBSEB.cpp:419
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > xvel_bc_data
Definition: ERF.H:1760
void InitData_pre()
Definition: ERF.cpp:1482
bool use_datetime
Definition: ERF.H:2261
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_track_xy
Definition: ERF.H:310
amrex::Vector< amrex::Vector< amrex::Real > > h_u_geos
Definition: ERF.H:2642
void read_checkpoint_mf(amrex::MultiFab &dst, const std::string &mf_name, int lev, int scomp, int dcomp, int ncomp, const amrex::IntVect &dst_ghosts, bool src_ghosts=false)
Definition: ERF_Checkpoint.cpp:961
void InitializeLevelFromData(int lev, const amrex::MultiFab &initial_data)
std::string subvol_file
Definition: ERF.H:2368
int rad_datalog_int
Definition: ERF.H:1983
void make_wall_dist(int lev)
Definition: ERF_PoissonWallDist.cpp:68
amrex::Real ComputeMaxTerrainSlope(int lev)
Definition: ERF_ComputeTimestep.cpp:398
amrex::Vector< std::string > datalogname
Definition: ERF.H:2953
void make_if_projection_sigma(int lev, amrex::Real l_dt, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &sigma)
Definition: ERF_ImmersedProjection.cpp:66
void initHSE()
Initialize HSE.
Definition: ERF_Init1D.cpp:259
static double dt_max
Definition: ERF.H:2277
amrex::Vector< amrex::MultiFab > surface_state_2
Definition: ERF.H:322
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ax
Definition: ERF.H:2045
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_phys_nd
Definition: ERF.H:2037
void MakeDiagnosticAverage(amrex::Vector< amrex::Real > &h_havg, amrex::MultiFab &S, int n)
Definition: ERF.cpp:5457
std::string MakeFilename_EyeTracker_surface_fluxes(int nstep)
Definition: ERF_TrackerOutput.cpp:98
std::unique_ptr< amrex::MultiFab > m_coupled_current_east
Definition: ERF.H:1432
amrex::Real metgrid_proximity
Definition: ERF.H:2563
amrex::Real volWgtSumMF(int lev, const amrex::MultiFab &mf, int comp, const amrex::MultiFab &dJ, const amrex::MultiFab &mfx, const amrex::MultiFab &mfy, bool finemask, bool local=true)
Definition: ERF_VolWgtSum.cpp:22
void setRecordDerDataInfo(int i, const std::string &filename)
Definition: ERF.H:2896
amrex::Vector< amrex::Real > h_havg_temperature
Definition: ERF.H:2674
void poisson_wall_dist(int lev)
Definition: ERF_PoissonWallDist.cpp:106
amrex::Vector< amrex::MultiFab > mfvec_surface_fluxes
Definition: ERF.H:327
std::vector< double > sbm_budget_reference_gross
Definition: ERF.H:1918
void write_bndry_planes(int step, double time)
Definition: ERF.cpp:1145
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_eye_track_latlon
Definition: ERF.H:312
bool m_checked_coupled_sst
Definition: ERF.H:1441
amrex::Vector< std::unique_ptr< amrex::MultiFab > > detJ_cc_src
Definition: ERF.H:2104
amrex::Gpu::DeviceVector< amrex::Real > d_havg_pressure
Definition: ERF.H:2681
void make_metrics_from_finest(int lev)
Definition: ERF_MakeNewArrays.cpp:1399
static bool is_it_time_for_action(int nstep, double time, double dt, int action_interval, double action_per)
Definition: ERF_WriteScalarProfiles.cpp:745
std::string plot2d_file_1
Definition: ERF.H:2366
void Advance(int lev, double time, double dt_lev, int iteration, int ncycle)
Definition: ERF_Advance.cpp:23
const amrex::iMultiFab & get_cf_implicit_mask(int lev, int which, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm, const amrex::IntVect &ng)
Definition: ERF_FillIntermediatePatch.cpp:315
static bool fixed_dt_cfl_limit
Definition: ERF.H:2313
void ResetIntervalMeans()
Definition: ERF.cpp:441
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_face33
Definition: ERF.H:2131
amrex::Vector< amrex::TableData< amrex::Real, 1 > > r_plane_avg
Definition: ERF.H:1769
int m_restart_step
Definition: ERF.H:1804
amrex::Vector< std::string > der_datalogname
Definition: ERF.H:2954
bool use_eb_surface_layer() const
Definition: ERF.cpp:5874
void ComputeDiffusiveRates(int lev, amrex::Real &rate_mom, amrex::Real &rate_scal) const
Definition: ERF_ComputeTimestep.cpp:209
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SmnSmn_lev
Definition: ERF.H:2009
const amrex::Vector< std::string > derived_names
Definition: ERF.H:2413
void fill_seb_from_coarse(int lev)
Fill a newly built level's two-stream SEB state from its parent.
Definition: ERF.cpp:737
void configure_sbm_physical_boundaries()
Definition: ERF_SBMAMRCoupling.cpp:44
void sum_integrated_quantities(double time)
Definition: ERF_WriteScalarProfiles.cpp:22
std::string MakeVTKFilename_TrackerCircle(int nstep)
Definition: ERF_TrackerOutput.cpp:28
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ay_src
Definition: ERF.H:2106
std::unique_ptr< StationSampler > station_sampler
Definition: ERF.H:2938
void ComputeDt(int step=-1, double cur_time_d=0.0)
Definition: ERF_ComputeTimestep.cpp:28
AMREX_FORCE_INLINE std::ostream & DataLog(int i)
Definition: ERF.H:2838
std::string MakeVTKFilename_EyeTracker_xy(int nstep)
Definition: ERF_TrackerOutput.cpp:42
amrex::Vector< double > m_subvol_per
Definition: ERF.H:2375
void initializeFlood(const int &)
Definition: ERF.cpp:4059
amrex::Vector< int > nsubsteps
Definition: ERF.H:1805
amrex::Vector< std::unique_ptr< amrex::iMultiFab > > yflux_imask
Definition: ERF.H:2209
amrex::Vector< amrex::MultiFab > rW_new
Definition: ERF.H:1902
amrex::Vector< amrex::MultiFab > weather_forecast_data_2
Definition: ERF.H:317
amrex::Vector< std::unique_ptr< amrex::MultiFab > > lon_m
Definition: ERF.H:1737
std::unique_ptr< WriteBndryPlanes > m_w2d
Definition: ERF.H:2687
void build_base_state_from_input_sounding_on(int lev, amrex::MultiFab &bs_g, const amrex::MultiFab &z_nd_g, const amrex::MultiFab *z_cc_g)
Definition: ERF_InitFromInputSounding.cpp:308
void HurricaneMinPressureTracker(MoistureType moisture_type, const amrex::Geometry &geom, const amrex::MultiFab &mf_cons_var, const double &time)
Definition: ERF_HurricaneDiagnostics.cpp:737
amrex::Vector< amrex::Vector< amrex::MultiFab * > > lsm_flux
Definition: ERF.H:1949
double EvolveOneStep(double time, double dt_request)
Definition: ERF_to_REMORA.cpp:269
bool use_erfbdy
Definition: ERF.H:2569
amrex::Vector< std::unique_ptr< SurfaceLayer > > m_SurfaceLayer
Definition: ERF.H:2689
const LargeScaleForcingData & lsf_at_level(int lev)
Definition: ERF_InitFromInputSounding.cpp:127
amrex::Vector< std::string > plot3d_var_names_1
Definition: ERF.H:2398
amrex::Vector< const amrex::MultiFab * > sampling_ground(const LineSampler &sampler)
Definition: ERF_WriteScalarProfiles.cpp:681
std::unique_ptr< amrex::MultiFab > m_coupler_sin_alpha
Definition: ERF.H:1425
void init_sbm_level_from_coarse(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm)
Definition: ERF_SBMAMRCoupling.cpp:371
void InitData_post()
Definition: ERF.cpp:1587
std::unique_ptr< amrex::MultiFab > m_coupler_cos_alpha
Definition: ERF.H:1424
void init_ibseb()
Definition: ERF_IBSEB.cpp:53
void refinement_criteria_setup()
Definition: ERF_Tagging.cpp:799
amrex::Vector< double > fixed_fast_dt_input
Definition: ERF.H:2309
static int nghost_eb_volume()
Definition: ERF.H:2995
bool metgrid_debug_dry
Definition: ERF.H:2555
static AMREX_FORCE_INLINE int ComputeGhostCells(const SolverChoice &sc)
Definition: ERF.H:2778
static int bndry_output_planes_interval
Definition: ERF.H:2625
void init_geo_wind_profile(const std::string input_file, amrex::Vector< amrex::Real > &u_geos, amrex::Gpu::DeviceVector< amrex::Real > &u_geos_d, amrex::Vector< amrex::Real > &v_geos, amrex::Gpu::DeviceVector< amrex::Real > &v_geos_d, const amrex::Geometry &lgeom, const amrex::Vector< amrex::Real > &zlev_stag)
Definition: ERF_InitGeowind.cpp:21
void ERF_shared()
Definition: ERF_Constructors.cpp:354
amrex::Vector< std::string > plot2d_var_names_2
Definition: ERF.H:2401
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > Tau_corr
Definition: ERF.H:2007
void FillPatchCrseLevel(int lev, double time, const amrex::Vector< amrex::MultiFab * > &mfs_vel, bool cons_only=false)
Definition: ERF_FillPatch.cpp:276
void WriteSubvolume(int isub, amrex::Vector< std::string > subvol_var_names)
Definition: ERF_WriteSubvolume.cpp:121
const InputSoundingData & sounding_at_level(int lev)
Definition: ERF_InitFromInputSounding.cpp:93
void initializeFire(const int &)
Definition: ERF.cpp:3947
amrex::Vector< std::array< amrex::Real, 2 > > hurricane_surface_fluxes_vs_time
Definition: ERF.H:316
void sum_energy_quantities(double time)
Definition: ERF_WriteScalarProfiles.cpp:436
amrex::Array< InflowProfile, 2 *AMREX_SPACEDIM > m_inflow_profiles
Definition: ERF.H:1766
void make_flux_register(int lev)
Definition: ERF_MakeNewArrays.cpp:776
static int nghost_eb_full()
Definition: ERF.H:2998
void RemakeLevel(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm) override
Definition: ERF_MakeNewLevel.cpp:1120
void HurricaneSurfaceFluxesTracker(const int &hurricane_eye_i_glob, const int &hurricane_eye_j_glob, const amrex::Real &hurricane_eye_latitude, const amrex::Real &hurricane_eye_longitude, const amrex::Real time)
Definition: ERF_HurricaneDiagnostics.cpp:800
static void GotoNextLine(std::istream &is)
Definition: ERF_Checkpoint.cpp:63
void MakeNewLevelFromScratch(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm) override
Definition: ERF_MakeNewLevel.cpp:105
void init_stuff(int lev, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm, amrex::Vector< amrex::MultiFab > &lev_new, amrex::Vector< amrex::MultiFab > &lev_old, amrex::MultiFab &tmp_base_state, std::unique_ptr< amrex::MultiFab > &tmp_zphys_nd)
Definition: ERF_MakeNewArrays.cpp:79
WRFSurfaceFields wrf_surface_fields
Definition: ERF.H:1744
amrex::Vector< amrex::MultiFab > zmom_crse_rhs
Definition: ERF.H:1906
void fill_surface_nodes(int lev, amrex::MultiFab &znd_surf)
Definition: ERF_PoissonWallDist.cpp:690
void advance_radiation(int lev, amrex::MultiFab &cons_in, const double &dt_advance)
Advance radiation diagnostics and heating rates for one time step.
Definition: ERF_AdvanceRadiation.cpp:55
std::unique_ptr< amrex::iMultiFab > m_coupled_current_valid
Definition: ERF.H:1434
amrex::Vector< std::unique_ptr< erf_sbm::SBMAMRFluxRegister > > sbm_amr_flux_regs
Definition: ERF.H:1912
bool metgrid_debug_isothermal
Definition: ERF.H:2554
void PerformDataAssimilation(int da_iter)
amrex::Vector< std::string > lsm_data_name
Definition: ERF.H:1946
void turbPert_update_uniform_wind(int lev, double time)
Definition: ERF_InitTurbPert.cpp:410
std::unique_ptr< erf_sbm::SBMStateManager > sbm_state_manager
Definition: ERF.H:1909
amrex::Vector< std::unique_ptr< amrex::MultiFab > > rhoqt_src
Definition: ERF.H:2637
void initSponge()
Initialize sponge profiles at every level that exists.
Definition: ERF_InitSponge.cpp:35
std::map< int, CFZFaceLayout > m_cf_zface_cache
Definition: ERF.H:2063
std::unique_ptr< PlaneSampler > plane_sampler
Definition: ERF.H:2933
void check_for_low_temp(amrex::MultiFab &S)
Definition: ERF.cpp:5661
amrex::Vector< std::unique_ptr< std::fstream > > der_datalog
Definition: ERF.H:2951
static amrex::Vector< amrex::Vector< int > > have_read_nc_init_file
Definition: ERF.H:2538
amrex::Vector< std::unique_ptr< std::fstream > > tot_e_datalog
Definition: ERF.H:2952
amrex::Vector< std::unique_ptr< amrex::MultiFab > > sinPhi_m
Definition: ERF.H:1746
amrex::Real ibseb_bulk_richardson_height(int lev, const amrex::MultiFab &cons, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel)
Definition: ERF_IBSEB.cpp:767
static double previousCPUTimeUsed
Definition: ERF.H:2866
void fill_from_bndryregs(int lev, const amrex::Vector< amrex::MultiFab * > &mfs, double time, bool cons_only=false)
Definition: ERF_BoundaryConditionsBndryReg.cpp:27
void writeJobInfo(const std::string &dir, erf_provenance::ArtifactType artifact_type, int artifact_step, double artifact_time_seconds) const
Definition: ERF_WriteJobInfo.cpp:16
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_height
Definition: ERF.H:2146
bool m_driver_has_atm2ocn_coupling
Definition: ERF.H:1407
double m_plot3d_per_1
Definition: ERF.H:2377
int real_width
Definition: ERF.H:2542
void MakeNewLevelFromCoarse(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm) override
Definition: ERF_MakeNewLevel.cpp:609
void sbm_qualification_record_initial_inventory()
Definition: ERF_SBMAMRQualification.cpp:628
amrex::Vector< int > last_subvol_step
Definition: ERF.H:2240
amrex::Gpu::DeviceVector< amrex::Real > make_sub_dz(int lev, const amrex::Box &subdomain)
Definition: ERF_SolveWithGMRES.cpp:112
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ax_src
Definition: ERF.H:2105
void derive_forcing_profiles_stag(amrex::Gpu::HostVector< amrex::Real > &h_avg_ttend, amrex::Gpu::HostVector< amrex::Real > &h_avg_qtend, amrex::Gpu::HostVector< amrex::Real > &h_avg_wsub, amrex::Gpu::HostVector< amrex::Real > &h_avg_thtend, amrex::Gpu::HostVector< amrex::Real > &h_avg_qhtend, amrex::Gpu::HostVector< amrex::Real > &h_avg_tvtend, amrex::Gpu::HostVector< amrex::Real > &h_avg_qvtend, amrex::Gpu::HostVector< amrex::Real > &h_avg_qcvtend, amrex::Gpu::HostVector< amrex::Real > &h_avg_tnudge, amrex::Gpu::HostVector< amrex::Real > &h_avg_qnudge, amrex::Gpu::HostVector< amrex::Real > &h_avg_unudge, amrex::Gpu::HostVector< amrex::Real > &h_avg_vnudge)
Definition: ERF_Write1DProfiles_stag.cpp:816
bool has_nonunit_mapfac(int lev) const
Definition: ERF_PoissonSolve.cpp:131
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > urb_frac_lev
Definition: ERF.H:2019
amrex::Vector< std::unique_ptr< amrex::MultiFab > > z_phys_cc_src
Definition: ERF.H:2103
bool nested_base_state(int lev)
Definition: ERF_NestedBaseState.cpp:53
void input_sponge(int lev)
Definition: ERF_InitSponge.cpp:17
amrex::Vector< std::unique_ptr< amrex::MultiFab > > nudge_data
Definition: ERF.H:1959
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > d_u_geos
Definition: ERF.H:2643
bool m_driver_uses_two_way_coupling
Definition: ERF.H:1408
void Define_ERFFillPatchers(int lev)
Definition: ERF.cpp:5532
AMREX_FORCE_INLINE int NumDataLogs() noexcept
Definition: ERF.H:2852
static PlotFileType plotfile3d_type_2
Definition: ERF.H:2529
void setRecordEnergyDataInfo(int i, const std::string &filename)
Definition: ERF.H:2909
TurbulentPerturbation turbPert
Definition: ERF.H:2484
amrex::Vector< amrex::MultiFab > rW_old
Definition: ERF.H:1901
amrex::Vector< double > fixed_dt
Definition: ERF.H:2304
void write_momentum_reflux_checkpoint(const std::string &checkpointname) const
Definition: ERF_MomentumReflux.cpp:403
void ResetIntervalMeansAfter3DPlotfileBatch(int plotfiles_written, bool interval_diagnostic_consumed)
Definition: ERF.cpp:427
amrex::Vector< amrex::Vector< amrex::MultiFab > > forecast_state_2
Definition: ERF.H:319
bool has_own_init_file(int lev) const
Definition: ERF.cpp:3365
amrex::Vector< std::unique_ptr< amrex::MultiFab > > station_ib_ground
Definition: ERF.H:2944
void check_for_negative_theta(amrex::MultiFab &S)
Definition: ERF.cpp:5741
void ImposeBCsOnPhi(int lev, amrex::MultiFab &phi, const amrex::Box &subdomain)
Definition: ERF_ImposeBCsOnPhi.cpp:19
void Interp2DArrays(int lev, const amrex::BoxArray &my_ba2d, const amrex::DistributionMapping &my_dm)
Definition: ERF.cpp:3660
amrex::Vector< std::unique_ptr< amrex::MultiFab > > lsf_data
Definition: ERF.H:1960
void bind_sbm_amr_flux_registers(int lev)
Definition: ERF_SBMAMRCoupling.cpp:349
void ClearLevel(int lev) override
Definition: ERF_MakeNewLevel.cpp:1886
std::string MakeFilename_EyeTracker_minpressure(int nstep)
Definition: ERF_TrackerOutput.cpp:84
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_ktarget
Definition: ERF.H:2142
std::unique_ptr< amrex::MultiFab > wrf_RDNW
Definition: ERF.H:2618
void ibseb_check_two_stream_buildings() const
Definition: ERF_IBSEB.cpp:471
static double dt_max_initial
Definition: ERF.H:2276
static PlotFileType plotfile2d_type_2
Definition: ERF.H:2531
int plane_sampling_interval
Definition: ERF.H:2924
void compute_divergence(int lev, amrex::MultiFab &rhs, amrex::Array< amrex::MultiFab const *, AMREX_SPACEDIM > rho0_u_const, amrex::MultiFab const &mf_mx, amrex::MultiFab const &mf_my, amrex::MultiFab const &mf_vx, amrex::MultiFab const &mf_uy, amrex::MultiFab const &ax_in, amrex::MultiFab const &ay_in, amrex::MultiFab const &dJ_in, amrex::Geometry const &geom_at_lev)
Definition: ERF_ComputeDivergence.cpp:18
void make_physbcs(int lev)
Definition: ERF_MakeNewArrays.cpp:1514
amrex::Vector< std::unique_ptr< amrex::MultiFab > > terrain_blanking_yface
Definition: ERF.H:2123
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > d_w_subsid
Definition: ERF.H:2640
void remake_sbm_level(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm)
Definition: ERF_SBMAMRCoupling.cpp:437
amrex::Vector< CFFluxHistory > m_cf_flux_hist
Definition: ERF.H:2083
amrex::Vector< ERFFillPatcher > FPr_w
Definition: ERF.H:2003
void HurricaneEyeTrackerInitial(const SolverChoice &sc, const amrex::Geometry &geom, const amrex::Vector< amrex::MultiFab > &S_data, int &hurricane_eye_i_glob, int &hurricane_eye_j_glob, amrex::Real &hurricane_eye_latitude, amrex::Real &hurricane_eye_longitude)
Definition: ERF_HurricaneDiagnostics.cpp:236
std::uint64_t sbm_budget_reference_terms
Definition: ERF.H:1919
void resolve_station_positions()
Definition: ERF_StationSampler.cpp:914
std::unique_ptr< erf_auxiliary::AuxiliaryInertTracer > auxiliary_inert_tracer
Definition: ERF.H:1923
void sbm_synchronize_levels(int nstep)
Definition: ERF_SBMAMRCoupling.cpp:558
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_hfx2_lev
Definition: ERF.H:2022
void CheckFixedDtCFLLimitAfterRegrid(int lev)
Definition: ERF_ComputeTimestep.cpp:1264
void WriteLinePlot(const std::string &filename, amrex::Vector< std::array< amrex::Real, 2 >> &points_xy)
Definition: ERF_Write1DProfiles.cpp:656
bool m_warned_coupled_sst_declined
Definition: ERF.H:1437
amrex::Vector< int > fixed_dt_cfl_warned
Definition: ERF.H:2297
amrex::Vector< amrex::Array< std::unique_ptr< amrex::MultiFab >, AMREX_SPACEDIM > > pi_upw_dir
Definition: ERF.H:1862
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab > > > soil_type_lev
Definition: ERF.H:2018
amrex::Vector< amrex::Vector< amrex::Real > > zlevels_stag
Definition: ERF.H:2034
bool use_native_fc_factories() const noexcept
Definition: ERF.H:2966
bool CheckFixedDtCFLLimit(const amrex::Vector< double > &cfl_rate, int lev_min, bool after_regrid)
Definition: ERF_ComputeTimestep.cpp:1198
void FillPlot3DVars(int lev, const amrex::Vector< std::string > &plot_var_names, Plot3DScratch &scratch, amrex::MultiFab &mf_dst, int ncomp_mf, amrex::Real tnew)
Definition: ERF_Plotfile.cpp:690
bool volume_weighted_interp() const
Definition: ERF_FillPatch.cpp:261
AMREX_FORCE_INLINE int NumDerDataLogs() noexcept
Definition: ERF.H:2859
amrex::EBFArrayBoxFactory const & EBFactory(int lev) const noexcept
Definition: ERF.H:2985
void sbm_record_budget_reference()
Definition: ERF_SBMAMRCoupling.cpp:246
amrex::Vector< amrex::Vector< amrex::MultiFab * > > lsm_data
Definition: ERF.H:1947
void init_immersed_forcing(int lev)
Definition: ERF_InitImmersedForcing.cpp:15
amrex::Vector< amrex::Vector< amrex::Real > > stretched_dz_h
Definition: ERF.H:2157
amrex::Vector< std::unique_ptr< LargeScaleForcingData > > lsf_fine
Definition: ERF.H:1958
bool use_real_time_in_pltname
Definition: ERF.H:2534
int m_plot2d_int_1
Definition: ERF.H:2371
void WriteCheckpointFile() const
Definition: ERF_Checkpoint.cpp:73
amrex::Array< amrex::Array< erf_wall_scalar_bc::WallScalarBCIntent, AMREX_SPACEDIM *2 >, NBCVAR_max > m_wall_scalar_bc_intent
Definition: ERF.H:2192
std::unique_ptr< LineSampler > sample_line_sampler
Definition: ERF.H:2930
void interp_land_masks_from_coarse(int lev)
Definition: ERF.cpp:3570
bool metgrid_debug_psfc
Definition: ERF.H:2556
void ReadStormTrackerRestart()
Definition: ERF_HurricaneDiagnostics.cpp:496
bool Write3DPlotFile(int which, PlotFileType plotfile_type, amrex::Vector< std::string > plot_var_names)
Definition: ERF_Plotfile.cpp:2236
amrex::Vector< std::unique_ptr< amrex::MultiFab > > az_src
Definition: ERF.H:2107
static int fixed_mri_dt_ratio
Definition: ERF.H:2310
static amrex::Real init_shrink
Definition: ERF.H:2274
bool cloud_optics_parameters_printed
Definition: ERF.H:2405
void HurricaneTrackerCircle()
Definition: ERF_HurricaneDiagnostics.cpp:201
static double last_check_file_time
Definition: ERF.H:2231
static std::string nc_low_file
Definition: ERF.H:2546
void solve_with_terrain_mlmg(int lev, const amrex::Box &subdomain, amrex::MultiFab &rhs, amrex::MultiFab &p, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &fluxes, amrex::MultiFab &ax_sub, amrex::MultiFab &ay_sub, amrex::MultiFab &az_sub, amrex::MultiFab &dJ_sub, amrex::MultiFab &znd_sub, bool use_gmres)
Definition: ERF_SolveWithTerrainMLMG.cpp:42
amrex::Vector< amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > > d_rayleigh_ptrs
Definition: ERF.H:2666
void InitData()
Definition: ERF.cpp:1472
amrex::Vector< int > m_mom_reflux_used
Definition: ERF.H:2089
void init_seb_t_deep_from_file(int lev)
Definition: ERF.cpp:918
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Lwave
Definition: ERF.H:2165
amrex::Vector< std::unique_ptr< amrex::MultiFab > > cosPhi_m
Definition: ERF.H:1746
amrex::Vector< std::unique_ptr< amrex::MultiFab > > interval_means
Definition: ERF.H:1843
void ParameterSanityChecks()
Definition: ERF.cpp:5243
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab > > > land_type_lev
Definition: ERF.H:2017
static double start_time
Definition: ERF.H:2258
void init_zphys(int lev, double elapsed_time)
Definition: ERF_MakeNewArrays.cpp:1058
void derive_stress_profiles(amrex::Gpu::HostVector< amrex::Real > &h_avg_tau11, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau12, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau13, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau22, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau23, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau33, amrex::Gpu::HostVector< amrex::Real > &h_avg_hfx3, amrex::Gpu::HostVector< amrex::Real > &h_avg_q1fx3, amrex::Gpu::HostVector< amrex::Real > &h_avg_q2fx3, amrex::Gpu::HostVector< amrex::Real > &h_avg_diss)
Definition: ERF_Write1DProfiles.cpp:557
amrex::Vector< amrex::Vector< amrex::MultiFab > > forecast_state_1
Definition: ERF.H:318
int cf_width
Definition: ERF.H:1986
static int last_plot2d_file_step_1
Definition: ERF.H:2220
amrex::Vector< const amrex::MultiFab * > sampling_volfrac() const
Definition: ERF_WriteScalarProfiles.cpp:664
amrex::Vector< std::unique_ptr< amrex::iMultiFab > > zflux_imask
Definition: ERF.H:2210
amrex::Vector< amrex::BoxArray > openface_grids
Definition: ERF.H:2292
std::unique_ptr< CloudChamberBudget > cloud_chamber_budget
Definition: ERF.H:1924
void Construct_ERFFillPatchers(int lev)
Definition: ERF.cpp:5506
amrex::Vector< int > num_boxes_at_level
Definition: ERF.H:1799
void compute_native_shoc_tendencies(int lev, amrex::MultiFab *cons, amrex::MultiFab *xvel, amrex::MultiFab *yvel, amrex::MultiFab *zvel, amrex::Real *w_subsid, amrex::MultiFab *tau13, amrex::MultiFab *tau23, amrex::MultiFab *hfx3, amrex::MultiFab *qfx3, amrex::MultiFab *eddyDiffs, amrex::MultiFab *z_phys_nd, const double &dt_advance)
Definition: ERF_ShocCoupling.cpp:6
amrex::Vector< std::string > station_vars_2d
Definition: ERF.H:2942
void FillSurfaceStateMultiFabs(const int lev, const std::string &filename, amrex::Vector< amrex::MultiFab > &surface_state)
Definition: ERF_SurfaceDataInterpolation.cpp:26
static amrex::Real sub_cfl
Definition: ERF.H:2273
static void print_error(MPI_Comm, const std::string &msg)
Definition: ERF_ConsoleIO.cpp:48
static int ng_dens_hse
Definition: ERF.H:2632
std::unique_ptr< ReadBndryPlanes > m_r2d
Definition: ERF.H:2688
static amrex::Real diffusive_cfl
Definition: ERF.H:2283
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ay
Definition: ERF.H:2046
amrex::Vector< amrex::Real > slope_report_alpha
Definition: ERF.H:2301
void interp_base_state_from_coarse(int lev)
Definition: ERF_Init1D.cpp:230
amrex::Vector< amrex::Vector< amrex::MultiFab * > > qmoist
Definition: ERF.H:1926
amrex::Vector< std::unique_ptr< amrex::MultiFab > > SFS_q1fx1_lev
Definition: ERF.H:2024
void GetLandMask(const amrex::iMultiFab *&lmask) const
Definition: ERF_to_REMORA.cpp:349
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > zvel_bc_data
Definition: ERF.H:1762
void derive_stress_profiles_stag(amrex::Gpu::HostVector< amrex::Real > &h_avg_tau11, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau12, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau13, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau22, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau23, amrex::Gpu::HostVector< amrex::Real > &h_avg_tau33, amrex::Gpu::HostVector< amrex::Real > &h_avg_hfx3, amrex::Gpu::HostVector< amrex::Real > &h_avg_q1fx3, amrex::Gpu::HostVector< amrex::Real > &h_avg_q2fx3, amrex::Gpu::HostVector< amrex::Real > &h_avg_diss)
Definition: ERF_Write1DProfiles_stag.cpp:697
LandSurface lsm
Definition: ERF.H:1944
static amrex::Real change_max
Definition: ERF.H:2275
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_hfx
Definition: ERF.H:2134
bool cf_anelastic_flux_match(int lev) const
Definition: ERF_CoarseFineFaces.cpp:914
void ApplyOceanSurfaceState(const amrex::Vector< amrex::MultiFab * > &state, double time, const amrex::iMultiFab *erf_coverage=nullptr)
Definition: ERF_to_REMORA.cpp:905
void setSpongeRefFromSounding(bool restarting)
Set sponge mean profiles from the input sponge file at every level that exists.
Definition: ERF_InitSponge.cpp:79
amrex::Vector< amrex::MultiFab > avg_ymom
Definition: ERF.H:1879
void make_eb_factories(int lev, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm)
Definition: ERF_MakeNewLevel.cpp:78
int line_sampling_interval
Definition: ERF.H:2923
amrex::Vector< amrex::Vector< amrex::Real > > h_sinesq_stag_ptrs
Definition: ERF.H:2663
void check_rad_level_grids(int lev, const amrex::BoxArray &ba)
Definition: ERF.cpp:485
amrex::Vector< std::unique_ptr< amrex::MultiFab > > detJ_cc_new
Definition: ERF.H:2110
void project_initial_velocity(int lev, double time, double dt)
Definition: ERF_PoissonSolve.cpp:171
amrex::Vector< std::unique_ptr< amrex::MultiFab > > ib_wall_qfx
Definition: ERF.H:2138
void interp_mapfac_from_coarse(int lev)
Definition: ERF.cpp:3412
std::vector< amrex::Real > sbm_qualification_composite_inventory() const
Definition: ERF_SBMAMRQualification.cpp:622
amrex::Array< std::string, 2 *AMREX_SPACEDIM > domain_bc_type
Definition: ERF.H:2180
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > yvel_bc_data
Definition: ERF.H:1761
static bool cf_flux_history_enabled()
Definition: ERF_CFFluxHistory.cpp:48
static void writeBuildInfo(std::ostream &os)
Definition: ERF_WriteJobInfo.cpp:183
amrex::GpuArray< ERF_BC, AMREX_SPACEDIM *2 > phys_bc_type
Definition: ERF.H:2205
std::string check_file
Definition: ERF.H:2392
bool rad_level_needs_interpolation(int lev) const
Definition: ERF.cpp:468
plotfile2d::CloudOpticsParameters cloud_optics_parameters
Definition: ERF.H:2404
amrex::Vector< amrex::MultiFab > surface_state_interp
Definition: ERF.H:323
amrex::Vector< amrex::Real > h_havg_qv
Definition: ERF.H:2676
amrex::Vector< std::unique_ptr< IBFaceSet > > m_ibseb
Definition: ERF.H:2116
void init_inflow_profile(const std::string &bcid, amrex::Orientation ori, const std::string &kind, amrex::ParmParse &pp)
Definition: ERF_InitBCs.cpp:1203
void CheckVariableBetaS(int lev)
Definition: ERF_ComputeTimestep.cpp:363
amrex::Vector< amrex::MultiFab > weather_forecast_data_1
Definition: ERF.H:317
void advance_dycore(int level, amrex::Vector< amrex::MultiFab > &state_old, amrex::Vector< amrex::MultiFab > &state_new, amrex::MultiFab &xvel_old, amrex::MultiFab &yvel_old, amrex::MultiFab &zvel_old, amrex::MultiFab &xvel_new, amrex::MultiFab &yvel_new, amrex::MultiFab &zvel_new, amrex::MultiFab &source, amrex::MultiFab &xmom_src, amrex::MultiFab &ymom_src, amrex::MultiFab &zmom_src, amrex::MultiFab &buoyancy, amrex::Geometry fine_geom, double dt, double time)
Definition: ERF_AdvanceDycore.cpp:43
static void print_usage(MPI_Comm, std::ostream &)
Definition: ERF_ConsoleIO.cpp:31
void cf_zface_coarse_at(int lev, double tc, bool conserved_rho, const amrex::MultiFab &pz, const amrex::MultiFab &pmu, const amrex::MultiFab &pmv, amrex::MultiFab &cOm, amrex::MultiFab &cRu, amrex::MultiFab &cRv)
Definition: ERF_CoarseFineFaces.cpp:231
void rebuild_base_state_from_input_sounding(int lev, amrex::MultiFab &base_state_mf)
Definition: ERF_InitFromInputSounding.cpp:363
amrex::Real solar_declin
Definition: ERF.H:1971
amrex::Vector< amrex::MultiFab > rV_old
Definition: ERF.H:1899
amrex::Vector< std::unique_ptr< amrex::MultiFab > > lat_m
Definition: ERF.H:1737
void timeStep(int lev, double time, int iteration)
Definition: ERF_TimeStep.cpp:21
amrex::Vector< amrex::Vector< amrex::Vector< amrex::Real > > > h_rayleigh_ptrs
Definition: ERF.H:2658
void make_eb_regular()
amrex::Vector< amrex::Vector< amrex::MultiFab * > > urban_flux
Definition: ERF.H:1952
void derive_diag_profiles(double time, amrex::Gpu::HostVector< amrex::Real > &h_avg_u, amrex::Gpu::HostVector< amrex::Real > &h_avg_v, amrex::Gpu::HostVector< amrex::Real > &h_avg_w, amrex::Gpu::HostVector< amrex::Real > &h_avg_rho, amrex::Gpu::HostVector< amrex::Real > &h_avg_th, amrex::Gpu::HostVector< amrex::Real > &h_avg_ksgs, amrex::Gpu::HostVector< amrex::Real > &h_avg_Kmv, amrex::Gpu::HostVector< amrex::Real > &h_avg_Khv, amrex::Gpu::HostVector< amrex::Real > &h_avg_qv, amrex::Gpu::HostVector< amrex::Real > &h_avg_qc, amrex::Gpu::HostVector< amrex::Real > &h_avg_qr, amrex::Gpu::HostVector< amrex::Real > &h_avg_wqv, amrex::Gpu::HostVector< amrex::Real > &h_avg_wqc, amrex::Gpu::HostVector< amrex::Real > &h_avg_wqr, amrex::Gpu::HostVector< amrex::Real > &h_avg_qi, amrex::Gpu::HostVector< amrex::Real > &h_avg_qs, amrex::Gpu::HostVector< amrex::Real > &h_avg_qg, amrex::Gpu::HostVector< amrex::Real > &h_avg_uu, amrex::Gpu::HostVector< amrex::Real > &h_avg_uv, amrex::Gpu::HostVector< amrex::Real > &h_avg_uw, amrex::Gpu::HostVector< amrex::Real > &h_avg_vv, amrex::Gpu::HostVector< amrex::Real > &h_avg_vw, amrex::Gpu::HostVector< amrex::Real > &h_avg_ww, amrex::Gpu::HostVector< amrex::Real > &h_avg_uth, amrex::Gpu::HostVector< amrex::Real > &h_avg_vth, amrex::Gpu::HostVector< amrex::Real > &h_avg_wth, amrex::Gpu::HostVector< amrex::Real > &h_avg_thth, amrex::Gpu::HostVector< amrex::Real > &h_avg_ku, amrex::Gpu::HostVector< amrex::Real > &h_avg_kv, amrex::Gpu::HostVector< amrex::Real > &h_avg_kw, amrex::Gpu::HostVector< amrex::Real > &h_avg_p, amrex::Gpu::HostVector< amrex::Real > &h_avg_pu, amrex::Gpu::HostVector< amrex::Real > &h_avg_pv, amrex::Gpu::HostVector< amrex::Real > &h_avg_pw, amrex::Gpu::HostVector< amrex::Real > &h_avg_wthv, amrex::Gpu::HostVector< amrex::Real > &h_avg_thv)
Definition: ERF_Write1DProfiles.cpp:249
void solve_with_if_gmres(int lev, const amrex::Box &subdomain, amrex::MultiFab &rhs, amrex::MultiFab &phi, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &fluxes, amrex::Array< amrex::MultiFab const *, AMREX_SPACEDIM > const &sigma)
Definition: ERF_ImmersedProjection.cpp:196
static int last_plot3d_file_step_1
Definition: ERF.H:2218
std::unique_ptr< LineSampler > line_sampler
Definition: ERF.H:2927
void sbm_qualification_check_regrid(int lev, amrex::Long cells, amrex::Long retained, amrex::Long prolonged, amrex::Long released, const std::vector< amrex::Real > &inventory_before, const std::vector< std::uint64_t > &phase_bytes)
Definition: ERF_SBMAMRQualification.cpp:815
amrex::Vector< std::unique_ptr< amrex::MultiFab > > Hwave
Definition: ERF.H:2164
void set_cf_zghost_projection(int lev, double time, amrex::MultiFab &xmom, amrex::MultiFab &ymom, amrex::MultiFab &omega_t, amrex::Vector< int > &slab_box)
Definition: ERF_CoarseFineFaces.cpp:472
amrex::Vector< amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > > Tau_EB
Definition: ERF.H:2029
amrex::Vector< int > istep
Definition: ERF.H:1803
const int datprecision
Definition: ERF.H:2247
amrex::Vector< std::unique_ptr< amrex::iMultiFab > > xflux_imask
Definition: ERF.H:2208
void derive_upwp(amrex::Vector< amrex::Real > &h_havg)
static PlotFileType plotfile2d_type_1
Definition: ERF.H:2530
int metgrid_order
Definition: ERF.H:2564
bool finished_wave
Definition: ERF.H:2168
void ReadCheckpointFile()
Definition: ERF_Checkpoint.cpp:1375
amrex::Vector< amrex::Vector< amrex::MultiFab > > vars_old
Definition: ERF.H:1833
void FillCoarseFineGhostsForImplicit(int lev, double time, amrex::MultiFab &cons, const amrex::Vector< int > &cons_comps, const amrex::Vector< amrex::MultiFab * > &mom)
Definition: ERF_FillIntermediatePatch.cpp:363
amrex::MultiFab * momentum_reflux_pressure(int lev)
Definition: ERF_MomentumReflux.cpp:139
void check_base_state_hse(int lev, const std::string &when, bool abort_if_fail=true)
Definition: ERF_RebuildBaseState.cpp:446
amrex::Real ibseb_z_i_level0
Level 0's bulk-Richardson depth of its current step, for the refined levels.
Definition: ERF.H:2118
void WriteAtFinalTime()
Definition: ERF.cpp:374
amrex::Vector< amrex::Array< std::unique_ptr< amrex::iMultiFab >, AMREX_SPACEDIM+1 > > cf_implicit_mask
Definition: ERF.H:2591
amrex::Vector< std::unique_ptr< ERFPhysBCFunct_base > > physbcs_base
Definition: ERF.H:1887
void init_thin_body(int lev, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm)
Definition: ERF_MakeNewLevel.cpp:2155
static PlotFileType plotfile3d_type_1
Definition: ERF.H:2528
amrex::Vector< int > m_subvol_int
Definition: ERF.H:2374
amrex::Vector< std::array< amrex::MultiFab, 2 > > m_mom_reflux_src
Definition: ERF.H:2092
void CheckFixedDtHardLimits(int lev, const DtEstimateInfo &info) const
Definition: ERF_ComputeTimestep.cpp:1290
std::string MakeFilename_EyeTracker_latlon(int nstep)
Definition: ERF_TrackerOutput.cpp:56
void WriteMultiLevelPlotfileWithTerrain(const std::string &plotfilename, int nlevels, const amrex::Vector< const amrex::MultiFab * > &mf, const amrex::Vector< const amrex::MultiFab * > &mf_nd, const amrex::Vector< std::string > &varnames, const amrex::Vector< amrex::Geometry > &my_geom, double time, const amrex::Vector< int > &level_steps, const amrex::Vector< amrex::IntVect > &my_ref_ratio, const std::string &versionName="HyperCLaw-V1.1", const std::string &levelPrefix="Level_", const std::string &mfPrefix="Cell", const amrex::Vector< std::string > &extra_dirs=amrex::Vector< std::string >()) const
Definition: ERF_Plotfile.cpp:2512
amrex::Vector< amrex::Array< bool, 4 > > openface_warned
Definition: ERF.H:2293
amrex::Array< amrex::Array< amrex::Real, AMREX_SPACEDIM *2 >, AMREX_SPACEDIM+NBCVAR_max > m_bc_neumann_vals
Definition: ERF.H:2186
amrex::Vector< amrex::BoxArray > ba_chkfile
Definition: ERF.H:2329
bool m_driver_atm2ocn_uses_state_contract
Definition: ERF.H:1409
bool m_plot_face_terrain_blanking
Definition: ERF.H:2382
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > tsk_lev
Definition: ERF.H:2013
bool HasA2OPrecipSource() const
Definition: ERF_to_REMORA.cpp:359
std::unique_ptr< amrex::MultiFab > m_coupled_sst
Definition: ERF.H:1416
bool has_surface_layer_inputs(const std::string &prefix) const
Definition: ERF.cpp:5859
static void print_summary(std::ostream &)
int m_plot3d_int_2
Definition: ERF.H:2370
amrex::Vector< std::unique_ptr< amrex::MultiFab > > qheating_rates
Definition: ERF.H:1963
void fill_terrain_surface(int lev, amrex::MultiFab &z_phys, double elapsed_time)
Definition: ERF_MakeNewArrays.cpp:953
void check_seb_surface_layer()
Definition: ERF.cpp:580
void turbPert_amplitude(const int lev)
Definition: ERF_InitTurbPert.cpp:478
std::unique_ptr< erf_sbm::SBMTransport > sbm_transport
Definition: ERF.H:1922
amrex::Vector< std::unique_ptr< amrex::MultiFab > > rad_fluxes
Definition: ERF.H:1969
const CFZFaceLayout & cf_zface_layout(int lev)
Definition: ERF_CoarseFineFaces.cpp:156
void initializeMicrophysics(const int &)
Definition: ERF.cpp:3909
static double bndry_output_planes_start_time
Definition: ERF.H:2627
std::unique_ptr< amrex::MultiFab > wrf_C2H
Definition: ERF.H:2613
bool plot_lsm
Definition: ERF.H:2384
bool perturbational_avgdown
Definition: ERF.H:1999
amrex::Vector< amrex::MultiFab > avg_zmom
Definition: ERF.H:1880
void set_cf_zface_omega(int lev, amrex::MultiFab &omega, const amrex::MultiFab &omega_t, const amrex::Vector< int > &slab_box)
Definition: ERF_CoarseFineFaces.cpp:504
const amrex::Vector< std::string > cons_names
Definition: ERF.H:2408
void ReadCheckpointFileSurfaceLayer()
Definition: ERF_Checkpoint.cpp:2890
bool perturbational_interp
Definition: ERF.H:1993
void GetOceanToAtmosCellCenterLonLat(const amrex::MultiFab *&lon_cc, const amrex::MultiFab *&lat_cc) const
Definition: ERF_to_REMORA.cpp:335
double m_plot2d_per_1
Definition: ERF.H:2379
void WarnSteepTerrainAtOpenFaces(int lev)
Definition: ERF.cpp:1550
void momentum_reflux_add_slow(int lev, amrex::MultiFab &P, const amrex::MultiFab &cons, const amrex::MultiFab &p0, const amrex::MultiFab &qt, bool moist, amrex::Real dt_stage)
Definition: ERF_MomentumReflux.cpp:174
void average_down_detJ(int crse_lev)
Set detJ_cc of level crse_lev under level crse_lev+1 so that each covered coarse cell's volume detJ/(...
Definition: ERF_AverageDown.cpp:630
Wrapper class for managing land surface models across AMR levels.
Definition: ERF_LandSurface.H:19
Definition: ERF_TopographicShading.H:15
The two-stream radiation model (erf.radiation_model = TwoStream).
Definition: ERF_TwoStreamRadiation.H:60
Wrapper class for managing urban models across AMR levels.
Definition: ERF_Urban.H:12
Definition: ERF_WRFSurfaceFields.H:47
Owns and exposes cell-centered and face-centered EB factories.
Definition: ERF_EB.H:26
Definition: ERF_ActuatorSampling.H:225
Definition: ERF_SBMAMRFluxRegister.H:27
Definition: ERF_SBMStateManager.H:17
Definition: ERF_SBMTransport.H:146
Definition: ERF_InterpolationUtils.H:15
@ ymom
Definition: ERF_IndexDefines.H:251
@ zmom
Definition: ERF_IndexDefines.H:252
@ xmom
Definition: ERF_IndexDefines.H:250
@ None
Definition: ERF_LSM_Types.H:6
@ P
Definition: ERF_IndexDefines.H:221
@ pres
Definition: ERF_Kessler.H:28
@ qt
Definition: ERF_Kessler.H:30
@ qv
Definition: ERF_Kessler.H:31
@ ng
Definition: ERF_Morrison.H:51
@ omega
Definition: ERF_Morrison.H:57
@ T
Definition: ERF_IndexDefines.H:180
constexpr int S
Definition: ERF_TwoStreamColumn.H:654
@ xvel
Definition: ERF_IndexDefines.H:232
@ cons
Definition: ERF_IndexDefines.H:231
@ zvel
Definition: ERF_IndexDefines.H:234
@ yvel
Definition: ERF_IndexDefines.H:233
@ t
Definition: ERF_WSM6.H:295
@ p
Definition: ERF_WSM6.H:303
Definition: ERF_ConsoleIO.cpp:17
amrex::Vector< std::string > plot3d_conserved_state_names()
Names of the raw conserved-state variables, in component order.
Definition: ERF_PlotfileSelection.H:126
ArtifactType
Definition: ERF_Provenance.H:37
Definition: ERF.H:128
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real phi(amrex::Real d, amrex::Real z0, amrex::Real psi) noexcept
Definition: ERF_ImmersedWallCell.H:176
real(c_double), parameter p0
Definition: ERF_module_model_constants.F90:40
real(c_double), parameter, private pi
Definition: ERF_module_mp_morr_two_moment.F90:100
integer, private isub
Definition: ERF_module_mp_morr_two_moment.F90:164
real(c_double), private bs
Definition: ERF_module_mp_morr_two_moment.F90:182
real(c_double), private ac
Definition: ERF_module_mp_morr_two_moment.F90:181
real(kind=kind_phys), parameter, private dens
Definition: ERF_module_mp_wdm6.F90:61
Definition: ERF_ObsNudging.cpp:22
Definition: ERF.H:125
Definition: ERF_BaseStateParams.H:35
Definition: ERF.H:2069
amrex::Vector< amrex::Real > time
Definition: ERF.H:2078
amrex::Array< amrex::Vector< amrex::MultiFab >, AMREX_SPACEDIM > flux
Definition: ERF.H:2076
bool complete
Definition: ERF.H:2079
amrex::Array< amrex::Vector< int >, AMREX_SPACEDIM > slab_box
Definition: ERF.H:2074
amrex::DistributionMapping fdm
Definition: ERF.H:2071
amrex::Vector< amrex::MultiFab > rho_w
Definition: ERF.H:2077
amrex::Array< amrex::BoxArray, AMREX_SPACEDIM > sba
Definition: ERF.H:2072
amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > tgt
Definition: ERF.H:2080
amrex::BoxArray fba
Definition: ERF.H:2070
amrex::Array< amrex::Vector< amrex::Box >, AMREX_SPACEDIM > slab_faces
Definition: ERF.H:2075
amrex::MultiFab tgt_w
Definition: ERF.H:2081
amrex::Array< amrex::DistributionMapping, AMREX_SPACEDIM > sdm
Definition: ERF.H:2073
Definition: ERF.H:2051
amrex::BoxArray ba_rz
Definition: ERF.H:2057
amrex::DistributionMapping sdm
Definition: ERF.H:2056
amrex::BoxArray fba
Definition: ERF.H:2052
amrex::BoxArray ba_mu
Definition: ERF.H:2058
amrex::BoxArray ba_r
Definition: ERF.H:2057
amrex::BoxArray ba_rv
Definition: ERF.H:2057
amrex::Vector< int > slab_box
Definition: ERF.H:2055
amrex::BoxArray ba_f
Definition: ERF.H:2060
std::map< int, amrex::Vector< amrex::Box > > patches
Definition: ERF.H:2054
amrex::BoxArray ba_cy
Definition: ERF.H:2059
amrex::BoxArray ba_rw
Definition: ERF.H:2057
amrex::BoxArray ba_x
Definition: ERF.H:2060
amrex::BoxArray ba_cx
Definition: ERF.H:2059
amrex::BoxArray ba_y
Definition: ERF.H:2060
amrex::DistributionMapping fdm
Definition: ERF.H:2053
amrex::BoxArray ba_mv
Definition: ERF.H:2058
amrex::BoxArray ba_ru
Definition: ERF.H:2057
amrex::BoxArray ba_cf
Definition: ERF.H:2059
Definition: ERF.H:833
double cfl_rate
Definition: ERF.H:836
double estdt_acoustic
Definition: ERF.H:838
bool sbm_mixing
Definition: ERF.H:844
amrex::Real sbm_rate
Definition: ERF.H:843
double wall_dt
Definition: ERF.H:845
amrex::Real wall_rate
Definition: ERF.H:846
Definition: ERF.H:1013
amrex::Vector< amrex::MultiFab > mf_cc_vel
Definition: ERF.H:1014
amrex::Vector< amrex::MultiFab > mf_cc_fx
Definition: ERF.H:1016
amrex::Vector< amrex::MultiFab > mf_cc_tau
Definition: ERF.H:1015
Definition: ERF_FireCouplingParams.H:18
Definition: ERF_FloodCouplingParams.H:20
Definition: ERF_IBSEBParams.H:25
bool two_stream_buildings
Definition: ERF_IBSEBParams.H:125
bool enable
Master switch.
Definition: ERF_IBSEBParams.H:26
std::string radiation
Definition: ERF_IBSEBParams.H:46
Definition: ERF_InputSoundingData.H:23
Definition: ERF_InputSpongeData.H:19
Definition: ERF_LargeScaleForcingData.H:31
Definition: ERF_SampleData.H:56
int qi
cloud ice
Definition: ERF_DataStruct.H:292
int qc
cloud liquid water
Definition: ERF_DataStruct.H:291
Definition: ERF_DataStruct.H:743
MoistureType moisture_type
Moisture or microphysics model.
Definition: ERF_DataStruct.H:3433
static bool buildings_fc_factories
Use native face-centered EB factories for immersed buildings on a static fitted mesh.
Definition: ERF_DataStruct.H:2998
bool use_building_immersed_forcing(const amrex::Geometry &geom) const noexcept
Definition: ERF_DataStruct.H:3231
AdvChoice advChoice
Advection-related options.
Definition: ERF_DataStruct.H:3016
static TerrainType terrain_type
Terrain or immersed-boundary representation.
Definition: ERF_DataStruct.H:2989
static BuildingsType buildings_type
Building representation.
Definition: ERF_DataStruct.H:2995
MoistureComponentIndices moisture_indices
Index map of the moisture data carried by the active scheme: conserved-state components for the speci...
Definition: ERF_DataStruct.H:3504
RadiationType rad_type
Radiation model.
Definition: ERF_DataStruct.H:3465
bool use_num_diff
Whether sixth-order numerical diffusion is enabled.
Definition: ERF_DataStruct.H:3429
Runtime state and operations for turbulent perturbation forcing.
Definition: ERF_TurbPertStruct.H:42
Definition: ERF_TwoStreamRadiation.H:572
Definition: ERF_CheckpointSurfaceTemperature.H:310
Definition: ERF_CloudChamber.H:56
Definition: ERF_Provenance.H:66
Definition: ERF_Plotfile2DCloudOptics.H:20
Definition: ERF_Plotfile2DSampledLevel.H:56