ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_DiffusionSrcForMom_T.cpp File Reference
#include <AMReX.H>
#include <ERF_Diffusion.H>
#include <ERF_IndexDefines.H>
Include dependency graph for ERF_DiffusionSrcForMom_T.cpp:

Functions

void DiffusionSrcForMom_T (const Box &bxx, const Box &bxy, const Box &bxz, const Array4< Real > &rho_u_rhs, const Array4< Real > &rho_v_rhs, const Array4< Real > &rho_w_rhs, const Array4< const Real > &tau11, const Array4< const Real > &tau22, const Array4< const Real > &tau33, const Array4< const Real > &tau12, const Array4< const Real > &tau13, const Array4< const Real > &tau21, const Array4< const Real > &tau23, const Array4< const Real > &tau31, const Array4< const Real > &tau32, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const Array4< const Real > &mf_m, const Array4< const Real > &, const Array4< const Real > &)
 

Function Documentation

◆ DiffusionSrcForMom_T()

void DiffusionSrcForMom_T ( const Box &  bxx,
const Box &  bxy,
const Box &  bxz,
const Array4< Real > &  rho_u_rhs,
const Array4< Real > &  rho_v_rhs,
const Array4< Real > &  rho_w_rhs,
const Array4< const Real > &  tau11,
const Array4< const Real > &  tau22,
const Array4< const Real > &  tau33,
const Array4< const Real > &  tau12,
const Array4< const Real > &  tau13,
const Array4< const Real > &  tau21,
const Array4< const Real > &  tau23,
const Array4< const Real > &  tau31,
const Array4< const Real > &  tau32,
const Array4< const Real > &  detJ,
const GpuArray< Real, AMREX_SPACEDIM > &  dxInv,
const Array4< const Real > &  mf_m,
const Array4< const Real > &  ,
const Array4< const Real > &   
)

Function for computing the momentum RHS for diffusion operator with terrain.

Parameters
[in]bxxnodal x box for x-mom
[in]bxynodal y box for y-mom
[in]bxznodal z box for z-mom
[out]rho_u_rhsRHS for x-mom
[out]rho_v_rhsRHS for y-mom
[out]rho_w_rhsRHS for z-mom
[in]tau1111 stress
[in]tau2222 stress
[in]tau3333 stress
[in]tau1212 stress
[in]tau1313 stress
[in]tau2121 stress
[in]tau2323 stress
[in]tau3131 stress
[in]tau3232 stress
[in]detJJacobian determinant
[in]differChoicecontainer with diffusion parameters
[in]dxInvinverse cell size array
[in]mf_mmap factor at cell center
44 {
45  BL_PROFILE_VAR("DiffusionSrcForMom_T()",DiffusionSrcForMom_T);
46 
47  auto dxinv = dxInv[0], dyinv = dxInv[1], dzinv = dxInv[2];
48 
49  ParallelFor(bxx, bxy, bxz,
50  [=] AMREX_GPU_DEVICE (int i, int j, int k)
51  {
52  Real mf = mf_m(i,j,0);
53 
54  Real diffContrib = ( (tau11(i , j , k ) - tau11(i-1, j ,k )) * dxinv * mf // Contribution to x-mom eqn from diffusive flux in x-dir
55  + (tau12(i , j+1, k ) - tau12(i , j ,k )) * dyinv * mf // Contribution to x-mom eqn from diffusive flux in y-dir
56  + (tau13(i , j , k+1) - tau13(i , j ,k )) * dzinv ); // Contribution to x-mom eqn from diffusive flux in z-dir;
57  diffContrib /= 0.5*(detJ(i,j,k) + detJ(i-1,j,k));
58  rho_u_rhs(i,j,k) -= diffContrib;
59  },
60  [=] AMREX_GPU_DEVICE (int i, int j, int k)
61  {
62  Real mf = mf_m(i,j,0);
63 
64  Real diffContrib = ( (tau21(i+1, j , k ) - tau21(i , j , k )) * dxinv * mf // Contribution to y-mom eqn from diffusive flux in x-dir
65  + (tau22(i , j , k ) - tau22(i , j-1, k )) * dyinv * mf // Contribution to y-mom eqn from diffusive flux in y-dir
66  + (tau23(i , j , k+1) - tau23(i , j , k )) * dzinv ); // Contribution to y-mom eqn from diffusive flux in z-dir;
67  diffContrib /= 0.5*(detJ(i,j,k) + detJ(i,j-1,k));
68  rho_v_rhs(i,j,k) -= diffContrib;
69  },
70  [=] AMREX_GPU_DEVICE (int i, int j, int k)
71  {
72  Real mf = mf_m(i,j,0);
73 
74  Real diffContrib = ( (tau31(i+1, j , k ) - tau31(i , j , k )) * dxinv * mf // Contribution to z-mom eqn from diffusive flux in x-dir
75  + (tau32(i , j+1, k ) - tau32(i , j , k )) * dyinv * mf // Contribution to z-mom eqn from diffusive flux in y-dir
76  + (tau33(i , j , k ) - tau33(i , j , k-1)) * dzinv ); // Contribution to z-mom eqn from diffusive flux in z-dir;
77  diffContrib /= 0.5*(detJ(i,j,k) + detJ(i,j,k-1));
78  rho_w_rhs(i,j,k) -= diffContrib;
79  });
80 }
void DiffusionSrcForMom_T(const Box &bxx, const Box &bxy, const Box &bxz, const Array4< Real > &rho_u_rhs, const Array4< Real > &rho_v_rhs, const Array4< Real > &rho_w_rhs, const Array4< const Real > &tau11, const Array4< const Real > &tau22, const Array4< const Real > &tau33, const Array4< const Real > &tau12, const Array4< const Real > &tau13, const Array4< const Real > &tau21, const Array4< const Real > &tau23, const Array4< const Real > &tau31, const Array4< const Real > &tau32, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const Array4< const Real > &mf_m, const Array4< const Real > &, const Array4< const Real > &)
Definition: ERF_DiffusionSrcForMom_T.cpp:31