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

Functions

void ComputeStressConsVisc_N (Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const Array4< const Real > &er_arr, Array4< Real > &tau13i, Array4< Real > &tau23i)
 
void ComputeStressVarVisc_N (Box bxcc, Box tbxxy, Box tbxxz, Box tbxyz, Real mu_eff, const Array4< const Real > &mu_turb, const Array4< const Real > &cell_data, Array4< Real > &tau11, Array4< Real > &tau22, Array4< Real > &tau33, Array4< Real > &tau12, Array4< Real > &tau13, Array4< Real > &tau23, const Array4< const Real > &er_arr, Array4< Real > &tau13i, Array4< Real > &tau23i)
 

Function Documentation

◆ ComputeStressConsVisc_N()

void ComputeStressConsVisc_N ( Box  bxcc,
Box  tbxxy,
Box  tbxxz,
Box  tbxyz,
Real  mu_eff,
const Array4< const Real > &  cell_data,
Array4< Real > &  tau11,
Array4< Real > &  tau22,
Array4< Real > &  tau33,
Array4< Real > &  tau12,
Array4< Real > &  tau13,
Array4< Real > &  tau23,
const Array4< const Real > &  er_arr,
Array4< Real > &  tau13i,
Array4< Real > &  tau23i 
)

Function for computing the stress with constant viscosity and without terrain.

Parameters
[in]bxcccell center box for tau_ii
[in]tbxxynodal xy box for tau_12
[in]tbxxznodal xz box for tau_13
[in]tbxyznodal yz box for tau_23
[in]mu_effconstant molecular viscosity
[in]cell_datato access rho if ConstantAlpha
[in,out]tau1111 strain -> stress
[in,out]tau2222 strain -> stress
[in,out]tau3333 strain -> stress
[in,out]tau1212 strain -> stress
[in,out]tau1313 strain -> stress
[in,out]tau2323 strain -> stress
[in]er_arrexpansion rate
[in,out]tau13icontribution to stress from du/dz
[in,out]tau23icontribution to stress from dv/dz
32 {
33  Real OneThird = (one/three);
34 
35  // NOTE: mu_eff includes factor of 2
36 
37  if (cell_data)
38  // constant alpha (stored in mu_eff)
39  {
40  // Cell centered strains
41  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
42  {
43  Real rhoAlpha = cell_data(i, j, k, Rho_comp) * mu_eff;
44  tau11(i,j,k) = -rhoAlpha * ( tau11(i,j,k) - OneThird*er_arr(i,j,k) );
45  tau22(i,j,k) = -rhoAlpha * ( tau22(i,j,k) - OneThird*er_arr(i,j,k) );
46  tau33(i,j,k) = -rhoAlpha * ( tau33(i,j,k) - OneThird*er_arr(i,j,k) );
47  });
48 
49  // Off-diagonal strains
50  ParallelFor(tbxxy,tbxxz,tbxyz,
51  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
52  Real rho_bar = fourth*( cell_data(i-1, j , k, Rho_comp) + cell_data(i, j , k, Rho_comp)
53  + cell_data(i-1, j-1, k, Rho_comp) + cell_data(i, j-1, k, Rho_comp) );
54  tau12(i,j,k) *= -rho_bar * mu_eff;
55  },
56  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
57  Real rho_bar = fourth*( cell_data(i-1, j, k , Rho_comp) + cell_data(i, j, k , Rho_comp)
58  + cell_data(i-1, j, k-1, Rho_comp) + cell_data(i, j, k-1, Rho_comp) );
59  tau13(i,j,k) *= -rho_bar * mu_eff;
60 
61  if (tau13i) tau13i(i,j,k) *= -rho_bar * mu_eff;
62  },
63  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
64  Real rho_bar = fourth*( cell_data(i, j-1, k , Rho_comp) + cell_data(i, j, k , Rho_comp)
65  + cell_data(i, j-1, k-1, Rho_comp) + cell_data(i, j, k-1, Rho_comp) );
66  tau23(i,j,k) *= -rho_bar * mu_eff;
67 
68  if (tau23i) tau23i(i,j,k) *= -rho_bar * mu_eff;
69  });
70  }
71  else
72  // constant mu_eff
73  {
74  // Cell centered strains
75  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
76  {
77  tau11(i,j,k) = -mu_eff * ( tau11(i,j,k) - OneThird*er_arr(i,j,k) );
78  tau22(i,j,k) = -mu_eff * ( tau22(i,j,k) - OneThird*er_arr(i,j,k) );
79  tau33(i,j,k) = -mu_eff * ( tau33(i,j,k) - OneThird*er_arr(i,j,k) );
80  });
81 
82  // Off-diagonal strains
83  ParallelFor(tbxxy,tbxxz,tbxyz,
84  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
85  tau12(i,j,k) *= -mu_eff;
86  },
87  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
88  tau13(i,j,k) *= -mu_eff;
89 
90  if (tau13i) tau13i(i,j,k) *= -mu_eff;
91  },
92  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
93  tau23(i,j,k) *= -mu_eff;
94 
95  if (tau23i) tau23i(i,j,k) *= -mu_eff;
96  });
97  }
98 }
@ tau12
Definition: ERF_DataStruct.H:49
@ tau23
Definition: ERF_DataStruct.H:49
@ tau33
Definition: ERF_DataStruct.H:49
@ tau22
Definition: ERF_DataStruct.H:49
@ tau11
Definition: ERF_DataStruct.H:49
@ tau13
Definition: ERF_DataStruct.H:49
#define Rho_comp
Definition: ERF_IndexDefines.H:53
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);})
constexpr amrex::Real three
Definition: ERF_NumericalConstants.H:39
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:42
amrex::Real Real
Definition: ERF_ShocInterface.H:19

Referenced by erf_make_tau_terms().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeStressVarVisc_N()

void ComputeStressVarVisc_N ( Box  bxcc,
Box  tbxxy,
Box  tbxxz,
Box  tbxyz,
Real  mu_eff,
const Array4< const Real > &  mu_turb,
const Array4< const Real > &  cell_data,
Array4< Real > &  tau11,
Array4< Real > &  tau22,
Array4< Real > &  tau33,
Array4< Real > &  tau12,
Array4< Real > &  tau13,
Array4< Real > &  tau23,
const Array4< const Real > &  er_arr,
Array4< Real > &  tau13i,
Array4< Real > &  tau23i 
)

Function for computing the stress with variable viscosity and without terrain.

Parameters
[in]bxcccell center box for tau_ii
[in]tbxxynodal xy box for tau_12
[in]tbxxznodal xz box for tau_13
[in]tbxyznodal yz box for tau_23
[in]mu_effconstant molecular viscosity
[in]mu_turbvariable turbulent viscosity
[in]cell_datato access rho if ConstantAlpha
[in,out]tau1111 strain -> stress
[in,out]tau2222 strain -> stress
[in,out]tau3333 strain -> stress
[in,out]tau1212 strain -> stress
[in,out]tau1313 strain -> stress
[in,out]tau2323 strain -> stress
[in]er_arrexpansion rate
[in,out]tau13icontribution to stress from du/dz
[in,out]tau23icontribution to stress from dv/dz
129 {
130  Real OneThird = (one/three);
131 
132  // NOTE: mu_eff includes factor of 2
133 
134  if (cell_data)
135  // constant alpha (stored in mu_eff)
136  {
137  // Cell centered strains
138  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
139  Real rhoAlpha = cell_data(i, j, k, Rho_comp) * mu_eff;
140  Real mu_11 = rhoAlpha + two * mu_turb(i, j, k, EddyDiff::Mom_h);
141  Real mu_22 = mu_11;
142  Real mu_33 = rhoAlpha + two * mu_turb(i, j, k, EddyDiff::Mom_v);
143  tau11(i,j,k) = -mu_11 * ( tau11(i,j,k) - OneThird*er_arr(i,j,k) );
144  tau22(i,j,k) = -mu_22 * ( tau22(i,j,k) - OneThird*er_arr(i,j,k) );
145  tau33(i,j,k) = -mu_33 * ( tau33(i,j,k) - OneThird*er_arr(i,j,k) );
146  });
147 
148  // Off-diagonal strains
149  ParallelFor(tbxxy,tbxxz,tbxyz,
150  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
151  Real rho_bar = fourth*( cell_data(i-1, j , k, Rho_comp) + cell_data(i, j , k, Rho_comp)
152  + cell_data(i-1, j-1, k, Rho_comp) + cell_data(i, j-1, k, Rho_comp) );
153  Real mu_bar = fourth*( mu_turb(i-1, j , k, EddyDiff::Mom_h) + mu_turb(i, j , k, EddyDiff::Mom_h)
154  + mu_turb(i-1, j-1, k, EddyDiff::Mom_h) + mu_turb(i, j-1, k, EddyDiff::Mom_h) );
155  Real mu_12 = rho_bar*mu_eff + two*mu_bar;
156  tau12(i,j,k) *= -mu_12;
157  },
158  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
159  Real rho_bar = fourth*( cell_data(i-1, j, k , Rho_comp) + cell_data(i, j, k , Rho_comp)
160  + cell_data(i-1, j, k-1, Rho_comp) + cell_data(i, j, k-1, Rho_comp) );
161  Real mu_bar = fourth*( mu_turb(i-1, j, k , EddyDiff::Mom_v) + mu_turb(i, j, k , EddyDiff::Mom_v)
162  + mu_turb(i-1, j, k-1, EddyDiff::Mom_v) + mu_turb(i, j, k-1, EddyDiff::Mom_v) );
163  Real mu_13 = rho_bar*mu_eff + two*mu_bar;
164  tau13(i,j,k) *= -mu_13;
165 
166  if (tau13i) tau13i(i,j,k) *= -mu_13;
167  },
168  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
169  Real rho_bar = fourth*( cell_data(i, j-1, k , Rho_comp) + cell_data(i, j, k , Rho_comp)
170  + cell_data(i, j-1, k-1, Rho_comp) + cell_data(i, j, k-1, Rho_comp) );
171  Real mu_bar = fourth*( mu_turb(i, j-1, k , EddyDiff::Mom_v) + mu_turb(i, j, k , EddyDiff::Mom_v)
172  + mu_turb(i, j-1, k-1, EddyDiff::Mom_v) + mu_turb(i, j, k-1, EddyDiff::Mom_v) );
173  Real mu_23 = rho_bar*mu_eff + two*mu_bar;
174  tau23(i,j,k) *= -mu_23;
175 
176  if (tau23i) tau23i(i,j,k) *= -mu_23;
177  });
178  }
179  else
180  // constant mu_eff
181  {
182  // Cell centered strains
183  ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
184  Real mu_11 = mu_eff + two * mu_turb(i, j, k, EddyDiff::Mom_h);
185  Real mu_22 = mu_11;
186  Real mu_33 = mu_eff + two * mu_turb(i, j, k, EddyDiff::Mom_v);
187  tau11(i,j,k) = -mu_11 * ( tau11(i,j,k) - OneThird*er_arr(i,j,k) );
188  tau22(i,j,k) = -mu_22 * ( tau22(i,j,k) - OneThird*er_arr(i,j,k) );
189  tau33(i,j,k) = -mu_33 * ( tau33(i,j,k) - OneThird*er_arr(i,j,k) );
190  });
191 
192  // Off-diagonal strains
193  ParallelFor(tbxxy,tbxxz,tbxyz,
194  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
195  Real mu_bar = fourth*( mu_turb(i-1, j , k, EddyDiff::Mom_h) + mu_turb(i, j , k, EddyDiff::Mom_h)
196  + mu_turb(i-1, j-1, k, EddyDiff::Mom_h) + mu_turb(i, j-1, k, EddyDiff::Mom_h) );
197  Real mu_12 = mu_eff + two*mu_bar;
198  tau12(i,j,k) *= -mu_12;
199  },
200  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
201  Real mu_bar = fourth*( mu_turb(i-1, j, k , EddyDiff::Mom_v) + mu_turb(i, j, k , EddyDiff::Mom_v)
202  + mu_turb(i-1, j, k-1, EddyDiff::Mom_v) + mu_turb(i, j, k-1, EddyDiff::Mom_v) );
203  Real mu_13 = mu_eff + two*mu_bar;
204  tau13(i,j,k) *= -mu_13;
205 
206  if (tau13i) tau13i(i,j,k) *= -mu_13;
207  },
208  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
209  Real mu_bar = fourth*( mu_turb(i, j-1, k , EddyDiff::Mom_v) + mu_turb(i, j, k , EddyDiff::Mom_v)
210  + mu_turb(i, j-1, k-1, EddyDiff::Mom_v) + mu_turb(i, j, k-1, EddyDiff::Mom_v) );
211  Real mu_23 = mu_eff + two*mu_bar;
212  tau23(i,j,k) *= -mu_23;
213 
214  if (tau23i) tau23i(i,j,k) *= -mu_23;
215  });
216  }
217 }
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
@ Mom_h
Definition: ERF_IndexDefines.H:284
@ Mom_v
Definition: ERF_IndexDefines.H:289

Referenced by erf_make_tau_terms().

Here is the call graph for this function:
Here is the caller graph for this function: