Skip to content

electron collision reaction#1262

Merged
speth merged 13 commits intoCantera:mainfrom
BangShiuh:collision-reaction
Mar 28, 2024
Merged

electron collision reaction#1262
speth merged 13 commits intoCantera:mainfrom
BangShiuh:collision-reaction

Conversation

@BangShiuh
Copy link
Copy Markdown
Contributor

@BangShiuh BangShiuh commented Apr 29, 2022

This PR accomplishes using LXCat data to calculate electron collision reaction rate.

If applicable, fill in the issue number this pull request is fixing

Cantera/enhancements#127

If applicable, provide an example illustrating new features this pull request is introducing

https://github.com/BangShiuh/cantera-examples/blob/main/plasma/plasma.py

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@ischoegl ischoegl added the Input Input parsing and conversion (for example, ck2yaml) label Apr 30, 2022
@BangShiuh BangShiuh force-pushed the collision-reaction branch 2 times, most recently from c9f60bf to dc3b60d Compare May 18, 2022 15:16
@codecov
Copy link
Copy Markdown

codecov bot commented May 18, 2022

Codecov Report

Attention: Patch coverage is 68.73156% with 106 lines in your changes are missing coverage. Please review.

Project coverage is 72.76%. Comparing base (d49d6f5) to head (c9c2f93).
Report is 10 commits behind head on main.

Files Patch % Lines
interfaces/cython/cantera/lxcat2yaml.py 61.72% 46 Missing and 16 partials ⚠️
src/kinetics/ElectronCollisionPlasmaRate.cpp 64.51% 10 Missing and 12 partials ⚠️
src/thermo/PlasmaPhase.cpp 52.38% 10 Missing ⚠️
src/kinetics/Reaction.cpp 72.41% 3 Missing and 5 partials ⚠️
...ude/cantera/kinetics/ElectronCollisionPlasmaRate.h 89.47% 2 Missing ⚠️
interfaces/cython/cantera/reaction.pyx 92.85% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1262      +/-   ##
==========================================
- Coverage   72.78%   72.76%   -0.02%     
==========================================
  Files         375      378       +3     
  Lines       56679    56986     +307     
  Branches    20607    20691      +84     
==========================================
+ Hits        41255    41468     +213     
- Misses      12400    12463      +63     
- Partials     3024     3055      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BangShiuh BangShiuh force-pushed the collision-reaction branch from dc3b60d to c31311b Compare May 20, 2022 20:04
@BangShiuh BangShiuh force-pushed the collision-reaction branch 2 times, most recently from 85996ae to a66b265 Compare January 5, 2023 04:17
@BangShiuh
Copy link
Copy Markdown
Contributor Author

@speth @bryanwweber I made a file lxcatml2yaml.py, which is used similarly to ctml2yaml. Do you know how to make a list in yaml compact?
Ex.

  • [1.0, 2.0, 3.0] instead of
  • 1.0
  • 2.0
  • 3.0

@speth
Copy link
Copy Markdown
Member

speth commented Jan 26, 2023

Do you know how to make a list in yaml compact?

This is what's know as "flow" style in YAML. Here's how it's done in ck2yaml for both lists and maps:

def FlowMap(*args, **kwargs):
m = yaml.comments.CommentedMap(*args, **kwargs)
m.fa.set_flow_style()
return m
def FlowList(*args, **kwargs):
lst = yaml.comments.CommentedSeq(*args, **kwargs)
lst.fa.set_flow_style()
return lst

@BangShiuh
Copy link
Copy Markdown
Contributor Author

I tried run and debug in vs code. from . import utilities causes an issue, so I can only insert print() to investigate. It would be nice if we can just run a particular test in a test file.

@BangShiuh BangShiuh marked this pull request as ready for review March 4, 2023 21:42
@BangShiuh BangShiuh force-pushed the collision-reaction branch from 7261d2b to a693a0c Compare March 4, 2023 22:44
@speth
Copy link
Copy Markdown
Member

speth commented Mar 4, 2023

I tried run and debug in vs code. from . import utilities causes an issue, so I can only insert print() to investigate. It would be nice if we can just run a particular test in a test file.

From the command line, it is definitely possible to run a single test. After executing scons build, a command like the following should work:

LD_LIBRARY_PATH=build/lib pytest -raP --verbose test/python/test_reaction.py -k 'add_rxn'

where the -k option is a filter based on test names. On macOS, you would need to replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.

You can also add the --pdb option to have it drop you into a debug terminal after any assertion failure.

@BangShiuh BangShiuh force-pushed the collision-reaction branch from a693a0c to 705cc7e Compare March 5, 2023 16:02
@BangShiuh BangShiuh force-pushed the collision-reaction branch 3 times, most recently from f2af2dd to 877a8db Compare April 8, 2023 20:09
@BangShiuh
Copy link
Copy Markdown
Contributor Author

Almost finish. I will add the test for lxcatml2yaml.

@BangShiuh BangShiuh force-pushed the collision-reaction branch from 6082cf1 to d7138e8 Compare May 22, 2023 02:27
@BangShiuh
Copy link
Copy Markdown
Contributor Author

BangShiuh commented Jul 5, 2023

@speth @ischoegl I have made some significant progress on this PR, and I think it is ready to be reviewed. The branch is not synchronized. Not sure why.

@ischoegl
Copy link
Copy Markdown
Member

ischoegl commented Jul 5, 2023

@BangShiuh thank you for the reminder. Could you rebase to the most recent main so the merge conflict is resolved?

@BangShiuh
Copy link
Copy Markdown
Contributor Author

@ischoegl I did it already but the PR information here is not up-to-date. Should I reopen a PR to fix this issue?

@ischoegl
Copy link
Copy Markdown
Member

ischoegl commented Jul 5, 2023

@ischoegl I did it already but the PR information here is not up-to-date. Should I reopen a PR to fix this issue?

I had an issue like this just the other day (apparently a glitch in GH). You may be able to fix it by introducing a minor change in one of the commits (example: edit a docstring) and force-push again.

@BangShiuh BangShiuh force-pushed the collision-reaction branch from 6a0a6f7 to 7122157 Compare July 5, 2023 20:03
@BangShiuh
Copy link
Copy Markdown
Contributor Author

@speth I have fixed most of the issues. The flag m_ROP_ok = false is still odd. test_jacobian fails if m_ROP_ok = false only implemented at each rate. I managed to make the tests passed by not removing m_ROP_ok = false at the original place.

@speth speth self-requested a review January 16, 2024 15:24
Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks for the continued work on this, @BangShiuh. Overall, I think this is looking really good. A lot of my comments here are just minor issues with spelling / formatting. Probably the two biggest points are

  • How this rate type should interact with the automatic third body identification / handling, where I'd like to get @ischoegl's opinion as well
  • To see if we can make the example using this feature more physically relevant, and if it's not straightforward to do so in this PR, to document in an enhancement issue the path toward doing so.

@BangShiuh BangShiuh force-pushed the collision-reaction branch from e76ccb1 to 6689073 Compare March 15, 2024 02:33
@BangShiuh
Copy link
Copy Markdown
Contributor Author

BangShiuh commented Mar 15, 2024

@speth I have addressed most of the issues. The new commit "fix setContext check for reactants" might be the fix.

@erwanp
Copy link
Copy Markdown

erwanp commented Mar 17, 2024

Many plasma physicists around here are computing close to fully-ionized plasma ; where the electron density cannot be considered negligible compared to the total concentration. @BangShiuh @speth if you're making this assumption ensure a warning or an error is raised if electron density is (for instance) >0.1% of total density.

@BangShiuh
Copy link
Copy Markdown
Contributor Author

BangShiuh commented Mar 17, 2024

R = ct.Reaction(
            equation=equation,
            rate=ct.ElectronCollisionPlasmaRate(energy_levels=energy_levels,
                                                cross_sections=cross_sections))

My fix works for a yaml reaction initiation, but fails for the initiation without kin object.

@BangShiuh BangShiuh force-pushed the collision-reaction branch from 3c3348b to 3c8ead6 Compare March 18, 2024 03:21
@BangShiuh
Copy link
Copy Markdown
Contributor Author

@speth take a look and let me know if this fix for the third body issue is fine.

@speth speth force-pushed the collision-reaction branch from 3c8ead6 to 7ae7339 Compare March 27, 2024 20:10
@speth speth force-pushed the collision-reaction branch 2 times, most recently from 8757197 to 2bb61d6 Compare March 27, 2024 21:49
@speth speth force-pushed the collision-reaction branch from 2bb61d6 to c9c2f93 Compare March 28, 2024 13:19
Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks, @BangShiuh. I modified the last commit to avoid needing to modify the function signature of Reaction::setEquation, which would have been a breaking API change. Otherwise, I think we're good to go. Thanks for your continued work on this!

@speth speth merged commit b0ba90a into Cantera:main Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Input Input parsing and conversion (for example, ck2yaml) Kinetics

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

4 participants