ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_WDM6.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_MicrophysicsColumns.H"
#include "ERF_MicrophysicsUtils.H"
#include "ERF_NullMoist.H"
#include "ERF_SurfacePrecipitation.H"
Include dependency graph for ERF_WDM6.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  WDM6
 

Namespaces

 MicVar_WDM6
 
 WDM6Sed
 

Enumerations

enum  {
  MicVar_WDM6::rho = 0 , MicVar_WDM6::theta , MicVar_WDM6::tabs , MicVar_WDM6::pres ,
  MicVar_WDM6::qv , MicVar_WDM6::qc , MicVar_WDM6::qi , MicVar_WDM6::qr ,
  MicVar_WDM6::qs , MicVar_WDM6::qg , MicVar_WDM6::nn , MicVar_WDM6::nc ,
  MicVar_WDM6::nr , MicVar_WDM6::rain_accum , MicVar_WDM6::snow_accum , MicVar_WDM6::graupel_accum ,
  MicVar_WDM6::precip_accum , MicVar_WDM6::NumVars
}
 
enum  {
  WDM6Sed::qi = 0 , WDM6Sed::qr , WDM6Sed::qs , WDM6Sed::qg ,
  WDM6Sed::nr , WDM6Sed::NumComps
}
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wdm6_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 wdm6_theta_from_temperature_and_pressure (const amrex::Real temperature, const amrex::Real pressure, const amrex::Real configured_rdOcp, const bool use_anelastic_reference_pressure) noexcept
 
constexpr amrex::Real wdm6_literal (double d)
 

Function Documentation

◆ wdm6_copy_state_to_micro_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wdm6_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
61 {
62  const amrex::Real rho_value = states(i,j,k,Rho_comp);
63  const amrex::Real rho_theta = states(i,j,k,RhoTheta_comp);
64  rho(i,j,k) = rho_value;
65  theta(i,j,k) = rho_theta / rho_value;
66  qv(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ1_comp) / rho_value);
67  qc(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ2_comp) / rho_value);
68  qi(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ3_comp) / rho_value);
69  qr(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ4_comp) / rho_value);
70  qs(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ5_comp) / rho_value);
71  qg(i,j,k) = amrex::max(amrex::Real(0.0), states(i,j,k,RhoQ6_comp) / rho_value);
72 
73  const amrex::Real p0 = use_anelastic_reference_pressure
74  ? base(i,j,k,BaseState::p0_comp) : amrex::Real(0.0);
76  rho_value, rho_theta, qv(i,j,k), rdOcp,
77  use_anelastic_reference_pressure, p0);
78  tabs(i,j,k) = thermo.temperature;
79  pres(i,j,k) = thermo.pressure_pa;
80 }
#define Rho_comp
Definition: ERF_IndexDefines.H:53
#define RhoQ4_comp
Definition: ERF_IndexDefines.H:69
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:54
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:67
#define RhoQ3_comp
Definition: ERF_IndexDefines.H:68
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:66
#define RhoQ6_comp
Definition: ERF_IndexDefines.H:71
#define RhoQ5_comp
Definition: ERF_IndexDefines.H:70
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:72
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
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ p0_comp
Definition: ERF_IndexDefines.H:98
@ qv
Definition: ERF_WDM6.H:27
@ qc
Definition: ERF_WDM6.H:28
@ pres
Definition: ERF_WDM6.H:26
@ theta
Definition: ERF_WDM6.H:24
@ rho
Definition: ERF_WDM6.H:23
@ tabs
Definition: ERF_WDM6.H:25
@ qr
Definition: ERF_WDM6.H:112
@ qs
Definition: ERF_WDM6.H:112
@ qg
Definition: ERF_WDM6.H:112
@ qi
Definition: ERF_WDM6.H:112
Definition: ERF_ConsoleIO.cpp:17
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:

◆ wdm6_literal()

constexpr amrex::Real wdm6_literal ( double  d)
constexpr
99 {
100 #ifdef ERF_WDM6_F32_LITERALS
101  // Match the Fortran as compiled today: its literals carry no kind suffix,
102  // so they are evaluated in single precision and then widened.
103  return amrex::Real(static_cast<float>(d));
104 #else
105  // True doubles. Correct when the Fortran is built -fdefault-real-8.
106  return amrex::Real(d);
107 #endif
108 }

Referenced by WDM6::AdvanceColumns(), WDM6::initialize_coeffs(), wdm6_diffus(), wdm6_lamdac_exact(), wdm6_lamdar(), wdm6_nislfv_rain_plm6_column(), wdm6_slope_rain_cell(), wdm6_venfac(), and wdm6_viscos().

Here is the caller graph for this function:

◆ wdm6_theta_from_temperature_and_pressure()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real wdm6_theta_from_temperature_and_pressure ( const amrex::Real  temperature,
const amrex::Real  pressure,
const amrex::Real  configured_rdOcp,
const bool  use_anelastic_reference_pressure 
)
noexcept
88 {
89  const amrex::Real theta_rdOcp = use_anelastic_reference_pressure
90  ? configured_rdOcp : RdoCp;
91  return getThgivenTandP(temperature, pressure, theta_rdOcp);
92 }
constexpr amrex::Real RdoCp
Definition: ERF_Constants.H:57
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

Referenced by WDM6::AdvanceColumns().

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