示例#1
0
        if alldone: break

# set the gas object state to that of this reactor, in
# preparation for the simulation of the next reactor
# downstream, where this object will set the inlet conditions
    gas = r.contents()

    dist = n * rlen * 1.0e3  # distance in mm

    # write the gas mole fractions and surface coverages
    # vs. distance
    writeCSV(f, [dist, r.temperature() - 273.15,
                 r.pressure() / OneAtm] + list(gas.moleFractions()) +
             list(surf.coverages()))

f.close()

# make a reaction path diagram tracing carbon. This diagram will show
# the pathways by the carbon entering the bed in methane is convered
# into CO and CO2. The diagram will be specifically for the exit of
# the bed; if the pathways are desired at some interior point, then
# put this statement inside the above loop.
#
# To process this diagram, give the command on the command line
# after running this script:
# dot -Tps < carbon_pathways.dot > carbon_pathways.ps
# This will generate the diagram in Postscript.

element = 'C'
rxnpath.write(surf, element, 'carbon_pathways.dot')
示例#2
0
	# set the gas object state to that of this reactor, in
	# preparation for the simulation of the next reactor
	# downstream, where this object will set the inlet conditions
        gas = r.contents()

        dist = n*rlen * 1.0e3   # distance in mm

	# write the gas mole fractions and surface coverages
	# vs. distance
        writeCSV(f, [dist, r.temperature() - 273.15,
		     r.pressure()/OneAtm] + list(gas.moleFractions())
                 + list(surf.coverages()))

f.close()

# make a reaction path diagram tracing carbon. This diagram will show
# the pathways by the carbon entering the bed in methane is convered
# into CO and CO2. The diagram will be specifically for the exit of
# the bed; if the pathways are desired at some interior point, then
# put this statement inside the above loop.
#
# To process this diagram, give the command on the command line
# after running this script:
# dot -Tps < carbon_pathways.dot > carbon_pathways.ps
# This will generate the diagram in Postscript.

element = 'C'
rxnpath.write(surf, element, 'carbon_pathways.dot')


示例#3
0
output_dir = 'd:/www/docs'
output_urldir = 'http://your.http.server/'

#-----------------------------------------------------------------------
# these lines can be replaced by any commands that generate
# an object of a class derived from class Kinetics (such as IdealGasMix)
# in some state. 
gas = GRI30()
gas.setState_TPX(2500.0, OneAtm, 'CH4:0.4, O2:1, N2:3.76')
gas.equilibrate('TP')
gas.setTemperature(500.0)

#------------------------------------------------------------------------

d = rxnpath.PathDiagram(title = 'reaction path diagram following N',
                        bold_color = 'green')

element = 'N'
output_file = 'rxnpath2.dot'
url = output_urldir+'/'+output_file

rxnpath.write(gas, element, join(output_dir, output_file), d)

if len(opts) > 1 and opts[1] == "-view":
    # graphics format. Must be one of png, svg, gif, or jpg
    fmt = 'svg'
    rxnpath.view(url, fmt)


示例#4
0
# is within the document tree of your web server, and set output_url to
# the URL that accesses this directory.

output_dir = 'd:/www/docs'
output_urldir = 'http://your.http.server/'

#-----------------------------------------------------------------------
# these lines can be replaced by any commands that generate
# an object of a class derived from class Kinetics (such as IdealGasMix)
# in some state.
gas = GRI30()
gas.setState_TPX(2500.0, OneAtm, 'CH4:0.4, O2:1, N2:3.76')
gas.equilibrate('TP')
gas.setTemperature(500.0)

#------------------------------------------------------------------------

d = rxnpath.PathDiagram(title='reaction path diagram following N',
                        bold_color='green')

element = 'N'
output_file = 'rxnpath2.dot'
url = output_urldir + '/' + output_file

rxnpath.write(gas, element, join(output_dir, output_file), d)

if len(opts) > 1 and opts[1] == "-view":
    # graphics format. Must be one of png, svg, gif, or jpg
    fmt = 'svg'
    rxnpath.view(url, fmt)
示例#5
0
from Cantera import *
from Cantera import rxnpath

#-----------------------------------------------------------------------
# these lines can be replaced by any commands that generate
# an object of a class derived from class Kinetics (such as IdealGasMix)
# in some state.
gas = GRI30()
gas.setState_TPX(2500.0, OneAtm, 'CH4:0.4, O2:1, N2:3.76')
gas.equilibrate('TP')
gas.setTemperature(500.0)

#------------------------------------------------------------------------

d = rxnpath.PathDiagram(title = 'reaction path diagram following N',
                        bold_color = 'green')

element = 'N'
dot_file = 'rxnpath2.dot'
img_file = 'rxnpath2.png'
img_path = os.path.join(os.getcwd(), img_file)

rxnpath.write(gas, element, dot_file, d)
print "Wrote graphviz input file to '%s'." % os.path.join(os.getcwd(), dot_file)

os.system('dot %s -Tpng -o%s -Gdpi=200' % (dot_file, img_file))
print "Wrote graphviz output file to '%s'." % img_path

if len(sys.argv) > 1 and sys.argv[1] == "-view":
    rxnpath.view('file:///' + img_path)
示例#6
0
from Cantera import rxnpath

#-----------------------------------------------------------------------
# these lines can be replaced by any commands that generate
# an object of a class derived from class Kinetics (such as IdealGasMix)
# in some state.
gas = GRI30()
gas.setState_TPX(2500.0, OneAtm, 'CH4:0.4, O2:1, N2:3.76')
gas.equilibrate('TP')
gas.setTemperature(500.0)

#------------------------------------------------------------------------

d = rxnpath.PathDiagram(title='reaction path diagram following N',
                        bold_color='green')

element = 'N'
dot_file = 'rxnpath2.dot'
img_file = 'rxnpath2.png'
img_path = os.path.join(os.getcwd(), img_file)

rxnpath.write(gas, element, dot_file, d)
print "Wrote graphviz input file to '%s'." % os.path.join(
    os.getcwd(), dot_file)

os.system('dot %s -Tpng -o%s -Gdpi=200' % (dot_file, img_file))
print "Wrote graphviz output file to '%s'." % img_path

if len(sys.argv) > 1 and sys.argv[1] == "-view":
    rxnpath.view('file:///' + img_path)