Importing nasa.cti or nasa.xml

1,066 views
Skip to first unread message

Carol Regalbuto

unread,
May 13, 2016, 7:21:59 PM5/13/16
to Cantera Users' Group
Hi all,

I'm trying to import either the nasa.cti or nasa.xml mechanism that came with my install (attached for reference) into Cantera, but am realizing that these files have no phase definitions, just species definitions, which proves problematic for the importPhase function. Are there any available mechanism files that have the phase definitions built in? Or how does one easily add in these definitions? It seems quite tedious to have to categorize each of the zillion species into 'ideal gas' or 'stoichiometric substance.'

I'm on a 64-bit Windows machine using Cantera 2.2.0 with MATLAB. Python version on my machine is 64-bit 3.4.

Thanks!

Carol
nasa.cti
nasa.xml

Bryan W. Weber

unread,
May 13, 2016, 8:30:32 PM5/13/16
to Cantera Users' Group
Dear Carol,

Some more detail about your application would be useful to help better specify what you need to do. Nonetheless, you can create a simple CTI file that will import the species definitions from nasa.cti as follows:

ideal_gas(name='nasa', elements='C O H N',
          species
='nasa: all',
          options
=['skip_undeclared_elements'],
          initial_state
=state(temperature=300, pressure=101325))

If you save that as a separate CTI file, you can use it in importPhase, and it will import all the species with CHON elements, and none of the others.

If there is a particular species you're interested in, you can replace all with that species:

ideal_gas(name='nasa', elements='C O H N',
          species
='nasa: CH4 H2O',
          options
=['skip_undeclared_elements'],
          initial_state
=state(temperature=300, pressure=101325))

Finally, if you're using the Python interface, you can write all of that into a string variable, and use it as follows:


cti_def = """ideal_gas(name='nasa', elements='C O H N',
          species='nasa: all',
          options=['skip_undeclared_elements'],
          initial_state=state(temperature=300, pressure=101325))"""

gas
= ct.Solution(source=cti_def)

Hope it helps,
Bryan

Ray Speth

unread,
May 13, 2016, 11:43:56 PM5/13/16
to Cantera Users' Group
You can go even a step further in the Python interface and create Species objects for all of the species in the nasa.cti file and then create phases from them as desired:

# Create a dict of species keyed by their names
S
= {s.name: s for s in ct.Species.listFromFile('nasa.cti')}
# Create a phase containing selected species
p
= ct.Solution(thermo='Incompressible', species=[S['ZrO2'], S['TiO2']])

Regards,
Ray

Carol Regalbuto

unread,
May 16, 2016, 12:56:17 PM5/16/16
to Cantera Users' Group
Thanks for the response! I didn't realize the 'all' option existed, so that's super helpful.

What I'm attempting to look into is the distribution between gas- and solid-phase products in a closed volume at different reaction pressures. With increasing pressure, I except to see more solid-phase products as the reactions that result in gas-phase species will be inhibited. Is there a similar syntax for solid-phase species for the simple cti file example you wrote? Something like stoichiometric_solid in place of ideal_gas? i.e.

stoichiometric_solid(name='nasa', elements='Al Cu',

          species
='nasa: all',
          options
=['skip_undeclared_elements'],
          initial_state
=state(temperature=300, pressure=101325))

I'm working strictly in MATLAB so the Python scripting is a bit above my pay grade.

Carol 

Carol Regalbuto

unread,
May 16, 2016, 12:56:17 PM5/16/16
to Cantera Users' Group
Hi Ray,

Thanks for the response. I'm working strictly in MATLAB, so this won't help me out right now, but if I ever decide to switch over I'll keep it in mind.

Carol

Steven DeCaluwe

unread,
May 23, 2016, 2:14:24 PM5/23/16
to canter...@googlegroups.com
Hi Carol,

What you have below almost works. By definition, the stoichiometric solid has only one species, so I implemented an incompressible solid.   Also, for solids, you need to specify the density.    So my cti file had the following:

incompressible_solid(name='nasa_solid', elements='Al Cu',
species='nasa: all',
density = 1.0,
options=['skip_undeclared_elements'],
initial_state=state(temperature=300,pressure=101325)) 

Note that the Cu(L) ad Al(cr) species definitions both had discontinuities in Cp, h, and s at the boundary between the high- and low-temperature regimes, which yielded several warnings.  You may not care about these species, since you’re looking at solids (I’ll be honest: I don’t know what the ‘(cr)’ in ‘Al(cr)’ stands for), but you’ll at least want to keep it in mind.

Cheers,
Steven


----------------------------------------------------------
Steven DeCaluwe, Ph.D.
Assistant Professor of Mechanical Engineering
Colorado School of Mines
G. Brown Hall, W410 B
Golden, CO, 80401

Twitter: @DrDeCaluwe

--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To post to this group, send email to canter...@googlegroups.com.
Visit this group at https://groups.google.com/group/cantera-users.
For more options, visit https://groups.google.com/d/optout.

Carol Regalbuto

unread,
May 23, 2016, 10:17:24 PM5/23/16
to Cantera Users' Group
Hi Steven,

This did the trick. Does the fact that the density value doesn't match the density for either Al or Cu matter or is it more of a placeholder to be able to import the cti file?

As for the (cr) in Al(cr), my only guess is that it's aluminum at its critical point.

I've got my solid phases and my gas phases defined, now it's a matter of seeing if I can equilibrate them together using a Mixture object.

Carol

Steven DeCaluwe

unread,
May 23, 2016, 11:25:46 PM5/23/16
to canter...@googlegroups.com
Sorry - I should have mentioned: I put a density of 1.0 in as a placeholder, but I think you'd rather put the correct value in there. 

On this note, I don't remember whether the density of an incompressible solid can be varied within Matlab after the phase has been created, for an incompressible solid; this may be an issue for you, if you are doing simulations where the composition (and therefore density) are allowed to vary. By my recollection, there may be some issues with how the chemical kinetic calculations handle this. You'll probably want to play around with a simple test case, before going too far down this road; I can likely assist with this, if need be. 

Cheers,
Steven 

Sent from my iPhone

Mehdi Baniasadi

unread,
Jan 19, 2017, 3:38:05 AM1/19/17
to Cantera Users' Group
Hi Ray,

Can we have something similar in the C++ interface?

Best,

Ray Speth

unread,
Jan 19, 2017, 11:22:10 AM1/19/17
to Cantera Users' Group
Hi,

Yes, in principle you can do something similar in the C++ interface, but it's more complicated since you have to load the input file as an XML document and find the XML nodes for each species in order to create the Species objects. From there, you would just create an empty ThermoPhase object of the desired type and add the species to that.

Regards,
Ray
Reply all
Reply to author
Forward
0 new messages