7 #include <athena/athena_arrays.hpp>
8 #include <athena/hydro/hydro.hpp>
11 #include <application/exceptions.hpp>
22 if (NVAPOR == 0)
return;
24 for (
auto& air : air_column) {
34 Real Teq = air.w[IDN];
35 std::stringstream msg;
43 for (
int i = 1; i <= NVAPOR; ++i) {
46 #pragma omp simd reduction(+ : qv)
53 for (
int i = 1; i <= NVAPOR; ++i) {
60 for (
int j = 1;
j < rates.size(); ++
j) {
65 Real Told = air.w[IDN];
68 if (fabs(air.w[IDN] - Teq) <
sa_ftol_)
break;
73 #pragma omp simd reduction(+ : qgas)
74 for (
int n = 0; n < NCLOUD; ++n) qgas += -air.c[n];
76 air.w[IDN] = Told +
sa_relax_ * (air.w[IDN] - Told);
81 msg <<
"Variables before iteration q0 = (" << air0 <<
")" << std::endl;
82 msg <<
"Variables after iteration q = (" << air <<
")" << std::endl;
83 throw RuntimeError(
"SaturationAdjustment", msg.str());
std::vector< AirParcel > AirColumn
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.
void SaturationAdjustment(AirColumn &ac) const
Real getDensityMole(AirParcel const &qfrac) const
int sa_max_iter_
maximum saturation adjustment iterations
std::vector< IndexSet > cloud_index_set_
cloud index set
Real sa_ftol_
saturation adjustment temperature tolerance
void updateTPConservingU(AirParcel *qfrac, Real rmole, Real umole) const
update T/P
Real sa_relax_
saturation adjustment relaxation parameter
std::array< Real, Size > cv_ratio_mole_
ratio of specific heat capacities [J/mol] at constant volume
Real GetGammad(AirParcel const &var) const
adiaibatic index of dry air [1]
Real getInternalEnergyMole(AirParcel const &qfrac) const