ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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_mx, const Array4< const Real > &mf_ux, const Array4< const Real > &mf_vx, const Array4< const Real > &mf_my, const Array4< const Real > &mf_uy, const Array4< const Real > &mf_vy)
 

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_mx,
const Array4< const Real > &  mf_ux,
const Array4< const Real > &  mf_vx,
const Array4< const Real > &  mf_my,
const Array4< const Real > &  mf_uy,
const Array4< const Real > &  mf_vy 
)

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
43 {
44  BL_PROFILE_VAR("DiffusionSrcForMom_N()",DiffusionSrcForMom_N);
45 
46  auto dxinv = dxInv[0], dyinv = dxInv[1], dzinv = dxInv[2];
47 
48  ParallelFor(bxx, bxy, bxz,
49  [=] AMREX_GPU_DEVICE (int i, int j, int k)
50  {
51  // Inv Jacobian
52  Real mfsq = mf_ux(i,j,0) * mf_uy(i,j,0);
53 
54  // Area corrections
55  Real Imfy_hi = 1. / mf_my(i ,j,0);
56  Real Imfy_lo = 1. / mf_my(i-1,j,0);
57  Real Imfx_hi = 1. / (0.5 * (mf_vx(i,j+1,0) + mf_vx(i-1,j+1,0)));
58  Real Imfx_lo = 1. / (0.5 * (mf_vx(i,j ,0) + mf_vx(i-1,j ,0)));
59  rho_u_rhs(i,j,k) -= ( (tau11(i , j , k )*Imfy_hi - tau11(i-1, j ,k )*Imfy_lo) * dxinv * mfsq // Contribution to x-mom eqn from diffusive flux in x-dir
60  + (tau12(i , j+1, k )*Imfx_hi - tau12(i , j ,k )*Imfx_lo) * dyinv * mfsq // Contribution to x-mom eqn from diffusive flux in y-dir
61  + (tau13(i , j , k+1) - tau13(i , j ,k ) ) * dzinv ); // Contribution to x-mom eqn from diffusive flux in z-dir;
62  },
63  [=] AMREX_GPU_DEVICE (int i, int j, int k)
64  {
65  // Inv Jacobian
66  Real mfsq = mf_vx(i,j,0) * mf_vy(i,j,0);
67 
68  // Area corrections
69  Real Imfy_hi = 1. / (0.5 * (mf_uy(i+1,j,0) + mf_uy(i+1,j-1,0)));
70  Real Imfy_lo = 1. / (0.5 * (mf_uy(i ,j,0) + mf_uy(i ,j-1,0)));
71  Real Imfx_hi = 1. / mf_mx(i ,j,0);
72  Real Imfx_lo = 1. / mf_mx(i-1,j,0);
73  rho_v_rhs(i,j,k) -= ( (tau12(i+1, j , k )*Imfy_hi - tau12(i , j , k )*Imfy_lo) * dxinv * mfsq // Contribution to y-mom eqn from diffusive flux in x-dir
74  + (tau22(i , j , k )*Imfx_hi - tau22(i , j-1, k )*Imfx_lo) * dyinv * mfsq // Contribution to y-mom eqn from diffusive flux in y-dir
75  + (tau23(i , j , k+1) - tau23(i , j , k ) ) * dzinv ); // Contribution to y-mom eqn from diffusive flux in z-dir;
76  },
77  [=] AMREX_GPU_DEVICE (int i, int j, int k)
78  {
79  // Inv Jacobian
80  Real mfsq = mf_mx(i,j,0) * mf_my(i,j,0);
81 
82  // Area corrections
83  Real Imfy_hi = 1. / mf_uy(i+1,j ,0);
84  Real Imfy_lo = 1. / mf_uy(i ,j ,0);
85  Real Imfx_hi = 1. / mf_vx(i ,j+1,0);
86  Real Imfx_lo = 1. / mf_vx(i ,j ,0);
87  rho_w_rhs(i,j,k) -= ( (tau13(i+1, j , k )*Imfy_hi - tau13(i , j , k )*Imfy_lo) * dxinv * mfsq // Contribution to z-mom eqn from diffusive flux in x-dir
88  + (tau23(i , j+1, k )*Imfx_hi - tau23(i , j , k )*Imfx_lo) * dyinv * mfsq // Contribution to z-mom eqn from diffusive flux in y-dir
89  + (tau33(i , j , k ) - tau33(i , j , k-1) ) * dzinv ); // Contribution to z-mom eqn from diffusive flux in z-dir;
90  });
91 }
@ tau12
Definition: ERF_DataStruct.H:26
@ tau23
Definition: ERF_DataStruct.H:26
@ tau33
Definition: ERF_DataStruct.H:26
@ tau22
Definition: ERF_DataStruct.H:26
@ tau11
Definition: ERF_DataStruct.H:26
@ tau13
Definition: ERF_DataStruct.H:26
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_mx, const Array4< const Real > &mf_ux, const Array4< const Real > &mf_vx, const Array4< const Real > &mf_my, const Array4< const Real > &mf_uy, const Array4< const Real > &mf_vy)
Definition: ERF_DiffusionSrcForMom_N.cpp:26