*** empty log message ***

This commit is contained in:
Dave Goodwin
2004-02-22 17:10:05 +00:00
parent cfccafb938
commit 4f0c424fb7
14 changed files with 167 additions and 72 deletions

View File

@@ -1,4 +1,4 @@
# CATCOMB -- Catalytic combustion on platinum.
# CATCOMB -- Catalytic combustion of methane on platinum.
#
# This script solves a catalytic combustion problem. A stagnation flow
# is set up, with a gas inlet 10 cm from a platinum surface at 900
@@ -82,27 +82,42 @@ surf_phase.setTemperature(tsurf)
# coverages.
surf_phase.advanceCoverages(1.0)
# create the object that simulates the stagnation flow, and specify an
# initial grid
sim = StagnationFlow(gas = gas, surfchem = surf_phase,
grid = initial_grid)
# Objects of class StagnationFlow have members that represent the gas inlet ('inlet') and the surface ('surface'). Set some parameters of these objects.
sim.inlet.set(mdot = mdot, T = tinlet, X = comp1)
sim.surface.set(T = tsurf)
# Set error tolerances
sim.set(tol = tol_ss, tol_time = tol_ts)
# Method 'init' must be called before beginning a simulation
sim.init()
# Show the initial solution estimate
sim.showSolution()
# start with the energy equation on
# Solving problems with stiff chemistry coulpled to flow can require
# a sequential approach where solutions are first obtained for
# simpler problems and used as the initial guess for more difficult
# problems.
# start with the energy equation on (default is 'off')
sim.set(energy = 'on')
# disable the surface coverage equations, and turn off all gas and
# surface chemistry
# surface chemistry.
sim.surface.setCoverageEqs('off')
surf_phase.setMultiplier(0.0);
gas.setMultiplier(0.0);
# solve the problem, refining the grid if needed
# solve the problem, refining the grid if needed, to determine the
# non-reacting velocity and temperature distributions
sim.solve(loglevel, refine_grid)
# now turn on the surface coverage equations, and turn the
@@ -119,7 +134,7 @@ for iter in range(6):
# problem.
sim.showSolution()
#Now switch the inlet to the methane/air composition.
# Now switch the inlet to the methane/air composition.
sim.inlet.set(X = comp2)
# set more stringent grid refinement criteria
@@ -138,16 +153,19 @@ sim.save("catcomb.xml", "soln1")
# save selected solution components in a CSV file for plotting in
# Excel or MATLAB.
# These methods return arrays containing the values at all grid points
z = sim.flow.grid()
T = sim.T()
u = sim.u()
V = sim.V()
f = open('catcomb.csv','w')
writeCSV(f, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)']
writeCSV(f, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)', 'rho (kg/m3']
+ list(gas.speciesNames()))
for n in range(sim.flow.nPoints()):
sim.setGasState(n)
writeCSV(f, [z[n], u[n], V[n], T[n]]+list(gas.moleFractions()))
writeCSV(f, [z[n], u[n], V[n], T[n], gas.density()]
+list(gas.moleFractions()))
# write the surface coverages to the CSV file
cov = sim.coverages()
@@ -159,4 +177,5 @@ f.close()
print 'solution saved to catcomb.csv'
# show some statistics
sim.showStats()

View File

@@ -0,0 +1,30 @@
"""
Dusty Gas transport model.
The Dusty Gas model is a mulicomponent transport model for gas
transport through the pores of a stationary porous medium. This
example shows how to create a transport manager that implements the
Dusty Gas model and use it to compute the multicomponent diffusion
coefficients.
"""
from Cantera import *
from Cantera.DustyGasTransport import *
# create a gas-phase object to represent the gas in the pores
g = importPhase('h2o2.cti')
# set the gas state
g.setState_TPX(500.0, OneAtm, "OH:1, H:2, O2:3")
# create a Dusty Gas transport manager for this phase
d = DustyGasTransport(g)
# set its parameters
d.set(porosity = 0.2, tortuosity = 4.0,
pore_radius = 1.5e-7, diameter = 1.5e-6) # lengths in meters
# print the multicomponent diffusion coefficients
print d.multiDiffCoeffs()

View File

@@ -73,11 +73,12 @@ T = f.T()
u = f.u()
V = f.V()
fcsv = open('flame1.csv','w')
writeCSV(fcsv, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)']
writeCSV(fcsv, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)', 'rho (kg/m3)']
+ list(gas.speciesNames()))
for n in range(f.flame.nPoints()):
f.setGasState(n)
writeCSV(fcsv, [z[n], u[n], V[n], T[n]]+list(gas.moleFractions()))
writeCSV(fcsv, [z[n], u[n], V[n], T[n], gas.density()]
+list(gas.moleFractions()))
fcsv.close()
print 'solution saved to flame1.csv'

View File

@@ -1,8 +1,6 @@
#
# FLAME1 - A burner-stabilized flat flame
#
# This script simulates a burner-stablized lean hydrogen-oxygen flame
# at low pressure.
# FLAME2 - A burner-stabilized, premixed methane/air flat flame
# with multicomponent transport properties
#
from Cantera import *
from Cantera.OneD import *
@@ -35,9 +33,10 @@ refine_grid = 1 # 1 to enable refinement, 0 to
################ create the gas object ########################
#
# This object will be used to evaluate all thermodynamic, kinetic,
# and transport properties
#
# This object will be used to evaluate all thermodynamic, kinetic, and
# transport properties. It is created with two transport managers, to
# enable switching from mixture-averaged to multicomponent transport
# on the last solution.
gas = GRI30('Mix')
gas.addTransportModel('Multi')
@@ -71,19 +70,20 @@ gas.switchTransportModel('Multi')
f.flame.setTransportModel(gas)
f.solve(loglevel, refine_grid)
f.save('ch4_flame1.xml','energy_multi',
'solution with the energy equation enabled')
'solution with the energy equation enabled and multicomponent transport')
# write the velocity, temperature, and mole fractions to a CSV file
# write the velocity, temperature, density, and mole fractions to a CSV file
z = f.flame.grid()
T = f.T()
u = f.u()
V = f.V()
fcsv = open('flame2.csv','w')
writeCSV(fcsv, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)']
writeCSV(fcsv, ['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)', 'rho (kg/m3)']
+ list(gas.speciesNames()))
for n in range(f.flame.nPoints()):
f.setGasState(n)
writeCSV(fcsv, [z[n], u[n], V[n], T[n]]+list(gas.moleFractions()))
writeCSV(fcsv, [z[n], u[n], V[n], T[n], gas.density()]
+list(gas.moleFractions()))
fcsv.close()
print 'solution saved to flame2.csv'