Skip to content

Commit ec47ee0

Browse files
authored
regenerate MOSAIC testing data; add implementation and test for MOSAIC function aerosol_water (#116)
* add implementation of aerosol_water * add verification data * testing logic * testing file * regenerate testing data * update testing tolerances -> all default * Remove duplicate fnlog_gamZ_output_ts_0 * new testing data for gas_difusivity and fuchs_sutugin
1 parent 13250bd commit ec47ee0

22 files changed

+191
-31
lines changed

src/core/impl/TChem_Impl_MOSAIC.hpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,6 +3137,35 @@ struct MOSAIC{
31373137
aerosol_water = dum;
31383138
} // aerosol_water_up
31393139

3140+
KOKKOS_INLINE_FUNCTION static
3141+
void aerosol_water(const MosaicModelData<DeviceType>& mosaic,
3142+
const real_type_1d_view_type& electrolyte,
3143+
const real_type& aH2O_a,
3144+
const real_type_1d_view_type& molalities,
3145+
real_type& jaerosolstate,
3146+
real_type& jphase,
3147+
real_type& jhyst_leg,
3148+
real_type& aerosol_water) {
3149+
3150+
for (ordinal_type je = 0; je < mosaic.nelectrolyte; je++) {
3151+
real_type molality = 0.0;
3152+
bin_molality(mosaic, je, aH2O_a, molality); // compute aH2O dependent binary molalities EFFI
3153+
molalities(je) = molality;
3154+
}
3155+
3156+
real_type dum = 0.0;
3157+
for (ordinal_type je = 0; je < (mosaic.nsalt + 4); je++) { // include hno3 and hcl in water calculation
3158+
dum += electrolyte(je) / molalities(je);
3159+
}
3160+
3161+
aerosol_water = dum * 1.0e-9;
3162+
if (aerosol_water <= 0.0) {
3163+
jaerosolstate = mosaic.all_solid;
3164+
jphase = mosaic.jsolid;
3165+
jhyst_leg = mosaic.jhyst_lo;
3166+
}
3167+
}
3168+
31403169
};
31413170

31423171
} // namespace Impl

src/verification/data_sets/mosaic/MTEM_compute_log_gamZ_input_ts_0.yaml

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/verification/data_sets/mosaic/MTEM_compute_log_gamZ_output_ts_0.py

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
TChem-atm:
3+
function: aerosol_water
4+
input:
5+
fixed:
6+
electrolyte: [ 0.77984160884932792E-003, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.32374869443985588E-003, 0.10558591027558305E-003, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000]
7+
aH2O_a: [ 0.86918676121422112E+000]
8+
jaerosolstate: [ 2]
9+
jphase: [ 2]
10+
jhyst_leg: [ 1]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
# This file was generated by PartMC-mosaic.
3+
4+
from math import nan as nan, inf as inf
5+
6+
# Object is just a dynamic container that stores input/output data.
7+
class Object(object):
8+
pass
9+
# Settings are stored here.
10+
settings = Object()
11+
# Input is stored here.
12+
input = Object()
13+
input.electrolyte=[[ 0.77984160884932792E-003, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.32374869443985588E-003, 0.10558591027558305E-003, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000,],]
14+
input.aH2O_a=[[ 0.86918676121422112E+000],]
15+
input.jaerosolstate=[[ 2],]
16+
input.jphase=[[ 2],]
17+
input.jhyst_leg=[[ 1],]
18+
# Output data is stored here.
19+
output = Object()
20+
output.jaerosolstate=[[ 2],]
21+
output.jphase=[[ 2],]
22+
output.jhyst_leg=[[ 1],]
23+
output.aerosol_water=[[ 0.27588384862958057E-012],]
24+
output.molalities=[[ 0.39938262305308316E+001, 0.20631562926260667E+001, 0.37125449931321697E+001, 0.37125449931321697E+001, 0.57556783407985233E+001, 0.43319966060422557E+001, 0.36061437563583723E+001, 0.19213285418818216E+001, 0.34951712211340586E+001, 0.34951712211340586E+001, 0.49367058281342588E+001, 0.35858101515618990E+001, 0.24386871472805547E+001, 0.19381152331027600E+001, 0.24386871472805547E+001, 0.27333455732066936E+001, 0.27333455732066936E+001, 0.33978613515005995E+001, 0.29236917930711290E+001, 0.26734712617394891E-004, 0.00000000000000000E+000, 0.00000000000000000E+000,],]
25+
output.aerosol_water=[[ 0.27588384862958057E-012],]

src/verification/data_sets/mosaic/bin_molality_60_output_ts_0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ class Object(object):
1414
input.molality=[[ 0.00000000000000000E+000],]
1515
# Output data is stored here.
1616
output = Object()
17-
output.molality=[[ 0.11753741728360607E+002],]
17+
output.molality=[[ 0.11753752526395242E+002],]

src/verification/data_sets/mosaic/bin_molality_input_ts_0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ input:
55
fixed:
66
je: [ 1]
77
aH2O_a: [ 0.86918676121422112E+000]
8-
molality: [ 0.25344302823602594E-316]
8+
molality: [ 0.25383329068967594E-316]

src/verification/data_sets/mosaic/bin_molality_output_ts_0.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Object(object):
1212
input = Object()
1313
input.je=[[ 1],]
1414
input.aH2O_a=[[ 0.86918676121422112E+000],]
15-
input.molality=[[ 0.25344302823602594E-316],]
15+
input.molality=[[ 0.25383329068967594E-316],]
1616
# Output data is stored here.
1717
output = Object()
18-
output.molality=[[ 0.39937951815127040E+001],]
18+
output.molality=[[ 0.39938262305308316E+001],]

src/verification/data_sets/mosaic/drh_mutual_output_ts_0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ class Object(object):
1414
input.T_K=[[ 0.29142360000000002E+003],]
1515
# Output data is stored here.
1616
output = Object()
17-
output.drh_mutual=[[ 0.80202077162854152E+002],]
17+
output.drh_mutual=[[ 0.80202061268387610E+002],]

src/verification/data_sets/mosaic/fn_Keq_output_ts_0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ class Object(object):
1717
input.Keq=[[ 0.10000000000000000E+002],]
1818
# Output data is stored here.
1919
output = Object()
20-
output.Keq=[[ 0.79354086448815266E+002],]
20+
output.Keq=[[ 0.79354109569559270E+002],]

0 commit comments

Comments
 (0)