2 #include <application/application.hpp>
6 #include <configure.hpp>
19 std::vector<IndexSet>
const& cloud_index_set) {
21 if (!pindex->HasVapor(
"H2O"))
return;
23 Application::Logger app(
"snap");
24 app->Log(
"Enrolling H2O vapor pressures");
26 int iH2O = pindex->GetVaporId(
"H2O");
28 svp_func1[iH2O][0] = [](
AirParcel const& qfrac, int, int) {
32 for (
int n = 1; n < cloud_index_set[iH2O].size(); ++n) {
39 std::vector<IndexSet>
const& cloud_index_set) {
41 if (!pindex->HasVapor(
"NH3"))
return;
43 Application::Logger app(
"snap");
44 app->Log(
"Enrolling NH3 vapor pressures");
46 int iNH3 = pindex->GetVaporId(
"NH3");
48 svp_func1[iNH3][0] = [](
AirParcel const& qfrac, int, int) {
52 for (
int n = 1; n < cloud_index_set[iNH3].size(); ++n) {
59 std::vector<IndexSet>
const& cloud_index_set) {
61 if (!pindex->HasVapor(
"H2S"))
return;
63 Application::Logger app(
"snap");
64 app->Log(
"Enrolling H2S vapor pressures");
66 int iH2S = pindex->GetVaporId(
"H2S");
68 svp_func1[iH2S][0] = [](
AirParcel const& qfrac, int, int) {
72 for (
int n = 1; n < cloud_index_set[iH2S].size(); ++n) {
80 std::map<IndexPair, ReactionInfo>& cloud_reaction_map) {
82 if (!pindex->HasVapor(
"NH3") || !pindex->HasVapor(
"H2S") ||
83 !pindex->HasCloud(
"NH4SH(s)"))
86 Application::Logger app(
"snap");
87 app->Log(
"Enrolling NH4SH vapor pressure");
90 int iNH3 = pindex->GetVaporId(
"NH3");
91 int iH2S = pindex->GetVaporId(
"H2S");
92 int iNH4SH = pindex->GetCloudId(
"NH4SH(s)");
94 auto ij = std::minmax(iNH3, iH2S);
96 svp_func2[ij] = [](
AirParcel const& qfrac, int, int, int) {
100 cloud_reaction_map[ij] = std::make_pair<ReactionIndx, ReactionStoi>(
101 {iNH3, iH2S, iNH4SH}, {1, 1, 1});
105 Application::Logger app(
"snap");
106 app->Log(
"Enrolling vapor functions");
double sat_vapor_p_NH3_BriggsS(double T)
double sat_vapor_p_NH4SH_Lewis(double T)
static IndexMap const * GetInstance()
void enrollVaporFunctions()
custom functions for vapor (to be overridden by user mods)
std::map< IndexPair, ReactionInfo > cloud_reaction_map_
reaction information map
std::vector< IndexSet > cloud_index_set_
cloud index set
std::vector< std::vector< SatVaporPresFunc1 > > SVPFunc1Container
std::map< IndexPair, SatVaporPresFunc2 > SVPFunc2Container
SVPFunc1Container svp_func1_
saturation vapor pressure function: Vapor -> Cloud
SVPFunc2Container svp_func2_
saturation vapor pressure function: Vapor + Vapor -> Cloud
Real NullSatVaporPres1(AirParcel const &air, int i, int j)
void enroll_vapor_function_NH3(Thermodynamics::SVPFunc1Container &svp_func1, std::vector< IndexSet > const &cloud_index_set)
void enroll_vapor_function_NH4SH(Thermodynamics::SVPFunc2Container &svp_func2, std::map< IndexPair, ReactionInfo > &cloud_reaction_map)
void enroll_vapor_function_H2S(Thermodynamics::SVPFunc1Container &svp_func1, std::vector< IndexSet > const &cloud_index_set)
void enroll_vapor_function_H2O(Thermodynamics::SVPFunc1Container &svp_func1, std::vector< IndexSet > const &cloud_index_set)
double sat_vapor_p_H2S_Antoine(double T)
double sat_vapor_p_H2O_BriggsS(double T)