Thermodynamic properties for a 2-temperature plasma#2101
Open
pag1pag wants to merge 57 commits intoCantera:mainfrom
Open
Thermodynamic properties for a 2-temperature plasma#2101pag1pag wants to merge 57 commits intoCantera:mainfrom
pag1pag wants to merge 57 commits intoCantera:mainfrom
Conversation
Updated and standardized comments throughout PlasmaPhase.cpp for clarity and consistency. Minor clarifications were made to comment phrasing to better describe the logic and intent of code blocks. No functional code changes were introduced.
Moved the comment about updating electron Gibbs functions inside the loop to accurately reflect where the update occurs.
Implemented cp_mole, cp_mole_e, cp_mass_e, cv_mole_e, cv_mass_e, cp_mole_h, cp_mass_h, cv_mole_h, and cv_mass_h methods in PlasmaPhase to separately compute specific heat capacities for electrons and heavy species. Updated the header and source files with method definitions and detailed documentation for each new function.
Introduced meanTemperature() to compute the mole-fraction-weighted average temperature of electrons and heavy species in the plasma phase. Overrode pressure() to use the mean temperature in pressure calculations, and updated setPressure() to set density based on the mean temperature.
Reorganizes and documents the PlasmaPhase class. Improves Doxygen comments, groups related methods, and adds stubs for unimplemented thermodynamic properties. No new codes, only reorganization and minor updates on comments.
Add full stop at the end of some comment, and change from parenthesis to bracket
Grouped and reordered method declarations in PlasmaPhase.h for partial molar, standard state, and reference state properties. Added and commented out several method overrides, that comes from the IdealGasPhase.
Reorganizes the PlasmaPhase class implementation by grouping related methods into clearly marked sections, improving code readability and maintainability. Moves and consolidates overridden methods, adds section comments. No functional changes are introduced.
Clarified the documentation for overridden methods in PlasmaPhase, specifying that methods are overridden from IdealGasPhase or ThermoPhase and adding a Doxygen group marker.
Added Doxygen-style comments and grouping for electron species information methods in PlasmaPhase.h to improve code documentation and organization.
Added detailed documentation for getStandardChemPotentials and getGibbs_ref in PlasmaPhase, clarifying their behavior for heavy species and electrons. Updated getStandardChemPotentials implementation to: - correctly evaluate getGibbs_ref using the electron temperature. - use total pressure instead of electron pressure.
There is no need to subtract the electron pressure instead of the total pressure (cf. previous commit, where the pressure has been defined including the electron temperature)
The getPartialMolarEntropies method in PlasmaPhase.cpp has been commented out. No need to correct for electron pressure.
Updated Doxygen comments in PlasmaPhase.h to use consistent notation (\overline{T} instead of \bar{T}), clarified units for variables in equations, and improved descriptions for several methods.
Also commented out the getPartialMolarEntropies method override (cf. previous commit).
Replaced calls to the m_Me() function with the m_Me member variable in cp_mass_e() and cv_mass_e() methods to ensure correct calculation of electron-specific heat capacities.
Commented out the entropy_mole, gibbs_mole, and intEnergy_mole overrides in PlasmaPhase, removing their NotImplementedError stubs. Now that pressure is defined, it should work as expected
Introduced new properties to ThermoPhase for accessing electron and heavy species heat capacities (cp/cv, mole/mass) and mean plasma temperature. These properties are only available when plasma mode is enabled and provide more detailed thermodynamic information for plasma phases.
Changed the setState_TD method in the Phase class to be virtual, allowing derived classes to override this method for custom behavior.
Introduces new methods to set the thermodynamic state of PlasmaPhase, including setState_TP, setState_TgTeP, setState_TD, and setState_TgTeD, supporting both gas and electron temperatures. Also adds explicit NotImplementedError exceptions for unsupported state-setting methods and improves documentation and member variable comments for clarity.
Changed the plasma test phase from 'discretized-electron-energy-plasma' to 'isotropic-electron-energy-plasma'. Updated known failures to only include unsupported 'setState_SV' in PlasmaPhase and added a note clarifying the assumption that electron temperature equals gas temperature in test cases.
Updates the test setup to assume electron temperature (Te) equals the bulk temperature (T) in all test cases. For plasma phases, explicitly sets Te and resets the state to ensure consistency. Before, the electron temperature was not set?
Implements PlasmaPhase::setState to allow setting the phase state from an AnyMap with flexible property keys and units. This method supports various synonyms for gas temperature, electron temperature, pressure, density, and composition, improving usability and integration with input files.
Simplifies the pressure() method in PlasmaPhase to use the multi-temperature ideal gas law with mean temperature and density, removing the previous adjustment for electron temperature and concentration.
Introduced a new plasma test case in consistency-cases.yaml where the electron temperature (Te) is set to a value different from the gas temperature (T) to test handling of non-equilibrium conditions. Now, tests are not passing.
Added implementations for standardConcentration, getPartialMolarVolumes, and getStandardVolumes in PlasmaPhase to properly handle multi-temperature plasma phases. Also added stubs for thermalExpansionCoeff and soundSpeed with NotImplementedError, and updated documentation to clarify temperature usage in these calculations.
Listed additional known failures in the plasma test cases for differential methods that are not yet implemented for two-temperature systems. This clarifies current test expectations and documents unimplemented features.
Update consistency tests to correctly handle two-temperature plasma models by distinguishing between electron and heavy species temperatures in relevant thermodynamic relations. Adjust tests for Gibbs energy, enthalpy, entropy, and heat capacity to account for electron temperature where appropriate. All consistency tests passed.
Introduced TgTeP and TgTeD properties to the ThermoPhase class for getting and setting gas temperature, electron temperature, and pressure or density, respectively. Updated the Cython interface to expose setState_TgTeP and setState_TgTeD methods. Added corresponding tests to verify correct behavior.
Replace raw pointer + size calls with vector-based overloads for saving/restoring partial state in PlasmaPhase (savePartialState/restorePartialState) and for retrieving partial molar entropies in the thermo consistency test. This simplifies calls, uses safer STL containers, and matches updated API signatures. Changes applied in src/thermo/PlasmaPhase.cpp and test/thermo_consistency/consistency.cpp.
… of PlasmaPhase.h
Update docstrings for getPartialMolarEnthalpies, getPartialMolarVolumes, getPartialMolarEntropies, and getPartialMolarCp. The last two are not overriden, since there is no need for it.
Also add a comment for 5 methods, for why we don't need to override them.
Without `.resolve()` on Windows, it can lead to error.
Check that cp and h are correctly computed, even if the electron temperature is not the same as the gas temperature
Some tests are failing for 2-temperature systems, when Te!=Tg
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2101 +/- ##
==========================================
- Coverage 77.62% 77.54% -0.09%
==========================================
Files 451 451
Lines 53045 53173 +128
Branches 8853 8871 +18
==========================================
+ Hits 41177 41231 +54
- Misses 8891 8946 +55
- Partials 2977 2996 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Remove numerous setState_XY overloads from PlasmaPhase.h that previously threw NotImplementedError (e.g., setState_HP, setState_UV, setState_SV, etc.).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note that the following assumes that a temperature can be defined for all species. While this may be true for all heavy species, electrons may not be characterized by an electron temperature (for instance, if the electron energy distribution function (EEDF) is far away from a Maxwellian). It is therefore assumed that the implementation below holds if, for instance, the EEDF is Maxwellian (which may be seen as a strong approximation in plasma).
The partial pressure is defined as:$P_k = R T_k X_k \rho_m$ (with $\rho_m$ the mixture molar density).$P = \sum_k P_k = R \rho_m \sum_k X_k T_k$ $\overline{T}=\sum_k X_k T_k$ , the total pressure is rewritten $P = R \rho_m \overline{T}$ .
The total pressure is the sum of all partial pressure:
Introducing a mean temperature, defined by
The standard concentration ($c^°=\frac{P}{R \overline{T}}$ .$v_k = \frac{R T_k}{P}$ .
standardConcentration) uses this mean temperature:The standard volume (
getStandardVolumesandgetPartialMolarVolumes) isChanges proposed in this pull request
enthalpy_mole,entropy_mole,gibbs_mole,intEnergy_molemeanTemperature,pressure,setPressure,electronPressurestandardConcentrationgetChemPotentials,getPartialMolarEnthalpies,getPartialMolarIntEnergies,getPartialMolarVolumesgetStandardChemPotentials,getStandardVolumesgetGibbs_ref,getStandardVolumes_refsetStatemethod to account for additional electron temperature. Also introducesetState_TgTePandsetState_TgTeDto set electron temperature along with other quantities.If applicable, fill in the issue number this pull request is fixing
Closes #1872
If applicable, provide an example illustrating new features this pull request is introducing
AI Statement (required)
assistance.
Checklist
scons build&scons test) and unit tests address code coverage