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

CEPTR: PLOG reaction support at constant pressure #549

Merged
merged 24 commits into from
Dec 23, 2024

Conversation

terencelehmann
Copy link
Contributor

Suggestion for #538 at constant pressure, which is provided by the user when converting the mechanism.

Changes to code:

  • ceptr/production.py : Assessing if reaction type is "pressure-dependent-Arrhenius", and call utilities function for rate calculation
  • ceptr/jacobian.py : Assessing if reaction type is "pressure-dependent-Arrhenius", and call utilities function for rate calculation
  • ceptr/utilities.py: New function evaluate_plog -> When called for the first time, gets pressure from used and stores in global variable for reuse. Then interpolation of rate coefficients.

Tests:

  • Generation of mechanisms within and outside the PLOG pressure limit. Checked computed rate coefficients and units.

Possible improvements:

terencelehmann and others added 8 commits November 14, 2024 18:27
* pin intel-oneapi version in CI (AMReX-Combustion#541)

* Bump Submodules/amrex from `8349789` to `00e6f75` (AMReX-Combustion#540)

Bumps [Submodules/amrex](https://github.com/AMReX-Codes/amrex) from `8349789` to `00e6f75`.
- [Release notes](https://github.com/AMReX-Codes/amrex/releases)
- [Commits](AMReX-Codes/amrex@8349789...00e6f75)

---
updated-dependencies:
- dependency-name: Submodules/amrex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bruce Perry <[email protected]>

* Make EOS functions templates to allow for CellData as an argument (AMReX-Combustion#536)

* template for celldata in EOS

* static asserts in templates

* templating for RY2 functions for all EOS

* Fix clang-tidy (AMReX-Combustion#535)

* fix unused variable

* free shared ptr for manfunc parm

---------

Co-authored-by: Marc T. Henry de Frahan <[email protected]>

* Unit conversions (AMReX-Combustion#539)

* Utilities and unit conversions

* Formatting

* 2 structs and renamed functions to avoid macros issue

* Templating and namespaces

* Added Utilities to Docs

* Overload instead of templating

* Fixed nested namespaces for clang-tidy error in PeleLMeX, removed Utilities.H from PelePhysics.H.wq (AMReX-Combustion#545)

* Update CI to ubuntu-24.04 (AMReX-Combustion#546)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Bruce Perry <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marc T. Henry de Frahan <[email protected]>
Co-authored-by: Dave Montgomery <[email protected]>
Co-authored-by: Jon Rood <[email protected]>
ceptr: Added functionality for reading and converting PLOG reactions.
@marchdf
Copy link
Contributor

marchdf commented Nov 20, 2024

Thank you for doing this! Do you have a small mech that you could add to the PR as and example?

@baperry2
Copy link
Contributor

Thanks for the submission @terencelehmann

For Discussion:

  • I like this capability, but I worry about the potential for people to accidentally use mechanisms that get generated though this process for the wrong pressure. One solution is that for mechanisms with plogs, we create a subdirectory with the specific pressure in the name to store mechanism.{h,cpp}. For example something like Mechanisms/POLIMI2020/p1atm/mechanism.{h,cpp}. The current gmake build system would work by specifying Chemistry_Model = POLIMI2020/p1atm, and this would ensure users are aware that they are using a mechanism for that specific pressure. It would also allow keeping around multiple versions for multiple pressures. Not sure how hard this would be to implement in CEPTR. @malihass @marchdf thoughts?
  • We should also add the new mechanism to list_mech so it gets included in batched mechanism generation, which will require some way of specifying the pressure a priori rather than on the fly on the command line.

@malihass
Copy link
Collaborator

malihass commented Nov 20, 2024

I was going to suggest indicating the pressure in a .toml input like we do for the symbolic Jacobin stuff, but I prefer your idea Bruce, I can see this being a recipe for mistakes if we don't explicitly write the value of pressure next to the mechanism name. I don't anticipate it being too difficult to implement in ceptr.

@malihass
Copy link
Collaborator

Also I ran cases with 0.5 atm, 1atm 2atm and everything looks on par with Cantera, with numerical Jac and Analytical Jac, great job!
plogval

@terencelehmann
Copy link
Contributor Author

Thank you @baperry2 @malihass for the input! I'm happy to implement these suggestions (next week). Where exactly is the list_mech file used?

@baperry2
Copy link
Contributor

list_mech is just a list of all working non-QSSA mechanisms in PelePhysics. We use it to regenerate all mechanism code in batched manner when necessary:

$ cd ${PELE_PHYSICS_HOME}/Support/ceptr
$ poetry run convert -l ${PELE_PHYSICS_HOME}/Mechanisms/list_mech

The catch is this won't work for specifying the pressure through an input prompt as its set up now. Ideally we'd have a way to specify the pressure for mechanisms with plogs as a command line argument when running this command or perhaps put that information into the list_mech file and parse it from there so it could be specified for mechanisms individually.

dependabot bot and others added 9 commits December 10, 2024 21:53
Bumps [Submodules/amrex](https://github.com/AMReX-Codes/amrex) from `00e6f75` to `f27eb69`.
- [Release notes](https://github.com/AMReX-Codes/amrex/releases)
- [Commits](AMReX-Codes/amrex@00e6f75...f27eb69)

---
updated-dependencies:
- dependency-name: Submodules/amrex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* simplify templated functions in EOS.cpp

* rearrange template specializations in EOS.cpp so they are all in header; improve speciesNames function for manifold

* SYCL ifdef for manifold speciesnames

* pass host eosparm to reactors

* ignitionDelay: remove one invalid call for manifold eos

* fix dumb bug

* clang-tidy unused arguments
pull main into ceptr_development
@terencelehmann
Copy link
Contributor Author

I have now fixed the issues mentioned above. Also, in this new version, I have used the pressure attribute in the Cantera mechanism object /Solution class to store the pressure rather than in a global variable in ceptr.utilities.
Let me know if there is anything else to fix.

@baperry2
Copy link
Contributor

Looks good. Thanks for the updates - I like getting rid of global variables as well. I'd like to add some documentation for PLOGs in CEPTR: ITV-RWTH#10

If that documentation looks good, I think we can merge this.

baperry2 and others added 2 commits December 23, 2024 09:19
fix another typo
add docs on plog mechanism conversion
Copy link
Contributor

@baperry2 baperry2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the contribution!

@baperry2 baperry2 enabled auto-merge (squash) December 23, 2024 17:39
@baperry2 baperry2 merged commit 3b3b7fe into AMReX-Combustion:development Dec 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants