Cantera/Sensitivity Analysis
From charlesreid1
Via https://groups.google.com/forum/#!topic/cantera-users/qMOxAdolJiA
Cantera 2.1 Script
""" Sensitivity analysis for a freely-propagating, premixed methane-air flame. Reports the sensitivity of the flame speed with respect to each reaction rate constant. """ from __future__ import print_function import cantera as ct # Simulation parameters p = ct.one_atm # pressure [Pa] Tin = 300.0 # unburned gas temperature [K] reactants = 'CH4:0.45, O2:1.0, N2:3.76' initial_grid = [0.0, 0.001, 0.01, 0.02, 0.029, 0.03] # m tol_ss = [1.0e-7, 1.0e-13] # [rtol atol] for steady-state problem tol_ts = [1.0e-4, 1.0e-13] # [rtol atol] for time stepping # IdealGasMix object used to compute mixture properties gas = ct.Solution('gri30.xml', 'gri30_mix') gas.TPX = Tin, p, reactants # Flame object f = ct.FreeFlame(gas, initial_grid) f.flame.set_steady_tolerances(default=tol_ss) f.flame.set_transient_tolerances(default=tol_ts) # Set properties of the upstream fuel-air mixture f.inlet.T = Tin f.inlet.X = reactants # Solve with the energy equation disabled f.energy_enabled = False f.set_max_jac_age(10, 10) f.set_time_step(1e-5, [2, 5, 10, 20]) f.solve(loglevel=1, refine_grid=False) # Solve with the energy equation enabled f.set_refine_criteria(ratio=3, slope=0.06, curve=0.12) f.energy_enabled = True f.solve(loglevel=1, refine_grid=True) Su0 = f.u[0] print('mixture-averaged flamespeed = {:7f} m/s'.format(f.u[0])) for m in range(gas.n_reactions): dk = 5e-2 gas.set_multiplier(1.0) gas.set_multiplier(1+dk, m) f.solve(loglevel=0, refine_grid=False) Su = f.u[0] print('k/S*dS/dk[{: 3d}] = {: .3e} [{}]'.format( m, (Su-Su0)/(Su0*dk), gas.reaction_equation(m)))
Cantera all pages on the wiki related to the Cantera combustion microkinetics and thermodynamics (a.k.a. "thermochemistry") software.
Cantera · Cantera Outline · Category:Cantera
Outline of Cantera topics: Cantera Outline · Cantera Outline/Brief Understanding Cantera's Structure: Cantera Structure Cantera from Matlab: Using_Cantera#Matlab Cantera from Python: Using_Cantera#Python Cantera from C++: Using_Cantera#C++ Cantera + Fipy (PDE Solver): Fipy and Cantera/Diffusion 1D Cantera Gas Objects: Cantera/Gases Cantera 1D Domains, Stacks: Cantera_One-D_Domains · Cantera_Stacks Cantera Gas Mixing: Cantera_Gas_Mixing
Topics in Combustion: Diffusion: Cantera/Diffusion · Cantera/Diffusion Coefficients Sensitivity Analysis: Cantera/Sensitivity Analysis Analysis of the Jacobian Matrix in Cantera: Jacobian_in_Cantera Chemical Equilibrium: Chemical_Equilibrium Kinetic Mechanisms: Cantera/Kinetic_Mechanisms Reactor Equations: Cantera/Reactor_Equations Differential vs. Integral Reactors: Cantera/Integral_and_Differential_Reactors Effect of Dilution on Adiabatic Flame Temperature: Cantera/Adiabatic_Flame_Temperature_Dilution
Topics in Catalysis: Cantera for Catalysis: Cantera_for_Catalysis Steps for Modeling 0D Multiphase Reactor: Cantera_Multiphase_Zero-D Reaction Rate Source Terms: Cantera/Reaction_Rate_Source_Terms Surface coverage: Cantera/Surface_Coverage Surface reactions: Cantera/Surface_Reactions
Cantera Input Files: Chemkin file format: Chemkin CTI files: Cantera/CTI_Files · Cantera/CTI_Files/Phases · Cantera/CTI_Files/Species · Cantera/CTI_Files/Reactions
Hacking Cantera: Pantera (monkey patches and convenience functions for Cantera): Pantera Extending Cantera's C API: Cantera/Extending_C_API Extending Cantera with Python Classes: Cantera/Adding Python Class Debugging Cantera: Cantera/Debugging_Cantera Debugging Cantera from Python: Cantera/Debugging_Cantera_from_Python Gas Mixing Functions: Cantera_Gas_Mixing Residence Time Reactor (new Cantera class): Cantera/ResidenceTimeReactor
Resources: Cantera Resources: Cantera Resources Cantera Lecture Notes: Cantera_Lecture
Category:Cantera · Category:Combustion Category:C++ · Category:Python Flags · Template:CanteraFlag · e |
Installing Cantera notes on the wiki related to installing the Cantera thermochemistry software library.
Cantera Installation: Mac OS X 10.5 (Leopard): Installing_Cantera#Leopard Mac OS X 10.6 (Snow Leopard): Installing_Cantera#Snow_Leopard · Cantera2 Config Mac OS X 10.7 (Lion): Installing_Cantera#Lion Mac OS X 10.8 (Mountain Lion): Installing_Cantera#Mountain_Lion Ubuntu 12.04 (Precise Pangolin): Installing_Cantera#Ubuntu Windows XP: Installing_Cantera#Windows_XP Windows 7: Installing_Cantera#Windows_7
Cantera Preconfig: In old versions of Cantera, a preconfig file was used to specify library locations and options. Mac OS X 10.5 (Leopard) preconfig: Cantera_Preconfig/Leopard_Preconfig Mac OS X 10.6 (Snow Leopard) preconfig: Cantera_Preconfig/Snow_Leopard_Preconfig Mac OS X 10.8 (Mountain Lion) preconfig: Cantera_Config/MountainLion_SconsConfig Ubuntu 12.04 (Precise Pangolin) preconfig: Cantera_Config/Ubuntu1204_SconsConfig Flags · Template:InstallingCanteraFlag · e |