ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
BaseStateParams Struct Reference

#include <ERF_BaseStateParams.H>

Collaboration diagram for BaseStateParams:

Public Member Functions

void set_layer_interfaces ()
 
bool same_params_as (const BaseStateParams &bsp) const
 

Public Attributes

amrex::Real T00 = amrex::Real(290.0)
 
amrex::Real P00 = p_0
 
amrex::Real TLP = amrex::Real(50.0)
 
amrex::Real TISO = amrex::Real(200.0)
 
amrex::Real TLP_STRAT = amrex::Real(-11.0)
 
amrex::Real P_STRAT = zero
 
amrex::Real P_iso = zero
 
amrex::Real z_iso = zero
 
amrex::Real z_strat = zero
 
bool use_strat = false
 
bool is_set = false
 

Detailed Description

Parameters defining the WRF reference (base) state, along with the layer interface heights derived from them.

The base state is piecewise in log-pressure: (1) troposphere T = T00 + TLP * ln(p/P00) p > P_iso (2) isothermal layer T = TISO P_STRAT < p <= P_iso (3) stratosphere T = TISO + TLP_STRAT * ln(p/P_STRAT) p <= P_STRAT Each piece inverts to p(z) in closed form under dp/dz = -rho g, so the two interface heights are precomputed once and the inversion branches on z.

Because the resulting profile is a pure function of height, it can be evaluated on any subset of a column – it does not require a box that spans the domain in the vertical.

NOTE: The defaults are the WRF namelist defaults for base_temp, base_pres, base_lapse, iso_temp, base_lapse_strat and base_pres_strat. metgrid files do not carry these parameters at all; wrfinput files usually do, and are read by read_base_state_params_from_wrfinput.

Member Function Documentation

◆ same_params_as()

bool BaseStateParams::same_params_as ( const BaseStateParams bsp) const
inline
108  {
109  return (T00 == bsp.T00 ) && (P00 == bsp.P00 ) &&
110  (TLP == bsp.TLP ) && (TISO == bsp.TISO) &&
111  (TLP_STRAT == bsp.TLP_STRAT) && (P_STRAT == bsp.P_STRAT);
112  }
amrex::Real T00
Definition: ERF_BaseStateParams.H:36
amrex::Real P00
Definition: ERF_BaseStateParams.H:37
amrex::Real TLP
Definition: ERF_BaseStateParams.H:38
amrex::Real P_STRAT
Definition: ERF_BaseStateParams.H:41
amrex::Real TLP_STRAT
Definition: ERF_BaseStateParams.H:40
amrex::Real TISO
Definition: ERF_BaseStateParams.H:39

◆ set_layer_interfaces()

void BaseStateParams::set_layer_interfaces ( )
inline
61  {
62  // The troposphere inverts p(z) as sqrt((T00/TLP)^2 - 2*g*z/(TLP*R_d)), which
63  // folds 1/TLP inside the square root and so discards the sign of TLP. A
64  // non-positive lapse parameter, or an isothermal temperature at or above the
65  // surface temperature, would silently select the wrong root instead of failing.
67  "Base state TLP must be positive");
69  "Base state TISO must be less than T00");
70 
71  const amrex::Real x_iso = (TISO - T00) / TLP;
72  P_iso = P00 * std::exp(x_iso);
73  z_iso = -(R_d/CONST_GRAV) * (T00*x_iso + myhalf*TLP*x_iso*x_iso);
74 
75  // The upper stratospheric layer is optional (P_STRAT == 0 or TLP_STRAT == 0
76  // disables it) and is only meaningful if it begins above the isothermal layer,
77  // i.e. if P_STRAT is below the pressure at which the isothermal layer starts.
78  const bool want_strat = ((P_STRAT > zero) && (TLP_STRAT != zero));
79  use_strat = (want_strat && (P_STRAT < P_iso));
81  : z_iso;
82 
83  // A configured stratospheric layer that lies at or below the isothermal
84  // transition cannot be represented, so say so rather than dropping it quietly.
85  if (want_strat && !use_strat) {
86  amrex::Print() << "WARNING: the base stratospheric layer is being ignored: P_STRAT = "
87  << P_STRAT << " Pa is not below the pressure at the base of the "
88  << "isothermal layer, P_iso = " << P_iso << " Pa.\n";
89  amrex::Print() << " TLP_STRAT = " << TLP_STRAT << " will have no effect and "
90  << "the atmosphere above z_iso will be isothermal at TISO = "
91  << TISO << " K.\n";
92  }
93 
94  amrex::Print() << "Base state layer interfaces: z_iso = " << z_iso << " m";
95  if (use_strat) amrex::Print() << ", z_strat = " << z_strat << " m";
96  amrex::Print() << "\n";
97 
98  is_set = true;
99  }
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:64
constexpr amrex::Real R_d
Definition: ERF_Constants.H:47
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
amrex::Real Real
Definition: ERF_ShocInterface.H:19
bool is_set
Definition: ERF_BaseStateParams.H:51
amrex::Real z_strat
Definition: ERF_BaseStateParams.H:46
amrex::Real z_iso
Definition: ERF_BaseStateParams.H:45
amrex::Real P_iso
Definition: ERF_BaseStateParams.H:44
bool use_strat
Definition: ERF_BaseStateParams.H:47
Here is the call graph for this function:

Member Data Documentation

◆ is_set

bool BaseStateParams::is_set = false

Referenced by set_layer_interfaces().

◆ P00

amrex::Real BaseStateParams::P00 = p_0

◆ P_iso

amrex::Real BaseStateParams::P_iso = zero

Referenced by set_layer_interfaces().

◆ P_STRAT

amrex::Real BaseStateParams::P_STRAT = zero

◆ T00

amrex::Real BaseStateParams::T00 = amrex::Real(290.0)

◆ TISO

amrex::Real BaseStateParams::TISO = amrex::Real(200.0)

◆ TLP

amrex::Real BaseStateParams::TLP = amrex::Real(50.0)

◆ TLP_STRAT

amrex::Real BaseStateParams::TLP_STRAT = amrex::Real(-11.0)

◆ use_strat

bool BaseStateParams::use_strat = false

Referenced by set_layer_interfaces().

◆ z_iso

amrex::Real BaseStateParams::z_iso = zero

Referenced by set_layer_interfaces().

◆ z_strat

amrex::Real BaseStateParams::z_strat = zero

Referenced by set_layer_interfaces().


The documentation for this struct was generated from the following file: