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

Go to the source code of this file.

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real calc_saturation_vapor_pressure (const amrex::Real T, const int type)
 

Function Documentation

◆ calc_saturation_vapor_pressure()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real calc_saturation_vapor_pressure ( const amrex::Real  T,
const int  type 
)

Helper function to calculate saturation vapor pressure for water or ice. This corresponds to the POLYSVP function in the Fortran code (line ~5580).

Parameters
[in]TTemperature in Kelvin
[in]type0 for liquid water, 1 for ice
Returns
Saturation vapor pressure in Pascals
37 {
39  amrex::Real del_T = T - Real(273.15); // Convert to Celsius
40 
41  if (type == 1) { // Ice (lines ~5631-5644)
42  if (T >= Real(195.8)) {
43  // Flatau et al. formula for ice
44  const amrex::Real a0i = Real(6.11147274);
45  const amrex::Real a1i = Real(0.503160820);
46  const amrex::Real a2i = Real(0.188439774e-1);
47  const amrex::Real a3i = Real(0.420895665e-3);
48  const amrex::Real a4i = Real(0.615021634e-5);
49  const amrex::Real a5i = Real(0.602588177e-7);
50  const amrex::Real a6i = Real(0.385852041e-9);
51  const amrex::Real a7i = Real(0.146898966e-11);
52  const amrex::Real a8i = Real(0.252751365e-14);
53 
54  polysvp = a0i + del_T*(a1i + del_T*(a2i + del_T*(a3i + del_T*(a4i + del_T*(a5i + del_T*(a6i + del_T*(a7i + a8i*del_T)))))));
55  polysvp *= Real(100.0); // Convert from hPa to Pa
56  } else {
57  // Goff-Gratch formula for ice at cold temperatures
58  polysvp = std::pow(Real(10.0), (-Real(9.09718)*(Real(273.16)/T-one) - Real(3.56654)*std::log10(Real(273.16)/T) +
59  Real(0.876793)*(one-T/Real(273.16)) + std::log10(Real(6.1071)))) * Real(100.0);
60  } // T
61  } else { // Water (lines ~5648-5665)
62  if (T >= Real(202.0)) {
63  // Flatau et al. formula for liquid water
64  const amrex::Real a0 = Real(6.11239921);
65  const amrex::Real a1 = Real(0.443987641);
66  const amrex::Real a2 = Real(0.142986287e-1);
67  const amrex::Real a3 = Real(0.264847430e-3);
68  const amrex::Real a4 = Real(0.302950461e-5);
69  const amrex::Real a5 = Real(0.206739458e-7);
70  const amrex::Real a6 = Real(0.640689451e-10);
71  const amrex::Real a7 = -Real(0.952447341e-13);
72  const amrex::Real a8 = -Real(0.976195544e-15);
73 
74  polysvp = a0 + del_T*(a1 + del_T*(a2 + del_T*(a3 + del_T*(a4 + del_T*(a5 + del_T*(a6 + del_T*(a7 + a8*del_T)))))));
75  polysvp *= Real(100.0); // Convert from hPa to Pa
76  } else {
77  // Goff-Gratch formula for water at cold temperatures
78  polysvp = std::pow(Real(10.0), (-Real(7.90298)*(Real(373.16)/T-one) + Real(5.02808)*std::log10(Real(373.16)/T) -
79  Real(1.3816e-7)*(std::pow(Real(10.0), (Real(11.344)*(one-T/Real(373.16))))-one) +
80  Real(8.1328e-3)*(std::pow(Real(10.0), (-Real(3.49149)*(Real(373.16)/T-one)))-one) +
81  std::log10(Real(1013.246)))) * Real(100.0);
82  }
83  }
84 
85  return polysvp;
86 }
constexpr amrex::Real one
Definition: ERF_Constants.H:7
Real T
Definition: ERF_InitCustomPert_Bubble.H:105
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter a2
Definition: ERF_module_model_constants.F90:95
real(c_double), parameter a3
Definition: ERF_module_model_constants.F90:96
real(c_double), parameter a4
Definition: ERF_module_model_constants.F90:97
real(c_double) function, public polysvp(T, TYPE)
Definition: ERF_module_mp_morr_two_moment.F90:4021

Referenced by Morrison::Advance().

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