Skip to content

Commit

Permalink
convective model working intermediate T (#3)
Browse files Browse the repository at this point in the history
- so2 condensation working
- all working besides CO2
  • Loading branch information
cometz95 authored and chengcli committed Jun 14, 2024
1 parent 828ee91 commit 4044dbb
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 18 deletions.
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
found error with vapor pressure functions:

when vapor pressure are too low (~1e-10 Pa) at low temperatuers, the saturationadjustment fails and eventually crashes

when vapor pressures are too high (1e5 Pa) eg. for CO2, the saturation adjustment fails immediately (all nan)
33 changes: 19 additions & 14 deletions examples/2024-CMetz-amars/amars.inp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ dt = 1.E4
<time>
cfl_number = 0.9 # The Courant, Friedrichs, & Lewy (CFL) Number
nlim = -1 # cycle limit
tlim = 100.E5 # time limit
tlim = 1.E7 # time limit
xorder = 5 # horizontal reconstruction order
integrator = rk3 # integration method

<mesh>
nx1 = 64 # Number of zones in X1-direction
nx1 = 128 # Number of zones in X1-direction
x1min = 0. # minimum value of X1
x1max = 16.E3 # maximum value of X1
x1max = 20.E3 # maximum value of X1
ix1_bc = reflecting # inner-X1 boundary flag
ox1_bc = reflecting # outer-X1 boundary flag

Expand All @@ -61,8 +61,8 @@ ix3_bc = periodic # Inner-X3 boundary condition flag
ox3_bc = periodic # Outer-X3 boundary condition flag

<meshblock>
nx1 = 64
nx2 = 32
nx1 = 128
nx2 = 16
nx3 = 1

<hydro>
Expand All @@ -78,7 +78,7 @@ top_cooling.flux = -2.

<species>
vapor = H2O, H2S, SO2, CO2
cloud = H2O(c), H2O(p), H2S(c), H2S(p), SO2(c), SO2(p), CO2(c), CO2(p)
cloud = H2O(c), H2S(c), SO2(c), CO2(c), H2O(p), H2S(p), SO2(p), CO2(p)

<chemistry>
microphysics_config = amars.yaml
Expand Down Expand Up @@ -114,6 +114,12 @@ rcp4 = 1.62 3.54 3.54
Ttriple4 = 216.58
Ptriple4 = 518500

#eps4 = 0.45 0.45 0.45
#beta4 = 0. 17.9 17.9
#rcp4 = 8.05 8.05 8.05
#Ttriple4 = 273.
#Ptriple4 = 611.7

sa.relax = 1.0
sa.max_iter = 20
sa.ftol = 0.1
Expand Down Expand Up @@ -141,16 +147,15 @@ HJ.equinox = 0.

<problem>
P0 = 0.5E5
T0 = 2.E2
Tmin = 80.
T0 = 200.
Tmin = 178.
qRelaxT = 1.E-4
distance_au = 1.523

qH2O.ppmv = 3.
qH2S.ppmv = 983.
qSO2.ppmv = 6826.
qCO2.ppmv = 0.
#qCO2.ppmv = 98218.
#qCO2.ppmv = 982.
qH2O.ppmv = 5.
qH2S.ppmv = 1000.
qSO2.ppmv = 10000.
qCO2.ppmv = 978995.
#qCO2.ppmv = 0.001

diagnostics = div, curl, b, mean, div_h, tempa, presa, hydroflux
6 changes: 3 additions & 3 deletions examples/2024-CMetz-amars/amars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ thermodynamics:
gammad_ref: 1.66

microphysics:
- SO2-system
- H2S-system
- H2O-system
#- CO2-system
- H2S-system
- SO2-system
- CO2-system

H2O-system:
scheme: Kessler94
Expand Down
12 changes: 11 additions & 1 deletion src/snap/thermodynamics/vapors/carbon_dioxide_vapors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@
inline double sat_vapor_p_CO2_Antoine(double T) {
double A = 6.81228;
double B = 1301.679;
double C = -3.494;
double C = -34.94;

double result = pow(10, A - B / (T + C));
return 1.E5 * result;

// best fit in [154.2, 204] K

// double A = 9.8106;
// double B = 1347.79;
// double C = 273;

// double result = pow(10, A - B / ((T-273.2) + C));
// return 133.3 * result;
}

#endif // SRC_SNAP_THERMODYNAMICS_VAPORS_CARBON_DIOXIDE_VAPORS_HPP_

0 comments on commit 4044dbb

Please sign in to comment.