[WIP] Adding Cantera fluid model for incompressible reacting flows - #2713
[WIP] Adding Cantera fluid model for incompressible reacting flows#2713Cristopher-Morales wants to merge 289 commits into
Conversation
| * \brief Get High temperature applied during spark ignition. | ||
| * \return Spark Temperature. | ||
| */ | ||
| const su2double GetSpark_Temperature(void) const { |
Check warning
Code scanning / CodeQL
Constant return type on member Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 days ago
The fix is to remove only the superfluous top-level const from the return type of GetSpark_Temperature, while preserving the method’s trailing const qualifier.
In Common/include/CConfig.hpp, at the getter near line 4102, change:
const su2double GetSpark_Temperature(void) const
to:
su2double GetSpark_Temperature(void) const
No other code, imports, or definitions are required. This keeps behavior identical and resolves the CodeQL warning.
| @@ -4099,7 +4099,7 @@ | ||
| * \brief Get High temperature applied during spark ignition. | ||
| * \return Spark Temperature. | ||
| */ | ||
| const su2double GetSpark_Temperature(void) const { | ||
| su2double GetSpark_Temperature(void) const { | ||
| return Spark_Temperature; | ||
| } | ||
|
|
|
|
||
| #include <cmath> | ||
|
|
||
| // #include <numeric> |
Check notice
Code scanning / CodeQL
Commented-out code Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
In general, to fix commented-out code, either remove it entirely if it is no longer needed, or reinstate it as active code if it is required for functionality. If the intent is to document an example snippet, it should be reformatted to avoid looking like disabled code (for example, quoting it or explaining it in prose).
For this specific case, the best fix with no functional change is to remove the commented-out include directive // #include <numeric> from SU2_CFD/src/fluid/CFluidCantera.cpp. There is no indication in the shown code that <numeric> is needed (no calls to std::accumulate or similar), so uncommenting it would introduce an unused include, while leaving it as a comment keeps triggering the static analysis warning. Removing that single line resolves the CodeQL issue cleanly without affecting behavior. No additional methods, imports, or definitions are needed.
| @@ -29,7 +29,6 @@ | ||
|
|
||
| #include <cmath> | ||
|
|
||
| // #include <numeric> | ||
| #ifdef USE_CANTERA | ||
| #include <cantera/core.h> | ||
| #include <cantera/kinetics/Reaction.h> |
|
How difficult would it be to extend this to the compressible solver? |
Have a look at all the changed files that have "INC" in the name :-) |
Proposed Changes
This pull request aims to add a fluid model called FLUID_CANTERA for coupling Cantera library with SU2. Cantera library is an open-source library for problems involving chemical kinetics, thermodynamics, and transport processes. This is needed for combustion problems using the incompressible solver.
[UPDATE] adding the cantera option to meson is now sufficient to get cantera coupled to su2.
SU2 can be built with Cantera as follows (for example):
• -Denable-tests=true can be used for testing if Cantera is correctly compiled with SU2, running one of the Cantera fluid unit test cases.
Work in progress:
• Improve cantera coupling, only compile the functionalities needed for SU2. Currently, when cantera is compiled, whole functionalities are compiled. Most of the cantera implementations are not needed for incompressible reacting flows.
• Compile cantera with the AD options. For this purpose, a different repository must be cloned and compiled, where the AD implementation of cantera is located.
• Add regression and unit test cases in the SU2 workflow.
Regarding the coupling between SU2 and Cantera, any advice/suggestion how to improve it would be really appreciated.
Thanks in advance!!
Related Work
Related to pull request #2426
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.
pre-commit run --allto format old commits.