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

Functions

void DiffusionSrcForMom_N (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 > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const Array4< const Real > &mf_m, const Array4< const Real > &, const Array4< const Real > &)
 

Function Documentation

◆ DiffusionSrcForMom_N()

void DiffusionSrcForMom_N ( 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 > &  tau23,
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 without 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]tau2323 stress
[in]dxInvinverse cell size array
[in]mf_mmap factor at cell center
37 {
38  BL_PROFILE_VAR("DiffusionSrcForMom_N()",DiffusionSrcForMom_N);
39 
40  auto dxinv = dxInv[0], dyinv = dxInv[1], dzinv = dxInv[2];
41 
42  ParallelFor(bxx, bxy, bxz,
43  [=] AMREX_GPU_DEVICE (int i, int j, int k)
44  {
45  Real mf = mf_m(i,j,0);
46 
47  rho_u_rhs(i,j,k) -= ( (tau11(i , j , k ) - tau11(i-1, j ,k )) * dxinv * mf // Contribution to x-mom eqn from diffusive flux in x-dir
48  + (tau12(i , j+1, k ) - tau12(i , j ,k )) * dyinv * mf // Contribution to x-mom eqn from diffusive flux in y-dir
49  + (tau13(i , j , k+1) - tau13(i , j ,k )) * dzinv ); // Contribution to x-mom eqn from diffusive flux in z-dir;
50  },
51  [=] AMREX_GPU_DEVICE (int i, int j, int k)
52  {
53  Real mf = mf_m(i,j,0);
54 
55  rho_v_rhs(i,j,k) -= ( (tau12(i+1, j , k ) - tau12(i , j , k )) * dxinv * mf // Contribution to y-mom eqn from diffusive flux in x-dir
56  + (tau22(i , j , k ) - tau22(i , j-1, k )) * dyinv * mf // Contribution to y-mom eqn from diffusive flux in y-dir
57  + (tau23(i , j , k+1) - tau23(i , j , k )) * dzinv ); // Contribution to y-mom eqn from diffusive flux in z-dir;
58  },
59  [=] AMREX_GPU_DEVICE (int i, int j, int k)
60  {
61  Real mf = mf_m(i,j,0);
62 
63  rho_w_rhs(i,j,k) -= ( (tau13(i+1, j , k ) - tau13(i , j , k )) * dxinv * mf // Contribution to z-mom eqn from diffusive flux in x-dir
64  + (tau23(i , j+1, k ) - tau23(i , j , k )) * dyinv * mf // Contribution to z-mom eqn from diffusive flux in y-dir
65  + (tau33(i , j , k ) - tau33(i , j , k-1)) * dzinv ); // Contribution to z-mom eqn from diffusive flux in z-dir;
66  });
67 }
void DiffusionSrcForMom_N(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 > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dxInv, const Array4< const Real > &mf_m, const Array4< const Real > &, const Array4< const Real > &)
Definition: ERF_DiffusionSrcForMom_N.cpp:26