mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[Test] Replace simplephases.cti with YAML
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
units(length="m", time="s", quantity="mol", energy="J")
|
||||
|
||||
ideal_gas(name="simple1",
|
||||
elements = "H O C",
|
||||
species = " O2 H2 H2O ")
|
||||
|
||||
ideal_gas(name="nasa1",
|
||||
elements = "H O C",
|
||||
species = "gri30: O2 H2 H2O ")
|
||||
|
||||
ideal_gas(name="shomate1",
|
||||
elements = "H O C",
|
||||
species = "CO CO2")
|
||||
|
||||
species(name="O2", atoms="O:2",
|
||||
thermo=const_cp(h0=0.0, s0=205.152, cp0=29.39))
|
||||
species(name="H2", atoms="H:2",
|
||||
thermo=const_cp(h0=0.0, s0=130.680, cp0=28.85))
|
||||
species(name="H2O", atoms="H:2 O:1",
|
||||
thermo=const_cp(h0=-241826.0, s0=188.84, cp0=35.22))
|
||||
|
||||
species(name="CO", atoms="C:1 O:1",
|
||||
thermo=(Shomate([298, 1300],
|
||||
[25.56759, 6.096130, 4.054656, -2.671301,
|
||||
0.131021, -118.0089, 227.3665]),
|
||||
Shomate([1300, 6000],
|
||||
[35.15070, 1.300095, -0.205921, 0.013550,
|
||||
-3.282780, -127.8375, 231.7120])))
|
||||
|
||||
species(name="CO2", atoms="C:1 O:2",
|
||||
thermo=(Shomate([298, 1200],
|
||||
[24.99735, 55.18696, -33.69137, 7.948387,
|
||||
-0.136638, -403.6075, 228.2431]),
|
||||
Shomate([1200, 6000],
|
||||
[58.16639, 2.720074,-0.492289, 0.038844,
|
||||
-6.447293,-425.9186, 263.6125])))
|
||||
60
test/data/simplephases.yaml
Normal file
60
test/data/simplephases.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
generator: cti2yaml
|
||||
cantera-version: 2.6.0a2
|
||||
date: Thu, 29 Apr 2021 18:35:16 -0400
|
||||
input-files: [simplephases.cti]
|
||||
|
||||
units: {quantity: mol}
|
||||
|
||||
phases:
|
||||
- name: simple1
|
||||
thermo: ideal-gas
|
||||
elements: [H, O, C]
|
||||
species: [O2, H2, H2O]
|
||||
- name: nasa1
|
||||
thermo: ideal-gas
|
||||
elements: [H, O, C]
|
||||
species:
|
||||
- gri30.yaml/species: [O2, H2, H2O]
|
||||
- name: shomate1
|
||||
thermo: ideal-gas
|
||||
elements: [H, O, C]
|
||||
species: [CO, CO2]
|
||||
|
||||
species:
|
||||
- name: O2
|
||||
composition: {O: 2}
|
||||
thermo:
|
||||
model: constant-cp
|
||||
h0: 0.0
|
||||
s0: 205.152
|
||||
cp0: 29.39
|
||||
- name: H2
|
||||
composition: {H: 2}
|
||||
thermo:
|
||||
model: constant-cp
|
||||
h0: 0.0
|
||||
s0: 130.68
|
||||
cp0: 28.85
|
||||
- name: H2O
|
||||
composition: {H: 2, O: 1}
|
||||
thermo:
|
||||
model: constant-cp
|
||||
h0: -2.41826e+05
|
||||
s0: 188.84
|
||||
cp0: 35.22
|
||||
- name: CO
|
||||
composition: {C: 1, O: 1}
|
||||
thermo:
|
||||
model: Shomate
|
||||
temperature-ranges: [298, 1300, 6000]
|
||||
data:
|
||||
- [25.56759, 6.09613, 4.054656, -2.671301, 0.131021, -118.0089, 227.3665]
|
||||
- [35.1507, 1.300095, -0.205921, 0.01355, -3.28278, -127.8375, 231.712]
|
||||
- name: CO2
|
||||
composition: {C: 1, O: 2}
|
||||
thermo:
|
||||
model: Shomate
|
||||
temperature-ranges: [298, 1200, 6000]
|
||||
data:
|
||||
- [24.99735, 55.18696, -33.69137, 7.948387, -0.136638, -403.6075, 228.2431]
|
||||
- [58.16639, 2.720074, -0.492289, 0.038844, -6.447293, -425.9186, 263.6125]
|
||||
@@ -34,8 +34,8 @@ double c_co2[] = {298.15, -3.9351e8, 2.13785e5, 3.712e4};
|
||||
|
||||
TEST_F(SpeciesThermoInterpTypeTest, install_const_cp)
|
||||
{
|
||||
// Compare against instantiation from CTI file
|
||||
IdealGasPhase p2("../data/simplephases.cti", "simple1");
|
||||
// Compare against instantiation from YAML file
|
||||
IdealGasPhase p2("simplephases.yaml", "simple1");
|
||||
auto sO2 = make_shared<Species>("O2", parseCompString("O:2"));
|
||||
auto sH2 = make_shared<Species>("H2", parseCompString("H:2"));
|
||||
auto sH2O = make_shared<Species>("H2O", parseCompString("H:2 O:1"));
|
||||
@@ -69,8 +69,8 @@ TEST_F(SpeciesThermoInterpTypeTest, DISABLED_install_bad_pref)
|
||||
|
||||
TEST_F(SpeciesThermoInterpTypeTest, install_nasa)
|
||||
{
|
||||
// Compare against instantiation from CTI file
|
||||
IdealGasPhase p2("../data/simplephases.cti", "nasa1");
|
||||
// Compare against instantiation from YAML file
|
||||
IdealGasPhase p2("simplephases.yaml", "nasa1");
|
||||
auto sO2 = make_shared<Species>("O2", parseCompString("O:2"));
|
||||
auto sH2 = make_shared<Species>("H2", parseCompString("H:2"));
|
||||
auto sH2O = make_shared<Species>("H2O", parseCompString("H:2 O:1"));
|
||||
@@ -91,8 +91,8 @@ TEST_F(SpeciesThermoInterpTypeTest, install_nasa)
|
||||
|
||||
TEST_F(SpeciesThermoInterpTypeTest, install_shomate)
|
||||
{
|
||||
// Compare against instantiation from CTI file
|
||||
IdealGasPhase p2("../data/simplephases.cti", "shomate1");
|
||||
// Compare against instantiation from YAML file
|
||||
IdealGasPhase p2("simplephases.yaml", "shomate1");
|
||||
auto sCO = make_shared<Species>("CO", parseCompString("C:1 O:1"));
|
||||
auto sCO2 = make_shared<Species>("CO2", parseCompString("C:1 O:2"));
|
||||
sCO->thermo.reset(new ShomatePoly2(200, 6000, 101325, co_shomate_coeffs));
|
||||
@@ -243,7 +243,7 @@ TEST(SpeciesThermo, Mu0PolyFromYaml) {
|
||||
}
|
||||
|
||||
TEST(SpeciesThermo, NasaPoly2ToYaml) {
|
||||
shared_ptr<Solution> soln = newSolution("../data/simplephases.cti", "nasa1");
|
||||
shared_ptr<Solution> soln = newSolution("simplephases.yaml", "nasa1");
|
||||
auto original = soln->thermo()->species("H2O")->thermo;
|
||||
AnyMap h2o_data1 = original->parameters();
|
||||
AnyMap h2o_data2 = AnyMap::fromYamlString(h2o_data1.toYamlString());
|
||||
@@ -260,7 +260,7 @@ TEST(SpeciesThermo, NasaPoly2ToYaml) {
|
||||
}
|
||||
|
||||
TEST(SpeciesThermo, ShomatePolyToYaml) {
|
||||
shared_ptr<Solution> soln = newSolution("../data/simplephases.cti", "shomate1");
|
||||
shared_ptr<Solution> soln = newSolution("simplephases.yaml", "shomate1");
|
||||
auto original = soln->thermo()->species("CO2")->thermo;
|
||||
AnyMap co2_data1 = original->parameters();
|
||||
AnyMap co2_data2 = AnyMap::fromYamlString(co2_data1.toYamlString());
|
||||
@@ -277,7 +277,7 @@ TEST(SpeciesThermo, ShomatePolyToYaml) {
|
||||
}
|
||||
|
||||
TEST(SpeciesThermo, ConstCpToYaml) {
|
||||
shared_ptr<Solution> soln = newSolution("../data/simplephases.cti", "simple1");
|
||||
shared_ptr<Solution> soln = newSolution("simplephases.yaml", "simple1");
|
||||
auto original = soln->thermo()->species("H2O")->thermo;
|
||||
AnyMap h2o_data1 = original->parameters();
|
||||
AnyMap h2o_data2 = AnyMap::fromYamlString(h2o_data1.toYamlString());
|
||||
@@ -311,7 +311,7 @@ TEST(SpeciesThermo, PiecewiseGibbsToYaml) {
|
||||
}
|
||||
|
||||
TEST(SpeciesThermo, Nasa9PolyToYaml) {
|
||||
shared_ptr<Solution> soln = newSolution("airNASA9.cti");
|
||||
shared_ptr<Solution> soln = newSolution("airNASA9.yaml");
|
||||
auto original = soln->thermo()->species("N2+")->thermo;
|
||||
AnyMap n2p_data1 = original->parameters();
|
||||
AnyMap n2p_data2 = AnyMap::fromYamlString(n2p_data1.toYamlString());
|
||||
|
||||
Reference in New Issue
Block a user