From dc5680c4f13e0ba86753894855cd5088a42b9a5a Mon Sep 17 00:00:00 2001 From: Pragyaan Gaur Date: Sun, 29 Nov 2026 20:36:26 +0530 Subject: [PATCH 1/6] Add the P1 radiative wall heat flux to TOTAL_HEATFLUX With RADIATION_MODEL= P1, TOTAL_HEATFLUX and TOTAL_HEATFLUX_ON_SURFACE only held the conductive heat flux, so the energy balance of a case with radiation did not close. CRadP1Solver now integrates the Marshak wall flux Theta*(G - 4*sigma*Tw^4) over the monitored isothermal and heat flux walls, and the incompressible output adds it to both fields. The p1rad reference values change only in the heat flux, and a regression test for the P1 radiation tutorial is added to tutorials.py. --- SU2_CFD/include/output/CFlowOutput.hpp | 3 +- SU2_CFD/include/solvers/CRadP1Solver.hpp | 23 ++++++++++ SU2_CFD/include/solvers/CSolver.hpp | 13 ++++++ SU2_CFD/src/output/CFlowIncOutput.cpp | 2 +- SU2_CFD/src/output/CFlowOutput.cpp | 10 +++-- SU2_CFD/src/solvers/CRadP1Solver.cpp | 57 ++++++++++++++++++++++++ TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- TestCases/tutorials.py | 9 ++++ 9 files changed, 114 insertions(+), 7 deletions(-) diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index 623938c65c2e..6e96b93179ea 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -201,8 +201,9 @@ class CFlowOutput : public CFVMOutput{ * \brief Set the value of the heat flux coefficients * \param[in] config - Definition of the particular problem. * \param[in] flow_solver - The container holding all solution data. + * \param[in] rad_solver - Radiation solver, whose wall heat flux is added when it is given. */ - void SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver); + void SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver, const CSolver* rad_solver = nullptr); /*! * \brief Add rotating frame coefficients as output fields. diff --git a/SU2_CFD/include/solvers/CRadP1Solver.hpp b/SU2_CFD/include/solvers/CRadP1Solver.hpp index 00325b90cfe7..f37f955e3ef7 100644 --- a/SU2_CFD/include/solvers/CRadP1Solver.hpp +++ b/SU2_CFD/include/solvers/CRadP1Solver.hpp @@ -35,6 +35,18 @@ class CRadP1Solver final: public CRadSolver { protected: su2double Temperature_Inf; /*!< \brief Temperature at the infinity. */ + vector Surface_HF_Rad; /*!< \brief Radiative heat flux into each monitored wall. */ + su2double Total_HF_Rad = 0.0; /*!< \brief Radiative heat flux into all the monitored walls. */ + + /*! + * \brief Integrate the radiative heat flux into the monitored walls. + * \note The flux follows from the Marshak condition, Theta*(G - 4*sigma*T_w^4), and is positive + * when the wall absorbs heat, as for the conductive heat flux of the flow solver. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + */ + void ComputeWallHeatFlux(const CGeometry *geometry, CSolver **solver_container, const CConfig *config); /*! * \brief Impose the Marshak boundary condition. @@ -256,4 +268,15 @@ class CRadP1Solver final: public CRadSolver { */ inline su2double GetTemperature_Inf(void) const { return Temperature_Inf; } + /*! + * \brief Get the radiative heat flux into all the monitored walls. + */ + inline su2double GetTotal_HeatFlux_Rad() const override { return Total_HF_Rad; } + + /*! + * \brief Get the radiative heat flux into one monitored wall. + * \param[in] val_marker - Index of the monitoring marker. + */ + inline su2double GetSurface_HF_Rad(unsigned short val_marker) const override { return Surface_HF_Rad[val_marker]; } + }; diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 1e5c0376f267..063999476450 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -2375,6 +2375,19 @@ class CSolver { */ inline virtual su2double GetTotal_HeatFlux() const { return 0; } + /*! + * \brief Get the radiative heat flux into all the monitored walls. + * \return Radiative heat flux, zero for solvers without a radiation model. + */ + inline virtual su2double GetTotal_HeatFlux_Rad() const { return 0; } + + /*! + * \brief Get the radiative heat flux into one monitored wall. + * \param[in] val_marker - Index of the monitoring marker. + * \return Radiative heat flux, zero for solvers without a radiation model. + */ + inline virtual su2double GetSurface_HF_Rad(unsigned short val_marker) const { return 0; } + /*! * \brief A virtual member. * \return Value of the heat load (integrated heat flux). diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 834394a86891..7838caaf8f66 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -261,7 +261,7 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv if (multiZone) SetHistoryOutputValue("BGS_TEMPERATURE", log10(heat_solver->GetRes_BGS(0))); } if (heat) { - SetHeatCoefficients(config, flow_solver); + SetHeatCoefficients(config, flow_solver, config->AddRadiation() ? rad_solver : nullptr); SetHistoryOutputValue("AVG_TEMPERATURE", flow_solver->GetTotal_AvgTemperature()); SetHistoryOutputValue("RMS_ENTHALPY", log10(flow_solver->GetRes_RMS(nDim + 1))); SetHistoryOutputValue("MAX_ENTHALPY", log10(flow_solver->GetRes_Max(nDim + 1))); diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 9684325a94d4..a79c1d86f287 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1961,15 +1961,19 @@ for (auto iMarker = 0u; iMarker < config->GetnMarker_Monitoring(); iMarker++) { /// END_GROUP } -void CFlowOutput::SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver) { +void CFlowOutput::SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver, const CSolver* rad_solver) { if (!config->GetViscous()) return; - SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux()); + /*--- With a radiation model, the walls also absorb a radiative heat flux. ---*/ + const su2double Total_HF_Rad = (rad_solver != nullptr) ? rad_solver->GetTotal_HeatFlux_Rad() : 0.0; + + SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux() + Total_HF_Rad); SetHistoryOutputValue("MAXIMUM_HEATFLUX", flow_solver->GetTotal_MaxHeatFlux()); for (auto iMarker = 0u; iMarker < config->GetnMarker_Monitoring(); iMarker++) { - SetHistoryOutputPerSurfaceValue("TOTAL_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_HF_Visc(iMarker), iMarker); + const su2double Surface_HF_Rad = (rad_solver != nullptr) ? rad_solver->GetSurface_HF_Rad(iMarker) : 0.0; + SetHistoryOutputPerSurfaceValue("TOTAL_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_HF_Visc(iMarker) + Surface_HF_Rad, iMarker); SetHistoryOutputPerSurfaceValue("MAXIMUM_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_MaxHF_Visc(iMarker), iMarker); } } diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp index 7920145c335c..7fded1092cd4 100644 --- a/SU2_CFD/src/solvers/CRadP1Solver.cpp +++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp @@ -125,6 +125,8 @@ CRadP1Solver::CRadP1Solver(CGeometry* geometry, CConfig *config) : CRadSolver(ge SetBaseClassPointerToNodes(); SolverName = "RAD"; + + Surface_HF_Rad.resize(config->GetnMarker_Monitoring(), 0.0); } CRadP1Solver::~CRadP1Solver() { @@ -185,6 +187,61 @@ void CRadP1Solver::Postprocessing(CGeometry *geometry, CSolver **solver_containe } + ComputeWallHeatFlux(geometry, solver_container, config); + +} + +void CRadP1Solver::ComputeWallHeatFlux(const CGeometry *geometry, CSolver **solver_container, const CConfig *config) { + SU2_ZONE_SCOPED + + const auto nMarker_Monitoring = config->GetnMarker_Monitoring(); + for (auto& hf : Surface_HF_Rad) hf = 0.0; + + for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { + + if (config->GetMarker_All_Monitoring(iMarker) != YES) continue; + + const auto KindBC = config->GetMarker_All_KindBC(iMarker); + if (KindBC != BC_TYPE::ISOTHERMAL && KindBC != BC_TYPE::HEAT_FLUX) continue; + + const string Marker_Tag = config->GetMarker_All_TagBound(iMarker); + + unsigned short iMarker_Monitoring = 0; + while (iMarker_Monitoring < nMarker_Monitoring && + config->GetMarker_Monitoring_TagBound(iMarker_Monitoring) != Marker_Tag) { + iMarker_Monitoring++; + } + if (iMarker_Monitoring == nMarker_Monitoring) continue; + + /*--- Same wall constant and wall temperature as in BC_Isothermal_Wall and BC_Marshak. ---*/ + const su2double Wall_Emissivity = config->GetWall_Emissivity(Marker_Tag); + const su2double Theta = Wall_Emissivity / (2.0*(2.0 - Wall_Emissivity)); + const bool isothermal = (KindBC == BC_TYPE::ISOTHERMAL); + const su2double Twall_iso = isothermal ? config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref() : 0.0; + + su2double HF_Local = 0.0; + for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) { + const auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + if (!geometry->nodes->GetDomain(iPoint)) continue; + + const su2double Area = GeometryToolbox::Norm(nDim, geometry->vertex[iMarker][iVertex]->GetNormal()); + const su2double Twall = isothermal ? Twall_iso : solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); + const su2double Ib_w = 4.0*STEFAN_BOLTZMANN*pow(Twall, 4.0); + + HF_Local += Theta*(nodes->GetSolution(iPoint, 0) - Ib_w)*Area; + } + Surface_HF_Rad[iMarker_Monitoring] += HF_Local; + } + + if (nMarker_Monitoring > 0) { + vector Surface_HF_Rad_Local = Surface_HF_Rad; + SU2_MPI::Allreduce(Surface_HF_Rad_Local.data(), Surface_HF_Rad.data(), nMarker_Monitoring, MPI_DOUBLE, MPI_SUM, + SU2_MPI::GetComm()); + } + + Total_HF_Rad = 0.0; + for (const auto hf : Surface_HF_Rad) Total_HF_Rad += hf; + } void CRadP1Solver::Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index b58c4d7e2199..5834e73c5113 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1679,7 +1679,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 50 - p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -57.186000] + p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3197.600000] test_list.append(p1rad) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 500d24109c62..833ae3d09067 100755 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1260,7 +1260,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 50 - p1rad.test_vals = [-8.284673, -8.008659, -2.424204, 0.389030, -56.560000] + p1rad.test_vals = [-8.284673, -8.008659, -2.424204, 0.389030, -3178.600000] test_list.append(p1rad) # ############################### diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index e34b59eabbed..8d261a38e76a 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -384,6 +384,15 @@ def main(): pywrapper_psi_quench.command = TestCase.Command("mpirun -np 2", "python", "run.py") test_list.append(pywrapper_psi_quench) + # custom source: volumetric heat source with the P1 radiation model + pywrapper_p1_cavity = TestCase('p1_radiation_python') + pywrapper_p1_cavity.cfg_dir = "../Tutorials/multiphysics/P1_radiation_python" + pywrapper_p1_cavity.cfg_file = "cavity.cfg" + pywrapper_p1_cavity.test_iter = 20 + pywrapper_p1_cavity.test_vals = [-7.710578, -8.043164, -7.883466, -2.603692, -3.354051, 9.082900] + pywrapper_p1_cavity.command = TestCase.Command("mpirun -np 2", "python", "run.py") + test_list.append(pywrapper_p1_cavity) + ###################################### ### RUN TESTS ### From 6e249562df4a91123a8ccad556ba589aac0f81d9 Mon Sep 17 00:00:00 2001 From: Pragyaan Gaur Date: Sun, 29 Nov 2026 21:00:36 +0530 Subject: [PATCH 2/6] Avoid the ternary operator with AD types in the radiative wall heat flux The conditional operator mixed an AD expression with a double, which does not compile in the forward and reverse mode builds. --- SU2_CFD/src/output/CFlowOutput.cpp | 6 ++++-- SU2_CFD/src/solvers/CRadP1Solver.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index a79c1d86f287..70c9a4041a1f 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1966,13 +1966,15 @@ void CFlowOutput::SetHeatCoefficients(const CConfig* config, const CSolver* flow if (!config->GetViscous()) return; /*--- With a radiation model, the walls also absorb a radiative heat flux. ---*/ - const su2double Total_HF_Rad = (rad_solver != nullptr) ? rad_solver->GetTotal_HeatFlux_Rad() : 0.0; + su2double Total_HF_Rad = 0.0; + if (rad_solver != nullptr) Total_HF_Rad = rad_solver->GetTotal_HeatFlux_Rad(); SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux() + Total_HF_Rad); SetHistoryOutputValue("MAXIMUM_HEATFLUX", flow_solver->GetTotal_MaxHeatFlux()); for (auto iMarker = 0u; iMarker < config->GetnMarker_Monitoring(); iMarker++) { - const su2double Surface_HF_Rad = (rad_solver != nullptr) ? rad_solver->GetSurface_HF_Rad(iMarker) : 0.0; + su2double Surface_HF_Rad = 0.0; + if (rad_solver != nullptr) Surface_HF_Rad = rad_solver->GetSurface_HF_Rad(iMarker); SetHistoryOutputPerSurfaceValue("TOTAL_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_HF_Visc(iMarker) + Surface_HF_Rad, iMarker); SetHistoryOutputPerSurfaceValue("MAXIMUM_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_MaxHF_Visc(iMarker), iMarker); } diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp index 7fded1092cd4..095920750adb 100644 --- a/SU2_CFD/src/solvers/CRadP1Solver.cpp +++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp @@ -217,7 +217,8 @@ void CRadP1Solver::ComputeWallHeatFlux(const CGeometry *geometry, CSolver **solv const su2double Wall_Emissivity = config->GetWall_Emissivity(Marker_Tag); const su2double Theta = Wall_Emissivity / (2.0*(2.0 - Wall_Emissivity)); const bool isothermal = (KindBC == BC_TYPE::ISOTHERMAL); - const su2double Twall_iso = isothermal ? config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref() : 0.0; + su2double Twall_iso = 0.0; + if (isothermal) Twall_iso = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref(); su2double HF_Local = 0.0; for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) { @@ -225,7 +226,8 @@ void CRadP1Solver::ComputeWallHeatFlux(const CGeometry *geometry, CSolver **solv if (!geometry->nodes->GetDomain(iPoint)) continue; const su2double Area = GeometryToolbox::Norm(nDim, geometry->vertex[iMarker][iVertex]->GetNormal()); - const su2double Twall = isothermal ? Twall_iso : solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); + su2double Twall = Twall_iso; + if (!isothermal) Twall = solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); const su2double Ib_w = 4.0*STEFAN_BOLTZMANN*pow(Twall, 4.0); HF_Local += Theta*(nodes->GetSolution(iPoint, 0) - Ib_w)*Area; From 0e194fb07259dac0f8e840a15243449bad83e91a Mon Sep 17 00:00:00 2001 From: Pragyaan Gaur Date: Sun, 29 Nov 2026 22:05:45 +0530 Subject: [PATCH 3/6] Update the parallel p1rad heat flux to the CI value --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 5834e73c5113..0119b4a945de 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1679,7 +1679,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 50 - p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3197.600000] + p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3199.900000] test_list.append(p1rad) From 7d970495e0ac552a14446fa7cafa8e9276cae16d Mon Sep 17 00:00:00 2001 From: Pragyaan Gaur Date: Sat, 5 Dec 2026 19:37:31 +0530 Subject: [PATCH 4/6] Add the P1 radiative flux to the wall heat flux of the flow solver The radiative wall flux is now added to HeatFlux in Friction_Forces, so TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, the per-surface values, the surface HEAT_FLUX field and the heat flux objective function all include it, with the same treatment as the conductive flux. It is computed from the current incident radiation on isothermal, heat flux and CHT walls, with the wall temperature that the P1 boundary conditions use. Radiation now requires INC_NONDIM= DIMENSIONAL, since the P1 model uses the dimensional Stefan-Boltzmann constant with the solver temperature. --- Common/src/CConfig.cpp | 5 ++ SU2_CFD/include/output/CFlowOutput.hpp | 3 +- .../include/solvers/CFVMFlowSolverBase.hpp | 1 + .../include/solvers/CFVMFlowSolverBase.inl | 16 +++++ SU2_CFD/include/solvers/CRadP1Solver.hpp | 29 +++------ SU2_CFD/include/solvers/CSolver.hpp | 18 +++--- SU2_CFD/src/output/CFlowIncOutput.cpp | 2 +- SU2_CFD/src/output/CFlowOutput.cpp | 16 ++--- SU2_CFD/src/solvers/CIncEulerSolver.cpp | 4 ++ SU2_CFD/src/solvers/CRadP1Solver.cpp | 59 ------------------- TestCases/tutorials.py | 2 +- 11 files changed, 51 insertions(+), 104 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index a3f397f4d2e9..5f2c6623a4a5 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -4381,6 +4381,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i Radiation = (Kind_Radiation != RADIATION_MODEL::NONE); + /*--- The P1 model uses the dimensional Stefan-Boltzmann constant with the solver temperature. ---*/ + if (Radiation && Ref_Inc_NonDim != DIMENSIONAL) { + SU2_MPI::Error("RADIATION_MODEL requires INC_NONDIM= DIMENSIONAL.", CURRENT_FUNCTION); + } + /*--- Check for unsupported features. ---*/ if ((Kind_Solver != MAIN_SOLVER::EULER && Kind_Solver != MAIN_SOLVER::NAVIER_STOKES && Kind_Solver != MAIN_SOLVER::RANS) && (TimeMarching == TIME_MARCHING::HARMONIC_BALANCE)){ diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index 6e96b93179ea..623938c65c2e 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -201,9 +201,8 @@ class CFlowOutput : public CFVMOutput{ * \brief Set the value of the heat flux coefficients * \param[in] config - Definition of the particular problem. * \param[in] flow_solver - The container holding all solution data. - * \param[in] rad_solver - Radiation solver, whose wall heat flux is added when it is given. */ - void SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver, const CSolver* rad_solver = nullptr); + void SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver); /*! * \brief Add rotating frame coefficients as output fields. diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 8725ea512a07..6be38d3745ac 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -173,6 +173,7 @@ class CFVMFlowSolverBase : public CSolver { vector Surface_HF_Visc; /*!< \brief Total (integrated) heat flux for each monitored surface. */ vector Surface_MaxHF_Visc; /*!< \brief Maximum heat flux for each monitored surface. */ vector HF_Visc; /*!< \brief Heat load (viscous contribution) for each boundary. */ + const CSolver* RadSolver = nullptr; /*!< \brief Radiation solver, whose wall heat flux is added to HeatFlux. */ vector MaxHF_Visc; /*!< \brief Maximum heat flux (viscous contribution) for each boundary. */ su2double AllBound_HF_Visc = 0.0; /*!< \brief Heat load (viscous contribution) for all the boundaries. */ su2double AllBound_MaxHF_Visc = 0.0; /*!< \brief Maximum heat flux (viscous contribution) for all boundaries. */ diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 223ed13763b8..cbab8dd56de7 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -2683,6 +2683,16 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr } const bool catalytic = nemo && config->GetCatalytic_Wall(iMarker); + /*--- With a radiation model, walls also absorb the radiative heat flux of the Marshak condition. + * The wall temperature is the one the radiation solver uses in its boundary conditions. ---*/ + const bool radiative_wall = (RadSolver != nullptr) && (KindBC == BC_TYPE::ISOTHERMAL || + KindBC == BC_TYPE::HEAT_FLUX || KindBC == BC_TYPE::CHT_WALL_INTERFACE); + su2double Emissivity = 0.0, Twall_Rad = 0.0; + if (radiative_wall) { + Emissivity = config->GetWall_Emissivity(Marker_Tag); + if (KindBC == BC_TYPE::ISOTHERMAL) Twall_Rad = config->GetIsothermal_Temperature(Marker_Tag) / RefTemperature; + } + /*--- Loop over the vertices to compute the forces (work-shared across threads, see * Pressure_Forces for why the chunk size is computed and the barrier skipped). ---*/ @@ -2793,6 +2803,12 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr if (FlowRegime == ENUM_REGIME::INCOMPRESSIBLE && !energy) dTdn = 0.0; HeatFlux[iMarker][iVertex] = thermal_conductivity * dTdn * RefHeatFlux; } + + if (radiative_wall) { + su2double Twall_local = Twall_Rad; + if (KindBC != BC_TYPE::ISOTHERMAL) Twall_local = nodes->GetTemperature(iPoint); + HeatFlux[iMarker][iVertex] += RadSolver->GetWallHeatFlux_Rad(iPoint, Emissivity, Twall_local); + } } else { const auto& thermal_conductivity_tr = nodes->GetThermalConductivity(iPoint); diff --git a/SU2_CFD/include/solvers/CRadP1Solver.hpp b/SU2_CFD/include/solvers/CRadP1Solver.hpp index f37f955e3ef7..99079a12a36f 100644 --- a/SU2_CFD/include/solvers/CRadP1Solver.hpp +++ b/SU2_CFD/include/solvers/CRadP1Solver.hpp @@ -35,18 +35,6 @@ class CRadP1Solver final: public CRadSolver { protected: su2double Temperature_Inf; /*!< \brief Temperature at the infinity. */ - vector Surface_HF_Rad; /*!< \brief Radiative heat flux into each monitored wall. */ - su2double Total_HF_Rad = 0.0; /*!< \brief Radiative heat flux into all the monitored walls. */ - - /*! - * \brief Integrate the radiative heat flux into the monitored walls. - * \note The flux follows from the Marshak condition, Theta*(G - 4*sigma*T_w^4), and is positive - * when the wall absorbs heat, as for the conductive heat flux of the flow solver. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - */ - void ComputeWallHeatFlux(const CGeometry *geometry, CSolver **solver_container, const CConfig *config); /*! * \brief Impose the Marshak boundary condition. @@ -269,14 +257,15 @@ class CRadP1Solver final: public CRadSolver { inline su2double GetTemperature_Inf(void) const { return Temperature_Inf; } /*! - * \brief Get the radiative heat flux into all the monitored walls. + * \brief Marshak radiative heat flux into a wall, Theta*(G - 4*sigma*T_w^4). + * \note Positive when the wall absorbs heat. + * \param[in] iPoint - Point on the wall. + * \param[in] emissivity - Emissivity of the wall. + * \param[in] Twall - Temperature of the wall. */ - inline su2double GetTotal_HeatFlux_Rad() const override { return Total_HF_Rad; } - - /*! - * \brief Get the radiative heat flux into one monitored wall. - * \param[in] val_marker - Index of the monitoring marker. - */ - inline su2double GetSurface_HF_Rad(unsigned short val_marker) const override { return Surface_HF_Rad[val_marker]; } + inline su2double GetWallHeatFlux_Rad(unsigned long iPoint, su2double emissivity, su2double Twall) const override { + const su2double Theta = emissivity / (2.0 * (2.0 - emissivity)); + return Theta * (nodes->GetSolution(iPoint, 0) - 4.0 * STEFAN_BOLTZMANN * pow(Twall, 4.0)); + } }; diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 2c9ee67c64f6..e2d3fcc76fcd 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -2415,17 +2415,15 @@ class CSolver { inline virtual su2double GetTotal_HeatFlux() const { return 0; } /*! - * \brief Get the radiative heat flux into all the monitored walls. - * \return Radiative heat flux, zero for solvers without a radiation model. + * \brief Get the radiative heat flux into a wall at a point, from the Marshak condition. + * \param[in] iPoint - Point on the wall. + * \param[in] emissivity - Emissivity of the wall. + * \param[in] Twall - Temperature of the wall. + * \return Heat flux, positive when the wall absorbs heat. Zero for solvers without radiation. */ - inline virtual su2double GetTotal_HeatFlux_Rad() const { return 0; } - - /*! - * \brief Get the radiative heat flux into one monitored wall. - * \param[in] val_marker - Index of the monitoring marker. - * \return Radiative heat flux, zero for solvers without a radiation model. - */ - inline virtual su2double GetSurface_HF_Rad(unsigned short val_marker) const { return 0; } + inline virtual su2double GetWallHeatFlux_Rad(unsigned long iPoint, su2double emissivity, su2double Twall) const { + return 0; + } /*! * \brief A virtual member. diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 7838caaf8f66..834394a86891 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -261,7 +261,7 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv if (multiZone) SetHistoryOutputValue("BGS_TEMPERATURE", log10(heat_solver->GetRes_BGS(0))); } if (heat) { - SetHeatCoefficients(config, flow_solver, config->AddRadiation() ? rad_solver : nullptr); + SetHeatCoefficients(config, flow_solver); SetHistoryOutputValue("AVG_TEMPERATURE", flow_solver->GetTotal_AvgTemperature()); SetHistoryOutputValue("RMS_ENTHALPY", log10(flow_solver->GetRes_RMS(nDim + 1))); SetHistoryOutputValue("MAX_ENTHALPY", log10(flow_solver->GetRes_Max(nDim + 1))); diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 70c9a4041a1f..66a9c4a6ce85 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1945,9 +1945,9 @@ void CFlowOutput::AddHeatCoefficients(const CConfig* config) { /// BEGIN_GROUP: HEAT, DESCRIPTION: Heat coefficients on all surfaces set with MARKER_MONITORING. /// DESCRIPTION: Total heatflux - AddHistoryOutput("TOTAL_HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heatflux on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("TOTAL_HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heatflux on all surfaces set with MARKER_MONITORING, including radiation if a RADIATION_MODEL is used.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Maximal heatflux - AddHistoryOutput("MAXIMUM_HEATFLUX", "maxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Maximum heatflux across all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("MAXIMUM_HEATFLUX", "maxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Maximum heatflux across all surfaces set with MARKER_MONITORING, including radiation if a RADIATION_MODEL is used.", HistoryFieldType::COEFFICIENT); vector Marker_Monitoring; Marker_Monitoring.reserve(config->GetnMarker_Monitoring()); @@ -1961,21 +1961,15 @@ for (auto iMarker = 0u; iMarker < config->GetnMarker_Monitoring(); iMarker++) { /// END_GROUP } -void CFlowOutput::SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver, const CSolver* rad_solver) { +void CFlowOutput::SetHeatCoefficients(const CConfig* config, const CSolver* flow_solver) { if (!config->GetViscous()) return; - /*--- With a radiation model, the walls also absorb a radiative heat flux. ---*/ - su2double Total_HF_Rad = 0.0; - if (rad_solver != nullptr) Total_HF_Rad = rad_solver->GetTotal_HeatFlux_Rad(); - - SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux() + Total_HF_Rad); + SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux()); SetHistoryOutputValue("MAXIMUM_HEATFLUX", flow_solver->GetTotal_MaxHeatFlux()); for (auto iMarker = 0u; iMarker < config->GetnMarker_Monitoring(); iMarker++) { - su2double Surface_HF_Rad = 0.0; - if (rad_solver != nullptr) Surface_HF_Rad = rad_solver->GetSurface_HF_Rad(iMarker); - SetHistoryOutputPerSurfaceValue("TOTAL_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_HF_Visc(iMarker) + Surface_HF_Rad, iMarker); + SetHistoryOutputPerSurfaceValue("TOTAL_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_HF_Visc(iMarker), iMarker); SetHistoryOutputPerSurfaceValue("MAXIMUM_HEATFLUX_ON_SURFACE", flow_solver->GetSurface_MaxHF_Visc(iMarker), iMarker); } } diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index 046d4bc4037b..6c1431250dd3 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1042,6 +1042,10 @@ void CIncEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_ unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { SU2_ZONE_SCOPED + /*--- The wall heat flux of Friction_Forces includes the radiative heat flux. ---*/ + + if (iMesh == MESH_0 && config->AddRadiation()) RadSolver = solver_container[RAD_SOL]; + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED); const bool center_jst = (config->GetKind_Centered_Flow() == CENTERED::JST || config->GetKind_Centered_Flow() == CENTERED::LD2) && (iMesh == MESH_0); diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp index 095920750adb..7920145c335c 100644 --- a/SU2_CFD/src/solvers/CRadP1Solver.cpp +++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp @@ -125,8 +125,6 @@ CRadP1Solver::CRadP1Solver(CGeometry* geometry, CConfig *config) : CRadSolver(ge SetBaseClassPointerToNodes(); SolverName = "RAD"; - - Surface_HF_Rad.resize(config->GetnMarker_Monitoring(), 0.0); } CRadP1Solver::~CRadP1Solver() { @@ -187,63 +185,6 @@ void CRadP1Solver::Postprocessing(CGeometry *geometry, CSolver **solver_containe } - ComputeWallHeatFlux(geometry, solver_container, config); - -} - -void CRadP1Solver::ComputeWallHeatFlux(const CGeometry *geometry, CSolver **solver_container, const CConfig *config) { - SU2_ZONE_SCOPED - - const auto nMarker_Monitoring = config->GetnMarker_Monitoring(); - for (auto& hf : Surface_HF_Rad) hf = 0.0; - - for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { - - if (config->GetMarker_All_Monitoring(iMarker) != YES) continue; - - const auto KindBC = config->GetMarker_All_KindBC(iMarker); - if (KindBC != BC_TYPE::ISOTHERMAL && KindBC != BC_TYPE::HEAT_FLUX) continue; - - const string Marker_Tag = config->GetMarker_All_TagBound(iMarker); - - unsigned short iMarker_Monitoring = 0; - while (iMarker_Monitoring < nMarker_Monitoring && - config->GetMarker_Monitoring_TagBound(iMarker_Monitoring) != Marker_Tag) { - iMarker_Monitoring++; - } - if (iMarker_Monitoring == nMarker_Monitoring) continue; - - /*--- Same wall constant and wall temperature as in BC_Isothermal_Wall and BC_Marshak. ---*/ - const su2double Wall_Emissivity = config->GetWall_Emissivity(Marker_Tag); - const su2double Theta = Wall_Emissivity / (2.0*(2.0 - Wall_Emissivity)); - const bool isothermal = (KindBC == BC_TYPE::ISOTHERMAL); - su2double Twall_iso = 0.0; - if (isothermal) Twall_iso = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref(); - - su2double HF_Local = 0.0; - for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) { - const auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - if (!geometry->nodes->GetDomain(iPoint)) continue; - - const su2double Area = GeometryToolbox::Norm(nDim, geometry->vertex[iMarker][iVertex]->GetNormal()); - su2double Twall = Twall_iso; - if (!isothermal) Twall = solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); - const su2double Ib_w = 4.0*STEFAN_BOLTZMANN*pow(Twall, 4.0); - - HF_Local += Theta*(nodes->GetSolution(iPoint, 0) - Ib_w)*Area; - } - Surface_HF_Rad[iMarker_Monitoring] += HF_Local; - } - - if (nMarker_Monitoring > 0) { - vector Surface_HF_Rad_Local = Surface_HF_Rad; - SU2_MPI::Allreduce(Surface_HF_Rad_Local.data(), Surface_HF_Rad.data(), nMarker_Monitoring, MPI_DOUBLE, MPI_SUM, - SU2_MPI::GetComm()); - } - - Total_HF_Rad = 0.0; - for (const auto hf : Surface_HF_Rad) Total_HF_Rad += hf; - } void CRadP1Solver::Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 46bfd75615ef..7eac2145cc41 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -389,7 +389,7 @@ def main(): pywrapper_p1_cavity.cfg_dir = "../Tutorials/multiphysics/P1_radiation_python" pywrapper_p1_cavity.cfg_file = "cavity.cfg" pywrapper_p1_cavity.test_iter = 20 - pywrapper_p1_cavity.test_vals = [-7.710578, -8.043164, -7.883466, -2.603692, -3.354051, 9.082900] + pywrapper_p1_cavity.test_vals = [-7.710578, -8.043164, -7.883466, -2.603692, -3.354051, 9.082500] pywrapper_p1_cavity.command = TestCase.Command("mpirun -np 2", "python", "run.py") test_list.append(pywrapper_p1_cavity) From 511e81f4ba938c0428bc5cb7ba74216168a0947b Mon Sep 17 00:00:00 2001 From: Pragyaan Gaur Date: Sat, 5 Dec 2026 19:37:41 +0530 Subject: [PATCH 5/6] Update the p1rad heat flux for the radiative flux at the current iteration --- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index fbce4d7eadfd..e46c0b37d8af 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1703,7 +1703,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 50 - p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3199.900000] + p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3211.800000] test_list.append(p1rad) diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index fe6a249520f7..d73174633969 100755 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1268,7 +1268,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 50 - p1rad.test_vals = [-8.284673, -8.008659, -2.424204, 0.389030, -3178.600000] + p1rad.test_vals = [-8.284673, -8.008659, -2.424204, 0.389030, -3190.600000] test_list.append(p1rad) # ############################### From 7f12258b098876f8acb5002661cc7f6bab9c1459 Mon Sep 17 00:00:00 2001 From: Pragyaan Gaur Date: Sat, 5 Dec 2026 20:24:37 +0530 Subject: [PATCH 6/6] Use the CI values for the p1rad and P1 tutorial regression tests --- TestCases/parallel_regression.py | 2 +- TestCases/tutorials.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index e46c0b37d8af..22005c0eaedd 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1703,7 +1703,7 @@ def main(): p1rad.cfg_dir = "radiation/p1model" p1rad.cfg_file = "configp1.cfg" p1rad.test_iter = 50 - p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3211.800000] + p1rad.test_vals = [-8.197112, -7.856394, -2.380743, 0.381122, -3211.700000] test_list.append(p1rad) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 7eac2145cc41..94c61ff918ed 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -389,7 +389,8 @@ def main(): pywrapper_p1_cavity.cfg_dir = "../Tutorials/multiphysics/P1_radiation_python" pywrapper_p1_cavity.cfg_file = "cavity.cfg" pywrapper_p1_cavity.test_iter = 20 - pywrapper_p1_cavity.test_vals = [-7.710578, -8.043164, -7.883466, -2.603692, -3.354051, 9.082500] + pywrapper_p1_cavity.test_vals = [-7.708332, -8.047920, -7.885417, -2.607572, -3.352777, 9.108100] + pywrapper_p1_cavity.test_vals_aarch64 = [-7.710578, -8.043164, -7.883466, -2.603692, -3.354051, 9.082500] pywrapper_p1_cavity.command = TestCase.Command("mpirun -np 2", "python", "run.py") test_list.append(pywrapper_p1_cavity)