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

#include <ERF_MaterialProperties.H>

Inheritance diagram for MaterialProperties:
Collaboration diagram for MaterialProperties:

Public Member Functions

AMREX_GPU_HOST_DEVICE MaterialProperties (const Species::Name &a_name)
 Constructor. More...
 
AMREX_GPU_HOST_DEVICE MaterialProperties (const MaterialProperties &a_matprop)
 Copy constructor. More...
 
AMREX_GPU_HOST_DEVICE ~MaterialProperties ()=default
 Default destructor. More...
 
AMREX_GPU_HOST void print () const
 Print parameters. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_H2O ()
 Set this material to H20. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_ice ()
 Set this material to ice. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_water ()
 Set this material to water. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_agua ()
 Set this material to agua. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_NaCl ()
 Set this material to NaCl. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_NH42SO4 ()
 Set this material to ammonium sulfate. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_NH4HSO4 ()
 Set this material to ammonium bisulfate. More...
 
AMREX_GPU_HOST_DEVICE void setProperties_soil ()
 Set this material to soil. More...
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void computeSaturationPressure (amrex::MultiFab &a_e, const amrex::MultiFab &a_T) const
 Compute saturation pressure. More...
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void computeSaturationVapFrac (amrex::MultiFab &a_S, const amrex::MultiFab &a_T, const amrex::MultiFab &a_p) const
 Compute saturation vapour fraction. More...
 
- Public Member Functions inherited from MaterialPropertiesCore
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real molarHeatCapacity (const amrex::Real a_T) const
 Return the molar heat capacity. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real surfaceTension (const amrex::Real a_T) const
 Compute the surface tension coeff given temperature. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real coeffCurv (const amrex::Real a_T) const
 Return the coeff of curvature given the temperature. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real coeffVPSolute () const
 Return the vapour pressure coefficient. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real coeffMolecularDiffusion (const amrex::Real a_T, const amrex::Real a_P) const
 Return the molecular diffusion coefficient given temperature and pressure. More...
 

Public Attributes

Species::Name m_name = Species::Name::none
 
decltype(saturation_funcs::compute_saturation_pressure_null) * m_saturation_pressure_func = nullptr
 
decltype(saturation_funcs::compute_saturation_vapfrac_null) * m_saturation_vapfrac_func = nullptr
 
- Public Attributes inherited from MaterialPropertiesCore
amrex::Real m_density = std::numeric_limits<double>::max()
 
amrex::Real m_ionization = std::numeric_limits<double>::max()
 
amrex::Real m_mol_weight = std::numeric_limits<double>::max()
 
amrex::Real m_lat_vap = std::numeric_limits<double>::max()
 
amrex::Real m_lat_fus = std::numeric_limits<double>::max()
 
amrex::Real m_Rv = std::numeric_limits<double>::max()
 
amrex::Real m_Tc = std::numeric_limits<double>::max()
 
amrex::Real m_Tb = std::numeric_limits<double>::max()
 
amrex::Real m_Nav_by_molweight = std::numeric_limits<float>::max()
 
amrex::Real m_mol_Cp_coeffs [7]
 
bool m_is_soluble = false
 
bool m_is_water = false
 
bool m_is_INP = false
 

Additional Inherited Members

- Static Public Attributes inherited from MaterialPropertiesCore
static constexpr amrex::Real s_N_av = amrex::Real(6.02214076e23)
 
static constexpr amrex::Real s_kb = amrex::Real(1.380649e-23)
 
static constexpr amrex::Real s_mol_weight_air = amrex::Real(0.0289647)
 
static constexpr amrex::Real s_sigma_air = amrex::Real(3.62e-10)
 
static constexpr amrex::Real s_eps_air_k = 97
 

Detailed Description

Class for material properties

Constructor & Destructor Documentation

◆ MaterialProperties() [1/2]

AMREX_GPU_HOST_DEVICE MaterialProperties::MaterialProperties ( const Species::Name &  a_name)

Constructor.

Initialize material properties based on species name.

Parameters
[in]a_nameName of the species.
115 {
116  m_name = a_name;
117 
118  if (a_name == Species::Name::H2O) {
120  } else if (a_name == Species::Name::ice) {
122  } else if (a_name == Species::Name::water) {
124  } else if (a_name == Species::Name::agua) {
126  } else if (a_name == Species::Name::NaCl) {
128  } else if (a_name == Species::Name::NH42SO4) {
130  } else if (a_name == Species::Name::NH4HSO4) {
132  } else if (a_name == Species::Name::soil) {
134  } else {
135  amrex::Abort("ERROR: undefined material in MaterialProperties()");
136  }
137  m_is_soluble = (m_ionization > 0);
138 }
amrex::Real m_ionization
Definition: ERF_MaterialProperties.H:84
bool m_is_soluble
Definition: ERF_MaterialProperties.H:101
AMREX_GPU_HOST_DEVICE void setProperties_water()
Set this material to water.
Definition: ERF_MaterialProperties.cpp:210
AMREX_GPU_HOST_DEVICE void setProperties_ice()
Set this material to ice.
Definition: ERF_MaterialProperties.cpp:190
AMREX_GPU_HOST_DEVICE void setProperties_NH4HSO4()
Set this material to ammonium bisulfate.
Definition: ERF_MaterialProperties.cpp:246
AMREX_GPU_HOST_DEVICE void setProperties_soil()
Set this material to soil.
Definition: ERF_MaterialProperties.cpp:258
AMREX_GPU_HOST_DEVICE void setProperties_NH42SO4()
Set this material to ammonium sulfate.
Definition: ERF_MaterialProperties.cpp:234
AMREX_GPU_HOST_DEVICE void setProperties_NaCl()
Set this material to NaCl.
Definition: ERF_MaterialProperties.cpp:222
AMREX_GPU_HOST_DEVICE void setProperties_H2O()
Set this material to H20.
Definition: ERF_MaterialProperties.cpp:169
AMREX_GPU_HOST_DEVICE void setProperties_agua()
Set this material to agua.
Definition: ERF_MaterialProperties.cpp:216
Species::Name m_name
Definition: ERF_MaterialProperties.H:189

◆ MaterialProperties() [2/2]

AMREX_GPU_HOST_DEVICE MaterialProperties::MaterialProperties ( const MaterialProperties a_matprop)

Copy constructor.

Copy constructor for material properties.

Parameters
[in]a_matpropSource material properties.
147 {
148  m_name = a_matprop.m_name;
149  m_density = a_matprop.m_density;
150  m_ionization = a_matprop.m_ionization;
151  m_mol_weight = a_matprop.m_mol_weight;
152  m_lat_vap = a_matprop.m_lat_vap;
153  m_lat_fus = a_matprop.m_lat_fus;
154  m_Rv = a_matprop.m_Rv;
155  m_Tc = a_matprop.m_Tc;
156  m_Tb = a_matprop.m_Tb;
158  for (auto i = 0; i < 7; i++) { m_mol_Cp_coeffs[i] = a_matprop.m_mol_Cp_coeffs[i]; }
159  m_is_soluble = a_matprop.m_is_soluble;
160  m_is_water = a_matprop.m_is_water;
161  m_is_INP = a_matprop.m_is_INP;
162  AMREX_IF_ON_HOST((
165  ))
166 }
amrex::Real m_mol_weight
Definition: ERF_MaterialProperties.H:85
bool m_is_water
Definition: ERF_MaterialProperties.H:102
bool m_is_INP
Definition: ERF_MaterialProperties.H:103
amrex::Real m_mol_Cp_coeffs[7]
Definition: ERF_MaterialProperties.H:94
amrex::Real m_Rv
Definition: ERF_MaterialProperties.H:88
amrex::Real m_Nav_by_molweight
Definition: ERF_MaterialProperties.H:91
amrex::Real m_lat_fus
Definition: ERF_MaterialProperties.H:87
amrex::Real m_Tb
Definition: ERF_MaterialProperties.H:90
amrex::Real m_density
Definition: ERF_MaterialProperties.H:83
amrex::Real m_lat_vap
Definition: ERF_MaterialProperties.H:86
amrex::Real m_Tc
Definition: ERF_MaterialProperties.H:89
decltype(saturation_funcs::compute_saturation_pressure_null) * m_saturation_pressure_func
Definition: ERF_MaterialProperties.H:192
decltype(saturation_funcs::compute_saturation_vapfrac_null) * m_saturation_vapfrac_func
Definition: ERF_MaterialProperties.H:195

◆ ~MaterialProperties()

AMREX_GPU_HOST_DEVICE MaterialProperties::~MaterialProperties ( )
default

Default destructor.

Member Function Documentation

◆ computeSaturationPressure()

AMREX_GPU_HOST AMREX_FORCE_INLINE void MaterialProperties::computeSaturationPressure ( amrex::MultiFab &  a_e,
const amrex::MultiFab &  a_T 
) const
inline

Compute saturation pressure.

255  {
256  m_saturation_pressure_func(a_e, a_T);
257  }

◆ computeSaturationVapFrac()

AMREX_GPU_HOST AMREX_FORCE_INLINE void MaterialProperties::computeSaturationVapFrac ( amrex::MultiFab &  a_S,
const amrex::MultiFab &  a_T,
const amrex::MultiFab &  a_p 
) const
inline

Compute saturation vapour fraction.

264  {
265  m_saturation_vapfrac_func(a_S, a_T, a_p);
266  }

◆ print()

AMREX_GPU_HOST void MaterialProperties::print ( ) const
inline

Print parameters.

211  {
212  amrex::Print() << "Material properties of " << amrex::getEnumNameString(m_name) << ":\n";
213  amrex::Print() << " density: " << m_density << "\n";
214  amrex::Print() << " ionization: " << m_ionization << "\n";
215  amrex::Print() << " mol. weight: " << m_mol_weight << "\n";
216  amrex::Print() << " latent heat (vap.): " << m_lat_vap << "\n";
217  amrex::Print() << " latent heat (fus.): " << m_lat_fus << "\n";
218  amrex::Print() << " Rv: " << m_Rv << "\n";
219  amrex::Print() << " Tc: " << m_Tc << "\n";
220  amrex::Print() << " Tb: " << m_Tb << "\n";
221  amrex::Print() << " N_av/mol.weight: " << m_Nav_by_molweight << "\n";
222  amrex::Print() << " mol. Cp coeffs: ";
223  for (int i = 0; i < 7; i++) { amrex::Print() << m_mol_Cp_coeffs[i] << ", "; }
224  amrex::Print() << "\n";
225  }

◆ setProperties_agua()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_agua ( )

Set this material to agua.

217 {
219 }

◆ setProperties_H2O()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_H2O ( )

Set this material to H20.

170 {
171  m_density = rhor; // ERF_Constants.H
172 
173  m_ionization = 0;
174  m_mol_weight = Real(1.802e-02); // kg mol^-1
175  m_lat_vap = L_v; // ERF_Constants.H
176  m_lat_fus = lfus; // ERF_Constants.H
177  m_Rv = R_v; // ERF_Constants.H
178  m_Tb = Real(373.15); // K
180  m_is_water = true;
181 
182  AMREX_IF_ON_HOST((
185  ))
186 
187 }
constexpr amrex::Real R_v
Definition: ERF_Constants.H:48
constexpr amrex::Real lfus
Definition: ERF_Constants.H:110
constexpr amrex::Real rhor
Definition: ERF_Constants.H:71
constexpr amrex::Real L_v
Definition: ERF_Constants.H:59
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST void compute_saturation_vapfrac_H2O(MultiFab &a_mf_sat_vapfrac, const MultiFab &a_mf_temperature, const MultiFab &a_mf_pressure)
Definition: ERF_MaterialProperties.cpp:62
AMREX_GPU_HOST void compute_saturation_pressure_H2O(MultiFab &a_mf_sat_pressure, const MultiFab &a_mf_temperature)
Definition: ERF_MaterialProperties.cpp:18
static constexpr amrex::Real s_N_av
Definition: ERF_MaterialProperties.H:62
Here is the call graph for this function:

◆ setProperties_ice()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_ice ( )

Set this material to ice.

191 {
192  m_density = amrex::Real(916.80); // kg m^{-3}
193 
194  m_ionization = 0;
195  m_mol_weight = amrex::Real(1.802e-02); // kg mol^-1
196  m_lat_vap = amrex::Real(2.8342e6); // J kg^{-1} (latent heat of sublimation)
197  m_lat_fus = lfus; // ERF_Constants.H
198  m_Rv = R_v; // ERF_Constants.H
199  m_Tb = tboil; // K
201 
202  AMREX_IF_ON_HOST((
205  ))
206 
207 }
constexpr amrex::Real tboil
Definition: ERF_Constants.H:132
AMREX_GPU_HOST void compute_saturation_pressure_ice(MultiFab &a_mf_sat_pressure, const MultiFab &a_mf_temperature)
Definition: ERF_MaterialProperties.cpp:35
AMREX_GPU_HOST void compute_saturation_vapfrac_ice(MultiFab &a_mf_sat_vapfrac, const MultiFab &a_mf_temperature, const MultiFab &a_mf_pressure)
Definition: ERF_MaterialProperties.cpp:85
Here is the call graph for this function:

◆ setProperties_NaCl()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_NaCl ( )

Set this material to NaCl.

223 {
224  m_density = Real(2170.0);
225 
226  m_ionization = 2;
227  m_mol_weight = Real(5.844e-02); //kg mol^-1
228 
229  m_saturation_pressure_func = nullptr;
230  m_saturation_vapfrac_func = nullptr;
231 }

◆ setProperties_NH42SO4()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_NH42SO4 ( )

Set this material to ammonium sulfate.

235 {
236  m_density = Real(1770.0);
237 
238  m_ionization = 3; // 2xNH4 + 1xSO4
239  m_mol_weight = Real(1.3214e-01); //kg mol^-1
240 
241  m_saturation_pressure_func = nullptr;
242  m_saturation_vapfrac_func = nullptr;
243 }

◆ setProperties_NH4HSO4()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_NH4HSO4 ( )

Set this material to ammonium bisulfate.

247 {
248  m_density = Real(1780.0);
249 
250  m_ionization = 2; // NH4+ and HSO4-
251  m_mol_weight = Real(1.1511e-01); //kg mol^-1
252 
253  m_saturation_pressure_func = nullptr;
254  m_saturation_vapfrac_func = nullptr;
255 }

◆ setProperties_soil()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_soil ( )

Set this material to soil.

259 {
260  m_density = Real(1220.0); // loose dry dirt
261 
262  m_ionization = 0;
263  m_is_INP = true; // soil/mineral dust can act as ice nucleating particle
264 
265  m_saturation_pressure_func = nullptr;
266  m_saturation_vapfrac_func = nullptr;
267 }

◆ setProperties_water()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_water ( )

Set this material to water.

211 {
213 }

Member Data Documentation

◆ m_name

Species::Name MaterialProperties::m_name = Species::Name::none

name

Referenced by MaterialProperties(), and print().

◆ m_saturation_pressure_func

decltype(saturation_funcs::compute_saturation_pressure_null) * MaterialProperties::m_saturation_pressure_func = nullptr

pointer to function to compute saturation pressure

Referenced by computeSaturationPressure(), and MaterialProperties().

◆ m_saturation_vapfrac_func

decltype(saturation_funcs::compute_saturation_vapfrac_null) * MaterialProperties::m_saturation_vapfrac_func = nullptr

pointer to function to compute vapour fraction

Referenced by computeSaturationVapFrac(), and MaterialProperties().


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