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

#include <ERF_MaterialProperties.H>

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_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_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...
 
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 Attributes

Species::Name m_name = Species::Name::none
 
amrex::Real m_density = DBL_MAX
 
amrex::Real m_ionization = DBL_MAX
 
amrex::Real m_mol_weight = DBL_MAX
 
amrex::Real m_lat_vap = DBL_MAX
 
amrex::Real m_Rv = DBL_MAX
 
amrex::Real m_Tc = DBL_MAX
 
amrex::Real m_Tb = DBL_MAX
 
amrex::Real m_Nav_by_molweight = DBL_MAX
 
amrex::Real m_mol_Cp_coeffs [7]
 
bool m_is_soluble = false
 
bool m_is_water = false
 
decltype(saturation_funcs::compute_saturation_pressure_null) * m_saturation_pressure_func = nullptr
 
decltype(saturation_funcs::compute_saturation_vapfrac_null) * m_saturation_vapfrac_func = nullptr
 

Static Public Attributes

static constexpr amrex::Real s_N_av = 6.02214076e23
 
static constexpr amrex::Real s_kb = 1.380649e-23
 
static constexpr amrex::Real s_mol_weight_air = 0.0289647
 
static constexpr amrex::Real s_sigma_air = 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.

57 {
58  m_name = a_name;
59 
60  if (a_name == Species::Name::H2O) {
62  } else if (a_name == Species::Name::water) {
64  } else if (a_name == Species::Name::agua) {
66  } else if (a_name == Species::Name::NaCl) {
68  } else if (a_name == Species::Name::NH42SO4) {
70  } else if (a_name == Species::Name::NH4HSO4) {
72  } else if (a_name == Species::Name::soil) {
74  } else {
75  amrex::Abort("ERROR: undefined material in MaterialProperties()");
76  }
77  m_is_soluble = (m_ionization > 0);
78 }
AMREX_GPU_HOST_DEVICE void setProperties_water()
Set this material to water.
Definition: ERF_MaterialProperties.cpp:122
AMREX_GPU_HOST_DEVICE void setProperties_NH4HSO4()
Set this material to ammonium bisulfate.
Definition: ERF_MaterialProperties.cpp:158
AMREX_GPU_HOST_DEVICE void setProperties_soil()
Set this material to soil.
Definition: ERF_MaterialProperties.cpp:170
AMREX_GPU_HOST_DEVICE void setProperties_NH42SO4()
Set this material to ammonium sulfate.
Definition: ERF_MaterialProperties.cpp:146
AMREX_GPU_HOST_DEVICE void setProperties_NaCl()
Set this material to NaCl.
Definition: ERF_MaterialProperties.cpp:134
amrex::Real m_ionization
Definition: ERF_MaterialProperties.H:62
AMREX_GPU_HOST_DEVICE void setProperties_H2O()
Set this material to H20.
Definition: ERF_MaterialProperties.cpp:102
AMREX_GPU_HOST_DEVICE void setProperties_agua()
Set this material to agua.
Definition: ERF_MaterialProperties.cpp:128
bool m_is_soluble
Definition: ERF_MaterialProperties.H:77
Species::Name m_name
Definition: ERF_MaterialProperties.H:60

◆ MaterialProperties() [2/2]

AMREX_GPU_HOST_DEVICE MaterialProperties::MaterialProperties ( const MaterialProperties a_matprop)

Copy constructor.

82 {
83  m_name = a_matprop.m_name;
84  m_density = a_matprop.m_density;
85  m_ionization = a_matprop.m_ionization;
86  m_mol_weight = a_matprop.m_mol_weight;
87  m_lat_vap = a_matprop.m_lat_vap;
88  m_Rv = a_matprop.m_Rv;
89  m_Tc = a_matprop.m_Tc;
90  m_Tb = a_matprop.m_Tb;
92  for (auto i = 0; i < 7; i++) { m_mol_Cp_coeffs[i] = a_matprop.m_mol_Cp_coeffs[i]; }
93  m_is_soluble = a_matprop.m_is_soluble;
94  m_is_water = a_matprop.m_is_water;
95  AMREX_IF_ON_HOST((
98  ))
99 }
amrex::Real m_mol_weight
Definition: ERF_MaterialProperties.H:63
amrex::Real m_Tb
Definition: ERF_MaterialProperties.H:67
amrex::Real m_Nav_by_molweight
Definition: ERF_MaterialProperties.H:68
decltype(saturation_funcs::compute_saturation_pressure_null) * m_saturation_pressure_func
Definition: ERF_MaterialProperties.H:80
amrex::Real m_mol_Cp_coeffs[7]
Definition: ERF_MaterialProperties.H:70
amrex::Real m_Tc
Definition: ERF_MaterialProperties.H:66
amrex::Real m_Rv
Definition: ERF_MaterialProperties.H:65
bool m_is_water
Definition: ERF_MaterialProperties.H:78
amrex::Real m_density
Definition: ERF_MaterialProperties.H:61
amrex::Real m_lat_vap
Definition: ERF_MaterialProperties.H:64
decltype(saturation_funcs::compute_saturation_vapfrac_null) * m_saturation_vapfrac_func
Definition: ERF_MaterialProperties.H:82

◆ ~MaterialProperties()

AMREX_GPU_HOST_DEVICE MaterialProperties::~MaterialProperties ( )
default

Default destructor.

Member Function Documentation

◆ coeffCurv()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real MaterialProperties::coeffCurv ( const amrex::Real  a_T) const
inline

Return the coeff of curvature given the temperature.

165  {
166  auto surf_tens = surfaceTension(a_T);
167  auto retval = 2 * surf_tens / (m_Rv * m_density);
168  return retval;
169  }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real surfaceTension(const amrex::Real a_T) const
Compute the surface tension coeff given temperature.
Definition: ERF_MaterialProperties.H:150
Here is the call graph for this function:

◆ coeffMolecularDiffusion()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real MaterialProperties::coeffMolecularDiffusion ( const amrex::Real  a_T,
const amrex::Real  a_P 
) const
inline

Return the molecular diffusion coefficient given temperature and pressure.

185  {
186  if (m_is_water) {
187 
188  return diffelq; // from ERF_Constants.H (2.21e-05 [m^2 s^{-1}])
189 
190  } else {
191 
192  auto mol_weight_v = s_N_av/m_Nav_by_molweight;
193  auto sigma = 1.18e-8 * std::cbrt(mol_weight_v/m_density);
194  auto sigma_v_air = 0.5 * (sigma + s_sigma_air);
195 
196  auto eps_v = 1.15 * m_Tb * s_kb;
197  auto eps_v_air = std::sqrt( eps_v * s_eps_air_k * s_kb);
198  auto T_star = a_T / (eps_v_air/s_kb);
199 
200  auto omegaD = 1.06036 / std::pow(T_star, 0.1561)
201  + 0.193 / std::exp(0.47635*T_star)
202  + 1.03587 / std::exp(1.52996*T_star)
203  + 1.76474 / std::exp(3.89411*T_star);
204 
205  auto term1 = 3 * std::sqrt( s_kb*a_T * s_kb*a_T * s_kb*a_T);
206  auto term2 = 8.0 * std::sqrt(2*PI) * a_P * sigma_v_air*sigma_v_air * omegaD;
207  auto term3 = std::sqrt( m_Nav_by_molweight + s_N_av/s_mol_weight_air );
208 
209  auto retval = term1*term3/term2;
210  return retval;
211  }
212  }
constexpr amrex::Real diffelq
Definition: ERF_Constants.H:73
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
static constexpr amrex::Real s_mol_weight_air
Definition: ERF_MaterialProperties.H:54
static constexpr amrex::Real s_sigma_air
Definition: ERF_MaterialProperties.H:56
static constexpr amrex::Real s_eps_air_k
Definition: ERF_MaterialProperties.H:58
static constexpr amrex::Real s_N_av
Definition: ERF_MaterialProperties.H:50
static constexpr amrex::Real s_kb
Definition: ERF_MaterialProperties.H:51

◆ coeffVPSolute()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real MaterialProperties::coeffVPSolute ( ) const
inline

Return the vapour pressure coefficient.

174  {
175  auto retval = (0.75/PI)*(m_mol_weight/m_density);
176  if (m_is_water) {
177  retval = 4.3e-06;
178  }
179  return retval;
180  }

◆ computeSaturationPressure()

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

Compute saturation pressure.

217  {
218  m_saturation_pressure_func(a_e, a_T);
219  }

◆ 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.

226  {
227  m_saturation_vapfrac_func(a_S, a_T, a_p);
228  }

◆ molarHeatCapacity()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real MaterialProperties::molarHeatCapacity ( const amrex::Real  a_T) const
inline

Return the molar heat capacity.

138  {
139  auto retval = 0.0;
140  auto term = 1.0;
141  for (auto i = 0; i < 7; i++) {
142  retval += (m_mol_Cp_coeffs[i] * term);
143  term *= a_T;
144  }
145  return retval;
146  }

Referenced by surfaceTension().

Here is the caller graph for this function:

◆ print()

AMREX_GPU_HOST void MaterialProperties::print ( ) const
inline

Print parameters.

98  {
99  amrex::Print() << "Material properties of " << amrex::getEnumNameString(m_name) << ":\n";
100  amrex::Print() << " density: " << m_density << "\n";
101  amrex::Print() << " ionization: " << m_ionization << "\n";
102  amrex::Print() << " mol. weight: " << m_mol_weight << "\n";
103  amrex::Print() << " latent heat (vap.): " << m_lat_vap << "\n";
104  amrex::Print() << " Rv: " << m_Rv << "\n";
105  amrex::Print() << " Tc: " << m_Tc << "\n";
106  amrex::Print() << " Tb: " << m_Tb << "\n";
107  amrex::Print() << " N_av/mol.weight: " << m_Nav_by_molweight << "\n";
108  amrex::Print() << " mol. Cp coeffs: ";
109  for (int i = 0; i < 7; i++) { amrex::Print() << m_mol_Cp_coeffs[i] << ", "; }
110  amrex::Print() << "\n";
111  }

◆ setProperties_agua()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_agua ( )

Set this material to agua.

129 {
131 }

◆ setProperties_H2O()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_H2O ( )

Set this material to H20.

103 {
104  m_density = rhor; // ERF_Constants.H
105 
106  m_ionization = 0;
107  m_mol_weight = 1.802e-02; // kg mol^-1
108  m_lat_vap = L_v; // ERF_Constants.H
109  m_Rv = R_v; // ERF_Constants.H
110  m_Tb = 373.15; // K
112  m_is_water = true;
113 
114  AMREX_IF_ON_HOST((
117  ))
118 
119 }
constexpr amrex::Real R_v
Definition: ERF_Constants.H:11
constexpr amrex::Real rhor
Definition: ERF_Constants.H:28
constexpr amrex::Real L_v
Definition: ERF_Constants.H:16
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:32
AMREX_GPU_HOST void compute_saturation_pressure_H2O(MultiFab &a_mf_sat_pressure, const MultiFab &a_mf_temperature)
Definition: ERF_MaterialProperties.cpp:12
Here is the call graph for this function:

◆ setProperties_NaCl()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_NaCl ( )

Set this material to NaCl.

135 {
136  m_density = 2170.0;
137 
138  m_ionization = 2;
139  m_mol_weight = 5.844e-02; //kg mol^-1
140 
141  m_saturation_pressure_func = nullptr;
142  m_saturation_vapfrac_func = nullptr;
143 }

◆ setProperties_NH42SO4()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_NH42SO4 ( )

Set this material to ammonium sulfate.

147 {
148  m_density = 1770.0;
149 
150  m_ionization = 3; // 2xNH4 + 1xSO4
151  m_mol_weight = 1.3214e-01; //kg mol^-1
152 
153  m_saturation_pressure_func = nullptr;
154  m_saturation_vapfrac_func = nullptr;
155 }

◆ setProperties_NH4HSO4()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_NH4HSO4 ( )

Set this material to ammonium bisulfate.

159 {
160  m_density = 1780.0;
161 
162  m_ionization = 2; // NH4+ and HSO4-
163  m_mol_weight = 1.1511e-01; //kg mol^-1
164 
165  m_saturation_pressure_func = nullptr;
166  m_saturation_vapfrac_func = nullptr;
167 }

◆ setProperties_soil()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_soil ( )

Set this material to soil.

171 {
172  m_density = 1220.0; // loose dry dirt
173 
174  m_ionization = 0;
175 
176  m_saturation_pressure_func = nullptr;
177  m_saturation_vapfrac_func = nullptr;
178 }

◆ setProperties_water()

AMREX_GPU_HOST_DEVICE void MaterialProperties::setProperties_water ( )

Set this material to water.

123 {
125 }

◆ surfaceTension()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real MaterialProperties::surfaceTension ( const amrex::Real  a_T) const
inline

Compute the surface tension coeff given temperature.

151  {
152  if (m_is_water) {
153  return amrex::Real(0.076148325); // N m^{-1}
154  } else {
155  auto term1 = 6.0 * std::cbrt(s_N_av);
156  auto term2 = std::cbrt((m_density/m_mol_weight)*(m_density/m_mol_weight));
157  auto retval = molarHeatCapacity(a_T)*(term2/term1)*(m_Tc - a_T);
158  return retval;
159  }
160  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real molarHeatCapacity(const amrex::Real a_T) const
Return the molar heat capacity.
Definition: ERF_MaterialProperties.H:137

Referenced by coeffCurv().

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

Member Data Documentation

◆ m_density

amrex::Real MaterialProperties::m_density = DBL_MAX

◆ m_ionization

amrex::Real MaterialProperties::m_ionization = DBL_MAX

ionization

Referenced by MaterialProperties(), and print().

◆ m_is_soluble

bool MaterialProperties::m_is_soluble = false

is soluble in water?

Referenced by MaterialProperties().

◆ m_is_water

bool MaterialProperties::m_is_water = false

◆ m_lat_vap

amrex::Real MaterialProperties::m_lat_vap = DBL_MAX

latent heat of vaporization

Referenced by MaterialProperties(), and print().

◆ m_mol_Cp_coeffs

amrex::Real MaterialProperties::m_mol_Cp_coeffs[7]
Initial value:
= { amrex::Real(DBL_MAX),
amrex::Real(DBL_MAX),
amrex::Real(DBL_MAX),
amrex::Real(DBL_MAX),
amrex::Real(DBL_MAX),
amrex::Real(DBL_MAX),
amrex::Real(DBL_MAX) }

vector of molar heat capacity polynomial coeffs

Referenced by MaterialProperties(), molarHeatCapacity(), and print().

◆ m_mol_weight

amrex::Real MaterialProperties::m_mol_weight = DBL_MAX

molecular weight (condensate)

Referenced by coeffVPSolute(), MaterialProperties(), print(), and surfaceTension().

◆ m_name

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

name

Referenced by MaterialProperties(), and print().

◆ m_Nav_by_molweight

amrex::Real MaterialProperties::m_Nav_by_molweight = DBL_MAX

Avogadro number by vapour mol. weight

Referenced by coeffMolecularDiffusion(), MaterialProperties(), and print().

◆ m_Rv

amrex::Real MaterialProperties::m_Rv = DBL_MAX

gas constant for vapour of this material

Referenced by coeffCurv(), 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().

◆ m_Tb

amrex::Real MaterialProperties::m_Tb = DBL_MAX

boiling temperature

Referenced by coeffMolecularDiffusion(), MaterialProperties(), and print().

◆ m_Tc

amrex::Real MaterialProperties::m_Tc = DBL_MAX

critical temperature for surface tension

Referenced by MaterialProperties(), print(), and surfaceTension().

◆ s_eps_air_k

constexpr amrex::Real MaterialProperties::s_eps_air_k = 97
staticconstexpr

Temperature parameter for air [K]

Referenced by coeffMolecularDiffusion().

◆ s_kb

constexpr amrex::Real MaterialProperties::s_kb = 1.380649e-23
staticconstexpr

Boltzmann constant [J K^{-1}]

Referenced by coeffMolecularDiffusion().

◆ s_mol_weight_air

constexpr amrex::Real MaterialProperties::s_mol_weight_air = 0.0289647
staticconstexpr

Molecular weight of air [kg mol^{-1}]

Referenced by coeffMolecularDiffusion().

◆ s_N_av

constexpr amrex::Real MaterialProperties::s_N_av = 6.02214076e23
staticconstexpr

Avogadro's number

Referenced by coeffMolecularDiffusion(), and surfaceTension().

◆ s_sigma_air

constexpr amrex::Real MaterialProperties::s_sigma_air = 3.62e-10
staticconstexpr

Molecular length scale of air [m]

Referenced by coeffMolecularDiffusion().


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