Skip to content

Commit b1499dd

Browse files
committed
Output solution for the heat solver in CElasticityOutput
1 parent 60d7b6c commit b1499dd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

SU2_CFD/include/output/CElasticityOutput.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
class CElasticityOutput final: public COutput {
3838
protected:
3939

40+
const CSolver *heat_solver = nullptr; //!< Pointer to the heat solver
4041
unsigned short nVar_FEM; //!< Number of FEM variables
4142
bool linear_analysis, //!< Boolean indicating a linear analysis
4243
nonlinear_analysis, //!< Boolean indicating a nonlinear analysis
@@ -84,4 +85,12 @@ class CElasticityOutput final: public COutput {
8485
*/
8586
bool SetInitResiduals(const CConfig *config) override ;
8687

88+
/*!
89+
* \brief Set the heat solver pointer for output integration.
90+
* \param[in] solver - Pointer to the heat solver.
91+
*/
92+
void SetHeatSolver(const CSolver *solver) {
93+
heat_solver = solver;
94+
}
95+
8796
};

SU2_CFD/src/output/CElasticityOutput.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS
152152
/*--- Keep this as last, since it uses the history values that were set. ---*/
153153
SetCustomAndComboObjectives(FEA_SOL, config, solver);
154154

155+
/*--- Add heat solver data if available ---*/
156+
if (heat_solver) {
157+
SetHistoryOutputValue("RMS_TEMPERATURE", log10(heat_solver->GetRes_RMS(0)));
158+
SetHistoryOutputValue("MAX_TEMPERATURE", log10(heat_solver->GetRes_Max(0)));
159+
SetHistoryOutputValue("AVG_TEMPERATURE", heat_solver->GetTotal_AvgTemperature());
160+
SetHistoryOutputValue("TOTAL_HEATFLUX", heat_solver->GetTotal_HeatFlux());
161+
SetHistoryOutputValue("MAXIMUM_HEATFLUX", heat_solver->GetTotal_MaxHeatFlux());
162+
}
163+
155164
}
156165

157166
void CElasticityOutput::SetHistoryOutputFields(CConfig *config) {
@@ -189,6 +198,12 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config) {
189198
}
190199
AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT);
191200

201+
AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root mean square residual of the temperature", HistoryFieldType::RESIDUAL);
202+
AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature", HistoryFieldType::RESIDUAL);
203+
AddHistoryOutput("AVG_TEMPERATURE", "avg[T]", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Average temperature on all surfaces", HistoryFieldType::COEFFICIENT);
204+
AddHistoryOutput("TOTAL_HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heat flux on all surfaces", HistoryFieldType::COEFFICIENT);
205+
AddHistoryOutput("MAXIMUM_HEATFLUX", "MaxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Maximum heat flux on all surfaces", HistoryFieldType::COEFFICIENT);
206+
192207
}
193208

194209
void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
@@ -228,6 +243,13 @@ void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo
228243
if (config->GetTopology_Optimization()) {
229244
SetVolumeOutputValue("TOPOL_DENSITY", iPoint, Node_Struc->GetAuxVar(iPoint));
230245
}
246+
247+
if (heat_solver) {
248+
const auto Node_Heat = heat_solver->GetNodes();
249+
SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0));
250+
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, heat_solver->LinSysRes(iPoint, 0));
251+
}
252+
231253
}
232254

233255
void CElasticityOutput::SetVolumeOutputFields(CConfig *config){
@@ -267,6 +289,10 @@ void CElasticityOutput::SetVolumeOutputFields(CConfig *config){
267289
if (config->GetTopology_Optimization()) {
268290
AddVolumeOutput("TOPOL_DENSITY", "Topology_Density", "TOPOLOGY", "filtered topology density");
269291
}
292+
293+
AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature");
294+
AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature");
295+
270296
}
271297

272298
bool CElasticityOutput::SetInitResiduals(const CConfig *config){

0 commit comments

Comments
 (0)