ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
erf_moist_perturbation Namespace Reference

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void perturb_temperature_and_vapour (const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real rhoqv, const amrex::Real dT, const amrex::Real dqv, const bool perturb_T, const bool moist, const amrex::Real rdOcp, amrex::Real &drho, amrex::Real &drhoqv) noexcept
 

Detailed Description

Initial temperature and vapour perturbations of a moist column, applied together.

Shared by the BOMEX, GATE and RICO setups (and DYCOMS, which uses the RICO one). rho*theta is held, so the temperature perturbation is stored as a density change; the vapour mixing ratio after the perturbation is qv + dqv, whatever the density.

Function Documentation

◆ perturb_temperature_and_vapour()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_moist_perturbation::perturb_temperature_and_vapour ( const amrex::Real  rho,
const amrex::Real  rhotheta,
const amrex::Real  rhoqv,
const amrex::Real  dT,
const amrex::Real  dqv,
const bool  perturb_T,
const bool  moist,
const amrex::Real  rdOcp,
amrex::Real &  drho,
amrex::Real &  drhoqv 
)
noexcept

Perturbation of rho and rho*qv for a temperature change dT and a vapour change dqv.

With perturb_T, the new density gives T = T_old + dT at the pressure of the new state, P(rho*theta, qv + dqv); with dqv = 0 that is the old pressure. Without perturb_T the density is left as it is. rho*qv then holds qv + dqv on the new density.

Parameters
[in]rhodry density of the unperturbed state
[in]rhothetarho*theta of the unperturbed state (held)
[in]rhoqvrho*qv of the unperturbed state (0 without moisture)
[in]dTtemperature change [K]
[in]dqvvapour mixing ratio change
[in]perturb_Twhether the temperature is perturbed
[in]moistwhether a moisture model is active
[in]rdOcpR_d / c_p
[out]drhoperturbation of rho
[out]drhoqvperturbation of rho*qv (0 without moisture)
44 {
45  const amrex::Real qv = moist ? rhoqv / rho : amrex::Real(0.0);
46  const amrex::Real qv_new = moist ? qv + dqv : amrex::Real(0.0);
47 
48  amrex::Real rho_new = rho;
49  if (perturb_T) {
50  const amrex::Real T_old = getTgivenRandRTh(rho, rhotheta, qv);
51  const amrex::Real P = getPgivenRTh(rhotheta, qv_new);
52  const amrex::Real theta_new = getThgivenTandP(T_old + dT, P, rdOcp);
53  rho_new = getRhogivenThetaPress(theta_new, P, rdOcp, qv_new);
54  }
55 
56  drho = rho_new - rho;
57  drhoqv = moist ? rho_new * qv_new - rho * qv : amrex::Real(0.0);
58 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhogivenThetaPress(const amrex::Real th, const amrex::Real p, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:96
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenTandP(const amrex::Real T, const amrex::Real P, const amrex::Real rdOcp)
Definition: ERF_EOS.H:18
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
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:72
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ P
Definition: ERF_IndexDefines.H:244
@ rho
Definition: ERF_Kessler.H:25
@ qv
Definition: ERF_Kessler.H:31

Referenced by ParallelForRNG().

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