Skip to content

Commit

Permalink
Add a check for the heat solver
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaish-W committed Jan 3, 2025
1 parent 0298a31 commit 3c83bbe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
9 changes: 0 additions & 9 deletions SU2_CFD/include/output/CElasticityOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

};
20 changes: 13 additions & 7 deletions SU2_CFD/src/output/CElasticityOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---*/
Expand Down Expand Up @@ -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);
}

}

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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");
}

}

Expand Down
4 changes: 0 additions & 4 deletions SU2_CFD/src/solvers/CFEASolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 3c83bbe

Please sign in to comment.