From 1866e3542d2bdbaa8f1d4df69923746a3279895c Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Sun, 29 Dec 2019 18:30:17 -0500 Subject: [PATCH] [YAML] Switch interfaces and examples to use YAML files --- .../examples/kinetics/extract_submechanism.py | 6 +- .../examples/kinetics/mechanism_reduction.py | 2 +- .../examples/kinetics/reaction_path.py | 2 +- .../cantera/examples/multiphase/adiabatic.py | 4 +- .../examples/multiphase/plasma_equilibrium.py | 4 +- .../examples/onedim/adiabatic_flame.py | 4 +- .../cantera/examples/onedim/burner_flame.py | 2 +- .../examples/onedim/burner_ion_flame.py | 2 +- .../examples/onedim/diffusion_flame.py | 2 +- .../examples/onedim/diffusion_flame_batch.py | 2 +- .../onedim/diffusion_flame_extinction.py | 2 +- .../cantera/examples/onedim/flame_fixed_T.py | 2 +- .../examples/onedim/flamespeed_sensitivity.py | 4 +- .../examples/onedim/ion_burner_flame.py | 2 +- .../cantera/examples/onedim/ion_free_flame.py | 2 +- .../onedim/premixed_counterflow_flame.py | 2 +- .../onedim/premixed_counterflow_twin_flame.py | 2 +- .../examples/onedim/stagnation_flame.py | 2 +- .../examples/reactors/NonIdealShockTube.py | 4 +- .../cantera/examples/reactors/combustor.py | 5 +- .../cantera/examples/reactors/custom.py | 2 +- .../examples/reactors/fuel_injection.py | 2 +- .../cantera/examples/reactors/ic_engine.py | 2 +- .../cython/cantera/examples/reactors/mix1.py | 4 +- .../examples/reactors/periodic_cstr.py | 4 +- .../cython/cantera/examples/reactors/pfr.py | 2 +- .../cantera/examples/reactors/piston.py | 4 +- .../cantera/examples/reactors/reactor1.py | 2 +- .../cantera/examples/reactors/reactor2.py | 6 +- .../cantera/examples/reactors/sensitivity1.py | 2 +- .../cantera/examples/reactors/surf_pfr.py | 6 +- .../surface_chemistry/catalytic_combustion.py | 8 +- .../examples/surface_chemistry/diamond_cvd.py | 6 +- .../examples/surface_chemistry/sofc.py | 33 ++++---- .../cantera/examples/thermo/isentropic.py | 2 +- .../cython/cantera/examples/thermo/mixing.py | 2 +- .../cantera/examples/thermo/sound_speed.py | 2 +- .../cantera/examples/transport/dusty_gas.py | 2 +- .../transport/multiprocessing_viscosity.py | 8 +- interfaces/cython/cantera/liquidvapor.py | 16 ++-- .../matlab/toolbox/@Solution/Solution.m | 12 +-- interfaces/matlab/toolbox/Air.m | 6 +- interfaces/matlab/toolbox/CarbonDioxide.m | 2 +- interfaces/matlab/toolbox/GRI30.m | 17 ++-- interfaces/matlab/toolbox/HFC134a.m | 2 +- interfaces/matlab/toolbox/Heptane.m | 2 +- interfaces/matlab/toolbox/Hydrogen.m | 2 +- interfaces/matlab/toolbox/IdealGasMix.m | 45 ++++++----- interfaces/matlab/toolbox/Methane.m | 2 +- interfaces/matlab/toolbox/Nitrogen.m | 2 +- interfaces/matlab/toolbox/Oxygen.m | 2 +- interfaces/matlab/toolbox/Water.m | 2 +- samples/cxx/LiC6_electrode/LiC6_electrode.cpp | 2 +- .../cxx/LiC6_electrode/LiC6_electrodebulk.xml | 80 ------------------- .../LiC6_electrode/LiC6_electrodebulk.yaml | 36 +++++++++ samples/cxx/combustor/combustor.cpp | 2 +- samples/f77/ctlib.f | 2 +- samples/f77/demo.f | 2 +- samples/f77/isentropic.f | 2 +- samples/f90/demo.f90 | 4 +- samples/matlab/catcomb.m | 8 +- samples/matlab/diffflame.m | 5 +- samples/matlab/equil.m | 3 +- samples/matlab/flame1.m | 4 +- samples/matlab/flame2.m | 9 +-- samples/matlab/ignite.m | 2 +- samples/matlab/ignite_hp.m | 2 +- samples/matlab/ignite_uv.m | 2 +- samples/matlab/isentropic.m | 2 +- samples/matlab/lithium_ion_battery.m | 14 ++-- samples/matlab/periodic_cstr.m | 4 +- samples/matlab/reactor1.m | 4 +- samples/matlab/reactor2.m | 2 +- samples/matlab/surfreactor.m | 6 +- samples/matlab/tut2.m | 56 ++++--------- 75 files changed, 229 insertions(+), 292 deletions(-) delete mode 100644 samples/cxx/LiC6_electrode/LiC6_electrodebulk.xml create mode 100644 samples/cxx/LiC6_electrode/LiC6_electrodebulk.yaml diff --git a/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py b/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py index 16b2a3e9a5..17d3818633 100644 --- a/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py +++ b/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py @@ -13,7 +13,7 @@ import numpy as np import matplotlib.pyplot as plt -all_species = ct.Species.listFromFile('gri30.xml') +all_species = ct.Species.listFromFile('gri30.yaml') species = [] # Filter species @@ -35,7 +35,7 @@ print('Species: {0}'.format(', '.join(S.name for S in species))) # Filter reactions, keeping only those that only involve the selected species -all_reactions = ct.Reaction.listFromFile('gri30.xml') +all_reactions = ct.Reaction.listFromFile('gri30.yaml') reactions = [] print('\nReactions:') @@ -50,7 +50,7 @@ print(R.equation) print('\n') -gas1 = ct.Solution('gri30.xml') +gas1 = ct.Solution('gri30.yaml') gas2 = ct.Solution(thermo='IdealGas', kinetics='GasKinetics', species=species, reactions=reactions) diff --git a/interfaces/cython/cantera/examples/kinetics/mechanism_reduction.py b/interfaces/cython/cantera/examples/kinetics/mechanism_reduction.py index 40a1167f87..dc1039eb36 100644 --- a/interfaces/cython/cantera/examples/kinetics/mechanism_reduction.py +++ b/interfaces/cython/cantera/examples/kinetics/mechanism_reduction.py @@ -17,7 +17,7 @@ import numpy as np import matplotlib.pyplot as plt -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') initial_state = 1200, 5 * ct.one_atm, 'CH4:0.35, O2:1.0, N2:3.76' # Run a simulation with the full mechanism diff --git a/interfaces/cython/cantera/examples/kinetics/reaction_path.py b/interfaces/cython/cantera/examples/kinetics/reaction_path.py index 14b44f04de..fdcd2f74cb 100644 --- a/interfaces/cython/cantera/examples/kinetics/reaction_path.py +++ b/interfaces/cython/cantera/examples/kinetics/reaction_path.py @@ -14,7 +14,7 @@ # these lines can be replaced by any commands that generate # an object of a class derived from class Kinetics in some state. -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') gas.TPX = 1300.0, ct.one_atm, 'CH4:0.4, O2:1, N2:3.76' r = ct.IdealGasReactor(gas) net = ct.ReactorNet([r]) diff --git a/interfaces/cython/cantera/examples/multiphase/adiabatic.py b/interfaces/cython/cantera/examples/multiphase/adiabatic.py index 76aa2664be..4c32f1b53a 100644 --- a/interfaces/cython/cantera/examples/multiphase/adiabatic.py +++ b/interfaces/cython/cantera/examples/multiphase/adiabatic.py @@ -16,8 +16,8 @@ P = 101325.0 # phases -gas = ct.Solution('gri30.xml') -carbon = ct.Solution('graphite.xml') +gas = ct.Solution('gri30.yaml') +carbon = ct.Solution('graphite.yaml') # the phases that will be included in the calculation, and their initial moles mix_phases = [(gas, 1.0), (carbon, 0.0)] diff --git a/interfaces/cython/cantera/examples/multiphase/plasma_equilibrium.py b/interfaces/cython/cantera/examples/multiphase/plasma_equilibrium.py index 89c521f7f9..f961b35307 100644 --- a/interfaces/cython/cantera/examples/multiphase/plasma_equilibrium.py +++ b/interfaces/cython/cantera/examples/multiphase/plasma_equilibrium.py @@ -8,9 +8,9 @@ # create objects representing the gas phase and the condensed phases. The gas # is a mixture of multiple species, and the condensed phases are all modeled -# as incompressible stoichiometric substances. See file KOH.cti for more +# as incompressible stoichiometric substances. See file KOH.yaml for more # information. -phases = ct.import_phases('KOH.cti', ['K_solid', 'K_liquid', 'KOH_a', 'KOH_b', +phases = ct.import_phases('KOH.yaml', ['K_solid', 'K_liquid', 'KOH_a', 'KOH_b', 'KOH_liquid', 'K2O2_solid', 'K2O_solid', 'KO2_solid', 'ice', 'liquid_water', 'KOH_plasma']) diff --git a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py index c55ede7e22..062e4f91bd 100644 --- a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py +++ b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py @@ -13,9 +13,9 @@ width = 0.03 # m loglevel = 1 # amount of diagnostic output (0 to 8) -# IdealGasMix object used to compute mixture properties, set to the state of the +# Solution object used to compute mixture properties, set to the state of the # upstream fuel-air mixture -gas = ct.Solution('h2o2.xml') +gas = ct.Solution('h2o2.yaml') gas.TPX = Tin, p, reactants # Set up flame object diff --git a/interfaces/cython/cantera/examples/onedim/burner_flame.py b/interfaces/cython/cantera/examples/onedim/burner_flame.py index c027619d56..03d0ef06f1 100644 --- a/interfaces/cython/cantera/examples/onedim/burner_flame.py +++ b/interfaces/cython/cantera/examples/onedim/burner_flame.py @@ -12,7 +12,7 @@ width = 0.5 # m loglevel = 1 # amount of diagnostic output (0 to 5) -gas = ct.Solution('h2o2.xml') +gas = ct.Solution('h2o2.yaml') gas.TPX = tburner, p, reactants f = ct.BurnerFlame(gas, width=width) diff --git a/interfaces/cython/cantera/examples/onedim/burner_ion_flame.py b/interfaces/cython/cantera/examples/onedim/burner_ion_flame.py index c0204a7d12..4e73e59d7c 100644 --- a/interfaces/cython/cantera/examples/onedim/burner_ion_flame.py +++ b/interfaces/cython/cantera/examples/onedim/burner_ion_flame.py @@ -11,7 +11,7 @@ width = 0.5 # m loglevel = 1 # amount of diagnostic output (0 to 5) -gas = ct.Solution('gri30_ion.cti') +gas = ct.Solution('gri30_ion.yaml') gas.TPX = tburner, p, reactants mdot = 0.15 * gas.density diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame.py index e15a3a2dd8..c368d9c69b 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame.py @@ -22,7 +22,7 @@ # Create the gas object used to evaluate all thermodynamic, kinetic, and # transport properties. -gas = ct.Solution('gri30.xml', 'gri30_mix') +gas = ct.Solution('gri30.yaml') gas.TP = gas.T, p # Create an object representing the counterflow flame configuration, diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py index b333355865..ddb32dc42d 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py @@ -35,7 +35,7 @@ class FlameExtinguished(Exception): # Set up an initial hydrogen-oxygen counterflow flame at 1 bar and low strain # rate (maximum axial velocity gradient = 2414 1/s) -reaction_mechanism = 'h2o2.xml' +reaction_mechanism = 'h2o2.yaml' gas = ct.Solution(reaction_mechanism) width = 18e-3 # 18mm wide f = ct.CounterflowDiffusionFlame(gas, width=width) diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py index 56fdb08847..2855d1ee4d 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py @@ -26,7 +26,7 @@ # Set up an initial hydrogen-oxygen counterflow flame at 1 bar and low strain # rate (maximum axial velocity gradient = 2414 1/s) -reaction_mechanism = 'h2o2.xml' +reaction_mechanism = 'h2o2.yaml' gas = ct.Solution(reaction_mechanism) width = 18.e-3 # 18mm wide f = ct.CounterflowDiffusionFlame(gas, width=width) diff --git a/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py b/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py index 25157c2b5c..178dbd2ac6 100644 --- a/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py +++ b/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py @@ -25,7 +25,7 @@ # transport properties. It is created with two transport managers, to enable # switching from mixture-averaged to multicomponent transport on the last # solution. -gas = ct.Solution('gri30.xml', 'gri30_mix') +gas = ct.Solution('gri30.yaml') # set its state to that of the unburned gas at the burner gas.TPX = tburner, p, comp diff --git a/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py b/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py index 032b9d54c9..08fe151deb 100644 --- a/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py +++ b/interfaces/cython/cantera/examples/onedim/flamespeed_sensitivity.py @@ -14,8 +14,8 @@ width = 0.03 # m -# IdealGasMix object used to compute mixture properties -gas = ct.Solution('gri30.xml', 'gri30_mix') +# Solution object used to compute mixture properties +gas = ct.Solution('gri30.yaml') gas.TPX = Tin, p, reactants # Flame object diff --git a/interfaces/cython/cantera/examples/onedim/ion_burner_flame.py b/interfaces/cython/cantera/examples/onedim/ion_burner_flame.py index 279c6f5753..8e665b49f1 100644 --- a/interfaces/cython/cantera/examples/onedim/ion_burner_flame.py +++ b/interfaces/cython/cantera/examples/onedim/ion_burner_flame.py @@ -11,7 +11,7 @@ width = 0.5 # m loglevel = 1 # amount of diagnostic output (0 to 5) -gas = ct.Solution('gri30_ion.cti') +gas = ct.Solution('gri30_ion.yaml') gas.TPX = tburner, p, reactants mdot = 0.15 * gas.density diff --git a/interfaces/cython/cantera/examples/onedim/ion_free_flame.py b/interfaces/cython/cantera/examples/onedim/ion_free_flame.py index aaa278ed84..3ed51b516a 100644 --- a/interfaces/cython/cantera/examples/onedim/ion_free_flame.py +++ b/interfaces/cython/cantera/examples/onedim/ion_free_flame.py @@ -14,7 +14,7 @@ # IdealGasMix object used to compute mixture properties, set to the state of the # upstream fuel-air mixture -gas = ct.Solution('gri30_ion.xml') +gas = ct.Solution('gri30_ion.yaml') gas.TPX = Tin, p, reactants # Set up flame object diff --git a/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py b/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py index dba335e3af..7dd1649c07 100644 --- a/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py +++ b/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py @@ -12,7 +12,7 @@ T_in = 373.0 # inlet temperature mdot_reactants = 0.12 # kg/m^2/s mdot_products = 0.06 # kg/m^2/s -rxnmech = 'h2o2.cti' # reaction mechanism file +rxnmech = 'h2o2.yaml' # reaction mechanism file comp = 'H2:1.6, O2:1, AR:7' # premixed gas composition width = 0.2 # m diff --git a/interfaces/cython/cantera/examples/onedim/premixed_counterflow_twin_flame.py b/interfaces/cython/cantera/examples/onedim/premixed_counterflow_twin_flame.py index 74c700a834..787a5c2be6 100644 --- a/interfaces/cython/cantera/examples/onedim/premixed_counterflow_twin_flame.py +++ b/interfaces/cython/cantera/examples/onedim/premixed_counterflow_twin_flame.py @@ -74,7 +74,7 @@ def solveOpposedFlame(oppFlame, massFlux=0.12, loglevel=1, return np.max(oppFlame.T), K, strainRatePoint # Select the reaction mechanism -gas = ct.Solution('gri30.cti') +gas = ct.Solution('gri30.yaml') # Create a CH4/Air premixed mixture with equivalence ratio=0.75, and at room # temperature and pressure. diff --git a/interfaces/cython/cantera/examples/onedim/stagnation_flame.py b/interfaces/cython/cantera/examples/onedim/stagnation_flame.py index d2cf0c010a..d3380e8e07 100644 --- a/interfaces/cython/cantera/examples/onedim/stagnation_flame.py +++ b/interfaces/cython/cantera/examples/onedim/stagnation_flame.py @@ -28,7 +28,7 @@ # then that solution will be used for the next mdot mdot = [0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12] # kg/m^2/s -rxnmech = 'h2o2.cti' # reaction mechanism file +rxnmech = 'h2o2.yaml' # reaction mechanism file comp = 'H2:1.8, O2:1, AR:7' # premixed gas composition # The solution domain is chosen to be 20 cm diff --git a/interfaces/cython/cantera/examples/reactors/NonIdealShockTube.py b/interfaces/cython/cantera/examples/reactors/NonIdealShockTube.py index 06448b3697..dd9e897056 100644 --- a/interfaces/cython/cantera/examples/reactors/NonIdealShockTube.py +++ b/interfaces/cython/cantera/examples/reactors/NonIdealShockTube.py @@ -68,7 +68,7 @@ def ignitionDelay(states, species): # Real gas IDT calculation # Load the real gas mechanism: -real_gas = ct.Solution('nDodecane_Reitz.cti','nDodecane_RK') +real_gas = ct.Solution('nDodecane_Reitz.yaml', 'nDodecane_RK') # Set the state of the gas object: real_gas.TP = reactorTemperature, reactorPressure @@ -109,7 +109,7 @@ def ignitionDelay(states, species): # Ideal gas IDT calculation # Create the ideal gas object: -ideal_gas = ct.Solution('nDodecane_Reitz.cti','nDodecane_IG') +ideal_gas = ct.Solution('nDodecane_Reitz.yaml', 'nDodecane_IG') # Set the state of the gas object: ideal_gas.TP = reactorTemperature, reactorPressure diff --git a/interfaces/cython/cantera/examples/reactors/combustor.py b/interfaces/cython/cantera/examples/reactors/combustor.py index 6a84238719..0eaed3494a 100644 --- a/interfaces/cython/cantera/examples/reactors/combustor.py +++ b/interfaces/cython/cantera/examples/reactors/combustor.py @@ -15,8 +15,9 @@ import matplotlib.pyplot as plt import cantera as ct -# Use reaction mechanism GRI-Mech 3.0 -gas = ct.Solution('gri30.xml') +# Use reaction mechanism GRI-Mech 3.0. For 0-D simulations, +# no transport model is necessary. +gas = ct.Solution('gri30.yaml') # Create a Reservoir for the inlet, set to a methane/air mixture at a specified # equivalence ratio diff --git a/interfaces/cython/cantera/examples/reactors/custom.py b/interfaces/cython/cantera/examples/reactors/custom.py index 7c982f28ec..5fc0d95310 100644 --- a/interfaces/cython/cantera/examples/reactors/custom.py +++ b/interfaces/cython/cantera/examples/reactors/custom.py @@ -37,7 +37,7 @@ def __call__(self, t, y): return np.hstack((dTdt, dYdt)) -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') # Initial condition P = ct.one_atm diff --git a/interfaces/cython/cantera/examples/reactors/fuel_injection.py b/interfaces/cython/cantera/examples/reactors/fuel_injection.py index 5f296b5fdd..e11f4eb19b 100644 --- a/interfaces/cython/cantera/examples/reactors/fuel_injection.py +++ b/interfaces/cython/cantera/examples/reactors/fuel_injection.py @@ -12,7 +12,7 @@ import cantera as ct # Use a reduced n-dodecane mechanism with PAH formation pathways -gas = ct.Solution('nDodecane_Reitz.cti', 'nDodecane_IG') +gas = ct.Solution('nDodecane_Reitz.yaml', 'nDodecane_IG') # Create a Reservoir for the fuel inlet, set to pure dodecane gas.TPX = 300, 20*ct.one_atm, 'c12h26:1.0' diff --git a/interfaces/cython/cantera/examples/reactors/ic_engine.py b/interfaces/cython/cantera/examples/reactors/ic_engine.py index 2840cdd35a..c3ef960d08 100644 --- a/interfaces/cython/cantera/examples/reactors/ic_engine.py +++ b/interfaces/cython/cantera/examples/reactors/ic_engine.py @@ -20,7 +20,7 @@ ######################################################################### # reaction mechanism, kinetics type and compositions -reaction_mechanism = 'nDodecane_Reitz.xml' +reaction_mechanism = 'nDodecane_Reitz.yaml' phase_name = 'nDodecane_IG' comp_air = 'o2:1, n2:3.76' comp_fuel = 'c12h26:1' diff --git a/interfaces/cython/cantera/examples/reactors/mix1.py b/interfaces/cython/cantera/examples/reactors/mix1.py index 0d91df4225..c086ecc9ed 100644 --- a/interfaces/cython/cantera/examples/reactors/mix1.py +++ b/interfaces/cython/cantera/examples/reactors/mix1.py @@ -19,7 +19,7 @@ import cantera as ct # Use air for stream a. -gas_a = ct.Solution('air.xml') +gas_a = ct.Solution('air.yaml') gas_a.TPX = 300.0, ct.one_atm, 'O2:0.21, N2:0.78, AR:0.01' rho_a = gas_a.density @@ -27,7 +27,7 @@ # Use GRI-Mech 3.0 for stream b (methane) and for the mixer. If it is desired # to have a pure mixer, with no chemistry, use instead a reaction mechanism # for gas_b that has no reactions. -gas_b = ct.Solution('gri30.xml') +gas_b = ct.Solution('gri30.yaml') gas_b.TPX = 300.0, ct.one_atm, 'CH4:1' rho_b = gas_b.density diff --git a/interfaces/cython/cantera/examples/reactors/periodic_cstr.py b/interfaces/cython/cantera/examples/reactors/periodic_cstr.py index 3ed3949c08..d6578278f5 100644 --- a/interfaces/cython/cantera/examples/reactors/periodic_cstr.py +++ b/interfaces/cython/cantera/examples/reactors/periodic_cstr.py @@ -11,7 +11,7 @@ as soon as a significant amount of water is produced the reaction stops. After enough time has passed that the water is exhausted from the reactor, the mixture explodes again and the process repeats. This explanation can be verified by -decreasing the rate for reaction 7 in file 'h2o2.cti' and re-running the +decreasing the rate for reaction 7 in file h2o2.yaml and re-running the example. Acknowledgments: The idea for this example and an estimate of the conditions @@ -22,7 +22,7 @@ import numpy as np # create the gas mixture -gas = ct.Solution('h2o2.cti') +gas = ct.Solution('h2o2.yaml') # pressure = 60 Torr, T = 770 K p = 60.0*133.3 diff --git a/interfaces/cython/cantera/examples/reactors/pfr.py b/interfaces/cython/cantera/examples/reactors/pfr.py index 982da873a7..cd50058844 100644 --- a/interfaces/cython/cantera/examples/reactors/pfr.py +++ b/interfaces/cython/cantera/examples/reactors/pfr.py @@ -20,7 +20,7 @@ area = 1.e-4 # cross-sectional area [m**2] # input file containing the reaction mechanism -reaction_mechanism = 'h2o2.xml' +reaction_mechanism = 'h2o2.yaml' # Resolution: The PFR will be simulated by 'n_steps' time steps or by a chain # of 'n_steps' stirred reactors. diff --git a/interfaces/cython/cantera/examples/reactors/piston.py b/interfaces/cython/cantera/examples/reactors/piston.py index 3afda49da5..01fc6cf5f2 100644 --- a/interfaces/cython/cantera/examples/reactors/piston.py +++ b/interfaces/cython/cantera/examples/reactors/piston.py @@ -27,10 +27,10 @@ 'V1 [m^3]', 'V2 [m^3]', 'V1+V2 [m^3]','X(CO)')) -gas1 = ct.Solution('h2o2.cti') +gas1 = ct.Solution('h2o2.yaml') gas1.TPX = 900.0, ct.one_atm, 'H2:2, O2:1, AR:20' -gas2 = ct.Solution('gri30.xml') +gas2 = ct.Solution('gri30.yaml') gas2.TPX = 900.0, ct.one_atm, 'CO:2, H2O:0.01, O2:5' r1 = ct.IdealGasReactor(gas1) diff --git a/interfaces/cython/cantera/examples/reactors/reactor1.py b/interfaces/cython/cantera/examples/reactors/reactor1.py index 5dd62b4403..765a1878af 100644 --- a/interfaces/cython/cantera/examples/reactors/reactor1.py +++ b/interfaces/cython/cantera/examples/reactors/reactor1.py @@ -9,7 +9,7 @@ import cantera as ct -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') gas.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:4' r = ct.IdealGasConstPressureReactor(gas) diff --git a/interfaces/cython/cantera/examples/reactors/reactor2.py b/interfaces/cython/cantera/examples/reactors/reactor2.py index 7832d888e5..9d599dd811 100644 --- a/interfaces/cython/cantera/examples/reactors/reactor2.py +++ b/interfaces/cython/cantera/examples/reactors/reactor2.py @@ -28,17 +28,17 @@ #----------------------------------------------------------------------- # create an argon gas object and set its state -ar = ct.Solution('argon.xml') +ar = ct.Solution('argon.yaml') ar.TP = 1000.0, 20.0 * ct.one_atm # create a reactor to represent the side of the cylinder filled with argon r1 = ct.IdealGasReactor(ar) # create a reservoir for the environment, and fill it with air. -env = ct.Reservoir(ct.Solution('air.xml')) +env = ct.Reservoir(ct.Solution('air.yaml')) # use GRI-Mech 3.0 for the methane/air mixture, and set its initial state -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') gas.TP = 500.0, 0.2 * ct.one_atm gas.set_equivalence_ratio(1.1, 'CH4:1.0', 'O2:2, N2:7.52') diff --git a/interfaces/cython/cantera/examples/reactors/sensitivity1.py b/interfaces/cython/cantera/examples/reactors/sensitivity1.py index 20d9c05cdc..3477cfc68a 100644 --- a/interfaces/cython/cantera/examples/reactors/sensitivity1.py +++ b/interfaces/cython/cantera/examples/reactors/sensitivity1.py @@ -7,7 +7,7 @@ import cantera as ct -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') temp = 1500.0 pres = ct.one_atm diff --git a/interfaces/cython/cantera/examples/reactors/surf_pfr.py b/interfaces/cython/cantera/examples/reactors/surf_pfr.py index 4e7252f47f..85ca5b6601 100644 --- a/interfaces/cython/cantera/examples/reactors/surf_pfr.py +++ b/interfaces/cython/cantera/examples/reactors/surf_pfr.py @@ -24,7 +24,7 @@ porosity = 0.3 # Catalyst bed porosity # input file containing the surface reaction mechanism -cti_file = 'methane_pox_on_pt.cti' +yaml_file = 'methane_pox_on_pt.yaml' output_filename = 'surf_pfr_output.csv' @@ -37,11 +37,11 @@ t = tc + 273.15 # convert to Kelvin # import the gas model and set the initial conditions -gas = ct.Solution(cti_file, 'gas') +gas = ct.Solution(yaml_file, 'gas') gas.TPX = t, ct.one_atm, 'CH4:1, O2:1.5, AR:0.1' # import the surface model -surf = ct.Interface(cti_file,'Pt_surf', [gas]) +surf = ct.Interface(yaml_file, 'Pt_surf', [gas]) surf.TP = t, ct.one_atm rlen = length/(NReactors-1) diff --git a/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py b/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py index 45c88bee79..b53e55996d 100644 --- a/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py +++ b/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py @@ -39,19 +39,19 @@ # # This object will be used to evaluate all thermodynamic, kinetic, and # transport properties. The gas phase will be taken from the definition of -# phase 'gas' in input file 'ptcombust.cti,' which is a stripped-down version +# phase 'gas' in input file 'ptcombust.yaml,' which is a stripped-down version # of GRI-Mech 3.0. -gas = ct.Solution('ptcombust.cti', 'gas') +gas = ct.Solution('ptcombust.yaml', 'gas', transport_model=transport) gas.TPX = tinlet, p, comp1 ################ create the interface object ################## # # This object will be used to evaluate all surface chemical production rates. # It will be created from the interface definition 'Pt_surf' in input file -# 'ptcombust.cti,' which implements the reaction mechanism of Deutschmann et +# 'ptcombust.yaml,' which implements the reaction mechanism of Deutschmann et # al., 1995 for catalytic combustion on platinum. # -surf_phase = ct.Interface('ptcombust.cti', 'Pt_surf', [gas]) +surf_phase = ct.Interface('ptcombust.yaml', 'Pt_surf', [gas]) surf_phase.TP = tsurf, p # integrate the coverage equations in time for 1 s, holding the gas diff --git a/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py b/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py index 41ddf83b4a..5cb1954e5d 100644 --- a/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py +++ b/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py @@ -3,7 +3,7 @@ This example computes the growth rate of a diamond film according to a simplified version of a particular published growth mechanism (see file -diamond.cti for details). Only the surface coverage equations are solved here; +diamond.yaml for details). Only the surface coverage equations are solved here; the gas composition is fixed. (For an example of coupled gas- phase and surface, see catalytic_combustion.py.) Atomic hydrogen plays an important role in diamond CVD, and this example computes the growth rate and surface @@ -17,10 +17,10 @@ print('\n****** CVD Diamond Example ******\n') # import the models for the gas and bulk diamond -g, dbulk = ct.import_phases('diamond.cti', ['gas', 'diamond']) +g, dbulk = ct.import_phases('diamond.yaml', ['gas', 'diamond']) # import the model for the diamond (100) surface -d = ct.Interface('diamond.cti', 'diamond_100', [g, dbulk]) +d = ct.Interface('diamond.yaml', 'diamond_100', [g, dbulk]) mw = dbulk.molecular_weights[0] diff --git a/interfaces/cython/cantera/examples/surface_chemistry/sofc.py b/interfaces/cython/cantera/examples/surface_chemistry/sofc.py index 9c08a929d3..c52830f5cc 100644 --- a/interfaces/cython/cantera/examples/surface_chemistry/sofc.py +++ b/interfaces/cython/cantera/examples/surface_chemistry/sofc.py @@ -8,13 +8,13 @@ OCV (it does not need to be separately specified), as well as polarization curves. -NOTE: The parameters here, and in the input file sofc.cti, are not to be +NOTE: The parameters here, and in the input file sofc.yaml, are not to be relied upon for a real SOFC simulation! They are meant to illustrate only how to do such a calculation in Cantera. While some of the parameters may be close to real values, others are simply set arbitrarily to give reasonable-looking results. -It is recommended that you read input file sofc.cti before reading or running +It is recommended that you read input file sofc.yaml before reading or running this script! """ @@ -89,15 +89,16 @@ def NewtonSolver(f, xstart, C=0.0): ##################################################################### # import the anode-side bulk phases -gas_a, anode_bulk, oxide_a = ct.import_phases('sofc.cti', - ['gas', 'metal', 'oxide_bulk',]) +gas_a, anode_bulk, oxide_a = ct.import_phases( + 'sofc.yaml', ['gas', 'metal', 'oxide_bulk'], +) # import the surfaces on the anode side -anode_surf = ct.Interface('sofc.cti', 'metal_surface', [gas_a]) -oxide_surf_a = ct.Interface('sofc.cti', 'oxide_surface', [gas_a, oxide_a]) +anode_surf = ct.Interface('sofc.yaml', 'metal_surface', [gas_a]) +oxide_surf_a = ct.Interface('sofc.yaml', 'oxide_surface', [gas_a, oxide_a]) # import the anode-side triple phase boundary -tpb_a = ct.Interface('sofc.cti', 'tpb', [anode_bulk, anode_surf, oxide_surf_a]) +tpb_a = ct.Interface('sofc.yaml', 'tpb', [anode_bulk, anode_surf, oxide_surf_a]) anode_surf.name = 'anode surface' oxide_surf_a.name = 'anode-side oxide surface' @@ -118,7 +119,7 @@ def anode_curr(E): # get the species net production rates due to the anode-side TPB reaction # mechanism. The production rate array has the values for the neighbor - # species in the order listed in the .cti file, followed by the tpb phase. + # species in the order listed in the .yaml file, followed by the tpb phase. # Since the first neighbor phase is the bulk metal, species 0 is the # electron. w = tpb_a.net_production_rates @@ -138,16 +139,18 @@ def anode_curr(E): # models would be used for the cathode, with a different reaction mechanism. # import the cathode-side bulk phases -gas_c, cathode_bulk, oxide_c = ct.import_phases('sofc.cti', - ['gas', 'metal', 'oxide_bulk']) +gas_c, cathode_bulk, oxide_c = ct.import_phases( + 'sofc.yaml', ['gas', 'metal', 'oxide_bulk'] +) # import the surfaces on the cathode side -cathode_surf = ct.Interface('sofc.cti', 'metal_surface', [gas_c]) -oxide_surf_c = ct.Interface('sofc.cti', 'oxide_surface', [gas_c, oxide_c]) +cathode_surf = ct.Interface('sofc.yaml', 'metal_surface', [gas_c]) +oxide_surf_c = ct.Interface('sofc.yaml', 'oxide_surface', [gas_c, oxide_c]) # import the cathode-side triple phase boundary -tpb_c = ct.Interface('sofc.cti', 'tpb', [cathode_bulk, cathode_surf, - oxide_surf_c]) +tpb_c = ct.Interface( + 'sofc.yaml', 'tpb', [cathode_bulk, cathode_surf, oxide_surf_c] +) cathode_surf.name = 'cathode surface' oxide_surf_c.name = 'cathode-side oxide surface' @@ -164,7 +167,7 @@ def cathode_curr(E): # get the species net production rates due to the cathode-side TPB # reaction mechanism. The production rate array has the values for the - # neighbor species in the order listed in the .cti file, followed by the + # neighbor species in the order listed in the .yaml file, followed by the # tpb phase. Since the first neighbor phase is the bulk metal, species 0 # is the electron. w = tpb_c.net_production_rates diff --git a/interfaces/cython/cantera/examples/thermo/isentropic.py b/interfaces/cython/cantera/examples/thermo/isentropic.py index 2381656e5d..b9fdf1e547 100644 --- a/interfaces/cython/cantera/examples/thermo/isentropic.py +++ b/interfaces/cython/cantera/examples/thermo/isentropic.py @@ -24,7 +24,7 @@ def isentropic(gas=None): K, P0 = 10 atm. """ if gas is None: - gas = ct.Solution('gri30.xml') + gas = ct.Solution('gri30.yaml') gas.TPX = 1200.0, 10.0*ct.one_atm, 'H2:1,N2:0.1' # get the stagnation state parameters diff --git a/interfaces/cython/cantera/examples/thermo/mixing.py b/interfaces/cython/cantera/examples/thermo/mixing.py index b3394b20b4..152b8c9582 100644 --- a/interfaces/cython/cantera/examples/thermo/mixing.py +++ b/interfaces/cython/cantera/examples/thermo/mixing.py @@ -10,7 +10,7 @@ import cantera as ct -gas = ct.Solution('gri30.xml') +gas = ct.Solution('gri30.yaml') # Stream A (air) A = ct.Quantity(gas, constant='HP') diff --git a/interfaces/cython/cantera/examples/thermo/sound_speed.py b/interfaces/cython/cantera/examples/thermo/sound_speed.py index a6f1d31206..d571955e07 100644 --- a/interfaces/cython/cantera/examples/thermo/sound_speed.py +++ b/interfaces/cython/cantera/examples/thermo/sound_speed.py @@ -48,7 +48,7 @@ def equilSoundSpeeds(gas, rtol=1.0e-6, maxiter=5000): # test program if __name__ == "__main__": - gas = ct.Solution('gri30.xml') + gas = ct.Solution('gri30.yaml') gas.X = 'CH4:1.00, O2:2.0, N2:7.52' for n in range(27): T = 300.0 + 100.0 * n diff --git a/interfaces/cython/cantera/examples/transport/dusty_gas.py b/interfaces/cython/cantera/examples/transport/dusty_gas.py index af4f1b43af..a3ec5f6e75 100644 --- a/interfaces/cython/cantera/examples/transport/dusty_gas.py +++ b/interfaces/cython/cantera/examples/transport/dusty_gas.py @@ -11,7 +11,7 @@ # create a gas-phase object to represent the gas in the pores, with a # dusty gas transport manager -g = ct.DustyGas('h2o2.cti') +g = ct.DustyGas('h2o2.yaml') # set the gas state g.TPX = 500.0, ct.one_atm, "OH:1, H:2, O2:3, O:1.0E-8, H2:1.0E-8, H2O:1.0E-8, H2O2:1.0E-8, HO2:1.0E-8, AR:1.0E-8" diff --git a/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py b/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py index 4358d341d5..d679750fc3 100644 --- a/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py +++ b/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py @@ -79,12 +79,12 @@ def serial(mech, predicate, nTemps): # significant speedup can be obtained using the multiprocessing module. print('Thermal conductivity') t1 = time() - parallel('gri30.xml', get_thermal_conductivity, nProcs, nPoints) + parallel('gri30.yaml', get_thermal_conductivity, nProcs, nPoints) t2 = time() print('Parallel: {0:.3f} seconds'.format(t2-t1)) t1 = time() - serial('gri30.xml', get_thermal_conductivity, nPoints) + serial('gri30.yaml', get_thermal_conductivity, nPoints) t2 = time() print('Serial: {0:.3f} seconds'.format(t2-t1)) @@ -92,11 +92,11 @@ def serial(mech, predicate, nTemps): # small, there may be no advantage to using multiprocessing. print('\nViscosity') t1 = time() - parallel('gri30.xml', get_viscosity, nProcs, nPoints) + parallel('gri30.yaml', get_viscosity, nProcs, nPoints) t2 = time() print('Parallel: {0:.3f} seconds'.format(t2-t1)) t1 = time() - serial('gri30.xml', get_viscosity, nPoints) + serial('gri30.yaml', get_viscosity, nPoints) t2 = time() print('Serial: {0:.3f} seconds'.format(t2-t1)) diff --git a/interfaces/cython/cantera/liquidvapor.py b/interfaces/cython/cantera/liquidvapor.py index 453286ca7a..2d8d57ee21 100644 --- a/interfaces/cython/cantera/liquidvapor.py +++ b/interfaces/cython/cantera/liquidvapor.py @@ -13,32 +13,32 @@ class WaterWithTransport(PureFluid, _cantera.Transport): __slots__ = () - return WaterWithTransport('liquidvapor.xml', 'water', transport_model='Water') + return WaterWithTransport('liquidvapor.yaml', 'water', transport_model='Water') def Nitrogen(): """Create a `PureFluid` object using the equation of state for nitrogen.""" - return PureFluid('liquidvapor.xml','nitrogen') + return PureFluid('liquidvapor.yaml','nitrogen') def Methane(): """Create a `PureFluid` object using the equation of state for methane.""" - return PureFluid('liquidvapor.xml','methane') + return PureFluid('liquidvapor.yaml','methane') def Hydrogen(): """Create a `PureFluid` object using the equation of state for hydrogen.""" - return PureFluid('liquidvapor.xml','hydrogen') + return PureFluid('liquidvapor.yaml','hydrogen') def Oxygen(): """Create a `PureFluid` object using the equation of state for oxygen.""" - return PureFluid('liquidvapor.xml','oxygen') + return PureFluid('liquidvapor.yaml','oxygen') def Hfc134a(): """Create a `PureFluid` object using the equation of state for HFC-134a.""" - return PureFluid('liquidvapor.xml','hfc134a') + return PureFluid('liquidvapor.yaml','hfc134a') def CarbonDioxide(): """Create a `PureFluid` object using the equation of state for carbon dioxide.""" - return PureFluid('liquidvapor.xml','carbondioxide') + return PureFluid('liquidvapor.yaml','carbondioxide') def Heptane(): """Create a `PureFluid` object using the equation of state for heptane.""" - return PureFluid('liquidvapor.xml','heptane') + return PureFluid('liquidvapor.yaml','heptane') diff --git a/interfaces/matlab/toolbox/@Solution/Solution.m b/interfaces/matlab/toolbox/@Solution/Solution.m index 5b90988d45..a62e3d11aa 100644 --- a/interfaces/matlab/toolbox/@Solution/Solution.m +++ b/interfaces/matlab/toolbox/@Solution/Solution.m @@ -10,13 +10,13 @@ % of each species, which may be given as mole fractions or mass % fractions. :: % -% >> s = Solution('input.xml'[, phase_name[, transport_model]]) +% >> s = Solution('input.yaml'[, phase_name[, transport_model]]) % -% constructs a Solution object from a specification contained in -% file ``input.xml``. Optionally, the name of the phase to be imported -% can be specified with ``phase_name``. If a -% Transport model is included in ``input.xml``, it will be included -% in the Solution instance with the default transport modeling as set +% constructs a :mat:func:`Solution` object from a specification contained in +% file ``input.yaml``. Optionally, the name of the phase to be imported +% can be specified with ``phase_name``. If a :mat:func:`Transport` model is +% included in ``input.yaml``, it will be included in the :mat:func:`Solution` +% instance with the default transport modeling as set % in the input file. To specify the transport modeling, set the input % argument ``trans`` to one of ``'default'``, ``'None'``, ``'Mix'``, or ``'Multi'``. % In this case, the phase name must be specified as well. Alternatively, diff --git a/interfaces/matlab/toolbox/Air.m b/interfaces/matlab/toolbox/Air.m index 67b2f59c10..3625a7be12 100644 --- a/interfaces/matlab/toolbox/Air.m +++ b/interfaces/matlab/toolbox/Air.m @@ -2,11 +2,11 @@ % AIR Create an object representing air. % gas = Air() % Air is modeled as an ideal gas mixture. The specification is taken -% from file ``air.xml``. Several reactions among oxygen and nitrogen are -% defined. +% from file ``air.yaml``. Several reactions among oxygen and nitrogen are +% defined. Mixture-averaged transport is specified by default. % % :return: % Instance of class :mat:func:`Solution` % -gas = Solution('air.xml', 'air'); +gas = Solution('air.yaml', 'air'); diff --git a/interfaces/matlab/toolbox/CarbonDioxide.m b/interfaces/matlab/toolbox/CarbonDioxide.m index c54ae1f7d2..0223ab7395 100644 --- a/interfaces/matlab/toolbox/CarbonDioxide.m +++ b/interfaces/matlab/toolbox/CarbonDioxide.m @@ -17,4 +17,4 @@ % Instance of class :mat:func:`Solution` % -c = Solution('liquidvapor.xml', 'carbondioxide'); +c = Solution('liquidvapor.yaml', 'carbondioxide'); diff --git a/interfaces/matlab/toolbox/GRI30.m b/interfaces/matlab/toolbox/GRI30.m index 6b672d114c..398e10b84c 100644 --- a/interfaces/matlab/toolbox/GRI30.m +++ b/interfaces/matlab/toolbox/GRI30.m @@ -12,16 +12,17 @@ % GRI-Mech 3.0 is available from http://www.me.berkeley.edu/gri_mech/ % % Function :mat:func:`GRI30` creates the solution according to the -% specifications in file gri30.cti. The ideal gas equation of -% state is used. Transport property evaluation is disabled by -% default. To enable transport properties, supply the name of +% specifications in file gri30.yaml. The ideal gas equation of +% state is used. Transport property evaluation is mixture-averaged by +% default. To change or disable transport properties, supply the name of % the transport model to use. % % .. code-block:: matlab % -% g1 = GRI30 % no transport properties +% g1 = GRI30 % mixture-averaged transport properties % g2 = GRI30('Mix') % mixture-averaged transport properties % g3 = GRI30('Multi') % miulticomponent transport properties +% g4 = GRI30('None') % no transport properties % % :param tr: % Transport modeling, ``'None'``, ``'Mix'``, or ``'Multi'`` @@ -30,14 +31,14 @@ % if nargin == 0 - s = Solution('gri30.xml', 'gri30'); + s = Solution('gri30.yaml', 'gri30'); elseif nargin == 1 if strcmp(tr, 'None') - s = Solution('gri30.xml', 'gri30'); + s = Solution('gri30.yaml', 'gri30', 'None'); elseif strcmp(tr, 'Mix') - s = Solution('gri30.xml', 'gri30_mix'); + s = Solution('gri30.yaml', 'gri30', 'Mix'); elseif strcmp(tr, 'Multi') - s = Solution('gri30.xml', 'gri30_multi'); + s = Solution('gri30.yaml', 'gri30', 'Multi') else error('Unknown transport specified. "None", "Mix", or "Multi" are supported.') end diff --git a/interfaces/matlab/toolbox/HFC134a.m b/interfaces/matlab/toolbox/HFC134a.m index 6d8bd7fb96..1e0adf3e75 100644 --- a/interfaces/matlab/toolbox/HFC134a.m +++ b/interfaces/matlab/toolbox/HFC134a.m @@ -18,4 +18,4 @@ % Instance of class :mat:func:`Solution` % -h = Solution('liquidvapor.xml', 'hfc134a'); +h = Solution('liquidvapor.yaml', 'hfc134a'); diff --git a/interfaces/matlab/toolbox/Heptane.m b/interfaces/matlab/toolbox/Heptane.m index e109bc4893..c6d01267fa 100644 --- a/interfaces/matlab/toolbox/Heptane.m +++ b/interfaces/matlab/toolbox/Heptane.m @@ -17,4 +17,4 @@ % Instance of class :mat:func:`Solution` % -h = Solution('liquidvapor.xml', 'heptane'); +h = Solution('liquidvapor.yaml', 'heptane'); diff --git a/interfaces/matlab/toolbox/Hydrogen.m b/interfaces/matlab/toolbox/Hydrogen.m index d7ee8a9269..45360a9325 100644 --- a/interfaces/matlab/toolbox/Hydrogen.m +++ b/interfaces/matlab/toolbox/Hydrogen.m @@ -17,4 +17,4 @@ % Instance of class :mat:func:`Solution` % -h = Solution('liquidvapor.xml', 'hydrogen'); +h = Solution('liquidvapor.yaml', 'hydrogen'); diff --git a/interfaces/matlab/toolbox/IdealGasMix.m b/interfaces/matlab/toolbox/IdealGasMix.m index 621bb9706e..1eeb1569f6 100644 --- a/interfaces/matlab/toolbox/IdealGasMix.m +++ b/interfaces/matlab/toolbox/IdealGasMix.m @@ -3,58 +3,61 @@ % s = IdealGasMix(infile, b, c) % Create a :mat:func:`Solution` instance representing an ideal gas mixture. :: % -% gas1 = IdealGasMix('ctml_file'[,'transport_model']) -% gas2 = IdealGasMix('ck_file'[,'thermo_db'[,'tran_db'[,'transport_model']]]) +% gas1 = IdealGasMix('yaml_file'[,'phase_name'[,'transport_model']]) +% gas2 = IdealGasMix('ck_file'[,'thermo_db'[,'tran_db']]) % % creates an object that represents an ideal gas mixture. The % species in the mixture, their properties, and the reactions among -% the species, if any, are specified in file 'ctml_file' and 'ck_file'. Two -% input file formats are supported - CTML and CK -% (CHEMKIN-compatible). Examples:: +% the species, if any, are specified in file ``'yaml_file'`` and +% ``'ck_file'``. Examples:: % -% g1a = IdealGasMix('mech.xml') -% g1b = IdealGasMix('mech.xml', 'Multi') +% g1a = IdealGasMix('mech.yaml') +% g1b = IdealGasMix('mech.yaml', 'phase_name', 'Multi') % g2 = IdealGasMix('mech2.inp') % g3 = IdealGasMix('mech3.inp', 'therm.dat') % g4 = IdealGasMix('mech4.inp', 'therm.dat', 'tran.dat') % -% Objects ``g1a`` and ``g1b`` are created from a CTML file. CTML files +% Objects ``g1a`` and ``g1b`` are created from a YAML file. YAML files % contain all data required to build the object, and do not require -% any additional database files. Objects ``g2`` - ``g4`` are created -% from CK-format input files. For ``g2``, 'mech2.inp' contains all required -% species thermo data. File 'mech3.inp' is missing some or all -% species thermo data, and requires database file 'therm.dat.' +% any additional database files. Objects ``g2``-``g4`` are created +% from CK-format input files. For ``g2``, ``'mech2.inp'`` contains all required +% species thermo data. File ``'mech3.inp'`` is missing some or all +% species thermo data, and requires database file ``'therm.dat'``. % Object ``g4`` is created including transport data. % % Note that calling :mat:func:`IdealGasMix` with a CK-format input file -% also creates an equivalent CTML file that may be used in future +% also creates an equivalent CTI file that may be used in future % calls. If the initial call includes a transport database, then -% the CTML file will contain transport data. +% the CTI file will contain transport data. % % See also: :mat:func:`ck2cti`, :mat:func:`Solution` % % :param infile: -% Input file, either CTI, CTML, or CHEMKIN format +% Input file, either YAML, CTI, CTML, or CHEMKIN format % :param b: -% If a CTI or CTML file is specified with ``infile``, this can be -% the transport modeling to be used. If a CHEMKIN format file is +% If a YAML, CTI, or CTML file is specified with ``infile``, this can be +% the name of the phase to be loaded from that file. If a CHEMKIN format file is % specified with ``infile``, this is the filename of the % thermodynamic database, if required. % :param c: -% If a CHEMKIN format file is specified with ``infile``, this is the -% filename of the transport database, if required. +% If a YAML, CTI, or CTML file is specified with ``infile``, this can be +% the transport modeling to be used. If a CHEMKIN format file is specified with +% ``infile``, this is the filename of the transport database, if required. % :return: % Instance of class :mat:func:`Solution` % -dotloc = findstr(infile, '.'); +dotloc = strfind(infile, '.'); if dotloc(end) > 1 ext = infile(dotloc(end):end); - if strcmp(ext, '.cti') || strcmp(ext, '.xml') + if strcmp(ext, '.cti') || strcmp(ext, '.xml') || ... + strcmp(ext, '.yaml') || strcmp(ext, '.yml') if nargin == 1 s = Solution(infile); elseif nargin == 2 s = Solution(infile, b); + elseif nargin == 3 + s = Solution(infile, b, c); end return end diff --git a/interfaces/matlab/toolbox/Methane.m b/interfaces/matlab/toolbox/Methane.m index 87ac95475d..432658f55f 100644 --- a/interfaces/matlab/toolbox/Methane.m +++ b/interfaces/matlab/toolbox/Methane.m @@ -14,4 +14,4 @@ % Instance of class :mat:func:`Solution` % -m = Solution('liquidvapor.xml', 'methane'); +m = Solution('liquidvapor.yaml', 'methane'); diff --git a/interfaces/matlab/toolbox/Nitrogen.m b/interfaces/matlab/toolbox/Nitrogen.m index 3319eec58b..bbc1276d60 100644 --- a/interfaces/matlab/toolbox/Nitrogen.m +++ b/interfaces/matlab/toolbox/Nitrogen.m @@ -14,4 +14,4 @@ % Instance of class :mat:func:`Solution` % -n = Solution('liquidvapor.xml', 'nitrogen'); +n = Solution('liquidvapor.yaml', 'nitrogen'); diff --git a/interfaces/matlab/toolbox/Oxygen.m b/interfaces/matlab/toolbox/Oxygen.m index d740515268..85c37973ba 100644 --- a/interfaces/matlab/toolbox/Oxygen.m +++ b/interfaces/matlab/toolbox/Oxygen.m @@ -14,4 +14,4 @@ % Instance of class :mat:func:`Solution` % -o = Solution('liquidvapor.xml', 'oxygen'); +o = Solution('liquidvapor.yaml', 'oxygen'); diff --git a/interfaces/matlab/toolbox/Water.m b/interfaces/matlab/toolbox/Water.m index 13b1df3b90..8988af881c 100644 --- a/interfaces/matlab/toolbox/Water.m +++ b/interfaces/matlab/toolbox/Water.m @@ -17,4 +17,4 @@ % Instance of class :mat:func:`Solution` % -w = Solution('liquidvapor.xml', 'water'); +w = Solution('liquidvapor.yaml', 'water'); diff --git a/samples/cxx/LiC6_electrode/LiC6_electrode.cpp b/samples/cxx/LiC6_electrode/LiC6_electrode.cpp index b1a71e6bf7..95f0f1c1ff 100644 --- a/samples/cxx/LiC6_electrode/LiC6_electrode.cpp +++ b/samples/cxx/LiC6_electrode/LiC6_electrode.cpp @@ -9,7 +9,7 @@ void calc_potentials() suppress_deprecation_warnings(); double Tk = 273.15 + 25.0; - std::string filename = "LiC6_electrodebulk.xml"; + std::string filename = "LiC6_electrodebulk.yaml"; std::string phasename = "LiC6_and_Vacancies"; std::unique_ptr electrodebulk(newPhase(filename,phasename)); std::string intercalatingSpeciesName("Li(C6)"); diff --git a/samples/cxx/LiC6_electrode/LiC6_electrodebulk.xml b/samples/cxx/LiC6_electrode/LiC6_electrodebulk.xml deleted file mode 100644 index 572d1439ce..0000000000 --- a/samples/cxx/LiC6_electrode/LiC6_electrodebulk.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - Li C - Li(C6) V(C6) - - 298.15 - 101325.0 - Li(C6):0.6,V(C6):0.4 - - - 2000.0 - - - - - - -3.268E6, - 3.955E6, - -4.573E6, - 6.147E6, - -3.339E6, - 1.117E7, - 2.997E5, - -4.866E7, - 1.362E5, - 1.373E8, - -2.129E7, - -1.722E8, - 3.956E7, - 9.302E7, - -3.280E7 - - - 0.0 - - - - - - - - - - - - - - - - - C:6 Li:1 - - - 298.15 - -11.65 - 0.0 - 0.0 - - - - - - - C:6 - - - 298.15 - 0.0 - 0.0 - 0.0 - - - - - - diff --git a/samples/cxx/LiC6_electrode/LiC6_electrodebulk.yaml b/samples/cxx/LiC6_electrode/LiC6_electrodebulk.yaml new file mode 100644 index 0000000000..e76860d71d --- /dev/null +++ b/samples/cxx/LiC6_electrode/LiC6_electrodebulk.yaml @@ -0,0 +1,36 @@ +generator: ctml2yaml +cantera-version: 2.5.0a3 +date: Fri, 13 Dec 2019 20:48:20 -0500 +input-files: [LiC6_electrodebulk.xml] + +phases: +- name: LiC6_and_Vacancies + elements: [Li, C] + species: [Li(C6), V(C6)] + thermo: Redlich-Kister + interactions: + - species: [Li(C6), V(C6)] + excess-enthalpy: [-3.268E6 J/kmol, 3.955E6 J/kmol, -4.573E6 J/kmol, 6.147E6 J/kmol, + -3.339E6 J/kmol, 1.117E7 J/kmol, 2.997E5 J/kmol, -4.866E7 J/kmol, 1.362E5 J/kmol, + 1.373E8 J/kmol, -2.129E7 J/kmol, -1.722E8 J/kmol, 3.956E7 J/kmol, 9.302E7 J/kmol, + -3.280E7 J/kmol] + excess-entropy: [0.0 J/kmol/K] + state: {T: 298.15 K, P: 1.01325e+05 Pa, X: {Li(C6): 0.6, V(C6): 0.4}} + +species: +- name: Li(C6) + composition: {C: 6.0, Li: 1.0} + thermo: + model: constant-cp + T0: 298.15 K + h0: -11.65 kJ/mol + s0: 0.0 J/mol/K + cp0: 0.0 J/mol/K +- name: V(C6) + composition: {C: 6.0} + thermo: + model: constant-cp + T0: 298.15 K + h0: 0.0 kJ/mol + s0: 0.0 J/mol/K + cp0: 0.0 J/mol/K diff --git a/samples/cxx/combustor/combustor.cpp b/samples/cxx/combustor/combustor.cpp index c85d671610..638f5eae0b 100644 --- a/samples/cxx/combustor/combustor.cpp +++ b/samples/cxx/combustor/combustor.cpp @@ -26,7 +26,7 @@ void runexample() fuel_in.insert(sol); double fuel_mw = gas->meanMolecularWeight(); - auto air = newSolution("air.cti"); + auto air = newSolution("air.yaml", "air", "None"); double air_mw = air->thermo()->meanMolecularWeight(); // create a reservoir for the air inlet diff --git a/samples/f77/ctlib.f b/samples/f77/ctlib.f index 193ba60ef8..8d67cbd558 100644 --- a/samples/f77/ctlib.f +++ b/samples/f77/ctlib.f @@ -27,7 +27,7 @@ program ctck c Read in the reaction mechanism. Since this is done differently c than in Chemkin, this function does not correspond to any CKLIB c subroutine. - call newIdealGasMix('gri30.cti','gri30','') + call newIdealGasMix('gri30.yaml','gri30','') c get the number of elements, species, and reactions call ctindx(ickwrk, rckwrk, mm, kk, ii) diff --git a/samples/f77/demo.f b/samples/f77/demo.f index dff42be301..d354f7fb49 100644 --- a/samples/f77/demo.f +++ b/samples/f77/demo.f @@ -17,7 +17,7 @@ program demo write(*,*) write(*,*) '******** Fortran 77 Test Program ********' - call newIdealGasMix('h2o2.cti','ohmech','Mix') + call newIdealGasMix('h2o2.yaml','ohmech','Mix') t = 1200.0 p = 101325.0 call setState_TPX_String(t, p, diff --git a/samples/f77/isentropic.f b/samples/f77/isentropic.f index 7c2da35f1b..e1e240c1cf 100644 --- a/samples/f77/isentropic.f +++ b/samples/f77/isentropic.f @@ -8,7 +8,7 @@ program isentropic double precision a(NPTS), dmach(NPTS), t(NPTS), $ ratio(NPTS) - call newIdealGasMix('gri30.cti','gri30','') + call newIdealGasMix('gri30.yaml','gri30','') temp = 1200.d0 pres = 10.d0*oneatm call setState_TPX_String(temp, pres,'H2:1, N2:0.1') diff --git a/samples/f90/demo.f90 b/samples/f90/demo.f90 index 670fb95102..7a14841aca 100644 --- a/samples/f90/demo.f90 +++ b/samples/f90/demo.f90 @@ -19,8 +19,8 @@ program main ! Read in a definition of the 'gas' phase. ! This will take the definition with name 'ohmech' from file - ! 'h2o2.cti', located in the Cantera data directory - gas = importPhase('h2o2.cti','ohmech') + ! 'h2o2.yaml', located in the Cantera data directory + gas = importPhase('h2o2.yaml','ohmech') t = 1200.0 ! K p = 101325.0 ! Pa diff --git a/samples/matlab/catcomb.m b/samples/matlab/catcomb.m index 82863e588c..729f59e31a 100644 --- a/samples/matlab/catcomb.m +++ b/samples/matlab/catcomb.m @@ -57,20 +57,20 @@ % and transport properties % % The gas phase will be taken from the definition of phase 'gas' in -% input file 'ptcombust.cti,' which is a stripped-down version of +% input file 'ptcombust.yaml,' which is a stripped-down version of % GRI-Mech 3.0. -gas = Solution('ptcombust.cti','gas'); +gas = Solution('ptcombust.yaml','gas',transport); set(gas,'T',tinlet,'P',p,'X',comp1); %%%%%%%%%%%%%%%% create the interface object %%%%%%%%%%%%%%%%%% % % This object will be used to evaluate all surface chemical production % rates. It will be created from the interface definition 'Pt_surf' -% in input file 'ptcombust.cti,' which implements the reaction +% in input file 'ptcombust.yaml,' which implements the reaction % mechanism of Deutschmann et al., 1995 for catalytic combustion on % platinum. % -surf_phase = importInterface('ptcombust.cti','Pt_surf',gas); +surf_phase = importInterface('ptcombust.yaml','Pt_surf',gas); setTemperature(surf_phase, tsurf); % integrate the coverage equations in time for 1 s, holding the gas diff --git a/samples/matlab/diffflame.m b/samples/matlab/diffflame.m index 78bae086e5..78d8b057d4 100644 --- a/samples/matlab/diffflame.m +++ b/samples/matlab/diffflame.m @@ -16,7 +16,6 @@ tin = 300.0; % Inlet temperature mdot_o = 0.72; % Air mass flux, kg/m^2/s mdot_f = 0.24; % Fuel mass flux, kg/m^2/s -rxnmech = 'gri30.xml'; % Reaction mechanism file transport = 'Mix'; % Transport model % NOTE: Transport model needed if mechanism file does not have transport % properties. @@ -36,8 +35,8 @@ % properties. % -fuel = GRI30('Mix'); -ox = GRI30('Mix'); +fuel = GRI30(transport); +ox = GRI30(transport); oxcomp = 'O2:0.21, N2:0.78'; % Air composition fuelcomp = 'C2H6:1'; % Fuel composition % Set each gas mixture state with the corresponding composition. diff --git a/samples/matlab/equil.m b/samples/matlab/equil.m index 7f5b264942..0e7479f5ef 100644 --- a/samples/matlab/equil.m +++ b/samples/matlab/equil.m @@ -9,11 +9,10 @@ function equil(g) if nargin == 1 gas = g; else - gas = IdealGasMix('gri30.cti'); + gas = Solution('gri30.yaml'); end nsp = nSpecies(gas); -phi = []; % find methane, nitrogen, and oxygen indices ich4 = speciesIndex(gas,'CH4'); diff --git a/samples/matlab/flame1.m b/samples/matlab/flame1.m index 6885ddb2db..8cfbd465fd 100644 --- a/samples/matlab/flame1.m +++ b/samples/matlab/flame1.m @@ -12,7 +12,7 @@ tburner = 373.0; % burner temperature mdot = 0.06; % kg/m^2/s -rxnmech = 'h2o2.cti'; % reaction mechanism file +rxnmech = 'h2o2.yaml'; % reaction mechanism file comp = 'H2:1.8, O2:1, AR:7'; % premixed gas composition initial_grid = [0.0 0.02 0.04 0.06 0.08 0.1 ... @@ -34,7 +34,7 @@ % This object will be used to evaluate all thermodynamic, kinetic, % and transport properties % -gas = IdealGasMix(rxnmech); +gas = Solution(rxnmech, 'ohmech', 'Mix'); % set its state to that of the unburned gas at the burner set(gas,'T', tburner, 'P', p, 'X', comp); diff --git a/samples/matlab/flame2.m b/samples/matlab/flame2.m index cf0fbffaf0..f6f21528dc 100644 --- a/samples/matlab/flame2.m +++ b/samples/matlab/flame2.m @@ -12,10 +12,9 @@ mdot_o = 0.72; % air, kg/m^2/s mdot_f = 0.24; % fuel, kg/m^2/s -rxnmech = 'gri30.xml'; % reaction mechanism file -transport = 'Mix'; % transport model -comp1 = 'O2:0.21, N2:0.78, AR:0.01'; % air composition -comp2 = 'C2H6:1'; % fuel composition +rxnmech = 'gri30.yaml'; % reaction mechanism file +comp1 = 'O2:0.21, N2:0.78, AR:0.01'; % air composition +comp2 = 'C2H6:1'; % fuel composition initial_grid = 0.02*[0.0 0.2 0.4 0.6 0.8 1.0]; % m @@ -34,7 +33,7 @@ % This object will be used to evaluate all thermodynamic, kinetic, % and transport properties % -gas = GRI30('Mix'); %IdealGasMix(rxnmech, transport); +gas = Solution(rxnmech,'gri30','Mix'); % set its state to that of the fuel (arbitrary) set(gas,'T', tin, 'P', p, 'X', comp2); diff --git a/samples/matlab/ignite.m b/samples/matlab/ignite.m index 5eec2ac22b..9417134cb6 100644 --- a/samples/matlab/ignite.m +++ b/samples/matlab/ignite.m @@ -11,7 +11,7 @@ if nargin == 1 gas = g; else - gas = IdealGasMix('gri30.xml'); + gas = Solution('gri30.yaml'); end nsp = nSpecies(gas); diff --git a/samples/matlab/ignite_hp.m b/samples/matlab/ignite_hp.m index ca9131258c..1896b23497 100644 --- a/samples/matlab/ignite_hp.m +++ b/samples/matlab/ignite_hp.m @@ -6,7 +6,7 @@ function ignite_hp(gas) help ignite_hp if nargin == 0 - gas = IdealGasMix('gri30.xml'); + gas = Solution('gri30.yaml'); end mw = molecularWeights(gas); diff --git a/samples/matlab/ignite_uv.m b/samples/matlab/ignite_uv.m index 736ebd6185..e1fc8f1ecc 100644 --- a/samples/matlab/ignite_uv.m +++ b/samples/matlab/ignite_uv.m @@ -5,7 +5,7 @@ function ignite_uv(gas) help ignite_uv if nargin == 0 - gas = IdealGasMix('gri30.xml'); + gas = Solution('gri30.yaml'); end mw = molecularWeights(gas); diff --git a/samples/matlab/isentropic.m b/samples/matlab/isentropic.m index 55d98742ae..d7fdbd1a16 100644 --- a/samples/matlab/isentropic.m +++ b/samples/matlab/isentropic.m @@ -9,7 +9,7 @@ function isentropic(g) if nargin == 1 gas = g; else - gas = IdealGasMix('gri30.xml'); + gas = Solution('gri30.yaml'); end % set the stagnation state diff --git a/samples/matlab/lithium_ion_battery.m b/samples/matlab/lithium_ion_battery.m index 2c18538d60..ae214b633c 100644 --- a/samples/matlab/lithium_ion_battery.m +++ b/samples/matlab/lithium_ion_battery.m @@ -28,7 +28,7 @@ P = oneatm; % [Pa] Pressure % Cell properties -inputCTI = 'lithium_ion_battery.cti'; % Cantera input file name +inputFile = 'lithium_ion_battery.yaml'; % Cantera input file name R_elyt = 0.0384; % [Ohm] Electrolyte resistance S_ca = 1.1167; % [m^2] Cathode total active material surface area S_an = 0.7824; % [m^2] Anode total active material surface area @@ -50,12 +50,12 @@ X_Li_ca = (X_Li_ca_0-X_Li_ca_1)*(1-SOC)+X_Li_ca_1; % cathode balancing % Import all Cantera phases -anode = Solution(inputCTI, 'anode'); -cathode = Solution(inputCTI, 'cathode'); -elde = Solution(inputCTI, 'electron'); -elyt = Solution(inputCTI, 'electrolyte'); -anode_interface = Interface(inputCTI, 'edge_anode_electrolyte', anode, elde, elyt); -cathode_interface = Interface(inputCTI, 'edge_cathode_electrolyte', cathode, elde, elyt); +anode = Solution(inputFile, 'anode'); +cathode = Solution(inputFile, 'cathode'); +elde = Solution(inputFile, 'electron'); +elyt = Solution(inputFile, 'electrolyte'); +anode_interface = Interface(inputFile, 'edge_anode_electrolyte', anode, elde, elyt); +cathode_interface = Interface(inputFile, 'edge_cathode_electrolyte', cathode, elde, elyt); % Set the temperatures and pressures of all phases set(anode,'T',T,'P',P); diff --git a/samples/matlab/periodic_cstr.m b/samples/matlab/periodic_cstr.m index 24a6a84080..883aae6da6 100644 --- a/samples/matlab/periodic_cstr.m +++ b/samples/matlab/periodic_cstr.m @@ -12,7 +12,7 @@ % stops. After enough time has passed that the water is exhausted from % the reactor, the mixture explodes again and the process % repeats. This explanation can be verified by decreasing the rate for -% reaction 7 in file 'h2o2.cti' and re-running the example. +% reaction 7 in file 'h2o2.yaml' and re-running the example. % % Acknowledgments: The idea for this example and an estimate of the % conditions needed to see the oscillations came from Bob Kee, @@ -23,7 +23,7 @@ help periodic_cstr % create the gas mixture -gas = IdealGasMix('h2o2.cti'); +gas = Solution('h2o2.yaml'); % pressure = 60 Torr, T = 770 K p = 60.0*133.3; diff --git a/samples/matlab/reactor1.m b/samples/matlab/reactor1.m index e5f283f46a..b80d219101 100644 --- a/samples/matlab/reactor1.m +++ b/samples/matlab/reactor1.m @@ -15,7 +15,7 @@ function reactor1(g) if nargin == 1 gas = g; else - gas = GRI30; + gas = GRI30('None'); end nsp = nSpecies(gas); @@ -28,7 +28,7 @@ function reactor1(g) r = IdealGasReactor(gas); % create a reservoir to represent the environment -a = IdealGasMix('air.cti'); +a = Solution('air.yaml','air','None'); set(a,'P',P) env = Reservoir(a); diff --git a/samples/matlab/reactor2.m b/samples/matlab/reactor2.m index 5ab19a6175..f48052dcad 100644 --- a/samples/matlab/reactor2.m +++ b/samples/matlab/reactor2.m @@ -11,7 +11,7 @@ function reactor2(g) if nargin == 1 gas = g; else - gas = GRI30; + gas = GRI30('None'); end nsp = nSpecies(gas); diff --git a/samples/matlab/surfreactor.m b/samples/matlab/surfreactor.m index 1110ceba59..67fca1fad7 100644 --- a/samples/matlab/surfreactor.m +++ b/samples/matlab/surfreactor.m @@ -7,7 +7,7 @@ help surfreactor t = 870.0; -gas = Solution('ptcombust.cti','gas'); +gas = Solution('ptcombust.yaml','gas'); % set the initial conditions set(gas,'T',t,'P',oneatm,'X','CH4:0.01, O2:0.21, N2:0.78'); @@ -15,7 +15,7 @@ % The surface reaction mechanism describes catalytic combustion of % methane on platinum, and is from Deutschman et al., 26th % Symp. (Intl.) on Combustion,1996, pp. 1747-1754 -surf = importInterface('ptcombust.cti','Pt_surf', gas); +surf = importInterface('ptcombust.yaml','Pt_surf', gas); setTemperature(surf, t); nsp = nSpecies(gas); @@ -25,7 +25,7 @@ setInitialVolume(r, 1.0e-6) % create a reservoir to represent the environment -a = IdealGasMix('air.cti'); +a = Solution('air.yaml','air','None'); set(a,'T',t,'P',oneatm); env = Reservoir(a); diff --git a/samples/matlab/tut2.m b/samples/matlab/tut2.m index f3af17e3d8..ba2d646fd7 100644 --- a/samples/matlab/tut2.m +++ b/samples/matlab/tut2.m @@ -16,14 +16,12 @@ % GRI-Mech 3.0. Another way to do this is shown here, with statements % added to measure how long this takes: -gas1 = Solution('gri30.cti', 'gri30'); +gas1 = Solution('gri30.yaml', 'gas', 'Mix'); msg = sprintf('time to create gas1: %f', cputime - t0) % Function 'Solution' constructs an object representing a phase of % matter by reading in attributes of the phase from a file, which in -% this case is 'gri30.cti'. This file contains several phase -% spcifications; the one we want here is 'gri30', which is specified -% by the second argument. This file contains a complete specification +% this case is 'gri30.yaml'. This file contains a complete specification % of the GRI-Mech 3.0 reaction mechanism, including element data % (name, atomic weight), species data (name, elemental composition, % coefficients to compute thermodynamic and transport properties), and @@ -31,18 +29,16 @@ % is written in a format understood by Cantera, which is described in % the document "Defining Phases and Interfaces." -% On some systems, processing long CTI files like gri30.cti can be a -% little slow. For example, using a typical laptop computer running -% Windows 2000, the statement above takes more than 4 s, while on a -% Mac Powerbook G4 of similar CPU speed it takes only 0.3 s. In any -% case, running it again takes much less time, because Cantera -% 'remembers' files it has already processed and doesn't need to read -% them in again: +% On some systems, processing long files can be a little slow. Loading +% a file again takes much less time, because Cantera 'remembers' files +% it has already processed and doesn't need to read them in again: t0 = cputime; -gas1b = Solution('gri30.cti', 'gri30'); +gas1b = Solution('gri30.yaml', 'gas', 'None'); msg = sprintf('time to create gas1b: %f', cputime - t0) +% Since GRI-Mech is a rather small mechanism, there might not be much +% difference in these times. % CTI files distributed with Cantera %----------------------------------- @@ -74,36 +70,18 @@ % A Cantera input file may contain more than one phase specification, % or may contain specifications of interfaces (surfaces). Here we % import definitions of two bulk phases and the interface between them -% from file diamond.cti: +% from file diamond.yaml: -gas2 = Solution('diamond.cti', 'gas'); % a gas +gas2 = Solution('diamond.yaml', 'gas'); % a gas -diamond = Solution('diamond.cti','diamond'); % bulk diamond +diamond = Solution('diamond.yaml','diamond'); % bulk diamond -diamonnd_surf = importInterface('diamond.cti','diamond_100',... +diamonnd_surf = importInterface('diamond.yaml','diamond_100',... gas2, diamond); % Note that the bulk (i.e., 3D) phases that participate in the surface % reactions must also be passed as arguments to importInterface. - -% CTML files -% ---------- - -% Note that when Cantera reads a .cti input file, wherever it is -% located, it always writes a file of the same name but with extension -% .xml *in the local directory*. If you happen to have some other file -% by that name, it will be overwritten. Once the XML file is created, -% you can use it instead of the .cti file, which will result in -% somewhat faster startup. - -gas4 = Solution('gri30.xml','gri30'); - -% Interfaces can be imported from XML files too. -diamonnd_surf2 = importInterface('diamond.xml','diamond_100',... - gas2, diamond); - - % Converting CK-format files % -------------------------- @@ -112,16 +90,14 @@ % software package. [See R. J. Kee, F. M. Rupley, and J. A. Miller, % Sandia National Laboratories Report SAND89-8009 (1989).] -% Cantera comes with a converter utility program 'ck2cti' (or -% 'ck2cti.exe') that converts CK format into Cantera format. This +% Cantera comes with a converter utility program 'ck2yaml' (or +% 'ck2yaml.exe') that converts CK format into YAML format. This % program should be run from the command line first to convert any CK -% files you plan to use into Cantera format. This utility program can -% also be downloaded from the Cantera User's Group web site. +% files you plan to use into YAML format. % % Here's an example of how to use it: % -% ck2cti -i mech.inp -t therm.dat -tr tran.dat -id mymech -% +% ck2yaml --input=mech.inp --thermo=therm.dat --transport=tran.dat --name=mymech clear all cleanup