ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_EBAdvectionSrcForMom.H
Go to the documentation of this file.
1 /**
2  * \file ERF_EBAdvectionSrcForMom.H
3  * \brief Defines EB momentum-advection flux builders for higher-order stencils.
4  */
5 #include <ERF_IndexDefines.H>
6 #include <ERF_Interpolation.H>
7 
8 /**
9  * \brief Build EB momentum fluxes with selected horizontal and vertical interpolation.
10  *
11  * The wrapper handles the x-, y-, and z-momentum grids separately and reduces
12  * interpolation order near covered EB cells and vertical domain boundaries.
13  *
14  * \tparam InterpType_H Horizontal interpolation functor.
15  * \tparam InterpType_V Vertical interpolation functor.
16  * \tparam WallInterpType Wall interpolation functor retained for interface symmetry.
17  */
18 template<typename InterpType_H, typename InterpType_V, typename WallInterpType>
19 void
20 EBAdvectionSrcForMomWrapper (const amrex::Vector<amrex::Box>& bxx_grown,
21  const amrex::Vector<amrex::Box>& bxy_grown,
22  const amrex::Vector<amrex::Box>& bxz_grown,
23  const amrex::Array4<const amrex::Real>& rho_u,
24  const amrex::Array4<const amrex::Real>& rho_v,
25  const amrex::Array4<const amrex::Real>& rho_w,
26  const amrex::Array4<const amrex::Real>& u,
27  const amrex::Array4<const amrex::Real>& v,
28  const amrex::Array4<const amrex::Real>& w,
29  const amrex::FabType u_type,
30  const amrex::FabType v_type,
31  const amrex::FabType w_type,
32  const amrex::Array4<const amrex::EBCellFlag>& u_cflag,
33  const amrex::Array4<const amrex::Real>& u_afrac_x,
34  const amrex::Array4<const amrex::Real>& u_afrac_y,
35  const amrex::Array4<const amrex::Real>& u_afrac_z,
36  const amrex::Array4<const amrex::EBCellFlag>& v_cflag,
37  const amrex::Array4<const amrex::Real>& v_afrac_x,
38  const amrex::Array4<const amrex::Real>& v_afrac_y,
39  const amrex::Array4<const amrex::Real>& v_afrac_z,
40  const amrex::Array4<const amrex::EBCellFlag>& w_cflag,
41  const amrex::Array4<const amrex::Real>& w_afrac_x,
42  const amrex::Array4<const amrex::Real>& w_afrac_y,
43  const amrex::Array4<const amrex::Real>& w_afrac_z,
44  const amrex::Array4<const amrex::Real>& mf_ux_inv,
45  const amrex::Array4<const amrex::Real>& mf_vx_inv,
46  const amrex::Array4<const amrex::Real>& mf_uy_inv,
47  const amrex::Array4<const amrex::Real>& mf_vy_inv,
48  const amrex::Real upw_frac_h,
49  const amrex::Real upw_frac_v,
50  const AdvType /*vert_adv_type*/,
51  amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx_u_arr,
52  amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx_v_arr,
53  amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx_w_arr,
54  const int lo_z_face, const int hi_z_face)
55 {
56  // Instantiate the appropriate structs
57  InterpType_H interp_u_horz(u, upw_frac_h); InterpType_V interp_u_vert(u, upw_frac_v); // X-MOM
58  InterpType_H interp_v_horz(v, upw_frac_h); InterpType_V interp_v_vert(v, upw_frac_v); // Y-MOM
59  InterpType_H interp_w_horz(w, upw_frac_h); InterpType_V interp_w_vert(w, upw_frac_v); // Z-MOM
60  // WallInterpType interp_w_wall(w, upw_frac_v); // Z-MOM @ wall
61 
62  const int ncells_u_horz = interp_u_horz.GetUpwindCellNumber();
63  const int ncells_u_vert = interp_u_vert.GetUpwindCellNumber();
64  const int ncells_v_horz = interp_v_horz.GetUpwindCellNumber();
65  const int ncells_v_vert = interp_v_vert.GetUpwindCellNumber();
66  const int ncells_w_horz = interp_w_horz.GetUpwindCellNumber();
67  const int ncells_w_vert = interp_w_vert.GetUpwindCellNumber();
68 
69  // Instantiate structs for lower-order vert/horiz interp (commonly using upw_frac_h)
70  CENTERED2 interp_u_CEN2(u, 0);
71  CENTERED2 interp_v_CEN2(v, 0);
72  CENTERED2 interp_w_CEN2(w, 0);
73 
74  UPWIND3 interp_u_UPW3(u, upw_frac_h);
75  UPWIND3 interp_v_UPW3(v, upw_frac_h);
76  UPWIND3 interp_w_UPW3(w, upw_frac_h);
77 
78  bool u_is_regular = (u_type == amrex::FabType::regular);
79  bool v_is_regular = (v_type == amrex::FabType::regular);
80  bool w_is_regular = (w_type == amrex::FabType::regular);
81 
82  bool u_is_singlevalued = (u_type == amrex::FabType::singlevalued);
83  bool v_is_singlevalued = (v_type == amrex::FabType::singlevalued);
84  bool w_is_singlevalued = (w_type == amrex::FabType::singlevalued);
85 
86  // ---------------------------------------------------- //
87  // x-momentum
88  // ---------------------------------------------------- //
89 
90  amrex::ParallelFor(bxx_grown[0], bxx_grown[1], bxx_grown[2],
91  // x-momentum: x-face
92  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
93  {
94  bool not_covered = u_is_regular || (u_is_singlevalued && u_afrac_x(i,j,k) > zero);
95 
96  if ( not_covered ) {
97 
98  amrex::Real rho_u_avg = myhalf * (rho_u(i-1,j,k) * mf_ux_inv(i-1,j,0) + rho_u(i,j,k) * mf_ux_inv(i,j,0));
99 
100  int icell = 0;
101 
102  if (rho_u_avg>zero)
103  {
104  for (int ii=0; ii<ncells_u_horz; ++ii) {
105  if (u_cflag(i-ii-1,j,k).isCovered()) {
106  break;
107  }
108  icell++;
109  }
110  }
111  else if (rho_u_avg<zero)
112  {
113  for (int ii=0; ii<ncells_u_horz; ++ii) {
114  if (u_cflag(i+ii,j,k).isCovered()) {
115  break;
116  }
117  icell++;
118  }
119  }
120 
121  // Interpolate u using the highest-order scheme
122 
123  amrex::Real interpx = zero;
124  if (icell==ncells_u_horz) {
125  interp_u_horz.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
126  } else {
127  if (icell<=1) {
128  interp_u_CEN2.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
129  } else if (icell==2) {
130  interp_u_UPW3.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
131  }
132  }
133  flx_u_arr[0](i,j,k) = rho_u_avg * interpx;
134 
135  } else {
136 
137  flx_u_arr[0](i,j,k) = zero;
138  }
139  },
140  // x-momentum: y-face
141  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
142  {
143  bool not_covered = u_is_regular || (u_is_singlevalued && u_afrac_y(i,j,k) > zero);
144 
145  if ( not_covered ) {
146 
147  amrex::Real rho_v_avg = myhalf * (rho_v(i,j,k) * mf_vx_inv(i,j,0) + rho_v(i-1,j,k) * mf_vx_inv(i-1,j,0));
148 
149  int jcell = 0;
150 
151  if (rho_v_avg>zero)
152  {
153  for (int jj=0; jj<ncells_u_horz; ++jj) {
154  if (u_cflag(i,j-jj-1,k).isCovered()) {
155  break;
156  }
157  jcell++;
158  }
159  }
160  else if (rho_v_avg<zero)
161  {
162  for (int jj=0; jj<ncells_u_horz; ++jj) {
163  if (u_cflag(i,j+jj,k).isCovered()) {
164  break;
165  }
166  jcell++;
167  }
168  }
169 
170  // Interpolate u using the highest-order scheme
171 
172  amrex::Real interpy = zero;
173  if (jcell==ncells_u_horz) {
174  interp_u_horz.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
175  } else {
176  if (jcell<=1) {
177  interp_u_CEN2.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
178  } else if (jcell==2) {
179  interp_u_UPW3.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
180  }
181  }
182  flx_u_arr[1](i,j,k) = rho_v_avg * interpy;
183 
184  } else {
185 
186  flx_u_arr[1](i,j,k) = zero;
187  }
188  },
189  // x-momentum: z-face
190  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
191  {
192  bool not_covered = u_is_regular || (u_is_singlevalued && u_afrac_z(i,j,k) > zero);
193 
194  if ( not_covered ) {
195 
196  amrex::Real rho_w_avg = myhalf * (rho_w(i,j,k) + rho_w(i-1,j,k));
197 
198  int kcell = 0;
199 
200  if (rho_w_avg>zero)
201  {
202  for (int kk=0; kk<ncells_u_vert; ++kk) {
203  if (u_cflag(i,j,k-kk-1).isCovered()) {
204  break;
205  }
206  kcell++;
207  }
208  }
209  else if (rho_w_avg<zero)
210  {
211  for (int kk=0; kk<ncells_u_vert; ++kk) {
212  if (u_cflag(i,j,k+kk).isCovered()) {
213  break;
214  }
215  kcell++;
216  }
217  }
218 
219  // Interpolate u using the highest-order scheme
220 
221  amrex::Real interpz = zero;
222  if (kcell==ncells_u_vert) {
223  interp_u_vert.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
224  } else {
225  if (kcell<=1) {
226  interp_u_CEN2.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
227  } else if (kcell==2) {
228  interp_u_UPW3.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
229  }
230  }
231  flx_u_arr[2](i,j,k) = rho_w_avg * interpz;
232 
233  } else {
234 
235  flx_u_arr[2](i,j,k) = zero;
236  }
237  });
238 
239  // ---------------------------------------------------- //
240  // y-momentum
241  // ---------------------------------------------------- //
242 
243  amrex::ParallelFor(bxy_grown[0], bxy_grown[1], bxy_grown[2],
244  // y-momentum: x-face
245  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
246  {
247  bool not_covered = v_is_regular || (v_is_singlevalued && v_afrac_x(i,j,k) > zero);
248 
249  if ( not_covered ) {
250 
251  amrex::Real rho_u_avg = myhalf * (rho_u(i,j,k) * mf_uy_inv(i,j,0) + rho_u(i,j-1,k) * mf_uy_inv(i,j-1,0));
252 
253  int icell = 0;
254 
255  if (rho_u_avg>zero)
256  {
257  for (int ii=0; ii<ncells_v_horz; ++ii) {
258  if (v_cflag(i-ii-1,j,k).isCovered()) {
259  break;
260  }
261  icell++;
262  }
263  }
264  else if (rho_u_avg<zero)
265  {
266  for (int ii=0; ii<ncells_v_horz; ++ii) {
267  if (v_cflag(i+ii,j,k).isCovered()) {
268  break;
269  }
270  icell++;
271  }
272  }
273 
274  // Interpolate v using the highest-order scheme
275 
276  amrex::Real interpx = zero;
277  if (icell==ncells_v_horz) {
278  interp_v_horz.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
279  } else {
280  if (icell<=1) {
281  interp_v_CEN2.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
282  } else if (icell==2) {
283  interp_v_UPW3.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
284  }
285  }
286  flx_v_arr[0](i,j,k) = rho_u_avg * interpx;
287 
288  } else {
289 
290  flx_v_arr[0](i,j,k) = zero;
291  }
292  },
293  // y-momentum: y-face
294  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
295  {
296  bool not_covered = v_is_regular || (v_is_singlevalued && v_afrac_y(i,j,k) > zero);
297 
298  if ( not_covered ) {
299 
300  amrex::Real rho_v_avg = myhalf * (rho_v(i,j,k) * mf_vy_inv(i,j,0) + rho_v(i,j-1,k) * mf_vy_inv(i,j-1,0));
301 
302  int jcell = 0;
303 
304  if (rho_v_avg>zero)
305  {
306  for (int jj=0; jj<ncells_v_horz; ++jj) {
307  if (v_cflag(i,j-jj-1,k).isCovered()) {
308  break;
309  }
310  jcell++;
311  }
312  }
313  else if (rho_v_avg<zero)
314  {
315  for (int jj=0; jj<ncells_v_horz; ++jj) {
316  if (v_cflag(i,j+jj,k).isCovered()) {
317  break;
318  }
319  jcell++;
320  }
321  }
322 
323  // Interpolate v using the highest-order scheme
324 
325  amrex::Real interpy = zero;
326  if (jcell==ncells_v_horz) {
327  interp_v_horz.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
328  } else {
329  if (jcell<=1) {
330  interp_v_CEN2.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
331  } else if (jcell==2) {
332  interp_v_UPW3.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
333  }
334  }
335  flx_v_arr[1](i,j,k) = rho_v_avg * interpy;
336 
337  } else {
338 
339  flx_v_arr[1](i,j,k) = zero;
340  }
341  },
342  // y-momentum: z-face
343  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
344  {
345  bool not_covered = v_is_regular || (v_is_singlevalued && v_afrac_z(i,j,k) > zero);
346 
347  if ( not_covered ) {
348 
349  amrex::Real rho_w_avg = myhalf * (rho_w(i,j,k) + rho_w(i,j-1,k));
350 
351  int kcell = 0;
352 
353  if (rho_w_avg>zero)
354  {
355  for (int kk=0; kk<ncells_v_vert; ++kk) {
356  if (v_cflag(i,j,k-kk-1).isCovered()) {
357  break;
358  }
359  kcell++;
360  }
361  }
362  else if (rho_w_avg<zero)
363  {
364  for (int kk=0; kk<ncells_v_vert; ++kk) {
365  if (v_cflag(i,j,k+kk).isCovered()) {
366  break;
367  }
368  kcell++;
369  }
370  }
371 
372  // Interpolate v using the highest-order scheme
373 
374  amrex::Real interpz = zero;
375  if (kcell==ncells_v_vert) {
376  interp_v_vert.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
377  } else {
378  if (kcell<=1) {
379  interp_v_CEN2.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
380  } else if (kcell==2) {
381  interp_v_UPW3.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
382  }
383  }
384  flx_v_arr[2](i,j,k) = rho_w_avg * interpz;
385 
386  } else {
387 
388  flx_v_arr[2](i,j,k) = zero;
389  }
390  });
391 
392  // ---------------------------------------------------- //
393  // z-momentum
394  // ---------------------------------------------------- //
395 
396  amrex::ParallelFor(bxz_grown[0], bxz_grown[1], bxz_grown[2],
397  // z-momentum: x-face
398  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
399  {
400  bool not_covered = w_is_regular || (w_is_singlevalued && w_afrac_x(i,j,k) > zero);
401 
402  if ( not_covered ) {
403 
404  amrex::Real rho_u_avg = myhalf * (rho_u(i,j,k) + rho_u(i,j,k-1)) * mf_ux_inv(i,j,0);
405 
406  int icell = 0;
407 
408  if (rho_u_avg>zero)
409  {
410  for (int ii=0; ii<ncells_w_horz; ++ii) {
411  if (w_cflag(i-ii-1,j,k).isCovered()) {
412  break;
413  }
414  icell++;
415  }
416  }
417  else if (rho_u_avg<zero)
418  {
419  for (int ii=0; ii<ncells_w_horz; ++ii) {
420  if (w_cflag(i+ii,j,k).isCovered()) {
421  break;
422  }
423  icell++;
424  }
425  }
426 
427  // Interpolate w using the highest-order scheme
428 
429  amrex::Real interpx = zero;
430  if (icell==ncells_w_horz) {
431  interp_w_horz.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
432  } else {
433  if (icell<=1) {
434  interp_w_CEN2.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
435  } else if (icell==2) {
436  interp_w_UPW3.InterpolateInX(i,j,k,0,interpx,rho_u_avg);
437  }
438  }
439  flx_w_arr[0](i,j,k) = rho_u_avg * interpx;
440 
441  } else {
442 
443  flx_w_arr[0](i,j,k) = zero;
444  }
445  },
446  // z-momentum: y-face
447  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
448  {
449  bool not_covered = w_is_regular || (w_is_singlevalued && w_afrac_y(i,j,k) > zero);
450 
451  if ( not_covered ) {
452 
453  amrex::Real rho_v_avg = myhalf * (rho_v(i,j,k) + rho_v(i,j,k-1)) * mf_vy_inv(i,j,0);
454 
455  int jcell = 0;
456 
457  if (rho_v_avg>zero)
458  {
459  for (int jj=0; jj<ncells_w_horz; ++jj) {
460  if (w_cflag(i,j-jj-1,k).isCovered()) {
461  break;
462  }
463  jcell++;
464  }
465  }
466  else if (rho_v_avg<zero)
467  {
468  for (int jj=0; jj<ncells_w_horz; ++jj) {
469  if (w_cflag(i,j+jj,k).isCovered()) {
470  break;
471  }
472  jcell++;
473  }
474  }
475 
476  // Interpolate w using the highest-order scheme
477 
478  amrex::Real interpy = zero;
479  if (jcell==ncells_w_horz) {
480  interp_w_horz.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
481  } else {
482  if (jcell<=1) {
483  interp_w_CEN2.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
484  } else if (jcell==2) {
485  interp_w_UPW3.InterpolateInY(i,j,k,0,interpy,rho_v_avg);
486  }
487  }
488  flx_w_arr[1](i,j,k) = rho_v_avg * interpy;
489 
490  } else {
491 
492  flx_w_arr[1](i,j,k) = zero;
493  }
494  },
495  // z-momentum: z-face
496  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
497  {
498  bool not_covered = w_is_regular || (w_is_singlevalued && w_afrac_z(i,j,k) > zero);
499 
500  if ( not_covered ) {
501 
502  if (k==lo_z_face || k==hi_z_face+1) {
503 
504  flx_w_arr[2](i,j,k) = rho_w(i,j,k) * w(i,j,k);
505 
506  } else {
507  amrex::Real rho_w_avg = myhalf * (rho_w(i,j,k) + rho_w(i,j,k-1));
508 
509  int kcell = 0;
510 
511  if (rho_w_avg>zero)
512  {
513  for (int kk=0; kk<ncells_w_vert; ++kk) {
514  if (w_cflag(i,j,k-kk-1).isCovered()) {
515  break;
516  }
517  kcell++;
518  }
519  }
520  else if (rho_w_avg<zero)
521  {
522  for (int kk=0; kk<ncells_w_vert; ++kk) {
523  if (w_cflag(i,j,k+kk).isCovered()) {
524  break;
525  }
526  kcell++;
527  }
528  }
529 
530  // Adjust available cell numbers near the top and bottom boundaries
531 
532  if (k == hi_z_face || k == lo_z_face+1) {
533  kcell=std::min(kcell,1);
534  } else if (k == hi_z_face-1 || k == lo_z_face+2 ) {
535  kcell=std::min(kcell,2);
536  }
537 
538  // Interpolate w using the highest-order scheme
539 
540  amrex::Real interpz = zero;
541  if (kcell==ncells_w_vert) {
542  interp_w_vert.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
543  } else {
544  if (kcell<=1) {
545  interp_w_CEN2.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
546  } else if (kcell==2) {
547  interp_w_UPW3.InterpolateInZ(i,j,k,0,interpz,rho_w_avg);
548  }
549  }
550  flx_w_arr[2](i,j,k) = rho_w_avg * interpz;
551  } // lo_z_face, hi_z_face
552 
553  } else {
554 
555  flx_w_arr[2](i,j,k) = zero;
556  }
557  });
558 
559 }
560 
561 /**
562  * \brief Dispatch EB momentum flux construction on the vertical advection scheme.
563  * \tparam InterpType_H Horizontal interpolation functor selected by the caller.
564  */
565 template<typename InterpType_H>
566 void
567 EBAdvectionSrcForMomVert (const amrex::Vector<amrex::Box>& bxx_grown,
568  const amrex::Vector<amrex::Box>& bxy_grown,
569  const amrex::Vector<amrex::Box>& bxz_grown,
570  const amrex::Array4<const amrex::Real>& rho_u,
571  const amrex::Array4<const amrex::Real>& rho_v,
572  const amrex::Array4<const amrex::Real>& rho_w,
573  const amrex::Array4<const amrex::Real>& u,
574  const amrex::Array4<const amrex::Real>& v,
575  const amrex::Array4<const amrex::Real>& w,
576  const amrex::FabType u_type,
577  const amrex::FabType v_type,
578  const amrex::FabType w_type,
579  const amrex::Array4<const amrex::EBCellFlag>& u_cflag,
580  const amrex::Array4<const amrex::Real>& u_afrac_x,
581  const amrex::Array4<const amrex::Real>& u_afrac_y,
582  const amrex::Array4<const amrex::Real>& u_afrac_z,
583  const amrex::Array4<const amrex::EBCellFlag>& v_cflag,
584  const amrex::Array4<const amrex::Real>& v_afrac_x,
585  const amrex::Array4<const amrex::Real>& v_afrac_y,
586  const amrex::Array4<const amrex::Real>& v_afrac_z,
587  const amrex::Array4<const amrex::EBCellFlag>& w_cflag,
588  const amrex::Array4<const amrex::Real>& w_afrac_x,
589  const amrex::Array4<const amrex::Real>& w_afrac_y,
590  const amrex::Array4<const amrex::Real>& w_afrac_z,
591  const amrex::Array4<const amrex::Real>& mf_ux_inv,
592  const amrex::Array4<const amrex::Real>& mf_vx_inv,
593  const amrex::Array4<const amrex::Real>& mf_uy_inv,
594  const amrex::Array4<const amrex::Real>& mf_vy_inv,
595  const amrex::Real upw_frac_h,
596  const amrex::Real upw_frac_v,
597  const AdvType vert_adv_type,
598  amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx_u_arr,
599  amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx_v_arr,
600  amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx_w_arr,
601  const int lo_z_face, const int hi_z_face)
602 {
603  if (vert_adv_type == AdvType::Centered_2nd) {
604  EBAdvectionSrcForMomWrapper<InterpType_H,CENTERED2,UPWINDALL>(
605  bxx_grown, bxy_grown, bxz_grown,
606  rho_u, rho_v, rho_w, u, v, w,
607  u_type, v_type, w_type,
608  u_cflag, u_afrac_x, u_afrac_y, u_afrac_z,
609  v_cflag, v_afrac_x, v_afrac_y, v_afrac_z,
610  w_cflag, w_afrac_x, w_afrac_y, w_afrac_z,
611  mf_ux_inv, mf_vx_inv,
612  mf_uy_inv, mf_vy_inv,
613  upw_frac_h, upw_frac_v, vert_adv_type,
614  flx_u_arr, flx_v_arr, flx_w_arr,
615  lo_z_face, hi_z_face);
616  } else if (vert_adv_type == AdvType::Upwind_3rd) {
617  EBAdvectionSrcForMomWrapper<InterpType_H,UPWIND3,UPWINDALL>(
618  bxx_grown, bxy_grown, bxz_grown,
619  rho_u, rho_v, rho_w, u, v, w,
620  u_type, v_type, w_type,
621  u_cflag, u_afrac_x, u_afrac_y, u_afrac_z,
622  v_cflag, v_afrac_x, v_afrac_y, v_afrac_z,
623  w_cflag, w_afrac_x, w_afrac_y, w_afrac_z,
624  mf_ux_inv, mf_vx_inv,
625  mf_uy_inv, mf_vy_inv,
626  upw_frac_h, upw_frac_v, vert_adv_type,
627  flx_u_arr, flx_v_arr, flx_w_arr,
628  lo_z_face, hi_z_face);
629  } else if (vert_adv_type == AdvType::Centered_4th) {
630  EBAdvectionSrcForMomWrapper<InterpType_H,CENTERED4,UPWINDALL>(
631  bxx_grown, bxy_grown, bxz_grown,
632  rho_u, rho_v, rho_w, u, v, w,
633  u_type, v_type, w_type,
634  u_cflag, u_afrac_x, u_afrac_y, u_afrac_z,
635  v_cflag, v_afrac_x, v_afrac_y, v_afrac_z,
636  w_cflag, w_afrac_x, w_afrac_y, w_afrac_z,
637  mf_ux_inv, mf_vx_inv,
638  mf_uy_inv, mf_vy_inv,
639  upw_frac_h, upw_frac_v, vert_adv_type,
640  flx_u_arr, flx_v_arr, flx_w_arr,
641  lo_z_face, hi_z_face);
642  } else if (vert_adv_type == AdvType::Upwind_5th) {
643  EBAdvectionSrcForMomWrapper<InterpType_H,UPWIND5,UPWINDALL>(
644  bxx_grown, bxy_grown, bxz_grown,
645  rho_u, rho_v, rho_w, u, v, w,
646  u_type, v_type, w_type,
647  u_cflag, u_afrac_x, u_afrac_y, u_afrac_z,
648  v_cflag, v_afrac_x, v_afrac_y, v_afrac_z,
649  w_cflag, w_afrac_x, w_afrac_y, w_afrac_z,
650  mf_ux_inv, mf_vx_inv,
651  mf_uy_inv, mf_vy_inv,
652  upw_frac_h, upw_frac_v, vert_adv_type,
653  flx_u_arr, flx_v_arr, flx_w_arr,
654  lo_z_face, hi_z_face);
655  } else if (vert_adv_type == AdvType::Centered_6th) {
656  EBAdvectionSrcForMomWrapper<InterpType_H,CENTERED6,UPWINDALL>(
657  bxx_grown, bxy_grown, bxz_grown,
658  rho_u, rho_v, rho_w, u, v, w,
659  u_type, v_type, w_type,
660  u_cflag, u_afrac_x, u_afrac_y, u_afrac_z,
661  v_cflag, v_afrac_x, v_afrac_y, v_afrac_z,
662  w_cflag, w_afrac_x, w_afrac_y, w_afrac_z,
663  mf_ux_inv, mf_vx_inv,
664  mf_uy_inv, mf_vy_inv,
665  upw_frac_h, upw_frac_v, vert_adv_type,
666  flx_u_arr, flx_v_arr, flx_w_arr,
667  lo_z_face, hi_z_face);
668  } else {
669  AMREX_ASSERT_WITH_MESSAGE(false, "Unknown advection scheme!");
670  }
671 }
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
void EBAdvectionSrcForMomVert(const amrex::Vector< amrex::Box > &bxx_grown, const amrex::Vector< amrex::Box > &bxy_grown, const amrex::Vector< amrex::Box > &bxz_grown, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::FabType u_type, const amrex::FabType v_type, const amrex::FabType w_type, const amrex::Array4< const amrex::EBCellFlag > &u_cflag, const amrex::Array4< const amrex::Real > &u_afrac_x, const amrex::Array4< const amrex::Real > &u_afrac_y, const amrex::Array4< const amrex::Real > &u_afrac_z, const amrex::Array4< const amrex::EBCellFlag > &v_cflag, const amrex::Array4< const amrex::Real > &v_afrac_x, const amrex::Array4< const amrex::Real > &v_afrac_y, const amrex::Array4< const amrex::Real > &v_afrac_z, const amrex::Array4< const amrex::EBCellFlag > &w_cflag, const amrex::Array4< const amrex::Real > &w_afrac_x, const amrex::Array4< const amrex::Real > &w_afrac_y, const amrex::Array4< const amrex::Real > &w_afrac_z, const amrex::Array4< const amrex::Real > &mf_ux_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vy_inv, const amrex::Real upw_frac_h, const amrex::Real upw_frac_v, const AdvType vert_adv_type, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_u_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_v_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_w_arr, const int lo_z_face, const int hi_z_face)
Dispatch EB momentum flux construction on the vertical advection scheme.
Definition: ERF_EBAdvectionSrcForMom.H:567
void EBAdvectionSrcForMomWrapper(const amrex::Vector< amrex::Box > &bxx_grown, const amrex::Vector< amrex::Box > &bxy_grown, const amrex::Vector< amrex::Box > &bxz_grown, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::FabType u_type, const amrex::FabType v_type, const amrex::FabType w_type, const amrex::Array4< const amrex::EBCellFlag > &u_cflag, const amrex::Array4< const amrex::Real > &u_afrac_x, const amrex::Array4< const amrex::Real > &u_afrac_y, const amrex::Array4< const amrex::Real > &u_afrac_z, const amrex::Array4< const amrex::EBCellFlag > &v_cflag, const amrex::Array4< const amrex::Real > &v_afrac_x, const amrex::Array4< const amrex::Real > &v_afrac_y, const amrex::Array4< const amrex::Real > &v_afrac_z, const amrex::Array4< const amrex::EBCellFlag > &w_cflag, const amrex::Array4< const amrex::Real > &w_afrac_x, const amrex::Array4< const amrex::Real > &w_afrac_y, const amrex::Array4< const amrex::Real > &w_afrac_z, const amrex::Array4< const amrex::Real > &mf_ux_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vy_inv, const amrex::Real upw_frac_h, const amrex::Real upw_frac_v, const AdvType, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_u_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_v_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_w_arr, const int lo_z_face, const int hi_z_face)
Build EB momentum fluxes with selected horizontal and vertical interpolation.
Definition: ERF_EBAdvectionSrcForMom.H:20
AdvType
Definition: ERF_IndexDefines.H:261
@ Centered_4th
@ Centered_6th
@ Centered_2nd
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);})
Real w
Definition: ERF_Plotfile2DInterpolator.cpp:22
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_ASSERT_WITH_MESSAGE(wbar_cutoff_min > wbar_cutoff_max, "ERROR: wbar_cutoff_min < wbar_cutoff_max")
Definition: ERF_Interpolation_UPW.H:10
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:38
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:56
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:20
Definition: ERF_Interpolation_UPW.H:95
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:159
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:133
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:107