mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[test-problems] Fix clib-test.c
Mole fractions have to be set before T and P; otherwise, the pressure changes. Before the change, the pressure was significantly lower than 5 atm. Also fix incorrect use of 'kin_newFromFile', which causes unintended linkages to default objects that do not raise exceptions but may lead to erroneous results.
This commit is contained in:
parent
7f04d839f3
commit
34989299d2
@ -34,7 +34,7 @@ int main(int argc, char** argv)
|
||||
ret = thermo_print(thermo, 1, 0);
|
||||
assert(ret == 0);
|
||||
|
||||
int kin = kin_newFromFile("gri30.yaml", "gri30", thermo, 0, 0, 0, 0);
|
||||
int kin = kin_newFromFile("gri30.yaml", "gri30", thermo, -1, -1, -1, -1);
|
||||
assert(kin > 0);
|
||||
|
||||
size_t nr = kin_nReactions(kin);
|
||||
@ -63,12 +63,14 @@ int main(int argc, char** argv)
|
||||
printf("%10s %8.6e\n", buf, dkm[k]);
|
||||
}
|
||||
|
||||
ret = thermo_setMoleFractionsByName(thermo, "CH4:1.0, O2:2.0, N2:7.52");
|
||||
assert(ret == 0);
|
||||
ret = thermo_setTemperature(thermo, 1050);
|
||||
assert(ret == 0);
|
||||
ret = thermo_setPressure(thermo, 5 * 101325);
|
||||
assert(ret == 0);
|
||||
ret = thermo_setMoleFractionsByName(thermo, "CH4:1.0, O2:2.0, N2:7.52");
|
||||
assert(ret == 0);
|
||||
|
||||
thermo_print(thermo, 1, 1e-6);
|
||||
|
||||
printf("\ntime Temperature\n");
|
||||
int reactor = reactor_new("IdealGasReactor");
|
||||
|
@ -418,8 +418,8 @@
|
||||
CO2 1.343550e-03
|
||||
HCO 1.491843e-03
|
||||
CH2O 1.479619e-03
|
||||
CH2OH 1.445208e-03
|
||||
CH3O 1.445208e-03
|
||||
CH2OH 1.445198e-03
|
||||
CH3O 1.445198e-03
|
||||
CH3OH 1.446742e-03
|
||||
C2H 1.450980e-03
|
||||
C2H2 1.436239e-03
|
||||
@ -433,7 +433,7 @@
|
||||
N 2.349996e-03
|
||||
NH 2.785123e-03
|
||||
NH2 2.726901e-03
|
||||
NH3 2.104919e-03
|
||||
NH3 2.104910e-03
|
||||
NNH 1.652984e-03
|
||||
NO 1.680343e-03
|
||||
NO2 1.498765e-03
|
||||
@ -454,25 +454,49 @@
|
||||
CH2CHO 1.246815e-03
|
||||
CH3CHO 1.241226e-03
|
||||
|
||||
gri30:
|
||||
|
||||
temperature 1050 K
|
||||
pressure 5.0662e+05 Pa
|
||||
density 1.6036 kg/m^3
|
||||
mean mol. weight 27.633 kg/kmol
|
||||
phase of matter gas
|
||||
|
||||
1 kg 1 kmol
|
||||
--------------- ---------------
|
||||
enthalpy 6.5537e+05 1.811e+07 J
|
||||
internal energy 3.3944e+05 9.3799e+06 J
|
||||
entropy 8246.1 2.2787e+05 J/K
|
||||
Gibbs function -8.0031e+06 -2.2115e+08 J
|
||||
heat capacity c_p 1355.9 37470 J/K
|
||||
heat capacity c_v 1055.1 29155 J/K
|
||||
|
||||
mass frac. Y mole frac. X chem. pot. / RT
|
||||
--------------- --------------- ---------------
|
||||
O2 0.22014 0.19011 -26.751
|
||||
CH4 0.055187 0.095057 -34.733
|
||||
N2 0.72467 0.71483 -23.704
|
||||
[ +50 minor] 0 0
|
||||
|
||||
time Temperature
|
||||
0.00e+00 1050.000
|
||||
5.00e-03 1050.063
|
||||
1.00e-02 1050.192
|
||||
1.50e-02 1050.361
|
||||
2.00e-02 1050.578
|
||||
2.50e-02 1050.858
|
||||
3.00e-02 1051.216
|
||||
3.50e-02 1051.680
|
||||
4.00e-02 1052.286
|
||||
4.50e-02 1053.088
|
||||
5.00e-02 1054.174
|
||||
5.50e-02 1055.692
|
||||
6.00e-02 1057.919
|
||||
6.50e-02 1061.450
|
||||
7.00e-02 1067.905
|
||||
7.50e-02 1084.644
|
||||
8.00e-02 2894.008
|
||||
8.50e-02 2894.004
|
||||
9.00e-02 2894.004
|
||||
9.50e-02 2894.004
|
||||
1.00e-01 2894.004
|
||||
5.00e-03 1050.064
|
||||
1.00e-02 1050.197
|
||||
1.50e-02 1050.369
|
||||
2.00e-02 1050.593
|
||||
2.50e-02 1050.881
|
||||
3.00e-02 1051.253
|
||||
3.50e-02 1051.736
|
||||
4.00e-02 1052.370
|
||||
4.50e-02 1053.216
|
||||
5.00e-02 1054.372
|
||||
5.50e-02 1056.007
|
||||
6.00e-02 1058.448
|
||||
6.50e-02 1062.431
|
||||
7.00e-02 1070.141
|
||||
7.50e-02 1094.331
|
||||
8.00e-02 2894.921
|
||||
8.50e-02 2894.921
|
||||
9.00e-02 2894.921
|
||||
9.50e-02 2894.921
|
||||
1.00e-01 2894.921
|
||||
|
Loading…
Reference in New Issue
Block a user