-
-
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
Enhance the PlasmaPhase to use the cross section data with an example of calculating the elastic collision energy loss rate #1731
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1731 +/- ##
==========================================
+ Coverage 73.23% 73.26% +0.02%
==========================================
Files 383 383
Lines 54652 54799 +147
Branches 9109 9133 +24
==========================================
+ Hits 40027 40150 +123
- Misses 11612 11625 +13
- Partials 3013 3024 +11 ☔ View full report in Codecov by Sentry. |
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.
Thanks for working on this, @BangShiuh. I had some suggestions that I think will lead to a simpler implementation. Please let me know if you have any questions.
@BangShiuh, I saw that you have marked all the comments from my previous review as "resolved", but I think the corresponding changes have not been pushed to this branch. Are they all in your |
Hi Ray,
Yes, I am mostly done. I am working on a small issue right now for updating
the interpolating the cross section. I will push it once I finished!
Bang
…On Tue, Nov 12, 2024 at 10:22 PM Ray Speth ***@***.***> wrote:
@BangShiuh <https://github.com/BangShiuh>, I saw that you have marked all
the comments from my previous review as "resolved", but I think the
corresponding changes have not been pushed to this branch. Are they all in
your collision-new branch that you mentioned in Cantera/enhancements#194
<Cantera/enhancements#194>? Could you push them
to this branch?
—
Reply to this email directly, view it on GitHub
<#1731 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEZZJBQ5JNPC2LX7E6SMOID2ALAXFAVCNFSM6AAAAABKQ3OMM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZSGI4TAMRTGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
bde326e
to
5f00629
Compare
@speth I have made updating rate or adding reaction triggers updating the interpolated cross sections. I also have tried to reduce the number of interpolating the cross-sections, but not successful. The rate object in PlasmaPhase is different to the one in m_bulk_rates, which is used by updateROP. I will check the Linters checks failure. How do I run that on my computer? |
The easiest thing to do is just look at the logs here on GitHub. The problem that it is finding is with the docstring for class /*!
* Base class for handling plasma properties, specifically focusing on the
* electron energy distribution. This class provides functionality
* to manage the the electron energy distribution using two primary methods
* for defining the electron distribution and electron temperature.
* There is a subtle difference between starting a Doxygen comment block with //! Base class for handling plasma properties, specifically focusing on the
//! electron energy distribution.
/*!
* This class provides functionality to manage the the electron energy distribution
* using two primary methods for defining the electron distribution and electron
* temperature.
* |
Commit 21bbebd erroneously reverts the state of the |
I am not sure why 4e7d6e2 is [1D].... I will investigate it. |
I think you've accidentally squashed a commit of yours into one of mine. The only change that should be in the commit with that message is a 3-line change to |
…nterpolated cross section
…ratureFromEnergyDist
I used reset during rebase to remove the change to example_data. But I used commit --amend, so the original commit was gone and became [1D] ... should just use commit instead. |
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.
Thanks for the updates here, @BangShiuh. I think this is just about ready -- I just have a few comments that are mostly about the documentation and code style.
* distribution (as described by @cite gudmundsson2001 @cite khalilpour2020) | ||
* is given by: |
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.
Because the @cite
command only produces the numerical reference (for example [10]
), write this as:
* distribution (as described by @cite gudmundsson2001 @cite khalilpour2020) | |
* is given by: | |
* distribution (as described by Gudmundsson @cite gudmundsson2001 and Khalilpour and Foroutan @cite khalilpour2020) | |
* is given by: |
* f(\epsilon) = c_1 \frac{\sqrt{\epsilon}}{\epsilon_m^{3/2}} | ||
* \exp(-c_2 (\frac{\epsilon}{\epsilon_m})^x), | ||
* \exp(-c_2 \left(\frac{\epsilon}{\epsilon_m}\right)^x), |
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.
* f(\epsilon) = c_1 \frac{\sqrt{\epsilon}}{\epsilon_m^{3/2}} | |
* \exp(-c_2 (\frac{\epsilon}{\epsilon_m})^x), | |
* \exp(-c_2 \left(\frac{\epsilon}{\epsilon_m}\right)^x), | |
* f(\epsilon) = c_1 \frac{\sqrt{\epsilon}}{\epsilon_m^{3/2}} | |
* \exp\left(-c_2 \left(\frac{\epsilon}{\epsilon_m}\right)^x\right), |
Likewise below in the definition of
//! @param updateEnergyDist update electron energy distribution | ||
void setElectronEnergyLevels(const double* levels, size_t length, | ||
bool updateEnergyDist); |
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.
Can this be simplified by just adding updateEnergyDist=true
as an optional argument to the existing version of setElectronEnergyLevels
?
virtual void addSolution(std::weak_ptr<Solution> soln) override; | ||
|
||
/** | ||
* The elastic power loss(J/s/m3) |
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.
Missing a space. I've also started to prefer writing subscripts and superscripts for units using the corresponding unicode characters, though you can also stick to just m^3
for now if you prefer.
* The elastic power loss(J/s/m3) | |
* The elastic power loss (J/s/m³) |
//! update the elastic electron energy loss coefficient of i collision | ||
void updateElasticElectronEnergyLossCoefficient(size_t i); | ||
|
||
//! update elastic electron energy loss coefficients | ||
void updateElasticElectronEnergyLossCoefficients(); |
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.
Can you elaborate on the conditions where these functions might need to be called?
|
||
for (const auto& [id, callback] : m_reactionChangedCallbacks) { | ||
callback(); | ||
} |
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.
Based on where this is called, and how it is used in conjunction with PlasmaPhase
, it might be more accurate to name this a reactionAddedCallback
.
// register callback when reaction is added later | ||
// The modifyReaction |
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.
Comment here seems incomplete.
@@ -8,9 +8,15 @@ | |||
#include "cantera/thermo/Species.h" | |||
#include "cantera/base/global.h" | |||
#include "cantera/numerics/funcs.h" | |||
#include "cantera/kinetics/Kinetics.h" | |||
#include "cantera/kinetics/Reaction.h" | |||
#include "cantera/kinetics/KineticsFactory.h" |
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.
I don't think you need KineticsFactory.h
here, do you?
|
||
namespace Cantera { | ||
|
||
static const double gamma = sqrt(2 * ElectronCharge / ElectronMass); |
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.
Rather than static const double
, this would be better as just const double
in an unnamed namespace.
|
||
if (shared_ptr<Solution> soln = m_soln.lock()) { | ||
shared_ptr<Kinetics> kin = soln->kinetics(); | ||
if (!kin) return; |
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.
Please don't use the one-line version of the if
statement -- always use braces and put the body on a separate line.
Changes proposed in this pull request
This PR change the initiation of the PlasmaPhase. The PlasmaPhase after this change takes the ElectronCollisionPlasmaRate cross-section data to calculate the plasma thermal properties (specifically the elastic collision energy loss rate). The elastic collision energy loss is the energy transfer from electron to molecule when a fast electron (higher electron temperature) collides to a slower molecule (lower gas temperature). This is useful for modelling a non-equilibrium plasma in which the electron temperature is much higher than the gas temperature. The elastic collision power loss includes the energy transfer via elastic collision and via the recoil effect of an inelastic collision. The equation can be found in the manual of bolsig, https://www.bolsig.laplace.univ-tlse.fr/download.html. I have compared the value of elastic power loss to bolsig, and it is reasonably close (around 1% different).
Data download:
The collision cross section can be downloaded from https://nl.lxcat.net/data/download.php. However, the zip file is currently broken. Fortunately, I have saved a previous version. Please email me if you want to use it.
If applicable, fill in the issue number this pull request is fixing
Closes #
If applicable, provide an example illustrating new features this pull request is introducing
Checklist
scons build
&scons test
) and unit tests address code coverage