Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermochemsity Parsing Refactoring Part 2: Antioch #550

Merged
merged 65 commits into from
Jul 27, 2018

Conversation

pbauman
Copy link
Member

@pbauman pbauman commented Jul 26, 2018

Monster PR, but part 2 cousin of #549. This updates the Antioch side. This PR is basically a massive overhaul of the internals of parsing data for Antioch. The code changes have left placeholders for inserting the Anitoch ChemKin parser, but I haven't dropped those in yet. This does add full support for Antioch's XML parser, including not just kinetics, but thermo and transport as well. As such, this PR will push the minimum Antioch version up to libantioch/antioch@e17822d, as reflected in the README and CHANGES file. We also do not need to explicitly set the species names in the GRINS input file when using XML anymore, we parse it just as we do with Cantera. We do still require it for the ASCII parsing. Finally, the type of curve fit will be deduced based on the input file.

Backward compatibility has been maintained (and tested, didn't update test input files until the end), but didn't add new features to old style so you need to switch (but it's easy).

We determine the Antioch parsing type based on the suffix of the file specified in the new chemical_data option: .dat is ASCII, .xml is XML, and .chemkin is CHEMKIN (which isn't implemented yet). For ASCII, you'll still have to set the species names and all the other data.

The new preferred input file format for Antioch specification is identical to Cantera when using XML except

  1. We still need the species data file (or default to Antioch's installed file) because Antioch doesn't automatically compute the molecular weights (Compute Species data from elements libantioch/antioch#248)
  2. We need set the thermo_model to ideal_gas (this is the same model as Cantera) or stat_mech.
  3. We need to set the transport_model and associated entries.

So, the new format for using XML input (that includes kinetics, thermo, transport in one file) is

[Materials]
  [./2SpeciesNGas]
     [./GasMixture]
        thermochemistry_library = 'antioch'

        [./Antioch]
           chemical_data = './input_files/air_2sp.xml'
           gas_mixture = 'air2sp'
           thermo_model = 'ideal_gas'
           transport_model = 'mixture_averaged'
           viscosity_model = 'blottner'
           thermal_conductivity_model = 'eucken'
           mass_diffusivity_model = 'constant_lewis'
         [../]
   [../]
   [./LewisNumber]
      value = '1.4'
[]

For Blottner or Sutherland, you still need the data in either raw txt file or just let it default to Antioch if the species are there (which is what will happen above). For kinetics_theory that data is parsed from the XML file.

One should now take the above input and change antioch to cantera and run with Cantera seamlessly (where Cantera would then be using the transport model specified in the XML file).

@bboutkov @klbudzin This should make your lives quite a bit easier.

I'm pretty happy with this except the kinetics_theory model doesn't work like Cantera does. But that's a separate issue. (I get divergence when starting from time 0 in the ozone_flame exampling after a few dozen time steps, and I can't get convergence when restarting from the same file we restart Cantera from to get steady state ozone flame example, dies after 4 or 5 Newton steps. @klbudzin I'm going to want your help in getting to the bottom of that.)

But with this PR we get quite a bit more functionality out of Antioch and it will make it easier to test, etc.

Use the builder since we have it instead of keeping copied code
around.
Wanting to use this class elsewhere, and we need placeholder functions
for now while we update interface internally.
This class originally only exposed building the Antioch wrapper,
but I think we want to shift to building "raw" Antioch objects
and exposing those. This will allow us to further consolidate
Antioch construction to the Builder.
We don't have all the transport methods moved to the builder yet,
but let's use the ones that we have.
These methods are deployed in the Antioch transport builder and
we're using them now, so let's get rid of the code duplication.
These effectively got moved to the Antioch builder so they are not
needed anymore.
It's shorter and the context of kinetics thermo vs. gas thermo
is not relevant here.
We're going to move to this completely in subsequent commits, but
this commit now will require a version of Antioch with
libantioch/antioch#259 merged to master. (We'll identify the
Git hash in subsequent README update).
Since we moved to Antioch::IdealGasThermo, we don't need to cache
that silly evaluator class anymore.
And migrate all it's construction to the builder so that the builder
and build everything and we can move away from any of the Antioch
parsing being contained in the Antioch wrapper objects.
This class will go away at some point, but need to support until
we move to an new thermochemistry+transport interface internally.
This way we don't have to do specializations for every Thermo
and KineticsCurveFit pair when we go to instantiate more CurveFit
models.
This is going to be the public method one uses to get the species
names out from Antioch. We will subsequently add the logic
for figuring out the parser type, etc. Also migrated the
MaterialsParsing::parse_chemical_species as a protected member
of AntiochMixtureBuilderBase. We'll use this method in the interim
but it should (hopefully) eventually go away. Regardless, we
don't want any other users using it.
This private helper function will tell us the Antioch::ParsingType
based on the suffix of the file given to the chemical_data input
option. The convention we adopt is .dat ==> ASCII, .xml ==> XML,
and .chemkin ==> CHEMKIN
We will do a pass using ChemKinParser later
Was missing the transport data for the last 4 species so add it.
The data was pulled from Cantera's GRI3 XML file.
Now we differentiate the parsing of the transport mixture data based
on the parser type. In particular, we should now be able to grab
the pure species data from the XML directly. We still support the
ASCII format. We can't do anything about the non-pure species
transport models since the Antioch XML parser doesn't support those
(see libantioch/antioch#256)
Some species had data different than the GRI3 XML file and looked
like bad copy/pasta, so I updated values to match GRI3 XML.
So we can reuse it later.
We were supposed to be using a template parameter there. Didn't come
up because we've only been doing CEA to this point.
Currently only for mixture averaged transport models. This now enables
us to leverage Antioch's XML parser to get the thermo data from the XML
file directly when we're using XML.
Just based off of the existing 2 species regression, but using
ideal_gas instead of stat_mech for the thermo model. Also acts to
check parsing of data from the XML file + blottner data.
The AntiochMixtureBuilderBase::get_thermo_type should correctly
handle this for us now with the way the parsing scheme is setup.
I don't know how we were getting away with what was effectively
partial template specialization. Cleared out the specialization
on CEACurveFit and replaced with already-existing-why-didn't-compiler-
complain-about-missing template parameter for the kinetics thermo
curve fit.
Same thing that we did in a435b60 to air.xml. Had to update the
regression test for the reacting_low_mach_cantera test.
The thermo data in the XML is the same as the Antioch defaults
so this is seamless to the user, but underneath it should be parsing
from the XML file now instead of the Antioch default ascii files.
@pbauman
Copy link
Member Author

pbauman commented Jul 26, 2018

Job GRINS-devel on 004f77e : invalidated by @pbauman

Updated Antioch version on femputer

@pbauman
Copy link
Member Author

pbauman commented Jul 26, 2018

Job GRINS-dbg on 004f77e : invalidated by @pbauman

Updated antioch-dbg version on femputer

Now that we parse species names away from the GRINS input file
using Antioch parsers, we broke that unit testing without Antioch.
This restructures the test so that 1. We still do the variable testing
and 2. We also still test the arbitrary naming of the variable.
These all run for me on 1--16 processors now.
@pbauman
Copy link
Member Author

pbauman commented Jul 27, 2018

That's why we have CI kids. Pushed tolerance tweaks for parallel runs and updated unit test that became stale when optdeps are disabled.

@pbauman pbauman merged commit 41f208e into grinsfem:master Jul 27, 2018
@pbauman pbauman deleted the thermochem-parsing-part2-antioch branch July 27, 2018 12:22
pbauman added a commit to pbauman/grins that referenced this pull request Aug 5, 2018
This should've been part of grinsfem#550 but was overlooked.
@pbauman pbauman mentioned this pull request Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant