ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_AdvectionSrcForScalars.H File Reference
Include dependency graph for ERF_AdvectionSrcForScalars.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename InterpType_H , typename InterpType_V >
void AdvectionSrcForScalarsWrapper (const amrex::Box &bx, const int &ncomp, const int &icomp, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > flx_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac)
 
template<typename InterpType_H >
void AdvectionSrcForScalarsVert (const amrex::Box &bx, const int &ncomp, const int &icomp, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > flx_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const AdvType vert_adv_type)
 

Function Documentation

◆ AdvectionSrcForScalarsVert()

template<typename InterpType_H >
void AdvectionSrcForScalarsVert ( const amrex::Box &  bx,
const int &  ncomp,
const int &  icomp,
const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM >  flx_arr,
const amrex::Array4< const amrex::Real > &  cell_prim,
const amrex::Array4< const amrex::Real > &  avg_xmom,
const amrex::Array4< const amrex::Real > &  avg_ymom,
const amrex::Array4< const amrex::Real > &  avg_zmom,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
const AdvType  vert_adv_type 
)

Wrapper function for templating the vertical advective tendency w/ spatial order > 2.

75 {
76  switch(vert_adv_type) {
78  AdvectionSrcForScalarsWrapper<InterpType_H,CENTERED2>(bx, ncomp, icomp,
79  flx_arr, cell_prim,
80  avg_xmom, avg_ymom, avg_zmom,
81  horiz_upw_frac, vert_upw_frac);
82  break;
84  AdvectionSrcForScalarsWrapper<InterpType_H,UPWIND3>(bx, ncomp, icomp,
85  flx_arr, cell_prim,
86  avg_xmom, avg_ymom, avg_zmom,
87  horiz_upw_frac, vert_upw_frac);
88  break;
90  AdvectionSrcForScalarsWrapper<InterpType_H,CENTERED4>(bx, ncomp, icomp,
91  flx_arr, cell_prim,
92  avg_xmom, avg_ymom, avg_zmom,
93  horiz_upw_frac, vert_upw_frac);
94  break;
96  AdvectionSrcForScalarsWrapper<InterpType_H,UPWIND5>(bx, ncomp, icomp,
97  flx_arr, cell_prim,
98  avg_xmom, avg_ymom, avg_zmom,
99  horiz_upw_frac, vert_upw_frac);
100  break;
102  AdvectionSrcForScalarsWrapper<InterpType_H,CENTERED6>(bx, ncomp, icomp,
103  flx_arr, cell_prim,
104  avg_xmom, avg_ymom, avg_zmom,
105  horiz_upw_frac, vert_upw_frac);
106  break;
107  default:
108  AMREX_ASSERT_WITH_MESSAGE(false, "Unknown vertical advection scheme!");
109  }
110 }
@ Centered_4th
@ Centered_6th
@ Centered_2nd

◆ AdvectionSrcForScalarsWrapper()

template<typename InterpType_H , typename InterpType_V >
void AdvectionSrcForScalarsWrapper ( const amrex::Box &  bx,
const int &  ncomp,
const int &  icomp,
const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM >  flx_arr,
const amrex::Array4< const amrex::Real > &  cell_prim,
const amrex::Array4< const amrex::Real > &  avg_xmom,
const amrex::Array4< const amrex::Real > &  avg_ymom,
const amrex::Array4< const amrex::Real > &  avg_zmom,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac 
)

Wrapper function for computing the advective tendency w/ spatial order > 2.

18 {
19  // Instantiate structs for vert/horiz interp
20  InterpType_H interp_prim_h(cell_prim);
21  InterpType_V interp_prim_v(cell_prim);
22 
23  const amrex::Box xbx = amrex::surroundingNodes(bx,0);
24  const amrex::Box ybx = amrex::surroundingNodes(bx,1);
25  const amrex::Box zbx = amrex::surroundingNodes(bx,2);
26 
27  amrex::ParallelFor(xbx, ncomp,[=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
28  {
29  const int cons_index = icomp + n;
30  const int prim_index = cons_index - 1;
31 
32  amrex::Real interpx(0.);
33 
34  interp_prim_h.InterpolateInX(i,j,k,prim_index,interpx,avg_xmom(i ,j ,k ),horiz_upw_frac);
35  (flx_arr[0])(i,j,k,cons_index) = avg_xmom(i,j,k) * interpx;
36  });
37  amrex::ParallelFor(ybx, ncomp,[=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
38  {
39  const int cons_index = icomp + n;
40  const int prim_index = cons_index - 1;
41 
42  amrex::Real interpy(0.);
43  interp_prim_h.InterpolateInY(i,j,k,prim_index,interpy,avg_ymom(i ,j ,k ),horiz_upw_frac);
44 
45  (flx_arr[1])(i,j,k,cons_index) = avg_ymom(i,j,k) * interpy;
46  });
47  amrex::ParallelFor(zbx, ncomp,[=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
48  {
49  const int cons_index = icomp + n;
50  const int prim_index = cons_index - 1;
51 
52  amrex::Real interpz(0.);
53 
54  interp_prim_v.InterpolateInZ(i,j,k,prim_index,interpz,avg_zmom(i ,j ,k ),vert_upw_frac);
55 
56  (flx_arr[2])(i,j,k,cons_index) = avg_zmom(i,j,k) * interpz;
57  });
58 }