From 96e45a2cc48eea0f589d6ac6dc7bc61c51a29a95 Mon Sep 17 00:00:00 2001 From: Cristopher-Morales Date: Fri, 12 Dec 2025 14:18:43 +0100 Subject: [PATCH] adding 'ENERGY' in CPrimitiveIndices to get index of energy equation --- SU2_CFD/include/variables/CPrimitiveIndices.hpp | 3 +++ TestCases/py_wrapper/turbulent_premixed_psi/run.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/include/variables/CPrimitiveIndices.hpp b/SU2_CFD/include/variables/CPrimitiveIndices.hpp index b5bfee928f18..97687547d394 100644 --- a/SU2_CFD/include/variables/CPrimitiveIndices.hpp +++ b/SU2_CFD/include/variables/CPrimitiveIndices.hpp @@ -124,6 +124,9 @@ std::map PrimitiveNameToIndexMap(const CPrimitiveIndices nameToIndex["VELOCITY_Y"] = idx.Velocity() + 1; if (idx.NDim() == 3) { nameToIndex["VELOCITY_Z"] = idx.Velocity() + 2; + nameToIndex["ENERGY"] = idx.Velocity() + 3; + } else { + nameToIndex["ENERGY"] = idx.Velocity() + 2; } for (IndexType iSpecies = 0; iSpecies < idx.NSpecies(); ++iSpecies) { nameToIndex["DENSITY_" + std::to_string(iSpecies)] = idx.SpeciesDensities() + iSpecies; diff --git a/TestCases/py_wrapper/turbulent_premixed_psi/run.py b/TestCases/py_wrapper/turbulent_premixed_psi/run.py index 8b418785bbc3..c218850ae43d 100644 --- a/TestCases/py_wrapper/turbulent_premixed_psi/run.py +++ b/TestCases/py_wrapper/turbulent_premixed_psi/run.py @@ -95,8 +95,10 @@ def update_temperature(SU2Driver, iPoint): iFLOWSOLVER = SU2Driver.GetSolverIndices()['INC.FLOW'] # the list with names solindex = getsolvar(SU2Driver) - iTEMP = solindex.get("TEMPERATURE") - SU2Driver.Solution(iFLOWSOLVER).Set(iPoint,iTEMP,T) + # get solution index for energy equation + iEnergy = solindex.get("ENERGY") + # set solution in energy equation + SU2Driver.Solution(iFLOWSOLVER).Set(iPoint,iEnergy,T) # ################################################################## #