Skip to content

Commit

Permalink
Output solution for the heat solver in CElasticityOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaish-W committed Jan 3, 2025
1 parent 60d7b6c commit b1499dd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
9 changes: 9 additions & 0 deletions SU2_CFD/include/output/CElasticityOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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
Expand Down Expand Up @@ -84,4 +85,12 @@ 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;
}

};
26 changes: 26 additions & 0 deletions SU2_CFD/src/output/CElasticityOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS
/*--- Keep this as last, since it uses the history values that were set. ---*/
SetCustomAndComboObjectives(FEA_SOL, config, solver);

/*--- Add heat solver data if available ---*/
if (heat_solver) {
SetHistoryOutputValue("RMS_TEMPERATURE", log10(heat_solver->GetRes_RMS(0)));
SetHistoryOutputValue("MAX_TEMPERATURE", log10(heat_solver->GetRes_Max(0)));
SetHistoryOutputValue("AVG_TEMPERATURE", heat_solver->GetTotal_AvgTemperature());
SetHistoryOutputValue("TOTAL_HEATFLUX", heat_solver->GetTotal_HeatFlux());
SetHistoryOutputValue("MAXIMUM_HEATFLUX", heat_solver->GetTotal_MaxHeatFlux());
}

}

void CElasticityOutput::SetHistoryOutputFields(CConfig *config) {
Expand Down Expand Up @@ -189,6 +198,12 @@ 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);

}

void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
Expand Down Expand Up @@ -228,6 +243,13 @@ void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo
if (config->GetTopology_Optimization()) {
SetVolumeOutputValue("TOPOL_DENSITY", iPoint, Node_Struc->GetAuxVar(iPoint));
}

if (heat_solver) {
const auto Node_Heat = heat_solver->GetNodes();
SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0));
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, heat_solver->LinSysRes(iPoint, 0));
}

}

void CElasticityOutput::SetVolumeOutputFields(CConfig *config){
Expand Down Expand Up @@ -267,6 +289,10 @@ void CElasticityOutput::SetVolumeOutputFields(CConfig *config){
if (config->GetTopology_Optimization()) {
AddVolumeOutput("TOPOL_DENSITY", "Topology_Density", "TOPOLOGY", "filtered topology density");
}

AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature");
AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature");

}

bool CElasticityOutput::SetInitResiduals(const CConfig *config){
Expand Down

0 comments on commit b1499dd

Please sign in to comment.