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

Go to the source code of this file.

Functions

 if (l_vert_implicit_fac > 0.)
 

Function Documentation

◆ if()

if ( l_vert_implicit_fac  ,
0.   
)
7  {
8 
9  const bool l_do_implicit_theta = solverChoice.implicit_thermal_diffusion;
10  const bool l_do_implicit_mom = solverChoice.implicit_momentum_diffusion;
11 
12  // If we're doing an implicit solve for momenta (u and v only),
13  // then we use the explicit solution at this point to derive
14  // the surface velocity gradient -- to be consistent with the
15  // hoextrap used with the surface layer BC. We then subtract
16  // out the contribution from the gradient of tau_corr times
17  // (1 - implicit_fac) and add in the implicit solution scaled
18  // by implicit_fac.
19  MultiFab* Tau13corr = (l_do_implicit_mom) ? Tau_corr[level][0].get() : nullptr;
20  MultiFab* Tau23corr = (l_do_implicit_mom) ? Tau_corr[level][1].get() : nullptr;
21 #ifdef ERF_IMPLICIT_W
22  MultiFab* Tau33corr = (l_do_implicit_mom) ? Tau_corr[level][2].get() : nullptr;
23 #endif
24 
25  // BCs
26  const BCRec* bc_ptr_h = domain_bcs_type.data();
27  GpuArray<Real, AMREX_SPACEDIM*2> l_bc_neumann_vals_d;
28  for (int ori = 0; ori < 2*AMREX_SPACEDIM; ori++) {
29  l_bc_neumann_vals_d[ori] = m_bc_neumann_vals[RhoTheta_comp][ori];
30  }
31  const bool l_use_SurfLayer = (m_SurfaceLayer != nullptr);
32 
33  const bool l_use_turb = solverChoice.turbChoice[level].use_kturb;
34 
35  const bool l_use_stretched_dz = (solverChoice.mesh_type == MeshType::StretchedDz);
36 
37  for ( MFIter mfi(S_old[IntVars::cons],TileNoZ()); mfi.isValid(); ++mfi)
38  {
39  Box bx = mfi.tilebox();
40  Box tbx = mfi.nodaltilebox(0);
41  Box tby = mfi.nodaltilebox(1);
42 
43  const Array4< Real>& cell_data = scratch.array(mfi);
44 
45  const Array4< Real>& rho_u = (l_do_implicit_mom) ? scratch_xmom.array(mfi) : Array4<Real>{};
46  const Array4< Real>& rho_v = (l_do_implicit_mom) ? scratch_ymom.array(mfi) : Array4<Real>{};
47  const Array4<const Real>& tau13_corr = (l_do_implicit_mom) ? Tau13corr->array(mfi) : Array4<Real>{};
48  const Array4<const Real>& tau23_corr = (l_do_implicit_mom) ? Tau23corr->array(mfi) : Array4<Real>{};
49 
50 #ifdef ERF_IMPLICIT_W
51  Box tbz = mfi.nodaltilebox(2);
52  const Array4< Real>& rho_w = (l_do_implicit_mom) ? scratch_zmom.array(mfi) : Array4<Real>{};
53  const Array4<const Real>& tau33_corr = (l_do_implicit_mom) ? Tau33corr->array(mfi) : Array4<Real>{};
54 #endif
55 
56  const Array4<const Real>& z_nd_arr = z_phys_nd[level]->const_array(mfi);
57  const Array4<const Real>& detJ_arr = detJ_cc[level]->const_array(mfi);
58 
59  const Array4<const Real>& mu_turb = l_use_turb ? eddyDiffs->const_array(mfi) : Array4<const Real>{};
60 
61  const Array4<const Real>& hfx_z = Hfx3->const_array(mfi);
62 
63  if (l_use_stretched_dz) {
64  if (l_do_implicit_theta) {
65  ImplicitDiffForState_S(bx, fine_geom.Domain(), level, slow_dt,
66  l_bc_neumann_vals_d,
67  cell_data,
68  stretched_dz_d[level], hfx_z,
69  mu_turb, solverChoice,
70  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
71  }
72  if (l_do_implicit_mom) {
73  ImplicitDiffForMom_S<0>(tbx, fine_geom.Domain(), level, slow_dt,
74  cell_data, rho_u, tau13_corr,
75  stretched_dz_d[level],
76  mu_turb, solverChoice,
77  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
78 
79  ImplicitDiffForMom_S<1>(tby, fine_geom.Domain(), level, slow_dt,
80  cell_data, rho_v, tau23_corr,
81  stretched_dz_d[level],
82  mu_turb, solverChoice,
83  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
84 #ifdef ERF_IMPLICIT_W
85  ImplicitDiffForMom_S<2>(tbz, fine_geom.Domain(), level, slow_dt,
86  cell_data, rho_w, tau33_corr,
87  stretched_dz_d[level],
88  mu_turb, solverChoice,
89  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
90 #endif
91  }
92  } else if (l_use_terrain_fitted_coords) {
93  if (l_do_implicit_theta) {
94  ImplicitDiffForState_T(bx, fine_geom.Domain(), level, slow_dt,
95  l_bc_neumann_vals_d,
96  cell_data,
97  z_nd_arr, detJ_arr, dxInv, hfx_z,
98  mu_turb, solverChoice,
99  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
100  }
101  if (l_do_implicit_mom) {
102  ImplicitDiffForMom_T<0>(tbx, fine_geom.Domain(), level, slow_dt,
103  cell_data, rho_u, tau13_corr,
104  z_nd_arr, detJ_arr, dxInv,
105  mu_turb, solverChoice,
106  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
107 
108  ImplicitDiffForMom_T<1>(tby, fine_geom.Domain(), level, slow_dt,
109  cell_data, rho_v, tau23_corr,
110  z_nd_arr, detJ_arr, dxInv,
111  mu_turb, solverChoice,
112  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
113 #ifdef ERF_IMPLICIT_W
114  ImplicitDiffForMom_T<2>(tbz, fine_geom.Domain(), level, slow_dt,
115  cell_data, rho_w, tau33_corr,
116  z_nd_arr, detJ_arr, dxInv,
117  mu_turb, solverChoice,
118  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
119 #endif
120  }
121  } else { // no terrain
122  if (l_do_implicit_theta) {
123  ImplicitDiffForState_N(bx, fine_geom.Domain(), level, slow_dt,
124  l_bc_neumann_vals_d,
125  cell_data,
126  dxInv, hfx_z,
127  mu_turb, solverChoice,
128  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
129  }
130  if (l_do_implicit_mom) {
131  ImplicitDiffForMom_N<0>(tbx, fine_geom.Domain(), level, slow_dt,
132  cell_data, rho_u, tau13_corr,
133  dxInv,
134  mu_turb, solverChoice,
135  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
136 
137  ImplicitDiffForMom_N<1>(tby, fine_geom.Domain(), level, slow_dt,
138  cell_data, rho_v, tau23_corr,
139  dxInv,
140  mu_turb, solverChoice,
141  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
142 #ifdef ERF_IMPLICIT_W
143  ImplicitDiffForMom_N<2>(tbz, fine_geom.Domain(), level, slow_dt,
144  cell_data, rho_w, tau33_corr,
145  dxInv,
146  mu_turb, solverChoice,
147  bc_ptr_h, l_use_SurfLayer, l_vert_implicit_fac);
148 #endif
149  }
150  }
151  } // mfi
152 
153  } // if do implicit solve for diffusive contribution to (rho theta) update
void ImplicitDiffForState_N(const amrex::Box &bx, const amrex::Box &domain, const int level, const amrex::Real dt, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM *2 > &bc_neumann_vals, const amrex::Array4< amrex::Real > &cell_data, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &hfx_z, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Real implicit_fac)
void ImplicitDiffForState_S(const amrex::Box &bx, const amrex::Box &domain, const int level, const amrex::Real dt, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM *2 > &bc_neumann_vals, const amrex::Array4< amrex::Real > &cell_data, const amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::Array4< const amrex::Real > &hfx_z, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Real implicit_fac)
void ImplicitDiffForState_T(const amrex::Box &bx, const amrex::Box &domain, const int level, const amrex::Real dt, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM *2 > &bc_neumann_vals, const amrex::Array4< amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &hfx_z, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Real implicit_fac)
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
@ cons
Definition: ERF_IndexDefines.H:158
Here is the call graph for this function: