From 3c83bbef12b0be43fca0a9d03b3e8902395cf76b Mon Sep 17 00:00:00 2001 From: Vaish-W Date: Fri, 3 Jan 2025 18:30:12 +0100 Subject: [PATCH] Add a check for the heat solver --- SU2_CFD/include/output/CElasticityOutput.hpp | 9 --------- SU2_CFD/src/output/CElasticityOutput.cpp | 20 +++++++++++++------- SU2_CFD/src/solvers/CFEASolver.cpp | 4 ---- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/SU2_CFD/include/output/CElasticityOutput.hpp b/SU2_CFD/include/output/CElasticityOutput.hpp index 199982ff77b..ca65cab7a9c 100644 --- a/SU2_CFD/include/output/CElasticityOutput.hpp +++ b/SU2_CFD/include/output/CElasticityOutput.hpp @@ -37,7 +37,6 @@ class CElasticityOutput final: public COutput { protected: - const CSolver *heat_solver = nullptr; //!< Pointer to the heat solver unsigned short nVar_FEM; //!< Number of FEM variables bool linear_analysis, //!< Boolean indicating a linear analysis nonlinear_analysis, //!< Boolean indicating a nonlinear analysis @@ -85,12 +84,4 @@ class CElasticityOutput final: public COutput { */ bool SetInitResiduals(const CConfig *config) override ; - /*! - * \brief Set the heat solver pointer for output integration. - * \param[in] solver - Pointer to the heat solver. - */ - void SetHeatSolver(const CSolver *solver) { - heat_solver = solver; - } - }; diff --git a/SU2_CFD/src/output/CElasticityOutput.cpp b/SU2_CFD/src/output/CElasticityOutput.cpp index 79ecd22f305..62815f4fcb0 100644 --- a/SU2_CFD/src/output/CElasticityOutput.cpp +++ b/SU2_CFD/src/output/CElasticityOutput.cpp @@ -106,6 +106,7 @@ CElasticityOutput::CElasticityOutput(CConfig *config, unsigned short nDim) : COu void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { CSolver* fea_solver = solver[FEA_SOL]; + CSolver* heat_solver = solver[HEAT_SOL]; /*--- Residuals: ---*/ /*--- Linear analysis: RMS of the displacements in the nDim coordinates ---*/ @@ -198,11 +199,13 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config) { } AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); - AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root mean square residual of the temperature", HistoryFieldType::RESIDUAL); - AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature", HistoryFieldType::RESIDUAL); - AddHistoryOutput("AVG_TEMPERATURE", "avg[T]", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Average temperature on all surfaces", HistoryFieldType::COEFFICIENT); - AddHistoryOutput("TOTAL_HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heat flux on all surfaces", HistoryFieldType::COEFFICIENT); - AddHistoryOutput("MAXIMUM_HEATFLUX", "MaxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Maximum heat flux on all surfaces", HistoryFieldType::COEFFICIENT); + if (config->GetWeakly_Coupled_Heat()) { + AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root mean square residual of the temperature", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature", HistoryFieldType::RESIDUAL); + AddHistoryOutput("AVG_TEMPERATURE", "avg[T]", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Average temperature on all surfaces", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("TOTAL_HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heat flux on all surfaces", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("MAXIMUM_HEATFLUX", "MaxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Maximum heat flux on all surfaces", HistoryFieldType::COEFFICIENT); + } } @@ -244,6 +247,7 @@ void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("TOPOL_DENSITY", iPoint, Node_Struc->GetAuxVar(iPoint)); } + CSolver* heat_solver = solver[HEAT_SOL]; if (heat_solver) { const auto Node_Heat = heat_solver->GetNodes(); SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); @@ -290,8 +294,10 @@ void CElasticityOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("TOPOL_DENSITY", "Topology_Density", "TOPOLOGY", "filtered topology density"); } - AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature"); - AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); + if (config->GetWeakly_Coupled_Heat()) { + AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature"); + AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); + } } diff --git a/SU2_CFD/src/solvers/CFEASolver.cpp b/SU2_CFD/src/solvers/CFEASolver.cpp index 886da26df69..03f2307e5fd 100644 --- a/SU2_CFD/src/solvers/CFEASolver.cpp +++ b/SU2_CFD/src/solvers/CFEASolver.cpp @@ -807,10 +807,6 @@ void CFEASolver::Compute_StiffMatrix_NodalStressRes(CGeometry *geometry, CNumeri if (heat_solver) { const su2double temperature = heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0); fea_elem->SetTemperature(iNode, temperature); - - if (de_effects) { - de_elem->SetTemperature(iNode, temperature); - } } }