-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
[WIP] Commit yaml files #768
Conversation
I would suggest limiting the replacement of CTI/XML with YAML in other tests. CTI and XML are still fully supported for Cantera 2.5, and I'd hate to have a bug creep in because we stopped testing these formats. If you really want to include all of the converted input files, I think this would be a good opportunity to think about which of the existing ones we should actually keep. There are quite a few that are either not used in the test suite or barely used and that I don't think are all that useful to users. A few examples are |
What is the benefit of no longer supporting those input files (there is next to no development effort involved)? Also, it is hard to know what people are using. speaking for myself, I have been using argon and silicon carbide, mostly when I need a phase that just acts as a cheap reservoir for heat transfer purposes. It’s a minor issue, but I wanted to put it out there. |
I think one primary reason is that we don't want to implicitly endorse one set of thermokinetics/transport data over another. By including the file with a Cantera distribution, we're kind of doing that. Obviously, there are several files we use in examples ( |
This is understandable. However, the message that users should use 'modern' input files is already muddled as cantera de facto endorses |
Personally, I see the distinction as related to the example. If the example is associated with a published work, then the example should more than likely use the same input file as the publication (I believe this is the case for the RK phase example that introduced the Reitz file). As for GRI-3.0, I personally give that an historical exception. At this point, everyone should know not to use GRI-3.0 for any publication-quality work, so I don't mind including it. We need to have some sort of input file for our examples, and having a somewhat realistic (if outdated) file seems like a benefit over having a trivial input file (e.g., 1-2 species, 1 reaction, etc.). The provenance of many of the other files is questionable, to me. To my understanding, many of them were invented for the purpose of the related example and haven't been peer-reviewed, and we should probably do a better job of clarifying where that's the case. One problem I have is that many of them were added before I started contributing, so I'm not sure what's good and what isn't. |
I am less optimistic in this regard, and believe that this needs to be pointed out especially to new users that may not be as familiar with the current state of affairs.
This is my understanding also. I agree that some simple, semi-realistic example input files are needed (whether or not those are One suggestion I'd have for 2.5 is to add fields to all cantera-supplied YAML (and CTI?) files that include a disclaimer and/or clarify provenance (similar to the |
Adding/referencing an open issue that could be laid to rest here: #339 |
I'm not sure where the best place to do this is - include a disclaimer in every example that uses GRI-3.0? I guess another question is, does it matter? There's no way anyone could publish a paper these days using GRI-3.0. Are there other outputs from using Cantera? (That question is clearly unanswerable 😄 ) Maybe someone uses it at an engineering firm, wouldn't they validate with experimental results for a design? I guess, it seems like adding a disclaimer for all the examples that use GRI-3.0 seems like adding quite a bit of noise 🤷♂
What do you mean by "scaled down"?
As far as I know, we're not planning any work specifically on existing examples. I'm also not sure what you mean by improvements - improvements where? If you have any ideas here, feel free to put an issue at Cantera/improvements.
This is already done, see Lines 1 to 6 in 6b9fe8a
I believe that
I am not planning to address #339 in this pull request. |
The This suggestion would partially address #339, especially as the future fate of some of the distributed input files is being actively discussed at this point. I am writing this in an attempt to provide constructive suggestions. I am not planning a PR myself if this is just a shot in the dark; this is clearly a higher level decision. It’s not up to me ... Ad scaled down Input / improvements: I don’t think that existing examples need work, but I was hoping for a more comprehensive suite of examples, some of which could be really basic ... 😉 |
@bryanwweber ... rather than adding a PR, I posted Cantera/enhancements#15 |
9aa49d2
to
68f3564
Compare
Codecov Report
@@ Coverage Diff @@
## master #768 +/- ##
==========================================
+ Coverage 71.44% 71.44% +<.01%
==========================================
Files 372 372
Lines 43935 43946 +11
==========================================
+ Hits 31388 31399 +11
Misses 12547 12547
Continue to review full report at Codecov.
|
68f3564
to
89157a4
Compare
I don't see the
Well, I ended up partially addressed #339 in 89157a4 at least identifying when I didn't know the source of the data.
If you have something specific in mind (or even if not), feel free to open an issue on Cantera/enhancements. We do have the tutorials on the website which are pretty basic. |
89157a4
to
546223a
Compare
@bryanwweber ... the way I see this alternative: Pro: This implementation is short and won't require further code modifcations. Con:
|
Until we remove those phases after Cantera 2.5.0, i.e., for a limited amount of time. After Cantera 2.5.0, the file will be able to be generated directly from the CK input. As such, I don't see this as a drawback for this approach. |
I'm ok with this solution (as long as the Edit: closed #737 |
Yes, these are just a message for the sake of seeing some output is generated. I'm interested in some feedback on the actual implementation for now, and I'll keep working on the messages. I was actually surprised at how easy this was to do, at least to the extent that the feature is available here. |
Yup. Seems like your solution hit a sweet spot - short and simple. Wouldn't have closed my PR otherwise!
Sure. I'm wondering whether it wouldn't make sense to move all warnings to |
The reason I included it here is that it requires a YAML file with this field to actually function, and this is the only branch that has YAML files committed to the repo. |
data/ohn.yaml
Outdated
@@ -0,0 +1,18 @@ | |||
description: This definition extracts the O/H/N submechanism from GRI-Mech 3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hand-copied from nasa.cti
in 89157a4 (similar for many other files) ... would it make sense to add parsing of the header block and conversion to the description
field to ctml2yaml
? (this would also benefit users converting their own files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it would be good to add this functionality... I think it should be possible in ctml2yaml
, I believe comments are accessible in the tree. I'm not sure about cti2yaml
, because that actually exec
s the input file, so I'm not sure if comments are available. I believe a docstring would be available and could be added though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I recall, CTI files typically have a commented #
header. The simplest way would be just to parse this block using with open(...) as cti_file:
etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctml2yaml
doesn't really stand a chance here of having a relevant description to copy, since the comment header in the CTI file would have been lost when running ctml_writer
, and there are very few XML files with any header comment blocks, at least in the cantera
repository.
I spent a little time trying to get access to the comments in a CTI file when writing cti2yaml
, but couldn't find a way to get at them in a way that provided correspondence to the code itself -- they don't seem to be available even through the ast
module. If we're only after the header comment to use for this field, then I think @ischoegl's suggestion is probably the best we can do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@speth I think it's probably worth seeing how hard this would be to add to ctml2yaml
, in case anyone has hand-edited XML files that include comments, at least for a top-level comment. Not a high priority, I'll add an issue at Cantera/enhancements eventually.
data/air.yaml
Outdated
@@ -0,0 +1,177 @@ | |||
description: |- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up on discussion in commit 89157a4 (which is not displayed outside of the commit):
I believe it would be preferable to add the description to the initial source air.inp
instead of adding it by hand after conversion. I.e. ck2yaml
will generate this field automatically (I did as much in a small addition added to #777).
It is a near duplicate of prandtl1.m
Python best practices are to use the with statement to manage opening and closing files. The Python docs recommend specifying newline='' to avoid certain problems with Windows-style carriage returns. See https://docs.python.org/3/library/csv.html#id3
Remove newlines and strip leading and trailing spaces to reformat the comment into a single line.
01e3491
to
c747b45
Compare
@speth I think this is finished now (finally). I reverted most of the controversial formatting changes, keeping mostly the ones adding spaces and the version requirements to the docstring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few final suggestions.
In many cases, these are copied from the corresponding CTI file. In some cases, the source of the data is unknown and these are also noted.
Add requirements to all Python examples. Update formatting to resolve some PEP8 problems.
c747b45
to
b72a6ca
Compare
@speth Thanks for all the comments! Updated again. |
@bryanwweber ... it looks like the chemkin to yaml conversion is no longer used in |
@ischoegl By intent, we decided to handle/discuss other input files in a separate PR to avoid extending the scope of this one even further. |
@bryanwweber ... as #777 depends on chemkin input, I (temporarily?) added the chemkin->yaml conversion back into |
Thanks for contributing code! Please include a description of your change and
check your PR against the list below (for further questions, refer to the
contributing guide).
scons build
&scons test
) and unit tests address code coveragePlease fill in the issue number this pull request is fixing
Fixes #662, #669
Changes proposed in this pull request
I also plan to convert all the tests that are currently using CTI/XML input files to use the equivalent YAML version, except of course tests that are testing the behavior of one of those two formats, or the conversion of them.
It occurred to me that
ruamel.yaml
will still be required to run the tests, so the benefit of removing the build-time dependency is less than I hoped. I still think this is the appropriate resolution of #662 and #669 though.