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