ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Utils.H
Go to the documentation of this file.
1 #ifndef ERF_UTILS_H_
2 #define ERF_UTILS_H_
3 
4 #include "AMReX.H"
5 #include "AMReX_MultiFab.H"
6 #include "AMReX_BCRec.H"
7 #include "ERF_DataStruct.H"
8 #include "ERF_IndexDefines.H"
9 #include "ERF_SurfaceLayer.H"
10 #include "ERF_FillPatcher.H"
11 
12 /*
13  * Create a new BoxArray in which every grid touches the bottom boundary
14  */
15 void ChopGrids2D (amrex::BoxArray& ba, const amrex::Box& domain, int target_size);
16 
17 /*
18  * Create a new BoxArray with exactly the number of boxes as MPI ranks.
19  * This is designed to work only on the base level which covers the entire domain.
20  */
21 amrex::BoxArray
22 ERFPostProcessBaseGrids (const amrex::Box& domain, bool decompose_in_z);
23 
24 /*
25  * Create the Jacobian for the metric transformation when use_terrain is true
26  */
27 void make_J (const amrex::Geometry& geom,
28  amrex::MultiFab& z_phys_nd,
29  amrex::MultiFab& detJ_cc);
30 
31 void make_areas (const amrex::Geometry& geom,
32  amrex::MultiFab& z_phys_nd,
33  amrex::MultiFab& ax,
34  amrex::MultiFab& ay,
35  amrex::MultiFab& az);
36 
37 /*
38  * Average z_phys_nd on nodes to cell centers
39  */
40 void make_zcc (const amrex::Geometry& geom,
41  amrex::MultiFab& z_phys_nd,
42  amrex::MultiFab& z_phys_cc);
43 
44 /*
45  * Convert momentum to velocity by dividing by density averaged onto faces
46  */
47 void MomentumToVelocity (amrex::MultiFab& xvel_out,
48  amrex::MultiFab& yvel_out,
49  amrex::MultiFab& zvel_out,
50  const amrex::MultiFab& cons_in,
51  const amrex::MultiFab& xmom_in,
52  const amrex::MultiFab& ymom_in,
53  const amrex::MultiFab& zmom_in,
54  const amrex::Box& domain,
55  const amrex::Vector<amrex::BCRec>& domain_bcs_type_h,
56  const amrex::MultiFab* c_vfrac = nullptr // optional
57  );
58 
59 /*
60  * Convert velocity to momentum by multiplying by density averaged onto faces
61  */
62 void VelocityToMomentum (const amrex::MultiFab& xvel_in,
63  const amrex::IntVect & xvel_ngrow,
64  const amrex::MultiFab& yvel_in,
65  const amrex::IntVect & yvel_ngrow,
66  const amrex::MultiFab& zvel_in,
67  const amrex::IntVect & zvel_ngrow,
68  const amrex::MultiFab& cons_in,
69  amrex::MultiFab& xmom_out,
70  amrex::MultiFab& ymom_out,
71  amrex::MultiFab& zmom_out,
72  const amrex::Box& domain,
73  const amrex::Vector<amrex::BCRec>& domain_bcs_type_h,
74  const amrex::MultiFab* c_vfrac = nullptr // optional
75  );
76 
77 /*
78  * Convert (den_div u) to (den_mlt u) by multiplying by (den_mlt/den_div)
79  */
80 void
81 ConvertForProjection (const amrex::MultiFab& den_div, const amrex::MultiFab& den_mlt,
82  amrex::MultiFab& xmom, amrex::MultiFab& ymom, amrex::MultiFab& zmom,
83  const amrex::Box& domain, const amrex::Vector<amrex::BCRec>& domain_bcs_type_h);
84 
85 /*
86  * \brief Enforces solvablity by scaling outflow to match with inflow.
87  *
88  */
90  amrex::Array<amrex::MultiFab*, AMREX_SPACEDIM>& vels_vec,
91  amrex::Array<amrex::MultiFab*, AMREX_SPACEDIM>& area_vec,
92  const amrex::Geometry& geom);
93 
94 /*
95  * Compute boxes for looping over interior/exterior ghost cells
96  * for use by fillpatch, erf_slow_rhs_pre, and erf_slow_rhs_post
97  */
98 void realbdy_interior_bxs_xy (const amrex::Box& bx,
99  const amrex::Box& domain,
100  const int& width,
101  amrex::Box& bx_xlo,
102  amrex::Box& bx_xhi,
103  amrex::Box& bx_ylo,
104  amrex::Box& bx_yhi,
105  const int& set_width=0,
106  const amrex::IntVect& ng_vect=amrex::IntVect(0,0,0),
107  const bool get_int_ng=false);
108 
109 /*
110  * Compute boxes for looping over set region cells
111  * for use by fillpatch, erf_slow_rhs_pre, and erf_slow_rhs_post
112  */
113 void realbdy_bc_bxs_xy (const amrex::Box& bx,
114  const amrex::Box& domain,
115  const int& set_width,
116  amrex::Box& bx_xlo,
117  amrex::Box& bx_xhi,
118  amrex::Box& bx_ylo,
119  amrex::Box& bx_yhi,
120  const amrex::IntVect& ng_vect=amrex::IntVect(0,0,0));
121 
122 /*
123  * Compute relaxation region RHS with wrfbdy
124  */
125 void realbdy_compute_interior_ghost_rhs (const amrex::Real& bdy_time_interval,
126  const amrex::Real& time,
127  const amrex::Real& delta_t,
128  const amrex::Real& stop_time_elapsed,
129  int width,
130  int set_width,
131  const amrex::Geometry& geom,
132  amrex::Vector<amrex::MultiFab>& S_rhs,
133  amrex::Vector<amrex::MultiFab>& S_old_data,
134  amrex::Vector<amrex::MultiFab>& S_cur_data,
135  amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_xlo,
136  amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_xhi,
137  amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_ylo,
138  amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_yhi);
139 
140 /*
141  * Compute relaxation region RHS at fine-crse interface
142  */
143 void
145  const amrex::Real& delta_t,
146  const int& width,
147  const int& set_width,
148  const amrex::Geometry& geom,
149  ERFFillPatcher* FPr_c,
150  ERFFillPatcher* FPr_u,
151  ERFFillPatcher* FPr_v,
152  ERFFillPatcher* FPr_w,
153  amrex::Vector<amrex::BCRec>& domain_bcs_type,
154  amrex::Vector<amrex::MultiFab>& S_rhs_f,
155  amrex::Vector<amrex::MultiFab>& S_data_f);
156 
157 /*
158  * Accumulate time averaged velocity fields
159  */
160 void
162  amrex::Real& t_avg_cnt,
163  amrex::MultiFab* vel_t_avg,
164  amrex::MultiFab& xvel,
165  amrex::MultiFab& yvel,
166  amrex::MultiFab& zvel);
167 
168 /**
169  * Zero RHS in the set region
170  *
171  * @param[in] icomp component offset
172  * @param[in] num_var number of variables to loop
173  * @param[in] bx_xlo box for low x relaxation
174  * @param[in] bx_xhi box for high x relaxation
175  * @param[in] bx_ylo box for low y relaxation
176  * @param[in] bx_yhi box for high y relaxation
177  * @param[out] rhs_arr RHS array
178  */
179 AMREX_GPU_HOST
180 AMREX_FORCE_INLINE
181 void
183  const int& icomp,
184  const int& num_var,
185  const int& width,
186  const int& set_width_x,
187  const int& set_width_y,
188  const amrex::Dim3& dom_lo,
189  const amrex::Dim3& dom_hi,
190  const amrex::Box& bx_xlo,
191  const amrex::Box& bx_xhi,
192  const amrex::Box& bx_ylo,
193  const amrex::Box& bx_yhi,
194  const amrex::Array4<const amrex::Real>& arr_xlo,
195  const amrex::Array4<const amrex::Real>& arr_xhi,
196  const amrex::Array4<const amrex::Real>& arr_ylo,
197  const amrex::Array4<const amrex::Real>& arr_yhi,
198  const amrex::Array4<const amrex::Real>& data_arr,
199  const amrex::Array4<amrex::Real>& rhs_arr)
200 {
201  int Spec_z_x = set_width_x;
202  int Spec_z_y = set_width_y;
203  amrex::ParallelFor(bx_xlo, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
204  {
205  // Corners with x boxes
206  int j_lo = std::min(j-dom_lo.y,width-1);
207  int j_hi = std::min(dom_hi.y-j,width-1);
208  int jj = std::min(j_lo,j_hi);
209  int n_ind_y = jj + 1;
210  int n_ind_x = i - dom_lo.x + 1;
211  if ((n_ind_x <= Spec_z_x) || (n_ind_y <= Spec_z_y)) {
212  amrex::Real tend = ( arr_xlo(i,j,k) - data_arr(i,j,k,n+icomp) ) / dt;
213  rhs_arr(i,j,k,n+icomp) = tend;
214  }
215  },
216  bx_xhi, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
217  {
218  // Corners with x boxes
219  int j_lo = std::min(j-dom_lo.y,width-1);
220  int j_hi = std::min(dom_hi.y-j,width-1);
221  int jj = std::min(j_lo,j_hi);
222  int n_ind_y = jj + 1;
223  int n_ind_x = dom_hi.x - i + 1;
224  if ((n_ind_x <= Spec_z_x) || (n_ind_y <= Spec_z_y)) {
225  amrex::Real tend = ( arr_xhi(i,j,k) - data_arr(i,j,k,n+icomp) ) / dt;
226  rhs_arr(i,j,k,n+icomp) = tend;
227  }
228  });
229 
230  amrex::ParallelFor(bx_ylo, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
231  {
232  // No corners for y boxes
233  int n_ind = j - dom_lo.y + 1;
234  if (n_ind <= Spec_z_y) {
235  amrex::Real tend = ( arr_ylo(i,j,k) - data_arr(i,j,k,n+icomp) ) / dt;
236  rhs_arr(i,j,k,n+icomp) = tend;
237  }
238  },
239  bx_yhi, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
240  {
241  // No corners for y boxes
242  int n_ind = dom_hi.y - j + 1;
243  if (n_ind <= Spec_z_y) {
244  amrex::Real tend = ( arr_yhi(i,j,k) - data_arr(i,j,k,n+icomp) ) / dt;
245  rhs_arr(i,j,k,n+icomp) = tend;
246  }
247  });
248 }
249 
250 /**
251  * Compute the Laplacian RHS in the relaxation zone
252  *
253  * @param[in] delta_t time step
254  * @param[in] icomp component offset
255  * @param[in] num_var number of variables to loop
256  * @param[in] width width of wrf bdy file
257  * @param[in] set_width width the set region
258  * @param[in] dom_lo low bound of domain
259  * @param[in] dom_hi high bound of domain
260  * @param[in] F1 drift relaxation parameter
261  * @param[in] F2 Laplacian relaxation parameter
262  * @param[in] bx_xlo box for low x relaxation
263  * @param[in] bx_xhi box for high x relaxation
264  * @param[in] bx_ylo box for low y relaxation
265  * @param[in] bx_yhi box for high y relaxation
266  * @param[in] arr_xlo array for low x relaxation
267  * @param[in] arr_xhi array for high x relaxation
268  * @param[in] arr_ylo array for low y relaxation
269  * @param[in] arr_yhi array for high y relaxation
270  * @param[in] data_arr data array
271  * @param[out] rhs_arr RHS array
272  */
273 AMREX_GPU_HOST
274 AMREX_FORCE_INLINE
275 void
277  const int& num_var,
278  const int& width,
279  const amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>& dx,
280  const amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>& ProbLo,
281  const amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>& ProbHi,
282  const amrex::Real& F1,
283  const amrex::Real& F2,
284  const amrex::Box& bx_xlo,
285  const amrex::Box& bx_xhi,
286  const amrex::Box& bx_ylo,
287  const amrex::Box& bx_yhi,
288  const amrex::Array4<const amrex::Real>& arr_xlo,
289  const amrex::Array4<const amrex::Real>& arr_xhi,
290  const amrex::Array4<const amrex::Real>& arr_ylo,
291  const amrex::Array4<const amrex::Real>& arr_yhi,
292  const amrex::Array4<const amrex::Real>& data_arr,
293  const amrex::Array4<amrex::Real>& rhs_arr)
294 {
295  // RHS computation
296  amrex::IntVect iv = bx_xlo.type();
297  amrex::Real ioff = (iv[0]==1) ? 0.0 : 0.5;
298  amrex::Real joff = (iv[1]==1) ? 0.0 : 0.5;
299  amrex::ParallelFor(bx_xlo, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
300  {
301  // Corners with x boxes
302  amrex::Real x = ProbLo[0] + (i + ioff) * dx[0];
303  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
304  amrex::Real x_end = ProbLo[0] + (width + ioff) * dx[0];
305  amrex::Real y_end = ProbLo[1] + (width + joff) * dx[1];
306  amrex::Real y_strt = ProbHi[1] - (width + joff) * dx[1];
307  amrex::Real xi = (x_end - x) / (x_end - ProbLo[0]);
308  amrex::Real eta_lo = (y < y_end ) ? (y_end - y) / (y_end - ProbLo[1]) : 0.0;
309  amrex::Real eta_hi = (y > y_strt) ? (y - y_strt) / (ProbHi[1] - y_strt) : 0.0;
310  amrex::Real eta = std::min(eta_lo,eta_hi);
311  amrex::Real Factor = std::max(xi*xi,eta*eta);
312 
313  amrex::Real d = data_arr(i ,j ,k ,n+icomp);
314  amrex::Real d_ip1 = data_arr(i+1,j ,k ,n+icomp);
315  amrex::Real d_im1 = data_arr(i-1,j ,k ,n+icomp);
316  amrex::Real d_jp1 = data_arr(i ,j+1,k ,n+icomp);
317  amrex::Real d_jm1 = data_arr(i ,j-1,k ,n+icomp);
318  amrex::Real delta = arr_xlo(i ,j ,k,n) - d;
319  amrex::Real delta_xp = arr_xlo(i+1,j ,k,n) - d_ip1;
320  amrex::Real delta_xm = arr_xlo(i-1,j ,k,n) - d_im1;
321  amrex::Real delta_yp = arr_xlo(i ,j+1,k,n) - d_jp1;
322  amrex::Real delta_ym = arr_xlo(i ,j-1,k,n) - d_jm1;
323  amrex::Real Laplacian = delta_xp + delta_xm + delta_yp + delta_ym - 4.0*delta;
324  amrex::Real Temp = (F1*delta - F2*Laplacian) * Factor;
325  rhs_arr(i,j,k,n+icomp) += Temp;
326  },
327  bx_xhi, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
328  {
329  // Corners with x boxes
330  amrex::Real x = ProbLo[0] + (i + ioff) * dx[0];
331  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
332  amrex::Real x_strt = ProbHi[0] - (width + ioff) * dx[0];
333  amrex::Real y_strt = ProbHi[1] - (width + joff) * dx[1];
334  amrex::Real y_end = ProbLo[1] + (width + joff) * dx[1];
335  amrex::Real xi = (x - x_strt) / (ProbHi[0] - x_strt);
336  amrex::Real eta_lo = (y < y_end ) ? (y_end - y) / (y_end - ProbLo[1]) : 0.0;
337  amrex::Real eta_hi = (y > y_strt) ? (y - y_strt) / (ProbHi[1] - y_strt) : 0.0;
338  amrex::Real eta = std::min(eta_lo,eta_hi);
339  amrex::Real Factor = std::max(xi*xi,eta*eta);
340 
341  amrex::Real d = data_arr(i ,j ,k ,n+icomp);
342  amrex::Real d_ip1 = data_arr(i+1,j ,k ,n+icomp);
343  amrex::Real d_im1 = data_arr(i-1,j ,k ,n+icomp);
344  amrex::Real d_jp1 = data_arr(i ,j+1,k ,n+icomp);
345  amrex::Real d_jm1 = data_arr(i ,j-1,k ,n+icomp);
346  amrex::Real delta = arr_xhi(i ,j ,k,n) - d;
347  amrex::Real delta_xp = arr_xhi(i+1,j ,k,n) - d_ip1;
348  amrex::Real delta_xm = arr_xhi(i-1,j ,k,n) - d_im1;
349  amrex::Real delta_yp = arr_xhi(i ,j+1,k,n) - d_jp1;
350  amrex::Real delta_ym = arr_xhi(i ,j-1,k,n) - d_jm1;
351  amrex::Real Laplacian = delta_xp + delta_xm + delta_yp + delta_ym - 4.0*delta;
352  amrex::Real Temp = (F1*delta - F2*Laplacian) * Factor;
353  rhs_arr(i,j,k,n+icomp) += Temp;
354  });
355 
356  amrex::ParallelFor(bx_ylo, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
357  {
358  // No corners for y boxes
359  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
360  amrex::Real y_end = ProbLo[1] + (width + joff) * dx[1];
361  amrex::Real eta = (y_end - y) / (y_end - ProbLo[1]);
362  amrex::Real Factor = eta*eta;
363 
364  amrex::Real d = data_arr(i ,j ,k ,n+icomp);
365  amrex::Real d_ip1 = data_arr(i+1,j ,k ,n+icomp);
366  amrex::Real d_im1 = data_arr(i-1,j ,k ,n+icomp);
367  amrex::Real d_jp1 = data_arr(i ,j+1,k ,n+icomp);
368  amrex::Real d_jm1 = data_arr(i ,j-1,k ,n+icomp);
369  amrex::Real delta = arr_ylo(i ,j ,k,n) - d;
370  amrex::Real delta_xp = arr_ylo(i+1,j ,k,n) - d_ip1;
371  amrex::Real delta_xm = arr_ylo(i-1,j ,k,n) - d_im1;
372  amrex::Real delta_yp = arr_ylo(i ,j+1,k,n) - d_jp1;
373  amrex::Real delta_ym = arr_ylo(i ,j-1,k,n) - d_jm1;
374  amrex::Real Laplacian = delta_xp + delta_xm + delta_yp + delta_ym - 4.0*delta;
375  amrex::Real Temp = (F1*delta - F2*Laplacian) * Factor;
376  rhs_arr(i,j,k,n+icomp) += Temp;
377  },
378  bx_yhi, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
379  {
380  // No corners for y boxes
381  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
382  amrex::Real y_strt = ProbHi[1] - (width + joff) * dx[1];
383  amrex::Real eta = (y - y_strt) / (ProbHi[1] - y_strt);
384  amrex::Real Factor = eta*eta;
385 
386  amrex::Real d = data_arr(i ,j ,k ,n+icomp);
387  amrex::Real d_ip1 = data_arr(i+1,j ,k ,n+icomp);
388  amrex::Real d_im1 = data_arr(i-1,j ,k ,n+icomp);
389  amrex::Real d_jp1 = data_arr(i ,j+1,k ,n+icomp);
390  amrex::Real d_jm1 = data_arr(i ,j-1,k ,n+icomp);
391  amrex::Real delta = arr_yhi(i ,j ,k,n) - d;
392  amrex::Real delta_xp = arr_yhi(i+1,j ,k,n) - d_ip1;
393  amrex::Real delta_xm = arr_yhi(i-1,j ,k,n) - d_im1;
394  amrex::Real delta_yp = arr_yhi(i ,j+1,k,n) - d_jp1;
395  amrex::Real delta_ym = arr_yhi(i ,j-1,k,n) - d_jm1;
396  amrex::Real Laplacian = delta_xp + delta_xm + delta_yp + delta_ym - 4.0*delta;
397  amrex::Real Temp = (F1*delta - F2*Laplacian) * Factor;
398  rhs_arr(i,j,k,n+icomp) += Temp;
399  });
400 }
401 
402 /*
403  * Effectively a Multiply for a MultiFab and an iMultiFab mask
404  */
405 AMREX_GPU_HOST
406 AMREX_FORCE_INLINE
407 void
408 ApplyMask (amrex::MultiFab& dst,
409  const amrex::iMultiFab& imask,
410  const int nghost = 0)
411 {
412  for (amrex::MFIter mfi(dst,amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
413  {
414  const amrex::Box& bx = mfi.growntilebox(nghost);
415  if (bx.ok())
416  {
417  auto dstFab = dst.array(mfi);
418  const auto maskFab = imask.const_array(mfi);
419  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
420  {
421  dstFab(i,j,k) *= maskFab(i,j,k);
422  });
423  }
424  }
425 }
426 
427 AMREX_GPU_HOST
428 AMREX_FORCE_INLINE
429 void
430 ApplyInvertedMask (amrex::MultiFab& dst,
431  const amrex::iMultiFab& imask,
432  const int nghost = 0)
433 {
434  for (amrex::MFIter mfi(dst,amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
435  {
436  const amrex::Box& bx = mfi.growntilebox(nghost);
437  if (bx.ok())
438  {
439  auto dstFab = dst.array(mfi);
440  const auto maskFab = imask.const_array(mfi);
441  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
442  {
443  dstFab(i,j,k) *= (1-maskFab(i,j,k));
444  });
445  }
446  }
447 }
448 
449 void
450 thinbody_wall_dist (std::unique_ptr<amrex::MultiFab>& wdist,
451  amrex::Vector<amrex::IntVect>& xfaces,
452  amrex::Vector<amrex::IntVect>& yfaces,
453  amrex::Vector<amrex::IntVect>& zfaces,
454  const amrex::Geometry& geomdata,
455  std::unique_ptr<amrex::MultiFab>& z_phys_cc);
456 
457 
459 
460 AMREX_GPU_HOST_DEVICE
461 AMREX_FORCE_INLINE
465  amrex::Real z1, amrex::Real p1,
466  amrex::Real z2, amrex::Real p2)
467 {
468  return p0 * ( (z - z1) * (z - z2) ) / ( (z0 - z1) * (z0 - z2) )
469  + p1 * ( (z - z0) * (z - z2) ) / ( (z1 - z0) * (z1 - z2) )
470  + p2 * ( (z - z0) * (z - z1) ) / ( (z2 - z0) * (z2 - z1) );
471 }
472 
473 #endif
const auto & dom_hi
Definition: ERF_SetupVertDiff.H:2
const auto & dom_lo
Definition: ERF_SetupVertDiff.H:1
amrex::Real Real
Definition: ERF_ShocInterface.H:19
void MomentumToVelocity(amrex::MultiFab &xvel_out, amrex::MultiFab &yvel_out, amrex::MultiFab &zvel_out, const amrex::MultiFab &cons_in, const amrex::MultiFab &xmom_in, const amrex::MultiFab &ymom_in, const amrex::MultiFab &zmom_in, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h, const amrex::MultiFab *c_vfrac=nullptr)
AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_set_rhs_in_spec_region(const amrex::Real &dt, const int &icomp, const int &num_var, const int &width, const int &set_width_x, const int &set_width_y, const amrex::Dim3 &dom_lo, const amrex::Dim3 &dom_hi, const amrex::Box &bx_xlo, const amrex::Box &bx_xhi, const amrex::Box &bx_ylo, const amrex::Box &bx_yhi, const amrex::Array4< const amrex::Real > &arr_xlo, const amrex::Array4< const amrex::Real > &arr_xhi, const amrex::Array4< const amrex::Real > &arr_ylo, const amrex::Array4< const amrex::Real > &arr_yhi, const amrex::Array4< const amrex::Real > &data_arr, const amrex::Array4< amrex::Real > &rhs_arr)
Definition: ERF_Utils.H:182
void VelocityToMomentum(const amrex::MultiFab &xvel_in, const amrex::IntVect &xvel_ngrow, const amrex::MultiFab &yvel_in, const amrex::IntVect &yvel_ngrow, const amrex::MultiFab &zvel_in, const amrex::IntVect &zvel_ngrow, const amrex::MultiFab &cons_in, amrex::MultiFab &xmom_out, amrex::MultiFab &ymom_out, amrex::MultiFab &zmom_out, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h, const amrex::MultiFab *c_vfrac=nullptr)
void WeatherDataInterpolation(const amrex::Real time)
void fine_compute_interior_ghost_rhs(const amrex::Real &time, const amrex::Real &delta_t, const int &width, const int &set_width, const amrex::Geometry &geom, ERFFillPatcher *FPr_c, ERFFillPatcher *FPr_u, ERFFillPatcher *FPr_v, ERFFillPatcher *FPr_w, amrex::Vector< amrex::BCRec > &domain_bcs_type, amrex::Vector< amrex::MultiFab > &S_rhs_f, amrex::Vector< amrex::MultiFab > &S_data_f)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real quad_interp_1d(amrex::Real z, amrex::Real z0, amrex::Real p0, amrex::Real z1, amrex::Real p1, amrex::Real z2, amrex::Real p2)
Definition: ERF_Utils.H:463
void thinbody_wall_dist(std::unique_ptr< amrex::MultiFab > &wdist, amrex::Vector< amrex::IntVect > &xfaces, amrex::Vector< amrex::IntVect > &yfaces, amrex::Vector< amrex::IntVect > &zfaces, const amrex::Geometry &geomdata, std::unique_ptr< amrex::MultiFab > &z_phys_cc)
void realbdy_interior_bxs_xy(const amrex::Box &bx, const amrex::Box &domain, const int &width, amrex::Box &bx_xlo, amrex::Box &bx_xhi, amrex::Box &bx_ylo, amrex::Box &bx_yhi, const int &set_width=0, const amrex::IntVect &ng_vect=amrex::IntVect(0, 0, 0), const bool get_int_ng=false)
amrex::BoxArray ERFPostProcessBaseGrids(const amrex::Box &domain, bool decompose_in_z)
void realbdy_compute_interior_ghost_rhs(const amrex::Real &bdy_time_interval, const amrex::Real &time, const amrex::Real &delta_t, const amrex::Real &stop_time_elapsed, int width, int set_width, const amrex::Geometry &geom, amrex::Vector< amrex::MultiFab > &S_rhs, amrex::Vector< amrex::MultiFab > &S_old_data, amrex::Vector< amrex::MultiFab > &S_cur_data, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_xlo, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_xhi, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_ylo, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_yhi)
void make_zcc(const amrex::Geometry &geom, amrex::MultiFab &z_phys_nd, amrex::MultiFab &z_phys_cc)
void realbdy_bc_bxs_xy(const amrex::Box &bx, const amrex::Box &domain, const int &set_width, amrex::Box &bx_xlo, amrex::Box &bx_xhi, amrex::Box &bx_ylo, amrex::Box &bx_yhi, const amrex::IntVect &ng_vect=amrex::IntVect(0, 0, 0))
AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_compute_laplacian_relaxation(const int &icomp, const int &num_var, const int &width, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dx, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &ProbLo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &ProbHi, const amrex::Real &F1, const amrex::Real &F2, const amrex::Box &bx_xlo, const amrex::Box &bx_xhi, const amrex::Box &bx_ylo, const amrex::Box &bx_yhi, const amrex::Array4< const amrex::Real > &arr_xlo, const amrex::Array4< const amrex::Real > &arr_xhi, const amrex::Array4< const amrex::Real > &arr_ylo, const amrex::Array4< const amrex::Real > &arr_yhi, const amrex::Array4< const amrex::Real > &data_arr, const amrex::Array4< amrex::Real > &rhs_arr)
Definition: ERF_Utils.H:276
void Time_Avg_Vel_atCC(const amrex::Real &dt, amrex::Real &t_avg_cnt, amrex::MultiFab *vel_t_avg, amrex::MultiFab &xvel, amrex::MultiFab &yvel, amrex::MultiFab &zvel)
AMREX_GPU_HOST AMREX_FORCE_INLINE void ApplyInvertedMask(amrex::MultiFab &dst, const amrex::iMultiFab &imask, const int nghost=0)
Definition: ERF_Utils.H:430
void make_J(const amrex::Geometry &geom, amrex::MultiFab &z_phys_nd, amrex::MultiFab &detJ_cc)
AMREX_GPU_HOST AMREX_FORCE_INLINE void ApplyMask(amrex::MultiFab &dst, const amrex::iMultiFab &imask, const int nghost=0)
Definition: ERF_Utils.H:408
void ConvertForProjection(const amrex::MultiFab &den_div, const amrex::MultiFab &den_mlt, amrex::MultiFab &xmom, amrex::MultiFab &ymom, amrex::MultiFab &zmom, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h)
void ChopGrids2D(amrex::BoxArray &ba, const amrex::Box &domain, int target_size)
void enforceInOutSolvability(int lev, amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &vels_vec, amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &area_vec, const amrex::Geometry &geom)
void make_areas(const amrex::Geometry &geom, amrex::MultiFab &z_phys_nd, amrex::MultiFab &ax, amrex::MultiFab &ay, amrex::MultiFab &az)
Definition: ERF_FillPatcher.H:9
@ ymom
Definition: ERF_IndexDefines.H:160
@ zmom
Definition: ERF_IndexDefines.H:161
@ xmom
Definition: ERF_IndexDefines.H:159
@ xvel
Definition: ERF_IndexDefines.H:141
@ zvel
Definition: ERF_IndexDefines.H:143
@ yvel
Definition: ERF_IndexDefines.H:142
real(c_double), parameter p0
Definition: ERF_module_model_constants.F90:40