-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Revive 1D radiation improvements of PR965 #1799
base: main
Are you sure you want to change the base?
Conversation
We should integrate RadLib into Cantera. The library is written in C++ and has Python and Fortran interfaces. It is well-documented, and published. I can provide details, and would like to be involved.
Repository:
https://github.com/BYUignite/radlib
Publication:
V.B. Stephens, S. Jensen, I. Wheeler, D.O. Lignell, “RadLib: a radiative heat transfer model library for CFD,” Computer Physics Communications, 272:108227<https://doi.org/10.1016/j.cpc.2021.108227>, (2022).
Documentation:
<https://ignite.byu.edu/radlib_documentation>
RadLib: RadLib<https://ignite.byu.edu/radlib_documentation>
ignite.byu.edu<https://ignite.byu.edu/radlib_documentation>
[X]<https://ignite.byu.edu/radlib_documentation>
David O. Lignell
Professor, Chemical Engineering
Brigham Young University
801-422-1772 | http://ignite.byu.edu
On Oct 21, 2024, at 9:10 PM, Chris Neal ***@***.***> wrote:
I was looking through the open pull requests and saw #965<#965> . It seemed like it was something that could be pushed across the finish line given the recent updates to Cantera that allow for easier handling of data in the YAML file.
Potentially allows for the discussions in Cantera/enhancements#72<Cantera/enhancements#72> to be realized.
I added some of the data from the original pull request into the gri30.yaml file (attached), and ran the 1D diffusion flame example<https://cantera.org/examples/python/onedim/diffusion_flame.py.html>
gri30.txt<https://github.com/user-attachments/files/17469322/gri30.txt>
From the discussions in the #965<#965> it seemed like there was more than one possibility for handling that absorption coefficient calculation, so I added a keyword of fit-type which can be table or polynomial. The polynomial type is what was originally used and the table is the log linear interpolation data that was apparently better. PMAC is Plank Mean Absorption Coefficient. I'm pretty clueless on radiation modeling, so if anyone else knows more about this, please chime in.
As an example this would be the YAML entry for a species C2H6 that used the log-linear interpolation tabulated data.
- name: C2H6
composition: {C: 2, H: 6}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [4.29142492, -5.5015427e-03, 5.99438288e-05, -7.08466285e-08, 2.68685771e-11,
-1.15222055e+04, 2.66682316]
- [1.0718815, 0.0216852677, -1.00256067e-05, 2.21412001e-09, -1.9000289e-13,
-1.14263932e+04, 15.1156107]
note: L8/88
transport:
model: gas
geometry: nonlinear
well-depth: 252.3
diameter: 4.302
rotational-relaxation: 1.5
radiation:
model: PMAC
fit-type: table
temperatures: [200.0, 300.0, 400.0, 500.0, 600.0,
700.0, 800.0, 900.0, 1000.0, 1100.0, 1200.0, 1300.0, 1400.0, 1500.0, 1600.0,
1700.0, 1800.0, 1900.0, 2000.0, 2100.0, 2200.0, 2300.0, 2400.0, 2500.0, 2600.0,
2700.0, 2800.0, 2900.0, 3000.0, 3100.0, 3200.0, 3300.0, 3400.0, 3500.0]
data: [0.38479552555827473, 0.330335973067736, 0.4412642688261878, 0.7234904395389986,
1.3047333754840624, 2.4582817867678797,
4.728954047788753, 9.185141033669707, 17.899543021230603, 34.850795560924084,
67.58893234939407, 130.26844542962587, 249.09122926085138, 471.9318246172849,
885.130031885148, 1642.3336783887491, 3013.480869817436, 5466.6396914389925,
9803.371388627636, 17379.457798083575, 30460.7202083096, 52790.33601327037,
90480.336797945, 153407.43112853833, 257355.273339689, 427303.61580306507,
702366.9359563864, 1143267.5642510268, 1843354.9491235327, 2944846.812649131,
4662659.170473707, 7318745.5983123155, 11391692.329199707, 17587602.579628713]
And for the case where the older polynomial fits (I'm not sure how prevalent/standardized this form is) are used, we specify using:
radiation:
model: PMAC
fit-type: polynomial
data: [-0.23093, -1.12390, 9.41530, -2.99880, 0.51382, -1.86840e-5]
Tagging the original creator of the pull request and the user who opened the enhancement. @lavrenyukiv<https://github.com/lavrenyukiv> @BYUignite<https://github.com/BYUignite>
…________________________________
You can view, comment on, or merge this pull request online at:
#1799
Commit Summary
* a9bf1e5<a9bf1e5> [oneD] reproducing PR965 with yaml file addition
File Changes
(3 files<https://github.com/Cantera/cantera/pull/1799/files>)
* M include/cantera/oneD/Flow1D.h<https://github.com/Cantera/cantera/pull/1799/files#diff-33e21ca309e69ad7952e02cc9817dd9a4ce057e21c59a8276888d732a08bef6d> (34)
* M src/oneD/Flow1D.cpp<https://github.com/Cantera/cantera/pull/1799/files#diff-14affd62b2c5b0e4c4d0001f3d72e5f0d3044785ac027e39455a5ebbcde5121b> (115)
* A test/data/air_radiation.yaml<https://github.com/Cantera/cantera/pull/1799/files#diff-89aaafb4bfefb80fc680b8d43085d4181f8a8d8819c75755c1085bfb5306095b> (274)
Patch Links:
* https://github.com/Cantera/cantera/pull/1799.patch
* https://github.com/Cantera/cantera/pull/1799.diff
—
Reply to this email directly, view it on GitHub<#1799>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AD5XI7IHQ3XVMWIHZXOSZV3Z4W64HAVCNFSM6AAAAABQLOYRYKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYDIMBZG42DANY>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Now that Cantera 3.1 is released, this should be ready for further discussion and review. Linking Cantera/enhancements#218 and tagging @marina8888 as there was interest. |
Hi All, I've been using the polynomials with high and low temperature ranges in my work by putting them into computeRadiation (excuse the ugly code below, but actually it seems quite similar to #965). Integrating RadLib into Cantera is way above my skill grade, but if no one else is working on this, perhaps, for now, I could rewrite this function for parsing yaml data to Flow1D computeRadiation - in a similar format to the SpeciesThermoFactory.cpp file? Assuming StFlow will be depreciated... Some coefficients taken from the literature result in solver errors, so I think it will need some tests on the input polynomials, but I don't have a good grasp of the issue at the moment. Flow1D.cpp:
|
I've been a bit busy the last few months. I recall from my investigation that there was generally multiple ways of obtaining the values that are needed to compute the radiative heat loss. At a high level, the interface between say the Cantera solver and the radiation coding would be something like the species, their mass/mole fraction in a mixture, and the temperature. I think getting a handle on the interface is the highest priority. From the Radlib website it looks like there's 3 major models that are usable. 1.) The Planck Mean (PM) model. This is where the folks who work with this library can help to clarify some things. So there's a single global equation that all radiation modeling boils down to trying to get the best estimate of the parameters for? In the current Cantera coding, the final thing that is needed by Cantera is this
If that's the case, then somewhere we would have a control for which of the 3 radiation models to use, which then would tell Cantera to setup whatever is needed by the particular model and potentially instantiate a radiation object. From this example it looks like the interface needs to be something like:
How this k_a quantity relates to the needed I think something like a factory during initalization that picks the type of radiation model that a user wants to use and creates the object and stores it in something like a generic |
In the example noted, k_P likely refers to a Planck mean absorption coefficient that is applied in an optically-thin model to compute the radiative_heat_loss. The equivalent in RadLib would be the |
Glad to see the continued discussion of this. I'd suggest it would be better to share these comments in an "Issue" (Cantera/enhancements#72) rather than as PR comments, as the latter are unfortunately likely to get automatically hidden by GitHub as more commits and code comments are added. |
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.
Thank you everyone for the input. While I think that Cantera/enhancements#72 may be a little too specific and potentially beyond the scope of the conversation here, I believe the path forward is relatively clear:
- Long-term, we would like to use a
newRadiationModel
factory method that supports RadLib variants as envisioned by @BYUignite. - Short-term, we'd like to include additional parameterizations along the lines of @lavrenyukiv's original PR Radiation model update in StFlow.cpp #965 (which appears to have parallels with @marina8888's intent) while moving away from hard-coded radiation parameterizations to YAML as was added in this PR by @wandadars.
I'd suggest moving forward with the original approach of this PR and working out the best possible compromise that allows for future enhancements. Ideally, this would involve a new Radiation1D
class that can be instantiated based on YAML directly. It should provide an interface for computeRadiation
that replaces the current Flow1D::computeRadiation
method.
For the YAML parameterization itself, I am a little hesitant to add this as a new radiation
field to species
specifications, as it is quite specific to a use case, hard to maintain, and will become unwieldy for large mechanisms. Instead, I'd suggest adding a stand-alone parameterization file radiation_parameters.yaml
, perhaps with sections for different models, i.e.:
# radiation_parameters.yaml
PMAC:
- H2O:
fit-type: polynomial
data: [-0.23093, -1.12390, 9.41530, -2.99880, 0.51382, -1.86840e-5]
- N2O:
fit-type: table
temperatures: [200.0, 300.0, 400.0, 500.0, 600.0,
700.0, 800.0, 900.0, 1000.0, 1100.0, 1200.0, 1300.0, 1400.0, 1500.0, 1600.0,
1700.0, 1800.0, 1900.0, 2000.0, 2100.0, 2200.0, 2300.0, 2400.0, 2500.0, 2600.0,
2700.0, 2800.0, 2900.0, 3000.0, 3100.0, 3200.0, 3300.0, 3400.0, 3500.0]
data: [0.05604186150530222, 0.04991781435183458,
0.04001827500393808, 0.036150506950346904, 0.03710719640348422, 0.04180788677648103,
0.05018622510260605, 0.06285657185631298, 0.08094410959148458, 0.10604926499576005,
0.1402734389982863, 0.18627028306484095, 0.24730302890664432, 0.32730217346266893,
0.430908689506439, 0.5635079200362725, 0.7312449464709093, 0.9410221482388516,
1.2004777818389483, 1.5179552157303737, 1.9024578243125905, 2.363587182232489,
2.911482794626652, 3.5567676931747707, 4.310436165387461, 5.18386757038981,
6.188658945204697, 7.336641004525838, 8.639751162834212, 10.110065918784443,
11.759665166149045, 13.600597157732668, 15.644893691074058, 17.9045229031322]
[...]
Similar to other entries, this could be linked in the main YAML file, e.g.
# air_radiation.yaml
phases:
- name: gas
thermo: ideal-gas
elements: [O, H, N, Ar]
species:
- gri30.yaml/species: all
skip-undeclared-elements: true
skip-undeclared-third-bodies: true
kinetics: bulk
reactions:
- gri30.yaml/reactions: declared-species
transport: mixture-averaged
radiation: # <--------------------------------- new entry
- radiation_parameters.yaml
or, alternatively, passed as a parameter to the RadiationModel
constructor? (mismatched species names could be addressed with the Phase::addSpeciesAlias
route).
If this is ok with everyone, I'd suggest rebasing the PR and proceeding with a standard review.
336a341
to
7cccced
Compare
Thanks for all the comments everyone. I think @ischoegl 's suggestion is a good solution towards enhancing the way Cantera handles radiative effects. I'm not very well versed in how the YAML parsing works beyond how I see the usage that happens in the Peng Robinson EOS class and the way we have it in the radiation coding in the PR. I can't quite just call species->input if I have a structure of the radiation_properties.yaml file like the one you have shown where the PMAC is sort of the entry-point for the YAML. |
Re YAML parsing: have a look at some of the main loaders, e.g. Lines 203 to 207 in 2e0d8ac
and associated calls, e.g. cantera/src/thermo/ThermoFactory.cpp Line 183 in 2e0d8ac
Reading YAML input is taken care of by AnyMap::fromYamlFile , and the rest is relatively straightforward. Ray has included very good documentation for AnyMap ... see C++ documentation
|
67555c5
to
f4aabb8
Compare
I was looking through the open pull requests and saw #965 . It seemed like it was something that could be pushed across the finish line given the recent updates to Cantera that allow for easier handling of data in the YAML file.
Potentially allows for the discussions in Cantera/enhancements#72 to be realized.
I added some of the data from the original pull request into the gri30.yaml file (attached), and ran the 1D diffusion flame example
gri30.txt
From the discussions in the #965 it seemed like there was more than one possibility for handling that absorption coefficient calculation, so I added a keyword of
fit-type
which can betable
orpolynomial
. Thepolynomial
type is what was originally used and thetable
is the log linear interpolation data that was apparently better. PMAC isPlank Mean Absorption Coefficient
. I'm pretty clueless on radiation modeling, so if anyone else knows more about this, please chime in.As an example this would be the YAML entry for a species C2H6 that used the log-linear interpolation tabulated data.
And for the case where the older polynomial fits (I'm not sure how prevalent/standardized this form is) are used, we specify using:
Tagging the original creator of the pull request and the user who opened the enhancement. @lavrenyukiv @BYUignite