ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_TI_substep_fun.H
Go to the documentation of this file.
1 #include "ERF_SrcHeaders.H"
2 
3 /**
4  * Wrapper for calling the routine that creates the fast RHS
5  */
6 auto acoustic_substepping_fun = [&,one_d=one,zero_d=zero](int fast_step, int n_sub, int nrk,
7  Vector<MultiFab>& S_slow_rhs,
8  const Vector<MultiFab>& S_old,
9  Vector<MultiFab>& S_stage,
10  Vector<MultiFab>& S_data,
11  const double dtau,
12  const double /*slow_dt*/, // MRI's full timestep: use n_sub*dtau for this stage
13  const Real inv_fac,
14  const double old_substep_time,
15  const double new_substep_time)
16 {
17  BL_PROFILE("acoustic_substepping_fun");
18  if (verbose) amrex::Print() << "Fast time integration at level " << level
19  << std::setprecision(timeprecision)
20  << " from " << old_substep_time << " to " << new_substep_time
21  << " with dt = " << dtau << std::endl;
22 
23  // Define beta_s here so that it is consistent between where we make the fast coefficients
24  // and where we use them
25  // Per p2902 of Klemp-Skamarock-Dudhia-2007
26  // beta_s = -one : fully explicit
27  // beta_s = one : fully implicit
28  // With erf.use_variable_beta_s, beta_s instead varies on the w-faces with the terrain
29  // slope and the vertical acoustic Courant number (see make_fast_coeffs); the substeps
30  // take it from fast_coeffs either way
31  Real beta_s;
32  bool l_variable_beta_s;
33  if (solverChoice.timestepping_type[level] == TimesteppingType::RK3_ImplicitSubstep) {
34  beta_s = solverChoice.beta_s;
35  l_variable_beta_s = solverChoice.use_variable_beta_s;
36  } else { // Fully explicit
37  beta_s = -one_d;
38  l_variable_beta_s = false;
39  }
40 
41  // On a moving fitted mesh the w equation is divided by the face volume at the end of the
42  // sub-step, so the face metric of the vertical pressure gradient and the volume dividing the
43  // vertical flux divergence in the implicit solve are both those of the new mesh. The lateral
44  // pressure gradients take their metrics from the mesh at the start of the sub-step, and the
45  // change of the metric terms since the stage time acts on the complete stage pressure
46  const bool l_moving_mesh = (solverChoice.terrain_type == TerrainType::MovingFittedMesh);
47 
48  const GpuArray<Real, AMREX_SPACEDIM> dxInv = fine_geom.InvCellSizeArray();
49 
50  // Canopy data for mom sources
51  MultiFab* forest_drag = (solverChoice.do_forest_drag) ?
52  m_forest_drag[level]->get_drag_field() : nullptr;
53 
54  // Immersed Forcing
55  MultiFab* terrain_blank = (solverChoice.terrain_type == TerrainType::ImmersedForcing ||
56  solverChoice.buildings_type == BuildingsType::ImmersedForcing ) ?
57  terrain_blanking[level].get() : nullptr;
58  MultiFab* terrain_blank_xface = (solverChoice.terrain_type == TerrainType::ImmersedForcing ||
59  solverChoice.buildings_type == BuildingsType::ImmersedForcing ) ?
60  terrain_blanking_xface[level].get() : nullptr;
61  MultiFab* terrain_blank_yface = (solverChoice.terrain_type == TerrainType::ImmersedForcing ||
62  solverChoice.buildings_type == BuildingsType::ImmersedForcing ) ?
63  terrain_blanking_yface[level].get() : nullptr;
64  MultiFab* terrain_blank_zface = (solverChoice.terrain_type == TerrainType::ImmersedForcing ||
65  solverChoice.buildings_type == BuildingsType::ImmersedForcing ) ?
66  terrain_blanking_zface[level].get() : nullptr;
67 
68  Vector<MultiFab> Svec_to_use;
69  if (fast_step == 0) {
70  // If this is the first substep we pass in S_old as the previous step's solution
71  Svec_to_use.push_back(MultiFab(S_old[IntVars::cons],make_alias,0,S_old[IntVars::cons].nComp()));
72  Svec_to_use.push_back(MultiFab(S_old[IntVars::xmom],make_alias,0,1));
73  Svec_to_use.push_back(MultiFab(S_old[IntVars::ymom],make_alias,0,1));
74  Svec_to_use.push_back(MultiFab(S_old[IntVars::zmom],make_alias,0,1));
75  } else {
76  // If this is not the first substep we pass in S_data as the previous step's solution
77  Svec_to_use.push_back(MultiFab(S_data[IntVars::cons],make_alias,0,S_data[IntVars::cons].nComp()));
78  Svec_to_use.push_back(MultiFab(S_data[IntVars::xmom],make_alias,0,1));
79  Svec_to_use.push_back(MultiFab(S_data[IntVars::ymom],make_alias,0,1));
80  Svec_to_use.push_back(MultiFab(S_data[IntVars::zmom],make_alias,0,1));
81  }
82 
83  // Get planar averages from persistent storage for immersed forcing in fast substeps
84  bool l_use_IF = (solverChoice.terrain_type == TerrainType::ImmersedForcing ||
85  solverChoice.buildings_type == BuildingsType::ImmersedForcing);
86  Table1D<Real> r_avg_to_pass = l_use_IF ? r_plane_avg[level].table() : Table1D<Real>();
87  Table1D<Real> t_avg_to_pass = l_use_IF ? t_plane_avg[level].table() : Table1D<Real>();
88 
89  make_sources(level, nrk, dtau, old_substep_time,
90  Svec_to_use, S_prim, cc_src, base_state[level], z_phys_cc[level].get(),
91  xvel_new, yvel_new, zvel_new,
92  qheating_rates[level].get(),
93  terrain_blank, fine_geom, solverChoice,
94  mapfac[level],
95  rhotheta_src[level].get(), rhoqt_src[level].get(),
96  dptr_wbar_sub, d_rayleigh_ptrs_at_lev,
97  d_sinesq_at_lev,
98  turbPert,
99  r_avg_to_pass, t_avg_to_pass,
100  forest_drag, &S_old[IntVars::cons],
101  false);
102 
103  // *************************************************************************
104  // Set up flux registers if using two_way coupling
105  // *************************************************************************
106  const bool l_reflux = IsRefluxStage(solverChoice, level, finest_level, nrk);
107 
108  YAFluxRegister* fr_as_crse = nullptr;
109  YAFluxRegister* fr_as_fine = nullptr;
110  if (l_reflux) {
111  if (level < finest_level) {
112  fr_as_crse = getAdvFluxReg(level+1);
113  }
114  if (level > 0) {
115  fr_as_fine = getAdvFluxReg(level);
116  }
117  }
118 
119  MultiFab base_to_use;
120  if ( solverChoice.terrain_type == TerrainType::MovingFittedMesh ) {
121  base_to_use = MultiFab(base_state_new[level], make_alias, 0, BaseState::num_comps);
122  } else {
123  base_to_use = MultiFab(base_state[level], make_alias, 0, BaseState::num_comps);
124  }
125 
126  make_mom_sources(level, old_substep_time, dtau, Svec_to_use,
127  z_phys_nd[level].get(), z_phys_cc[level].get(), stretched_dz_h[level],
128  xvel_new, yvel_new, zvel_new,
129  xmom_src, ymom_src, zmom_src,
130  base_to_use, forest_drag, terrain_blank,
131  terrain_blank_xface, terrain_blank_yface, terrain_blank_zface,
132  cosPhi_m[level].get(), sinPhi_m[level].get(), fine_geom, solverChoice,
133  mapfac[level],
134  (solverChoice.have_geo_wind_profile) ? d_u_geos[level].data() : nullptr,
135  (solverChoice.have_geo_wind_profile) ? d_v_geos[level].data() : nullptr,
136  dptr_wbar_sub, d_rayleigh_ptrs_at_lev,
137  d_sinesq_at_lev, d_sinesq_stag_at_lev, d_sponge_ptrs_at_lev,
138  (solverChoice.hindcast_lateral_forcing? &forecast_state_interp[level] : nullptr),
139  sounding_at_level(level), lsf_at_level(level), lsf_data[level],
140  get_eb(level), false);
141 
142  // Moving terrain
143  std::unique_ptr<MultiFab> z_t_pert;
144  if ( solverChoice.terrain_type == TerrainType::MovingFittedMesh )
145  {
146  z_t_pert = std::make_unique<MultiFab>(S_data[IntVars::zmom].boxArray(), S_data[IntVars::zmom].DistributionMap(), 1, 1);
147  update_terrain_substep(level, old_substep_time, new_substep_time, dtau, S_data, z_t_pert);
148  }
149 
150  bool l_use_moisture = ( solverChoice.moisture_type != MoistureType::None );
151 
152  if ( (fast_step == 0) || (solverChoice.terrain_type == TerrainType::MovingFittedMesh) )
153  {
154  make_fast_coeffs(level, fast_coeffs, S_stage, S_prim, pi_stage, fine_geom,
155  l_use_moisture, SolverChoice::mesh_type, solverChoice.gravity, solverChoice.c_p,
156  (l_moving_mesh ? detJ_cc_new[level] : detJ_cc[level]), dtau, beta_s,
157  z_phys_cc[level].get(), z_phys_nd[level].get(),
158  !l_moving_mesh && solverChoice.zcc_vertical_metric(level),
159  l_variable_beta_s, phys_bc_type);
160  }
161 
162  bool l_rayleigh_implicit = solverChoice.rayleigh_implicit_w(level);
163  Real l_damp_coef = solverChoice.dampingChoice.rayleigh_dampcoef;
164 
165  // The coarse/fine face fluxes of the last RK stage (ERF_CFFluxHistory.cpp): a coarse
166  // level records those of each substep, a fine level takes the coarse ones. Not done
167  // with moving terrain (cf_flux_history_active).
168  CFFaceFluxes cf_fluxes;
169  Array<MultiFab, AMREX_SPACEDIM> cf_rec;
170  MultiFab cf_rec_om, cf_rec_om_old;
171  const bool cf_terrain = (solverChoice.mesh_type == MeshType::VariableDz);
172  // This is the last RK stage, whose fluxes are the step's, under either coupling
173  // (cf_flux_history_active excludes the anelastic levels)
174  const bool cf_stage = (StageFluxWeight(solverChoice, level, nrk) > Real(0));
175  const bool cf_record = cf_stage && cf_flux_history_active(level);
176  const bool cf_impose = cf_stage && (level > 0) && cf_flux_history_active(level-1);
177  if (cf_record) {
178  const int mom[AMREX_SPACEDIM] = {AMREX_D_DECL(IntVars::xmom, IntVars::ymom, IntVars::zmom)};
179  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
180  cf_rec[dir].define(S_data[mom[dir]].boxArray(), S_data[mom[dir]].DistributionMap(), 1, 0);
181  cf_fluxes.rec[dir] = &cf_rec[dir];
182  }
183  // With terrain the z-faces hold Omega, which the substep records itself
184  if (cf_terrain) {
185  cf_rec_om.define(S_data[IntVars::zmom].boxArray(), S_data[IntVars::zmom].DistributionMap(), 1, 0);
186  cf_fluxes.rec_w = &cf_rec_om;
187  if (fast_step == 0) {
188  cf_rec_om_old.define(S_data[IntVars::zmom].boxArray(), S_data[IntVars::zmom].DistributionMap(), 1, 0);
189  cf_fluxes.rec_w_old = &cf_rec_om_old;
190  }
191  }
192  }
193  if (cf_impose) {
194  cf_flux_history_targets(level, static_cast<Real>(old_substep_time),
195  static_cast<Real>(new_substep_time));
196  CFFluxHistory& H = cf_flux_history(level);
197  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
198  cf_fluxes.tgt[dir] = &H.tgt[dir];
199  }
200  cf_fluxes.tgt_w = &H.tgt_w;
201  }
202 
203  // Lateral walls: faces through which no mass passes. The substeps keep the
204  // normal momentum there at its stage value (a lateral surface layer sets the normal
205  // velocity to zero, as a slip wall does)
206  auto is_wall = [&] (int ori) {
207  const ERF_BC bc = phys_bc_type[ori];
210  };
211  const GpuArray<bool,4> lateral_walls{is_wall(Orientation::xlo()), is_wall(Orientation::xhi()),
212  is_wall(Orientation::ylo()), is_wall(Orientation::yhi())};
213 
214  if ( solverChoice.terrain_type == TerrainType::MovingFittedMesh )
215  {
216  erf_substep_MT(fast_step, nrk, level, finest_level,
217  S_slow_rhs, Svec_to_use, S_stage, S_prim, qt, pi_stage, p_stage, fast_coeffs,
218  S_data, lagged_delta_rt[level], avg_xmom[level], avg_ymom[level], avg_zmom[level],
219  cc_src, xmom_src, ymom_src, zmom_src,
220  fine_geom,
221  solverChoice.gravity, solverChoice.use_lagged_delta_rt,
222  z_t_rk[level], z_t_pert.get(),
223  z_phys_nd[level], z_phys_nd_new[level], z_phys_nd_src[level],
224  detJ_cc[level], detJ_cc_new[level], detJ_cc_src[level],
225  dtau, inv_fac, mapfac[level],
226  fr_as_crse, fr_as_fine, l_use_moisture, l_reflux, solverChoice.use_real_bcs,
227  (l_rayleigh_implicit) ? d_sinesq_stag_ptrs[level].data() : nullptr, l_damp_coef,
228  solverChoice.beta_d, lateral_walls);
229 
230  } else if (cf_terrain) {
231 
232  erf_substep_T(fast_step, nrk, level, finest_level,
233  S_slow_rhs, Svec_to_use, S_stage, S_prim, qt, pi_stage, fast_coeffs,
234  S_data, lagged_delta_rt[level], avg_xmom[level], avg_ymom[level], avg_zmom[level],
235  cc_src, xmom_src, ymom_src, zmom_src,
236  fine_geom, solverChoice.gravity,
237  z_phys_nd[level], detJ_cc[level], *ax[level], *ay[level], dtau, inv_fac,
238  mapfac[level],
239  fr_as_crse, fr_as_fine, l_use_moisture, l_reflux, solverChoice.use_real_bcs,
240  (l_rayleigh_implicit) ? d_sinesq_stag_ptrs[level].data() : nullptr, l_damp_coef,
241  solverChoice.beta_d, cf_fluxes, lateral_walls);
242 
243  } else {
244 
245  erf_substep_NS(fast_step, nrk, level, finest_level,
246  S_slow_rhs, Svec_to_use, S_stage, S_prim, qt, pi_stage, fast_coeffs,
247  S_data, lagged_delta_rt[level], avg_xmom[level], avg_ymom[level], avg_zmom[level],
248  cc_src, xmom_src, ymom_src, zmom_src,
249  fine_geom, solverChoice.gravity, stretched_dz_d[level],
250  dtau, inv_fac, mapfac[level],
251  fr_as_crse, fr_as_fine, l_use_moisture, l_reflux, solverChoice.use_real_bcs,
252  (l_rayleigh_implicit) ? d_sinesq_stag_ptrs[level].data() : nullptr, l_damp_coef,
253  solverChoice.beta_d, cf_fluxes,
254  (l_reflux) ? momentum_reflux_pressure(level) : nullptr, lateral_walls);
255  }
256 
257  // The vertical quantity at the start and end of the substep: Omega, recorded by the
258  // substep, with terrain; (rho w) without it, where Svec_to_use holds (rho w) at the start
259  // of the stage when fast_step is 0, the only substep at which the record reads it
260  if (cf_record) {
261  const MultiFab& w_old = (cf_terrain) ? ((fast_step == 0) ? cf_rec_om_old : cf_rec_om)
262  : Svec_to_use[IntVars::zmom];
263  const MultiFab& w_new = (cf_terrain) ? cf_rec_om : S_data[IntVars::zmom];
264  cf_flux_history_record(level, fast_step, n_sub,
265  static_cast<Real>(old_substep_time), static_cast<Real>(new_substep_time),
266  cf_rec, w_old, w_new);
267  }
268 
269  // Even if we update all the conserved variables we don't need
270  // to fillpatch the slow ones every acoustic substep
271 
272  // NOTE: Numerical diffusion is tested on in FillPatchIntermediate and dictates the size of the
273  // box over which VelocityToMomentum is computed. V2M requires one more ghost cell be
274  // filled for rho than velocity. This logical condition ensures we fill enough ghost cells
275  // when use_num_diff is true.
276  int ng_cons = S_data[IntVars::cons].nGrowVect().max() - 1;
277  int ng_vel = S_data[IntVars::xmom].nGrowVect().max();
278  if (!solverChoice.use_num_diff) {
279  ng_cons = 1;
280  ng_vel = 1;
281  }
282 
283  if ( (solverChoice.vert_implicit_fac[level][nrk] > zero_d) &&
284  !solverChoice.implicit_before_substep &&
285  (fast_step == n_sub-1) )
286  {
287  // The solves read the ghost cells of S_data: rho and the momenta at the walls and
288  // above and below a column that ends at a coarse/fine boundary, and rho beside the
289  // faces at a grid edge. They are filled only at the end of each substep (below),
290  // so here they still hold those of the previous substep -- or nothing at all in a
291  // stage with a single substep. Fill them at the time this substep reaches; the
292  // fill at the end of the substep then refreshes them after the solves.
293  apply_bcs(S_data, new_substep_time, ng_cons, ng_vel, fast_only=true, vel_and_mom_synced=false);
294 
295  // The interval actually advanced by this RK stage -- NOT the full MRI timestep
296  const Real stage_dt = static_cast<Real>(n_sub * dtau);
297  MultiFab scratch(S_data[IntVars::cons], make_alias, 0, 2);
298  MultiFab scratch_xmom(S_data[IntVars::xmom], make_alias, 0, 1);
299  MultiFab scratch_ymom(S_data[IntVars::ymom], make_alias, 0, 1);
300 #include "ERF_ImplicitPre.H"
301  }
302 
303  // Apply vertical velocity damping at the end of the timestep
304  if ( (solverChoice.dampingChoice.w_damping) &&
305  (nrk == 2) &&
306  (fast_step == n_sub-1))
307  {
308  amrex::Real w_damping_const = solverChoice.dampingChoice.w_damping_const;
309  amrex::Real w_damping_coeff = solverChoice.dampingChoice.w_damping_coeff;
310  amrex::Real cflw_lim = solverChoice.dampingChoice.w_damping_cfl;
311 
312  for ( MFIter mfi(S_data[IntVars::cons]); mfi.isValid(); ++mfi)
313  {
314  Box tbz = mfi.nodaltilebox(2);
315 
316  const Array4<const Real>& z_nd_arr = z_phys_nd[level]->const_array(mfi);
317 
318  const Array4<const Real>& cell_data = S_data[IntVars::cons].const_array(mfi);
319  const Array4< Real>& rho_w = S_data[IntVars::zmom].array(mfi);
320 
321  ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
322  {
323  Real dzInv;
324  if (z_nd_arr) {
325  // average z_nd to face then diff
326  if (k == domain.smallEnd(2)) {
327  dzInv = amrex::Real(4.0) / (
328  z_nd_arr(i ,j ,k+1) - z_nd_arr(i ,j ,k)
329  + z_nd_arr(i+1,j ,k+1) - z_nd_arr(i+1,j ,k)
330  + z_nd_arr(i ,j+1,k+1) - z_nd_arr(i ,j+1,k)
331  + z_nd_arr(i+1,j+1,k+1) - z_nd_arr(i+1,j+1,k) );
332  } else if (k == domain.bigEnd(2)+1) {
333  dzInv = amrex::Real(4.0) / (
334  z_nd_arr(i ,j ,k) - z_nd_arr(i ,j ,k-1)
335  + z_nd_arr(i+1,j ,k) - z_nd_arr(i+1,j ,k-1)
336  + z_nd_arr(i ,j+1,k) - z_nd_arr(i ,j+1,k-1)
337  + z_nd_arr(i+1,j+1,k) - z_nd_arr(i+1,j+1,k-1) );
338  } else {
339  // dz = myhalf * (dz[i,j,k] + dz[i,j,k+1])
340  // = myhalf * (z_nd_face[i,j,k+1] - z_nd_face[i,j,k-1])
341  dzInv = amrex::Real(8.0) / (
342  z_nd_arr(i ,j ,k+1) - z_nd_arr(i ,j ,k-1)
343  + z_nd_arr(i+1,j ,k+1) - z_nd_arr(i+1,j ,k-1)
344  + z_nd_arr(i ,j+1,k+1) - z_nd_arr(i ,j+1,k-1)
345  + z_nd_arr(i+1,j+1,k+1) - z_nd_arr(i+1,j+1,k-1) );
346  }
347  } else {
348  dzInv = dxInv[2];
349  }
350 
351  Real dt_adv = static_cast<Real>(dt_advance);
352 
353  Real dampcoef = (w_damping_const > 0) ? w_damping_const
354  : w_damping_coeff / (dzInv * dt_adv * dt_adv);
355 
356  Real rho_on_w_face = myhalf * ( cell_data(i,j,k,Rho_comp) + cell_data(i,j,k-1,Rho_comp) );
357  Real wmag = std::abs(rho_w(i,j,k) / rho_on_w_face);
358 
359  // This is the dynamics timestep, not the slow or fast dt
360  Real cflw = wmag * dt_adv * dzInv;
361 
362  if (cflw > cflw_lim) {
363  Real sgn_w = (rho_w(i,j,k) > 0) ? one : -one;
364  rho_w(i, j, k) -= rho_on_w_face * sgn_w * dampcoef * (cflw - cflw_lim) * dt_adv;
365  // Note: These prints are not immediately flushed to screen
366 #ifdef AMREX_USE_GPU
367  AMREX_DEVICE_PRINTF("t=%f w-damping applied at (%d,%d,%d) for w-CFL = %f > %f : %f --> %f\n",
368  old_time+dt_adv, i,j,k, cflw, cflw_lim, sgn_w*wmag, rho_w(i,j,k)/rho_on_w_face);
369 #else
370  printf("t=%f w-damping applied at (%d,%d,%d) for w-CFL = %f > %f : %f --> %f\n",
371  old_time+dt_adv, i,j,k, cflw, cflw_lim, sgn_w*wmag, rho_w(i,j,k)/rho_on_w_face);
372 #endif
373  }
374  });
375  }
376  }
377 
378  apply_bcs(S_data, new_substep_time, ng_cons, ng_vel, fast_only=true, vel_and_mom_synced=false);
379 };
#define Rho_comp
Definition: ERF_IndexDefines.H:61
ERF_BC
Definition: ERF_IndexDefines.H:293
@ no_slip_wall
@ surface_layer
pp_for_pert_vels get("prob_type", prob_type)
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:16
if(add_bubble)
Definition: ERF_InitCustomPert_ABL.H:60
Real H
Definition: ERF_InitCustomPert_MovingTerrain.H:8
void make_fast_coeffs(int, MultiFab &fast_coeffs, Vector< MultiFab > &S_stage_data, const MultiFab &S_stage_prim, const MultiFab &pi_stage, const amrex::Geometry geom, bool l_use_moisture, MeshType mesh_type, Real gravity, Real c_p, std::unique_ptr< MultiFab > &detJ_cc, const double dtau, Real beta_s, const MultiFab *z_phys_cc, const MultiFab *z_phys_nd, bool use_zcc_kface_metric, bool use_variable_beta_s, amrex::GpuArray< ERF_BC, AMREX_SPACEDIM *2 > &phys_bc_type)
Definition: ERF_MakeFastCoeffs.cpp:42
void make_mom_sources(int level, double time_d, double dt, const Vector< MultiFab > &S_data, const MultiFab *z_phys_nd, const MultiFab *z_phys_cc, Vector< Real > &stretched_dz_h, const MultiFab &xvel, const MultiFab &yvel, const MultiFab &wvel, MultiFab &xmom_src, MultiFab &ymom_src, MultiFab &zmom_src, const MultiFab &base_state, MultiFab *forest_drag, MultiFab *terrain_blank, MultiFab *terrain_blank_xface, MultiFab *terrain_blank_yface, MultiFab *terrain_blank_zface, MultiFab *cosPhi_mf, MultiFab *sinPhi_mf, const Geometry geom, const SolverChoice &solverChoice, Vector< std::unique_ptr< MultiFab >> &, const Real *dptr_u_geos, const Real *dptr_v_geos, const Real *dptr_wbar_sub, const Vector< Real * > d_rayleigh_ptrs_at_lev, const amrex::Real *d_sinesq_at_lev, const amrex::Real *d_sinesq_stag_at_lev, const Vector< Real * > d_sponge_ptrs_at_lev, const Vector< MultiFab > *forecast_state_at_lev, const InputSoundingData &input_sounding_data, const LargeScaleForcingData &lsf_data, std::unique_ptr< amrex::MultiFab > &lsf_tendencies, const eb_ &ebfact, bool is_slow_step)
Definition: ERF_MakeMomSources.cpp:41
void make_sources(int level, int, double dt, double time_d, const Vector< MultiFab > &S_data, const MultiFab &S_prim, MultiFab &source, const MultiFab &base_state, const MultiFab *z_phys_cc, const MultiFab &xvel, const MultiFab &yvel, const MultiFab &zvel, const MultiFab *qheating_rates, MultiFab *terrain_blank, const Geometry geom, const SolverChoice &solverChoice, Vector< std::unique_ptr< MultiFab >> &mapfac, const MultiFab *rhotheta_src, const MultiFab *rhoqt_src, const Real *dptr_wbar_sub, const Vector< Real * > d_rayleigh_ptrs_at_lev, const Real *d_sinesq_at_lev, TurbulentPerturbation &turbPert, const Table1D< Real > r_plane_avg, const Table1D< Real > t_plane_avg, const MultiFab *forest_drag, const MultiFab *cons_old, bool is_slow_step, MultiFab *ib_wall_hfx, MultiFab *ib_wall_ktarget, MultiFab *ib_wall_qfx)
Definition: ERF_MakeSources.cpp:39
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
void erf_substep_MT(int step, int, int level, int finest_level, Vector< MultiFab > &S_slow_rhs, const Vector< MultiFab > &S_prev, Vector< MultiFab > &S_stg_data, const MultiFab &S_stg_prim, const MultiFab &qt, const MultiFab &pi_stage, const MultiFab &p_stage, const MultiFab &fast_coeffs, Vector< MultiFab > &S_data, MultiFab &lagged_delta_rt, MultiFab &avg_xmom, MultiFab &avg_ymom, MultiFab &avg_zmom, const MultiFab &cc_src, const MultiFab &xmom_src, const MultiFab &ymom_src, const MultiFab &zmom_src, const Geometry geom, const Real gravity, const bool use_lagged_delta_rt, std::unique_ptr< MultiFab > &z_t_rk, const MultiFab *z_t_pert, std::unique_ptr< MultiFab > &z_phys_nd_old, std::unique_ptr< MultiFab > &z_phys_nd_new, std::unique_ptr< MultiFab > &z_phys_nd_stg, std::unique_ptr< MultiFab > &detJ_cc_old, std::unique_ptr< MultiFab > &detJ_cc_new, std::unique_ptr< MultiFab > &detJ_cc_stg, const double dtau_d, const Real facinv, Vector< std::unique_ptr< MultiFab >> &mapfac, YAFluxRegister *fr_as_crse, YAFluxRegister *fr_as_fine, bool l_use_moisture, bool l_reflux, bool, const Real *sinesq_stag_d, const Real l_damp_coef, const Real beta_d, const GpuArray< bool, 4 > &lateral_walls)
Definition: ERF_Substep_MT.cpp:55
void erf_substep_NS(int step, int nrk, int level, int finest_level, Vector< MultiFab > &S_slow_rhs, const Vector< MultiFab > &S_prev, Vector< MultiFab > &S_stage_data, const MultiFab &S_stage_prim, const MultiFab &qt, const MultiFab &pi_stage, const MultiFab &fast_coeffs, Vector< MultiFab > &S_data, MultiFab &lagged_delta_rt, MultiFab &avg_xmom, MultiFab &avg_ymom, MultiFab &avg_zmom, const MultiFab &cc_src, const MultiFab &xmom_src, const MultiFab &ymom_src, const MultiFab &zmom_src, const Geometry geom, const Real gravity, amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const double dtau_d, const Real facinv, Vector< std::unique_ptr< MultiFab >> &mapfac, YAFluxRegister *fr_as_crse, YAFluxRegister *fr_as_fine, bool l_use_moisture, bool l_reflux, bool l_real_bc, const amrex::Real *sinesq_stag_d, const Real l_damp_coef, const Real beta_d, const CFFaceFluxes &cf_fluxes, MultiFab *mom_reflux_p, const GpuArray< bool, 4 > &lateral_walls)
Definition: ERF_Substep_NS.cpp:47
void erf_substep_T(int step, int, int level, int finest_level, Vector< MultiFab > &S_slow_rhs, const Vector< MultiFab > &S_prev, Vector< MultiFab > &S_stage_data, const MultiFab &S_stage_prim, const MultiFab &qt, const MultiFab &pi_stage, const MultiFab &fast_coeffs, Vector< MultiFab > &S_data, MultiFab &lagged_delta_rt, MultiFab &avg_xmom, MultiFab &avg_ymom, MultiFab &avg_zmom, const MultiFab &cc_src, const MultiFab &xmom_src, const MultiFab &ymom_src, const MultiFab &zmom_src, const Geometry geom, const Real gravity, std::unique_ptr< MultiFab > &z_phys_nd, std::unique_ptr< MultiFab > &detJ_cc, const MultiFab &ax, const MultiFab &ay, const double dtau_d, const Real facinv, Vector< std::unique_ptr< MultiFab >> &mapfac, YAFluxRegister *fr_as_crse, YAFluxRegister *fr_as_fine, bool l_use_moisture, bool l_reflux, bool l_real_bc, const Real *sinesq_stag_d, const Real l_damp_coef, const Real beta_d, const CFFaceFluxes &cf_fluxes, const GpuArray< bool, 4 > &lateral_walls)
Definition: ERF_Substep_T.cpp:71
bool IsRefluxStage(const SolverChoice &solverChoice, int level, int finest_level, int nrk)
Definition: ERF_TI_slow_headers.H:91
amrex::Real StageFluxWeight(const SolverChoice &solverChoice, int level, int nrk)
Definition: ERF_TI_slow_headers.H:51
auto acoustic_substepping_fun
Definition: ERF_TI_substep_fun.H:6
auto apply_bcs
Definition: ERF_TI_utils.H:46
auto update_terrain_substep
Definition: ERF_TI_utils.H:218
@ num_comps
Definition: ERF_IndexDefines.H:114
@ ymom
Definition: ERF_IndexDefines.H:251
@ cons
Definition: ERF_IndexDefines.H:249
@ zmom
Definition: ERF_IndexDefines.H:252
@ xmom
Definition: ERF_IndexDefines.H:250
@ None
Definition: ERF_LSM_Types.H:6
@ qt
Definition: ERF_Kessler.H:30
real(c_double), private bc
Definition: ERF_module_mp_morr_two_moment.F90:182
Definition: ERF_TI_fast_headers.H:28
std::array< amrex::MultiFab *, AMREX_SPACEDIM > rec
Definition: ERF_TI_fast_headers.H:29
amrex::MultiFab * rec_w
Definition: ERF_TI_fast_headers.H:30
const amrex::MultiFab * tgt_w
Definition: ERF_TI_fast_headers.H:33
std::array< const amrex::MultiFab *, AMREX_SPACEDIM > tgt
Definition: ERF_TI_fast_headers.H:32
amrex::MultiFab * rec_w_old
Definition: ERF_TI_fast_headers.H:31
static MeshType mesh_type
Vertical mesh representation.
Definition: ERF_DataStruct.H:3004