ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_WSM6.H File Reference
#include <memory>
#include <string>
#include <vector>
#include <AMReX_FArrayBox.H>
#include <AMReX_Geometry.H>
#include <AMReX_MultiFabUtil.H>
#include "ERF_Constants.H"
#include "ERF_MicrophysicsConstants.H"
#include "ERF_DataStruct.H"
#include "ERF_IndexDefines.H"
#include "ERF_MicrophysicsUtils.H"
#include "ERF_NullMoist.H"
#include "ERF_SurfacePrecipitation.H"
Include dependency graph for ERF_WSM6.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  WSM6
 

Namespaces

 MicVar_WSM6
 
 WSM6Ind
 

Enumerations

enum  {
  MicVar_WSM6::rho = 0 , MicVar_WSM6::theta , MicVar_WSM6::tabs , MicVar_WSM6::pres ,
  MicVar_WSM6::qv , MicVar_WSM6::qc , MicVar_WSM6::qi , MicVar_WSM6::qr ,
  MicVar_WSM6::qs , MicVar_WSM6::qg , MicVar_WSM6::rain_accum , MicVar_WSM6::snow_accum ,
  MicVar_WSM6::graup_accum , MicVar_WSM6::NumVars
}
 
enum  {
  WSM6Ind::t = 0 , WSM6Ind::q , WSM6Ind::qc , WSM6Ind::qi ,
  WSM6Ind::qr , WSM6Ind::qs , WSM6Ind::qg , WSM6Ind::den ,
  WSM6Ind::p , WSM6Ind::delz , WSM6Ind::fallc , WSM6Ind::falkc ,
  WSM6Ind::work1c , WSM6Ind::work2c , WSM6Ind::workr , WSM6Ind::worka ,
  WSM6Ind::den_tmp , WSM6Ind::delz_tmp , WSM6Ind::pigen , WSM6Ind::pidep ,
  WSM6Ind::pcond , WSM6Ind::prevp , WSM6Ind::psevp , WSM6Ind::pgevp ,
  WSM6Ind::psdep , WSM6Ind::pgdep , WSM6Ind::praut , WSM6Ind::psaut ,
  WSM6Ind::pgaut , WSM6Ind::piacr , WSM6Ind::pracw , WSM6Ind::praci ,
  WSM6Ind::pracs , WSM6Ind::psacw , WSM6Ind::psaci , WSM6Ind::psacr ,
  WSM6Ind::pgacw , WSM6Ind::pgaci , WSM6Ind::pgacr , WSM6Ind::pgacs ,
  WSM6Ind::paacw , WSM6Ind::psmlt , WSM6Ind::pgmlt , WSM6Ind::pseml ,
  WSM6Ind::pgeml , WSM6Ind::qsum , WSM6Ind::xl , WSM6Ind::cpm ,
  WSM6Ind::work2 , WSM6Ind::denfac , WSM6Ind::xni , WSM6Ind::denqrs1 ,
  WSM6Ind::denqrs2 , WSM6Ind::denqrs3 , WSM6Ind::denqci , WSM6Ind::n0sfac ,
  WSM6Ind::rhw , WSM6Ind::rhi , WSM6Ind::qsatw , WSM6Ind::qsati ,
  WSM6Ind::rslope_r , WSM6Ind::rslope_s , WSM6Ind::rslope_g , WSM6Ind::rslope2_r ,
  WSM6Ind::rslope2_s , WSM6Ind::rslope2_g , WSM6Ind::rslope3_r , WSM6Ind::rslope3_s ,
  WSM6Ind::rslope3_g , WSM6Ind::rslopeb_r , WSM6Ind::rslopeb_s , WSM6Ind::rslopeb_g ,
  WSM6Ind::qrs_tmp_r , WSM6Ind::qrs_tmp_s , WSM6Ind::qrs_tmp_g , WSM6Ind::falk_r ,
  WSM6Ind::falk_s , WSM6Ind::falk_g , WSM6Ind::fall_r , WSM6Ind::fall_s ,
  WSM6Ind::fall_g , WSM6Ind::work1_r , WSM6Ind::work1_s , WSM6Ind::work1_g ,
  WSM6Ind::workdiffw , WSM6Ind::workdiffi , WSM6Ind::NumInds
}
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_copy_state_to_micro_cell (const amrex::Array4< const amrex::Real > &states, const amrex::Array4< const amrex::Real > &base, const amrex::Array4< amrex::Real > &rho, const amrex::Array4< amrex::Real > &theta, const amrex::Array4< amrex::Real > &tabs, const amrex::Array4< amrex::Real > &pres, const amrex::Array4< amrex::Real > &qv, const amrex::Array4< amrex::Real > &qc, const amrex::Array4< amrex::Real > &qi, const amrex::Array4< amrex::Real > &qr, const amrex::Array4< amrex::Real > &qs, const amrex::Array4< amrex::Real > &qg, const amrex::Real rdOcp, const bool use_anelastic_reference_pressure, const int i, const int j, const int k) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real wsm6_theta_from_temperature_and_pressure (const amrex::Real rho, const amrex::Real temperature, const amrex::Real pressure, const amrex::Real qv, const amrex::Real configured_rdOcp, const bool use_anelastic_reference_pressure) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_copy_micro_to_state_cell (const amrex::Array4< amrex::Real > &states, const amrex::Array4< amrex::Real > &theta, const amrex::Array4< const amrex::Real > &rho, const amrex::Array4< const amrex::Real > &tabs, const amrex::Array4< const amrex::Real > &pres, const amrex::Array4< const amrex::Real > &qv, const amrex::Array4< const amrex::Real > &qc, const amrex::Array4< const amrex::Real > &qi, const amrex::Array4< const amrex::Real > &qr, const amrex::Array4< const amrex::Real > &qs, const amrex::Array4< const amrex::Real > &qg, const bool use_anelastic_reference_pressure, const amrex::Real rdOcp, const int i, const int j, const int k) noexcept
 

Function Documentation

◆ wsm6_copy_micro_to_state_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_copy_micro_to_state_cell ( const amrex::Array4< amrex::Real > &  states,
const amrex::Array4< amrex::Real > &  theta,
const amrex::Array4< const amrex::Real > &  rho,
const amrex::Array4< const amrex::Real > &  tabs,
const amrex::Array4< const amrex::Real > &  pres,
const amrex::Array4< const amrex::Real > &  qv,
const amrex::Array4< const amrex::Real > &  qc,
const amrex::Array4< const amrex::Real > &  qi,
const amrex::Array4< const amrex::Real > &  qr,
const amrex::Array4< const amrex::Real > &  qs,
const amrex::Array4< const amrex::Real > &  qg,
const bool  use_anelastic_reference_pressure,
const amrex::Real  rdOcp,
const int  i,
const int  j,
const int  k 
)
noexcept
107 {
109  rho(i,j,k), tabs(i,j,k), pres(i,j,k), qv(i,j,k), rdOcp,
110  use_anelastic_reference_pressure);
111  theta(i,j,k) = theta_value;
112  states(i,j,k,RhoTheta_comp) = rho(i,j,k) * theta_value;
113  states(i,j,k,RhoQ1_comp) = rho(i,j,k) * amrex::max(amrex::Real(0), qv(i,j,k));
114  states(i,j,k,RhoQ2_comp) = rho(i,j,k) * amrex::max(amrex::Real(0), qc(i,j,k));
115  states(i,j,k,RhoQ3_comp) = rho(i,j,k) * amrex::max(amrex::Real(0), qi(i,j,k));
116  states(i,j,k,RhoQ4_comp) = rho(i,j,k) * amrex::max(amrex::Real(0), qr(i,j,k));
117  states(i,j,k,RhoQ5_comp) = rho(i,j,k) * amrex::max(amrex::Real(0), qs(i,j,k));
118  states(i,j,k,RhoQ6_comp) = rho(i,j,k) * amrex::max(amrex::Real(0), qg(i,j,k));
119 }
#define RhoQ4_comp
Definition: ERF_IndexDefines.H:48
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:40
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:46
#define RhoQ3_comp
Definition: ERF_IndexDefines.H:47
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:45
#define RhoQ6_comp
Definition: ERF_IndexDefines.H:50
#define RhoQ5_comp
Definition: ERF_IndexDefines.H:49
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:72
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real wsm6_theta_from_temperature_and_pressure(const amrex::Real rho, const amrex::Real temperature, const amrex::Real pressure, const amrex::Real qv, const amrex::Real configured_rdOcp, const bool use_anelastic_reference_pressure) noexcept
Definition: ERF_WSM6.H:78
@ theta
Definition: ERF_WSM6.H:23
@ qv
Definition: ERF_WSM6.H:26
@ rho
Definition: ERF_WSM6.H:22
@ pres
Definition: ERF_WSM6.H:25
@ tabs
Definition: ERF_WSM6.H:24
@ qg
Definition: ERF_WSM6.H:278
@ qc
Definition: ERF_WSM6.H:274
@ qi
Definition: ERF_WSM6.H:275
@ qs
Definition: ERF_WSM6.H:277
@ qr
Definition: ERF_WSM6.H:276

Referenced by WSM6::Copy_Micro_to_State().

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

◆ wsm6_copy_state_to_micro_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_copy_state_to_micro_cell ( const amrex::Array4< const amrex::Real > &  states,
const amrex::Array4< const amrex::Real > &  base,
const amrex::Array4< amrex::Real > &  rho,
const amrex::Array4< amrex::Real > &  theta,
const amrex::Array4< amrex::Real > &  tabs,
const amrex::Array4< amrex::Real > &  pres,
const amrex::Array4< amrex::Real > &  qv,
const amrex::Array4< amrex::Real > &  qc,
const amrex::Array4< amrex::Real > &  qi,
const amrex::Array4< amrex::Real > &  qr,
const amrex::Array4< amrex::Real > &  qs,
const amrex::Array4< amrex::Real > &  qg,
const amrex::Real  rdOcp,
const bool  use_anelastic_reference_pressure,
const int  i,
const int  j,
const int  k 
)
noexcept
56 {
57  const amrex::Real rho_value = states(i,j,k,Rho_comp);
58  const amrex::Real rho_theta = states(i,j,k,RhoTheta_comp);
59  rho(i,j,k) = rho_value;
60  theta(i,j,k) = rho_theta / rho_value;
61  qv(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ1_comp) / rho_value);
62  qc(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ2_comp) / rho_value);
63  qi(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ3_comp) / rho_value);
64  qr(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ4_comp) / rho_value);
65  qs(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ5_comp) / rho_value);
66  qg(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ6_comp) / rho_value);
67 
68  const amrex::Real p0 = use_anelastic_reference_pressure
69  ? base(i,j,k,BaseState::p0_comp) : amrex::Real(0.0);
71  rho_value, rho_theta, qv(i,j,k), rdOcp,
72  use_anelastic_reference_pressure, p0);
73  tabs(i,j,k) = thermo.temperature;
74  pres(i,j,k) = thermo.pressure_pa;
75 }
#define Rho_comp
Definition: ERF_IndexDefines.H:39
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE MicrophysicsThermoState diagnose_microphysics_thermo_state(const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real qv, const amrex::Real rdOcp, const bool use_anelastic_reference_pressure, const amrex::Real p0) noexcept
Definition: ERF_MicrophysicsUtils.H:35
@ p0_comp
Definition: ERF_IndexDefines.H:77
Definition: ERF_ConsoleIO.cpp:15
real(c_double), parameter p0
Definition: ERF_module_model_constants.F90:40
Definition: ERF_MicrophysicsUtils.H:22
amrex::Real pressure_pa
Definition: ERF_MicrophysicsUtils.H:23
amrex::Real temperature
Definition: ERF_MicrophysicsUtils.H:24
Here is the call graph for this function:

◆ wsm6_theta_from_temperature_and_pressure()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real wsm6_theta_from_temperature_and_pressure ( const amrex::Real  rho,
const amrex::Real  temperature,
const amrex::Real  pressure,
const amrex::Real  qv,
const amrex::Real  configured_rdOcp,
const bool  use_anelastic_reference_pressure 
)
noexcept
85 {
86  return use_anelastic_reference_pressure
87  ? getThgivenTandP(temperature, pressure, configured_rdOcp)
88  : getThgivenRandT(rho, temperature, RdoCp, qv);
89 }
constexpr amrex::Real RdoCp
Definition: ERF_Constants.H:41
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 getThgivenRandT(const amrex::Real rho, const amrex::Real T, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:64

Referenced by wsm6_copy_micro_to_state_cell().

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