Skip to content

Reading composition with 5 elements in Chemkin files (in ck2cti) #656

@rwest

Description

@rwest

Cantera version

2.4 (and earlier)

Operating System

Mac OS X

Python/MATLAB version

Python

Expected Behavior

As described in the original documentation on Page 61 of Sandia report from 1980
in the Chemkin thermo block, on line 1 of a species definition, columns 74 through 78 can contain, if needed (eg. you have 5 atom types), atomic symbol and formula (2 letters then 3 digits), much like columns 25 through 44.

It would look something like

MYSPECIESNAME     201906C   5H  12O   2N   1G   300.0    5000.0   1000.0 X   1 1
                                                                         ^^^^^

Comments from the ckinterp.f source code

C     OPTIONAL THERMODYNAMIC DATA: (Subroutine CKTHRM)
C     (If this feature is not used, thermodynamic properties are
C     obtained from a CHEMKIN database.)  The format for this option
C     is the word 'THERMO' followed by any number of 4-line data sets:
C
C     Line 1: species name, optional comments, elemental composition,
C             phase, T(low), T(high), T(mid), additional elemental
C             composition, card number (col. 80);
C             format(A10,A14,4(A2,I3),A1,E10.0,E10.0,E8.0,(A2,I3),I1)

and the source code itself

      ICOL = 20
      DO 60 I = 1, 5
         ICOL = ICOL + 5
         IF (I .EQ. 5) ICOL = 74
         ELEM  = LINE(1)(ICOL:ICOL+1)

Actual Behavior

This syntax is not supported and those elements are not read by ck2cti.py

Discussion

I think the answer may be as simple as finding this part of ck2cti.py

    def readThermoEntry(self, lines, TintDefault):
        """
        Read a thermodynamics entry for one species in a Chemkin-format file
        (consisting of two 7-coefficient NASA polynomials). Returns the label of
        the species, the thermodynamics model as a :class:`MultiNASA` object, the
        elemental composition of the species, and the comment/note associated with
        the thermo entry.
        """
        identifier = lines[0][0:24].split()
        species = identifier[0].strip()

        if len(identifier) > 1:
            note = ''.join(identifier[1:]).strip()
        else:
            note = ''

        # Normal method for specifying the elemental composition
        composition = self.parseComposition(lines[0][24:44], 4, 5)

and replacing that last line with

        composition = self.parseComposition(lines[0][24:44]+lines[0][73:78], 4, 5)

But of course it would be nice to include a unit test etc. too.

Actually, I'm reconsidering this issue. I'm going to finish writing it anyway, so there's a record of the decision, but we should probably have a think before fixing it....

I have just checked through close to 100 chemkin files taken from combustion literature, and it looks like none of them use this feature. But many of them do put other random junk in these columns, that we would have to ignore (mostly a digit in the first or last column, so would be easy enough to ignore, but...).

These are all the unique opening lines I have come across:
openininglines.txt

That said, none of these use the extended line notation either, because none of them have more than 4 atom types.

As context, what led me to open this issue is that RMG can now generate things with more than four elements (especially when a catalytic surface site counts as one) and so we need to choose how to represent them in CHEMKIN format. It seems if we use columns 74-48, we're not compatible with Cantera. For now we can use the extended line syntax and be compatible with Cantera and Chemkin 4+, but not Chemkin-II

Metadata

Metadata

Assignees

No one assigned

    Labels

    InputInput parsing and conversion (for example, ck2yaml)SpeciesIssues related to species definitionsenhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions