Canoe
Comprehensive Atmosphere N' Ocean Engine
equilibrate_tp.cpp
Go to the documentation of this file.
1 // canoe
2 #include <air_parcel.hpp>
3 
4 // snap
5 #include "thermodynamics.hpp"
6 
9 
10  // vapor <=> cloud
11  for (int i = 1; i <= NVAPOR; ++i) {
12  auto rates = TryEquilibriumTP_VaporCloud(*qfrac, i);
13 
14  // vapor condensation rate
15  qfrac->w[i] += rates[0];
16 
17  // cloud concentration rates
18  for (int n = 1; n < rates.size(); ++n)
19  qfrac->c[cloud_index_set_[i][n - 1]] += rates[n];
20  }
21 
22  // vapor + vapor <=> cloud
23  for (auto const& [ij, info] : cloud_reaction_map_) {
24  auto rates = TryEquilibriumTP_VaporVaporCloud(*qfrac, ij);
25  auto& indx = info.first;
26 
27  // vapor condensation rate
28  qfrac->w[indx[0]] += rates[0];
29  qfrac->w[indx[1]] += rates[1];
30 
31  // cloud concentration rates
32  qfrac->c[indx[2]] += rates[3];
33  }
34 }
Real *const w
Definition: air_parcel.hpp:36
Real *const c
cloud data
Definition: air_parcel.hpp:39
RealArrayX TryEquilibriumTP_VaporCloud(AirParcel const &qfrac, int ivapor, Real cv_hat=0., bool misty=false) const
Calculate the equilibrium mole transfer by cloud reaction vapor -> cloud.
std::map< IndexPair, ReactionInfo > cloud_reaction_map_
reaction information map
std::vector< IndexSet > cloud_index_set_
cloud index set
void EquilibrateTP(AirParcel *qfrac) const
void setTotalEquivalentVapor(AirParcel *qfrac) const
RealArray3 TryEquilibriumTP_VaporVaporCloud(AirParcel const &air, IndexPair ij, Real cv_hat=0., bool misty=false) const
Calculate the equilibrium mole transfer by cloud reaction vapor1 + vapor2 -> cloud.