ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_RebuildBaseState.cpp File Reference
#include <ERF.H>
#include <iomanip>
#include <sstream>
#include <ERF_EOS.H>
#include <ERF_Constants.H>
#include <ERF_Utils.H>
#include <ERF_HSEUtils.H>
#include <ERF_ColumnBands.H>
Include dependency graph for ERF_RebuildBaseState.cpp:

Functions

void recompute_p_pi_hse (MultiFab &base_state_mf, const Real l_rdOcp)
 

Detailed Description

The base state of a level that a regrid made or remade, and the check that a level's base state is in discrete hydrostatic balance (erf-model/ERF#5228, #5236).

Function Documentation

◆ recompute_p_pi_hse()

void recompute_p_pi_hse ( MultiFab &  base_state_mf,
const Real  l_rdOcp 
)

Re-compute p_0 and pi_0 from rho_0, theta_0 and qv_0 over the valid region.

Parameters
[in,out]base_state_mfbase state, with all BaseState components
[in]l_rdOcpR_d / c_p
27 {
28  for (MFIter mfi(base_state_mf, TilingIfNotGPU()); mfi.isValid(); ++mfi)
29  {
30  Box bx = mfi.tilebox();
31 
32  const Array4<Real>& bs = base_state_mf.array(mfi);
33 
34  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
35  {
36  Real rhotheta = bs(i,j,k,BaseState::r0_comp) * bs(i,j,k,BaseState::th0_comp);
37  bs(i,j,k,BaseState::p0_comp) = getPgivenRTh(rhotheta, bs(i,j,k,BaseState::qv0_comp));
38  bs(i,j,k,BaseState::pi0_comp) = getExnergivenRTh(rhotheta, l_rdOcp, bs(i,j,k,BaseState::qv0_comp));
39  });
40  }
41 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getExnergivenRTh(const amrex::Real rhotheta, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:156
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:81
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);})
@ qv0_comp
Definition: ERF_IndexDefines.H:113
@ pi0_comp
Definition: ERF_IndexDefines.H:111
@ p0_comp
Definition: ERF_IndexDefines.H:110
@ th0_comp
Definition: ERF_IndexDefines.H:112
@ r0_comp
Definition: ERF_IndexDefines.H:109
real(c_double), private bs
Definition: ERF_module_mp_morr_two_moment.F90:182

Referenced by ERF::build_base_state_from_input_sounding_on(), ERF::build_nested_base_state(), ERF::init_from_input_sounding(), and ERF::rebuild_base_state_from_coarse().

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