From 8e9b705b96a7cc7d6e9a2ca69e1b0fa71a9008b0 Mon Sep 17 00:00:00 2001 From: joshkellyjak Date: Thu, 6 Apr 2023 16:21:04 +0100 Subject: [PATCH 01/47] Reimplemented turboperformance calculations --- SU2_CFD/include/output/COutput.hpp | 85 +++++ SU2_CFD/src/drivers/CMultizoneDriver.cpp | 1 + SU2_CFD/src/output/CFlowCompOutput.cpp | 70 +++- SU2_CFD/src/output/COutput.cpp | 434 +++++++++++++++++++++++ 4 files changed, 589 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 70788bf4997..ab7c173d921 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -320,6 +320,62 @@ class COutput { su2double WndCauchy_Value; /*!< \brief Summed value of the convergence indicator. */ bool TimeConvergence; /*!< \brief To indicate, if the windowed time average of the time loop has converged*/ + /*--- Turbomachinery Performance Variable ---*/ + su2double Sum_Total_RadialDistortion, Sum_Total_CircumferentialDistortion; // Add all the distortion to compute a run average. + bool turbo; + unsigned short nSpanWiseSections, nMarkerTurboPerf; + + su2double **TotalStaticEfficiency, + **TotalTotalEfficiency, + **KineticEnergyLoss, + **TRadius, + **TotalPressureLoss, + **MassFlowIn, + **MassFlowOut, + **FlowAngleIn, + **FlowAngleIn_BC, + **FlowAngleOut, + **EulerianWork, + **TotalEnthalpyIn, + **TotalEnthalpyIn_BC, + **EntropyIn, + **EntropyOut, + **EntropyIn_BC, + **PressureRatio, + **TotalTemperatureIn, + **EnthalpyOut, + ***MachIn, + ***MachOut, + **VelocityOutIs, + **DensityIn, + **PressureIn, + ***TurboVelocityIn, + **DensityOut, + **PressureOut, + ***TurboVelocityOut, + **EnthalpyOutIs, + **EntropyGen, + **AbsFlowAngleIn, + **TotalEnthalpyOut, + **RothalpyIn, + **RothalpyOut, + **TotalEnthalpyOutIs, + **AbsFlowAngleOut, + **PressureOut_BC, + **TemperatureIn, + **TemperatureOut, + **TotalPressureIn, + **TotalPressureOut, + **TotalTemperatureOut, + **EnthalpyIn, + **TurbIntensityIn, + **Turb2LamViscRatioIn, + **TurbIntensityOut, + **Turb2LamViscRatioOut, + **NuFactorIn, + **NuFactorOut; + + /*--- End of turbomachinery performance ---*/ public: /*----------------------------- Public member functions ----------------------------*/ @@ -586,6 +642,35 @@ class COutput { */ void WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE format, string fileName = ""); + /* + * \brief Initialize turboperformance variables + * \param[in] config - Definition of the particular problem + */ + void InitTurboPerformance(const CConfig *config); + + /*! + * \brief Compute turboperformance variables + * \param[in] config - Definition of the particular problem. + * \param[in] geometry - Geometrical definition of the problem + * \param[in] solver - The container holding all solution data + */ + void ComputeTurboPerformance(CConfig *config, CGeometry *geometry, CSolver *solver); + + /*! + * \brief Collects Turbomachinery Performance data from the solvers and prints the data in tabular format on screen. + * \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. + * \param[in] TimeIter - Value of the time iteration index + * \param[in] OuterIter - Value of outer iteration index + * \param[in] InnerIter - Value of the inner iteration index + */ + void SetTurboPerformance_Output(CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iZone); + + void SetTurboMultiZonePerformance_Output(CConfig *config); + + void WriteTurboPerfConvHistory(CConfig *config); + protected: /*----------------------------- Protected member functions ----------------------------*/ diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index b29da9b2161..0e2d02a0c65 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -636,6 +636,7 @@ void CMultizoneDriver::SetTurboPerformance() { solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL], donorZone); } + output_container[ZONE_0]->ComputeTurboPerformance(config_container[ZONE_0], geometry_container[ZONE_0][INST_0][MESH_0], solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]); } bool CMultizoneDriver::Monitor(unsigned long TimeIter){ diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 0e8e6b78613..af424a39f7e 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -96,6 +96,11 @@ CFlowCompOutput::CFlowCompOutput(const CConfig *config, unsigned short nDim) : C cauchySerie.resize(convFields.size(), vector(nCauchy_Elems, 0.0)); } } + + if (config->GetBoolTurbomachinery()) { + /*--- Initialise turboperformance variables ---*/ + InitTurboPerformance(config); + } } void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ @@ -207,6 +212,45 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ AddNearfieldInverseDesignOutput(); + /// BEGIN_GROUP: TURBO_PERF, DESCRIPTION: Turboperformance variables + if (config->GetBoolTurbomachinery()) { + unsigned short iMarker_Monitoring; + for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_TurboPerformance(); iMarker_Monitoring++) { + stringstream tag; + tag << iMarker_Monitoring + 1; + /// DESCRIPTION: Total pressure loss + AddHistoryOutput("TotalPressureLoss_" + tag.str(), "TotPressureLoss_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Kinetic energy loss + AddHistoryOutput("KineticEnergyLoss_" + tag.str(), "KineticEnergyLoss_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Entropy generation + AddHistoryOutput("EntropyGeneration_" + tag.str(), "EntropyGen_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Eulerian work + AddHistoryOutput("EulerianWork_" + tag.str(), "EulerianWork_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Pressure ratio + AddHistoryOutput("PressureRatio_" + tag.str(), "PressureRatio_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: FLow angle in + AddHistoryOutput("FlowAngleIn_" + tag.str(), "FlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Flow angle out + AddHistoryOutput("FlowAngleOut_" + tag.str(), "FlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Absolute flow angle in + AddHistoryOutput("AbsFlowAngleIn_" + tag.str(), "AbsFlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Absolute flow angle out + AddHistoryOutput("AbsFlowAngleOut_" + tag.str(), "AbsFlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Mass flow in + AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Mass flow out + AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Mach in + AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Mach out + AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Total efficiency + AddHistoryOutput("TotalEfficiency_" + tag.str(), "TotalEfficiency_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); + /// DESCRIPTION: Total-to-static efficiency + AddHistoryOutput("TotalStaticEfficiency_" + tag.str(), "TotalStaticEfficiency_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + } + } + } void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ @@ -441,12 +485,36 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol if (config->GetEquivArea()) SetNearfieldInverseDesign(flow_solver, geometry, config); + if (config->GetBoolTurbomachinery()){ + + unsigned short iMarker_Monitoring; + for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_TurboPerformance(); iMarker_Monitoring++) { + stringstream tag; + tag << iMarker_Monitoring + 1; + SetHistoryOutputValue("TotalPressureLoss_" + tag.str(), TotalPressureLoss[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("KineticEnergyLoss_" + tag.str(), KineticEnergyLoss[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("EntropyGeneration_" + tag.str(), EntropyGen[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("EulerianWork_" + tag.str(), EulerianWork[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("PressureRatio_" + tag.str(), PressureRatio[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("FlowAngleIn_" + tag.str(), 180/PI_NUMBER*FlowAngleIn[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("FlowAngleOut_" + tag.str(), 180/PI_NUMBER*FlowAngleOut[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), 180/PI_NUMBER*AbsFlowAngleIn[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), 180/PI_NUMBER*AbsFlowAngleOut[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("MassFlowIn_" + tag.str(), MassFlowIn[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("MassFlowOut_" + tag.str(), MassFlowOut[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("MachIn_" + tag.str(), sqrt(MachIn[iMarker_Monitoring][nSpanWiseSections][1]*MachIn[iMarker_Monitoring][nSpanWiseSections][1] + MachIn[iMarker_Monitoring][nSpanWiseSections][0]*MachIn[iMarker_Monitoring][nSpanWiseSections][0])); + SetHistoryOutputValue("MachOut_" + tag.str(), sqrt(MachOut[iMarker_Monitoring][nSpanWiseSections][1]*MachOut[iMarker_Monitoring][nSpanWiseSections][1] + MachOut[iMarker_Monitoring][nSpanWiseSections][0]*MachOut[iMarker_Monitoring][nSpanWiseSections][0])); + SetHistoryOutputValue("TotalEfficiency_" + tag.str(), TotalTotalEfficiency[iMarker_Monitoring][nSpanWiseSections]); + SetHistoryOutputValue("TotalStaticEfficiency_" + tag.str(), TotalStaticEfficiency[iMarker_Monitoring][nSpanWiseSections]); + } + } + /*--- Keep this as last, since it uses the history values that were set. ---*/ SetCustomOutputs(solver, geometry, config); SetCustomAndComboObjectives(FLOW_SOL, config, solver); - + } bool CFlowCompOutput::SetInitResiduals(const CConfig *config){ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 646cc521c93..b95b4ad6018 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -2476,3 +2476,437 @@ void COutput::PrintVolumeFields(){ VolumeFieldTable.PrintFooter(); } } + +void COutput::InitTurboPerformance(const CConfig *config){ + unsigned short iDim, iSpan, iMarker; + + /*--- Initializate quantities for turboperformace ---*/ + nSpanWiseSections = config->GetnSpanMaxAllZones(); + nMarkerTurboPerf = config->GetnMarker_TurboPerformance(); + + + TotalStaticEfficiency = new su2double*[nMarkerTurboPerf]; + TotalTotalEfficiency = new su2double*[nMarkerTurboPerf]; + KineticEnergyLoss = new su2double*[nMarkerTurboPerf]; + TRadius = new su2double*[nMarkerTurboPerf]; + TotalPressureLoss = new su2double*[nMarkerTurboPerf]; + MassFlowIn = new su2double*[nMarkerTurboPerf]; + MassFlowOut = new su2double*[nMarkerTurboPerf]; + FlowAngleIn = new su2double*[nMarkerTurboPerf]; + FlowAngleIn_BC = new su2double*[nMarkerTurboPerf]; + FlowAngleOut = new su2double*[nMarkerTurboPerf]; + EulerianWork = new su2double*[nMarkerTurboPerf]; + TotalEnthalpyIn = new su2double*[nMarkerTurboPerf]; + TotalEnthalpyIn_BC = new su2double*[nMarkerTurboPerf]; + EntropyIn = new su2double*[nMarkerTurboPerf]; + EntropyOut = new su2double*[nMarkerTurboPerf]; + EntropyIn_BC = new su2double*[nMarkerTurboPerf]; + PressureRatio = new su2double*[nMarkerTurboPerf]; + TotalTemperatureIn = new su2double*[nMarkerTurboPerf]; + EnthalpyOut = new su2double*[nMarkerTurboPerf]; + MachIn = new su2double**[nMarkerTurboPerf]; + MachOut = new su2double**[nMarkerTurboPerf]; + VelocityOutIs = new su2double*[nMarkerTurboPerf]; + DensityIn = new su2double*[nMarkerTurboPerf]; + PressureIn = new su2double*[nMarkerTurboPerf]; + TurboVelocityIn = new su2double**[nMarkerTurboPerf]; + DensityOut = new su2double*[nMarkerTurboPerf]; + PressureOut = new su2double*[nMarkerTurboPerf]; + TurboVelocityOut = new su2double**[nMarkerTurboPerf]; + EnthalpyOutIs = new su2double*[nMarkerTurboPerf]; + EntropyGen = new su2double*[nMarkerTurboPerf]; + AbsFlowAngleIn = new su2double*[nMarkerTurboPerf]; + TotalEnthalpyOut = new su2double*[nMarkerTurboPerf]; + TotalEnthalpyOutIs = new su2double*[nMarkerTurboPerf]; + RothalpyIn = new su2double*[nMarkerTurboPerf]; + RothalpyOut = new su2double*[nMarkerTurboPerf]; + AbsFlowAngleOut = new su2double*[nMarkerTurboPerf]; + PressureOut_BC = new su2double*[nMarkerTurboPerf]; + TemperatureIn = new su2double*[nMarkerTurboPerf]; + TemperatureOut = new su2double*[nMarkerTurboPerf]; + TotalPressureIn = new su2double*[nMarkerTurboPerf]; + TotalPressureOut = new su2double*[nMarkerTurboPerf]; + TotalTemperatureOut = new su2double*[nMarkerTurboPerf]; + EnthalpyIn = new su2double*[nMarkerTurboPerf]; + TurbIntensityIn = new su2double*[nMarkerTurboPerf]; + Turb2LamViscRatioIn = new su2double*[nMarkerTurboPerf]; + TurbIntensityOut = new su2double*[nMarkerTurboPerf]; + Turb2LamViscRatioOut = new su2double*[nMarkerTurboPerf]; + NuFactorIn = new su2double*[nMarkerTurboPerf]; + NuFactorOut = new su2double*[nMarkerTurboPerf]; + + for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++){ + TotalStaticEfficiency [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalTotalEfficiency [iMarker] = new su2double [nSpanWiseSections + 1]; + KineticEnergyLoss [iMarker] = new su2double [nSpanWiseSections + 1]; + TRadius [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalPressureLoss [iMarker] = new su2double [nSpanWiseSections + 1]; + MassFlowIn [iMarker] = new su2double [nSpanWiseSections + 1]; + MassFlowOut [iMarker] = new su2double [nSpanWiseSections + 1]; + FlowAngleIn [iMarker] = new su2double [nSpanWiseSections + 1]; + FlowAngleIn_BC [iMarker] = new su2double [nSpanWiseSections + 1]; + FlowAngleOut [iMarker] = new su2double [nSpanWiseSections + 1]; + EulerianWork [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalEnthalpyIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalEnthalpyIn_BC [iMarker] = new su2double [nSpanWiseSections + 1]; + EntropyIn [iMarker] = new su2double [nSpanWiseSections + 1]; + EntropyOut [iMarker] = new su2double [nSpanWiseSections + 1]; + EntropyIn_BC [iMarker] = new su2double [nSpanWiseSections + 1]; + PressureRatio [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalTemperatureIn [iMarker] = new su2double [nSpanWiseSections + 1]; + EnthalpyOut [iMarker] = new su2double [nSpanWiseSections + 1]; + MachIn [iMarker] = new su2double*[nSpanWiseSections + 1]; + MachOut [iMarker] = new su2double*[nSpanWiseSections + 1]; + VelocityOutIs [iMarker] = new su2double [nSpanWiseSections + 1]; + DensityIn [iMarker] = new su2double [nSpanWiseSections + 1]; + PressureIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TurboVelocityIn [iMarker] = new su2double*[nSpanWiseSections + 1]; + DensityOut [iMarker] = new su2double [nSpanWiseSections + 1]; + PressureOut [iMarker] = new su2double [nSpanWiseSections + 1]; + TurboVelocityOut [iMarker] = new su2double*[nSpanWiseSections + 1]; + EnthalpyOutIs [iMarker] = new su2double [nSpanWiseSections + 1]; + EntropyGen [iMarker] = new su2double [nSpanWiseSections + 1]; + AbsFlowAngleIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalEnthalpyOut [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalEnthalpyOutIs [iMarker] = new su2double [nSpanWiseSections + 1]; + RothalpyIn [iMarker] = new su2double [nSpanWiseSections + 1]; + RothalpyOut [iMarker] = new su2double [nSpanWiseSections + 1]; + AbsFlowAngleOut [iMarker] = new su2double [nSpanWiseSections + 1]; + PressureOut_BC [iMarker] = new su2double [nSpanWiseSections + 1]; + TemperatureIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TemperatureOut [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalPressureIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalPressureOut [iMarker] = new su2double [nSpanWiseSections + 1]; + TotalTemperatureOut [iMarker] = new su2double [nSpanWiseSections + 1]; + EnthalpyIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TurbIntensityIn [iMarker] = new su2double [nSpanWiseSections + 1]; + Turb2LamViscRatioIn [iMarker] = new su2double [nSpanWiseSections + 1]; + TurbIntensityOut [iMarker] = new su2double [nSpanWiseSections + 1]; + Turb2LamViscRatioOut [iMarker] = new su2double [nSpanWiseSections + 1]; + NuFactorIn [iMarker] = new su2double [nSpanWiseSections + 1]; + NuFactorOut [iMarker] = new su2double [nSpanWiseSections + 1]; + + + for (iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++){ + TotalStaticEfficiency [iMarker][iSpan] = 0.0; + TotalTotalEfficiency [iMarker][iSpan] = 0.0; + KineticEnergyLoss [iMarker][iSpan] = 0.0; + TRadius [iMarker][iSpan] = 0.0; + TotalPressureLoss [iMarker][iSpan] = 0.0; + MassFlowIn [iMarker][iSpan] = 0.0; + MassFlowOut [iMarker][iSpan] = 0.0; + FlowAngleIn [iMarker][iSpan] = 0.0; + FlowAngleIn_BC [iMarker][iSpan] = config->GetFlowAngleIn_BC(); + FlowAngleOut [iMarker][iSpan] = 0.0; + EulerianWork [iMarker][iSpan] = 0.0; + TotalEnthalpyIn [iMarker][iSpan] = 0.0; + TotalEnthalpyIn_BC [iMarker][iSpan] = 0.0; + EntropyIn [iMarker][iSpan] = 0.0; + EntropyOut [iMarker][iSpan] = 0.0; + EntropyIn_BC [iMarker][iSpan] = 0.0; + PressureRatio [iMarker][iSpan] = 0.0; + TotalTemperatureIn [iMarker][iSpan] = 0.0; + EnthalpyOut [iMarker][iSpan] = 0.0; + + + VelocityOutIs [iMarker][iSpan] = 0.0; + DensityIn [iMarker][iSpan] = 0.0; + PressureIn [iMarker][iSpan] = 0.0; + + DensityOut [iMarker][iSpan] = 0.0; + PressureOut [iMarker][iSpan] = 0.0; + + EnthalpyOutIs [iMarker][iSpan] = 0.0; + EntropyGen [iMarker][iSpan] = 0.0; + AbsFlowAngleIn [iMarker][iSpan] = 0.0; + TotalEnthalpyOut [iMarker][iSpan] = 0.0; + TotalEnthalpyOutIs [iMarker][iSpan] = 0.0; + RothalpyIn [iMarker][iSpan] = 0.0; + RothalpyOut [iMarker][iSpan] = 0.0; + AbsFlowAngleOut [iMarker][iSpan] = 0.0; + PressureOut_BC [iMarker][iSpan] = config->GetPressureOut_BC(); + + TemperatureIn [iMarker][iSpan] = 0.0; + TemperatureOut [iMarker][iSpan] = 0.0; + TotalPressureIn [iMarker][iSpan] = 0.0; + TotalPressureOut [iMarker][iSpan] = 0.0; + TotalTemperatureOut [iMarker][iSpan] = 0.0; + EnthalpyIn [iMarker][iSpan] = 0.0; + TurbIntensityIn [iMarker][iSpan] = 0.0; + Turb2LamViscRatioIn [iMarker][iSpan] = 0.0; + TurbIntensityOut [iMarker][iSpan] = 0.0; + Turb2LamViscRatioOut [iMarker][iSpan] = 0.0; + NuFactorIn [iMarker][iSpan] = 0.0; + NuFactorOut [iMarker][iSpan] = 0.0; + MachIn [iMarker][iSpan] = new su2double[4]; + MachOut [iMarker][iSpan] = new su2double[4]; + TurboVelocityIn [iMarker][iSpan] = new su2double[4]; + TurboVelocityOut [iMarker][iSpan] = new su2double[4]; + + for (iDim = 0; iDim < 4; iDim++){ + MachIn [iMarker][iSpan][iDim] = 0.0; + MachOut [iMarker][iSpan][iDim] = 0.0; + TurboVelocityIn [iMarker][iSpan][iDim] = 0.0; + TurboVelocityOut [iMarker][iSpan][iDim] = 0.0; + } + } + } +} + +void COutput::ComputeTurboPerformance(CConfig *config, CGeometry *geometry, CSolver *solver){ + CFluidModel *FluidModel; + unsigned short nDim = geometry->GetnDim(); + unsigned short iMarkerTP, iSpan, iDim, iStage, iBlade; + unsigned short nMarkerTP = config->GetnMarker_Turbomachinery(); + FluidModel = solver->GetFluidModel(); + su2double area, absVel2, soundSpeed, mach, tangVel, tangVel2, *relVel, relVel2; + su2double relPressureIn, relPressureOut, enthalpyOutIs, relVelOutIs2; + relVel = new su2double[nDim]; + su2double muLam, kine, omega, nu; + bool turbulent = ((config->GetKind_Solver() == MAIN_SOLVER::RANS) || (config->GetKind_Solver() == MAIN_SOLVER::DISC_ADJ_RANS)); + bool menter_sst = (config->GetKind_Turb_Model() == TURB_MODEL::SST); + + unsigned short nBladesRow, nStages; + + nBladesRow = config->GetnMarker_Turbomachinery(); + nStages = SU2_TYPE::Int(nBladesRow/2); + + + /*--- Compute BC imposed value for convergence monitoring ---*/ + for(iMarkerTP = 0; iMarkerTP < nMarkerTP; iMarkerTP++ ){ + for(iSpan = 0; iSpan < config->GetnSpan_iZones(iMarkerTP) + 1; iSpan++){ + if(config->GetRampOutletPressure() && config->GetInnerIter() > 0){ + PressureOut_BC[iMarkerTP][iSpan] = config->GetMonitorOutletPressure()/config->GetPressure_Ref(); + } + FluidModel->SetTDState_PT(config->GetTotalPressureIn_BC(), config->GetTotalTemperatureIn_BC()); + TotalEnthalpyIn_BC[iMarkerTP][iSpan] = FluidModel->GetStaticEnergy()+ FluidModel->GetPressure()/FluidModel->GetDensity(); + EntropyIn_BC[iMarkerTP][iSpan] = FluidModel->GetEntropy(); + } + } + + /*--- Compute performance for each blade ---*/ + for(iMarkerTP = 0; iMarkerTP < nMarkerTP; iMarkerTP++ ){ + for(iSpan = 0; iSpan < config->GetnSpan_iZones(iMarkerTP) + 1; iSpan++){ + + + /*--- INFLOW ---*/ + /*--- Retrieve Inflow primitive quantities ---*/ + DensityIn[iMarkerTP][iSpan] = solver->GetDensityIn(iMarkerTP, iSpan); + PressureIn[iMarkerTP][iSpan] = solver->GetPressureIn(iMarkerTP, iSpan); + + absVel2 = 0.0; + + for (iDim = 0; iDim < nDim; iDim++){ + TurboVelocityIn[iMarkerTP][iSpan][iDim] = solver->GetTurboVelocityIn(iMarkerTP, iSpan)[iDim]; + absVel2 += TurboVelocityIn[iMarkerTP][iSpan][iDim]*TurboVelocityIn[iMarkerTP][iSpan][iDim]; + } + TurboVelocityIn[iMarkerTP][iSpan][nDim] = sqrt(absVel2); + + TRadius[iMarkerTP][iSpan] = geometry->GetTurboRadiusIn(iMarkerTP, iSpan); + area = geometry->GetSpanAreaIn(iMarkerTP, iSpan); + + /*--- Compute static Inflow quantities ---*/ + FluidModel->SetTDState_Prho(PressureIn[iMarkerTP][iSpan], DensityIn[iMarkerTP][iSpan]); + EntropyIn[iMarkerTP][iSpan] = FluidModel->GetEntropy(); + MassFlowIn[iMarkerTP][iSpan] = config->GetnBlades(iMarkerTP)*DensityIn[iMarkerTP][iSpan]*TurboVelocityIn[iMarkerTP][iSpan][0]*area; + AbsFlowAngleIn[iMarkerTP][iSpan] = atan(TurboVelocityIn[iMarkerTP][iSpan][1]/TurboVelocityIn[iMarkerTP][iSpan][0]); + EnthalpyIn[iMarkerTP][iSpan] = FluidModel->GetStaticEnergy() + PressureIn[iMarkerTP][iSpan]/DensityIn[iMarkerTP][iSpan]; + soundSpeed = FluidModel->GetSoundSpeed(); + + + /*--- Compute Total Inflow quantities ---*/ + TotalEnthalpyIn[iMarkerTP][iSpan] = EnthalpyIn[iMarkerTP][iSpan] + 0.5*absVel2; + FluidModel->SetTDState_hs(TotalEnthalpyIn[iMarkerTP][iSpan], EntropyIn[iMarkerTP][iSpan]); + TotalPressureIn[iMarkerTP][iSpan] = FluidModel->GetPressure(); + TotalTemperatureIn[iMarkerTP][iSpan] = FluidModel->GetTemperature(); + + /*--- Retrieve Inflow relative quantities ---*/ + tangVel = geometry->GetTangGridVelIn(iMarkerTP, iSpan); + tangVel2 = tangVel*tangVel; + + for (iDim = 0; iDim < nDim; iDim++){ + relVel[iDim] = TurboVelocityIn[iMarkerTP][iSpan][iDim]; + } + relVel[1] -= tangVel; + + relVel2 = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + relVel2 += relVel[iDim]*relVel[iDim]; + } + + /*--- Compute Total relative Inflow quantities ---*/ + RothalpyIn[iMarkerTP][iSpan] = EnthalpyIn[iMarkerTP][iSpan] + 0.5*relVel2 - 0.5*tangVel2; + FluidModel->SetTDState_hs(RothalpyIn[iMarkerTP][iSpan], EntropyIn[iMarkerTP][iSpan]); + relPressureIn = FluidModel->GetPressure(); + + /*--- Compute kinematic relative Inflow quantities ---*/ + FlowAngleIn[iMarkerTP][iSpan] = atan(relVel[1]/relVel[0]); + mach = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + MachIn[iMarkerTP][iSpan][iDim] = relVel[iDim]/soundSpeed; + mach = MachIn[iMarkerTP][iSpan][iDim]*MachIn[iMarkerTP][iSpan][iDim]; + } + MachIn[iMarkerTP][iSpan][nDim] = sqrt(mach); + + /*--- Compute Turbulent Inflow quantities ---*/ + if(turbulent){ + FluidModel->SetTDState_Prho(PressureIn[iMarkerTP][iSpan], DensityIn[iMarkerTP][iSpan]); + muLam = FluidModel->GetLaminarViscosity(); + if(menter_sst){ + kine = solver->GetKineIn(iMarkerTP, iSpan); + omega = solver->GetOmegaIn(iMarkerTP, iSpan); + TurbIntensityIn[iMarkerTP][iSpan] = sqrt(2.0/3.0*kine/absVel2); + Turb2LamViscRatioIn[iMarkerTP][iSpan] = DensityIn[iMarkerTP][iSpan]*kine/(muLam*omega); +// TurbIntensityIn[iMarkerTP][iSpan] = kine; +// Turb2LamViscRatioIn[iMarkerTP][iSpan] = omega; + } + else{ + nu = solver->GetNuIn(iMarkerTP, iSpan); + NuFactorIn[iMarkerTP][iSpan] = nu*DensityIn[iMarkerTP][iSpan]/muLam; + } + } + + /*--- OUTFLOW ---*/ + /*--- Retrieve Outflow primitive quantities ---*/ + DensityOut[iMarkerTP][iSpan] = solver->GetDensityOut(iMarkerTP, iSpan); + PressureOut[iMarkerTP][iSpan] = solver->GetPressureOut(iMarkerTP, iSpan); + absVel2 = 0.0; + + for (iDim = 0; iDim < nDim; iDim++){ + TurboVelocityOut[iMarkerTP][iSpan][iDim] = solver->GetTurboVelocityOut(iMarkerTP, iSpan)[iDim]; + absVel2 += TurboVelocityOut[iMarkerTP][iSpan][iDim]*TurboVelocityOut[iMarkerTP][iSpan][iDim]; + } + TurboVelocityOut[iMarkerTP][iSpan][nDim] = sqrt(absVel2); + + + for (iDim = 0; iDim < 3; iDim++){ + } + area = geometry->GetSpanAreaOut(iMarkerTP, iSpan); + + + /*--- Compute all the Outflow quantities ---*/ + FluidModel->SetTDState_Prho(PressureOut[iMarkerTP][iSpan], DensityOut[iMarkerTP][iSpan]); + EntropyOut[iMarkerTP][iSpan] = FluidModel->GetEntropy(); + MassFlowOut[iMarkerTP][iSpan] = config->GetnBlades(iMarkerTP)*DensityOut[iMarkerTP][iSpan]*TurboVelocityOut[iMarkerTP][iSpan][0]*area; + AbsFlowAngleOut[iMarkerTP][iSpan] = atan(TurboVelocityOut[iMarkerTP][iSpan][1]/TurboVelocityOut[iMarkerTP][iSpan][0]); + EnthalpyOut[iMarkerTP][iSpan] = FluidModel->GetStaticEnergy() + PressureOut[iMarkerTP][iSpan]/DensityOut[iMarkerTP][iSpan]; + soundSpeed = FluidModel->GetSoundSpeed(); + + /*--- Compute Total Outflow quantities ---*/ + TotalEnthalpyOut[iMarkerTP][iSpan] = EnthalpyOut[iMarkerTP][iSpan] + 0.5*absVel2; + FluidModel->SetTDState_hs(TotalEnthalpyOut[iMarkerTP][iSpan], EntropyOut[iMarkerTP][iSpan]); + TotalPressureOut[iMarkerTP][iSpan] = FluidModel->GetPressure(); + TotalTemperatureOut[iMarkerTP][iSpan] = FluidModel->GetTemperature(); + + /*--- Retrieve relative Outflow quantities ---*/ + tangVel = geometry->GetTangGridVelOut(iMarkerTP, iSpan); + tangVel2 = tangVel*tangVel; + + for (iDim = 0; iDim < nDim; iDim++){ + relVel[iDim] = TurboVelocityOut[iMarkerTP][iSpan][iDim]; + } + relVel[1] -= tangVel; + + relVel2 = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + relVel2 += relVel[iDim]*relVel[iDim]; + } + + /*--- Compute Total relative Outflow quantities ---*/ + RothalpyOut[iMarkerTP][iSpan] = EnthalpyOut[iMarkerTP][iSpan] + 0.5*relVel2 - 0.5*tangVel2; + FluidModel->SetTDState_hs(RothalpyOut[iMarkerTP][iSpan], EntropyOut[iMarkerTP][iSpan]); + relPressureOut = FluidModel->GetPressure(); + + /*--- Compute isentropic Outflow quantities ---*/ + FluidModel->SetTDState_Ps(PressureOut[iMarkerTP][iSpan], EntropyIn[iMarkerTP][iSpan]); + enthalpyOutIs = FluidModel->GetStaticEnergy() + PressureOut[iMarkerTP][iSpan]/FluidModel->GetDensity(); + relVelOutIs2 = 2*(RothalpyOut[iMarkerTP][iSpan] - enthalpyOutIs) + tangVel2; + + + /*--- Compute kinematic relative Outflow quantities ---*/ + FlowAngleOut[iMarkerTP][iSpan] = atan(relVel[1]/relVel[0]); + mach = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + MachOut[iMarkerTP][iSpan][iDim] = relVel[iDim]/soundSpeed; + mach = MachOut[iMarkerTP][iSpan][iDim]*MachOut[iMarkerTP][iSpan][iDim]; + } + MachOut[iMarkerTP][iSpan][nDim] = sqrt(mach); + + /*--- Compute Turbulent Outflow quantities ---*/ + if(turbulent){ + FluidModel->SetTDState_Prho(PressureOut[iMarkerTP][iSpan], DensityOut[iMarkerTP][iSpan]); + muLam = FluidModel->GetLaminarViscosity(); + if(menter_sst){ + kine = solver->GetKineOut(iMarkerTP, iSpan); + omega = solver->GetOmegaOut(iMarkerTP, iSpan); + TurbIntensityOut[iMarkerTP][iSpan] = sqrt(2.0/3.0*kine/absVel2); + Turb2LamViscRatioOut[iMarkerTP][iSpan] = DensityOut[iMarkerTP][iSpan]*kine/(muLam*omega); +// TurbIntensityOut[iMarkerTP][iSpan] = kine; +// Turb2LamViscRatioOut[iMarkerTP][iSpan] = omega; + } + else{ + nu = solver->GetNuOut(iMarkerTP, iSpan); + NuFactorOut[iMarkerTP][iSpan] = nu*DensityOut[iMarkerTP][iSpan]/muLam; + } + } + + /*--- TURBO-PERFORMANCE---*/ + EntropyGen[iMarkerTP][iSpan] = (EntropyOut[iMarkerTP][iSpan] - EntropyIn[iMarkerTP][iSpan])/abs(EntropyIn_BC[iMarkerTP][iSpan] + 1); + EulerianWork[iMarkerTP][iSpan] = TotalEnthalpyIn[iMarkerTP][iSpan] - TotalEnthalpyOut[iMarkerTP][iSpan]; + TotalPressureLoss[iMarkerTP][iSpan] = (relPressureIn - relPressureOut)/(relPressureIn - PressureOut[iMarkerTP][iSpan]); + KineticEnergyLoss[iMarkerTP][iSpan] = 2*(EnthalpyOut[iMarkerTP][iSpan] - enthalpyOutIs)/relVelOutIs2; + PressureRatio[iMarkerTP][iSpan] = TotalPressureOut[iMarkerTP][iSpan]/TotalPressureIn[iMarkerTP][iSpan]; + EnthalpyOutIs[iMarkerTP][iSpan] = (pow(TotalPressureOut[iMarkerTP][iSpan]/TotalPressureIn[iMarkerTP][iSpan], 0.4/1.4) - 1.0)/(TotalTemperatureOut[iMarkerTP][iSpan]/TotalTemperatureIn[iMarkerTP][iSpan] -1.0); + } + } + + if(nBladesRow > 1){ + /*--- Compute performance for each stage ---*/ + + EulerianWork[nBladesRow + nStages][nSpanWiseSections] = 0.0; + /*---Comnpute performance for each stage---*/ + for(iStage = 0; iStage < nStages; iStage++ ){ + FluidModel->SetTDState_Ps(PressureOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)], EntropyIn[iStage*2][config->GetnSpan_iZones(iStage*2)]); + EnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections] = FluidModel->GetStaticEnergy() + PressureOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)]/FluidModel->GetDensity(); + FluidModel->SetTDState_Prho(PressureOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)], DensityOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)]); + absVel2 = 0.0; + for (iDim = 0; iDimGetnSpan_iZones(iStage*2 +1)][iDim]*TurboVelocityOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)][iDim]; + TotalEnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections] = EnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections] + 0.5*absVel2; + + TotalTotalEfficiency[nBladesRow + iStage][nSpanWiseSections] = (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - TotalEnthalpyOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2 +1)]); + TotalTotalEfficiency[nBladesRow + iStage][nSpanWiseSections] /= (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - TotalEnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections]); + TotalStaticEfficiency[nBladesRow + iStage][nSpanWiseSections] = (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - TotalEnthalpyOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2+1)]); + TotalStaticEfficiency[nBladesRow + iStage][nSpanWiseSections] /= (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - EnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections]); + PressureRatio[nBladesRow + iStage][nSpanWiseSections] = (PressureRatio[iStage*2][config->GetnSpan_iZones(iStage*2)]*PressureOut[iStage*2][config->GetnSpan_iZones(iStage*2)]/PressureOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2+1)]); + MassFlowIn[nBladesRow + iStage][nSpanWiseSections] = MassFlowIn[iStage*2][config->GetnSpan_iZones(iStage*2)]; + MassFlowOut[nBladesRow + iStage][nSpanWiseSections] = MassFlowOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2+1)]; + EntropyGen[nBladesRow + iStage][nSpanWiseSections] = EntropyGen[iStage*2 + 1][config->GetnSpan_iZones(iStage*2 +1)] + EntropyGen[iStage*2][config->GetnSpan_iZones(iStage*2)]; + + } + + /*---Compute turbo performance for full machine---*/ + FluidModel->SetTDState_Ps(PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)], EntropyIn[0][config->GetnSpan_iZones(0)]); + EnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections] = FluidModel->GetStaticEnergy() + PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]/FluidModel->GetDensity(); + FluidModel->SetTDState_Prho(PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)], DensityOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]); + absVel2 = 0.0; + for (iDim = 0; iDimGetnSpan_iZones(nBladesRow-1)][iDim]*TurboVelocityOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)][iDim]; + TotalEnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections] = EnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections] + 0.5*absVel2; + + TotalTotalEfficiency[nBladesRow + nStages][nSpanWiseSections] = (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - TotalEnthalpyOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]); + TotalTotalEfficiency[nBladesRow + nStages][nSpanWiseSections] /= (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - TotalEnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections]); + TotalStaticEfficiency[nBladesRow +nStages][nSpanWiseSections] = (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - TotalEnthalpyOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]); + TotalStaticEfficiency[nBladesRow +nStages][nSpanWiseSections] /= (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - EnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections]); + PressureRatio[nBladesRow + nStages][nSpanWiseSections] = PressureRatio[0][config->GetnSpan_iZones(0)]*PressureOut[0][config->GetnSpan_iZones(0)]/PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]; + MassFlowIn[nBladesRow + nStages][nSpanWiseSections] = MassFlowIn[0][config->GetnSpan_iZones(0)]; + MassFlowOut[nBladesRow + nStages][nSpanWiseSections] = MassFlowOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]; + + EntropyGen[nBladesRow + nStages][nSpanWiseSections] = 0.0; + for(iBlade = 0; iBlade < nBladesRow; iBlade++ ){ + EntropyGen[nBladesRow + nStages][nSpanWiseSections] += EntropyGen[iBlade][config->GetnSpan_iZones(iBlade)]; + } + } + + delete [] relVel; + +} \ No newline at end of file From 4744927ed2deaf0721a92e463f3655a1a86d1505 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Fri, 14 Apr 2023 18:01:24 +0100 Subject: [PATCH 02/47] Updated turboperformance methods & history output --- Common/include/CConfig.hpp | 10 +- Common/include/option_structure.hpp | 24 +- Common/src/CConfig.cpp | 19 +- SU2_CFD/include/SU2_CFD.hpp | 2 +- SU2_CFD/include/drivers/CMultizoneDriver.hpp | 4 - SU2_CFD/include/iteration/CFluidIteration.hpp | 9 + SU2_CFD/include/iteration/CIteration.hpp | 19 + SU2_CFD/include/iteration/CTurboIteration.hpp | 5 + SU2_CFD/include/output/COutput.hpp | 79 +-- SU2_CFD/include/output/CTurboOutput.hpp | 262 +++++++++ SU2_CFD/include/solvers/CEulerSolver.hpp | 41 +- SU2_CFD/include/solvers/CSolver.hpp | 18 + SU2_CFD/src/drivers/CDriver.cpp | 50 +- SU2_CFD/src/drivers/CMultizoneDriver.cpp | 57 +- SU2_CFD/src/integration/CIntegration.cpp | 7 + .../src/integration/CMultiGridIntegration.cpp | 23 + SU2_CFD/src/iteration/CFluidIteration.cpp | 133 +++++ SU2_CFD/src/iteration/CTurboIteration.cpp | 10 + SU2_CFD/src/meson.build | 1 + SU2_CFD/src/output/CFlowCompOutput.cpp | 90 +-- SU2_CFD/src/output/COutput.cpp | 554 ++++-------------- SU2_CFD/src/output/CTurboOutput.cpp | 304 ++++++++++ SU2_CFD/src/solvers/CEulerSolver.cpp | 5 + config_template.cfg | 4 + 24 files changed, 1100 insertions(+), 630 deletions(-) create mode 100644 SU2_CFD/include/output/CTurboOutput.hpp create mode 100644 SU2_CFD/src/output/CTurboOutput.cpp diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index f10273fbfc8..d4b8e93aa37 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -71,7 +71,6 @@ class CConfig { unsigned short Kind_PerformanceAverageProcess; /*!< \brief Kind of mixing process.*/ unsigned short Kind_MixingPlaneInterface; /*!< \brief Kind of mixing process.*/ unsigned short Kind_SpanWise; /*!< \brief Kind of span-wise section computation.*/ - unsigned short *Kind_TurboMachinery; /*!< \brief Kind of turbomachynery architecture.*/ unsigned short iZone, nZone; /*!< \brief Number of zones in the mesh. */ unsigned short nZoneSpecified; /*!< \brief Number of zones that are specified in config file. */ su2double Highlite_Area; /*!< \brief Highlite area. */ @@ -434,6 +433,9 @@ class CConfig { Max_DeltaTime, /*!< \brief Max delta time. */ Unst_CFL; /*!< \brief Unsteady CFL number. */ + TURBO_PERF_KIND *Kind_TurboPerf; /*!< \brief Kind of turbomachynery architecture.*/ + TURBOMACHINERY_TYPE *Kind_TurboMachinery; + /* Gradient smoothing options */ su2double SmoothingEps1; /*!< \brief Parameter for the identity part in gradient smoothing. */ su2double SmoothingEps2; /*!< \brief Parameter for the Laplace part in gradient smoothing. */ @@ -5036,7 +5038,7 @@ class CConfig { * \brief Get the kind of turbomachinery architecture. * \return Kind of turbomachinery architecture. */ - unsigned short GetKind_TurboMachinery(unsigned short val_iZone) const { return Kind_TurboMachinery[val_iZone]; } + TURBOMACHINERY_TYPE GetKind_TurboMachinery(unsigned short val_iZone) const { return Kind_TurboMachinery[val_iZone]; } /*! * \brief Get the kind of turbomachinery architecture. @@ -5151,7 +5153,7 @@ class CConfig { void SetnSpanWiseSections(unsigned short nSpan) { nSpanWiseSections = nSpan;} /*! - * \brief set number span-wise sections to compute 3D BC and performance for turbomachinery. + * \brief get number span-wise sections to compute 3D BC and performance for turbomachinery. */ unsigned short GetnSpan_iZones(unsigned short iZone) const { return nSpan_iZones[iZone];} @@ -5176,7 +5178,7 @@ class CConfig { * \brief get marker kind for Turbomachinery performance calculation. * \return kind index. */ - unsigned short GetKind_TurboPerf(unsigned short index); + TURBO_PERF_KIND GetKind_TurboPerf(unsigned short val_iZone) const { return Kind_TurboPerf[val_iZone]; }; /*! * \brief get outlet bounds name for Turbomachinery performance calculation. diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 9ce8808b038..f53b426dade 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1738,11 +1738,25 @@ enum TURBOMACHINERY_TYPE { AXIAL_CENTRIFUGAL = 5 /*!< \brief mixed flow turbine. */ }; static const MapType TurboMachinery_Map = { - MakePair("AXIAL", AXIAL) - MakePair("CENTRIFUGAL", CENTRIFUGAL) - MakePair("CENTRIPETAL", CENTRIPETAL) - MakePair("CENTRIPETAL_AXIAL", CENTRIPETAL_AXIAL) - MakePair("AXIAL_CENTRIFUGAL", AXIAL_CENTRIFUGAL) + MakePair("AXIAL", TURBOMACHINERY_TYPE::AXIAL) + MakePair("CENTRIFUGAL", TURBOMACHINERY_TYPE::CENTRIFUGAL) + MakePair("CENTRIPETAL", TURBOMACHINERY_TYPE::CENTRIPETAL) + MakePair("CENTRIPETAL_AXIAL", TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL) + MakePair("AXIAL_CENTRIFUGAL", TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL) +}; + +/*! + * \brief Types of Turbomachinery performance Type. + */ +enum class TURBO_PERF_KIND{ + TURBINE, /*!< \brief Turbine Performance. */ + COMPRESSOR, /*!< \brief Compressor Performance. */ + PROPELLOR /*!< \brief Propellor Performance. */ +}; +static const MapType TurboPerfKind_Map = { + MakePair("TURBINE", TURBO_PERF_KIND::TURBINE) + MakePair("COMPRESSOR", TURBO_PERF_KIND::COMPRESSOR) + MakePair("PROPELLOR", TURBO_PERF_KIND::PROPELLOR) }; /*! diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 5f3a9d7535a..f2f8bbceffd 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1587,6 +1587,9 @@ void CConfig::SetConfig_Options() { /*!\brief TURBOMACHINERY_KIND \n DESCRIPTION: types of turbomachynery architecture. \n OPTIONS: see \link TurboMachinery_Map \endlink \n Default: AXIAL */ addEnumListOption("TURBOMACHINERY_KIND",nTurboMachineryKind, Kind_TurboMachinery, TurboMachinery_Map); + /*!\brief TURBOMACHINERY_KIND \n DESCRIPTION: types of turbomachynery Performance Calculations. + \n OPTIONS: see \link TurboPerfKind_Map \endlink \n Default: TURBINE */ + addEnumListOption("TURBO_PERF_KIND", nTurboMachineryKind, Kind_TurboPerf, TurboPerfKind_Map); /*!\brief MARKER_SHROUD \n DESCRIPTION: markers in which velocity is forced to 0.0 . * \n Format: (shroud1, shroud2, ...)*/ addStringListOption("MARKER_SHROUD", nMarker_Shroud, Marker_Shroud); @@ -6787,16 +6790,16 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { default: break; + } } - } - else { - if (Time_Domain) { - cout << "Dynamic structural analysis."<< endl; - cout << "Time step provided by the user for the dynamic analysis(s): "<< Delta_DynTime << "." << endl; - } else { - cout << "Static structural analysis." << endl; + else { + if (Time_Domain) { + cout << "Dynamic structural analysis."<< endl; + cout << "Time step provided by the user for the dynamic analysis(s): "<< Delta_DynTime << "." << endl; + } else { + cout << "Static structural analysis." << endl; + } } - } if ((Kind_Solver == MAIN_SOLVER::EULER) || (Kind_Solver == MAIN_SOLVER::NAVIER_STOKES) || (Kind_Solver == MAIN_SOLVER::RANS) || (Kind_Solver == MAIN_SOLVER::INC_EULER) || (Kind_Solver == MAIN_SOLVER::INC_NAVIER_STOKES) || (Kind_Solver == MAIN_SOLVER::INC_RANS) || diff --git a/SU2_CFD/include/SU2_CFD.hpp b/SU2_CFD/include/SU2_CFD.hpp index c23920bb9e4..044cfd7ae58 100644 --- a/SU2_CFD/include/SU2_CFD.hpp +++ b/SU2_CFD/include/SU2_CFD.hpp @@ -29,7 +29,7 @@ #include "../../Common/include/parallelization/mpi_structure.hpp" #include "../../Common/include/parallelization/omp_structure.hpp" -#include "CLI11.hpp" +#include "../../externals/CLI11/CLI11.hpp" #include "drivers/CDriver.hpp" #include "drivers/CSinglezoneDriver.hpp" diff --git a/SU2_CFD/include/drivers/CMultizoneDriver.hpp b/SU2_CFD/include/drivers/CMultizoneDriver.hpp index afff04b8eac..48d4f9d740e 100644 --- a/SU2_CFD/include/drivers/CMultizoneDriver.hpp +++ b/SU2_CFD/include/drivers/CMultizoneDriver.hpp @@ -83,10 +83,6 @@ class CMultizoneDriver : public CDriver { */ bool TransferData(unsigned short donorZone, unsigned short targetZone); - /*! - * \brief Set Mixing Plane interface within multiple zones. - */ - void SetMixingPlane(unsigned short donorZone); /*! * \brief Transfer the local turboperfomance quantities (for each blade row) from all the donorZones to the diff --git a/SU2_CFD/include/iteration/CFluidIteration.hpp b/SU2_CFD/include/iteration/CFluidIteration.hpp index 6346c716929..4b24fec9f80 100644 --- a/SU2_CFD/include/iteration/CFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CFluidIteration.hpp @@ -106,6 +106,15 @@ class CFluidIteration : public CIteration { CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, unsigned short val_iInst) override; + /*! + * \brief Monitors turbo computation (pressure and turbo ramps). + */ + void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) override; + + /*! + * \brief Monitors turbo computation (pressure and turbo ramps). + */ + void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) override; /*! * \brief Postprocesses the fluid system before heading to another physics system or the next iteration. diff --git a/SU2_CFD/include/iteration/CIteration.hpp b/SU2_CFD/include/iteration/CIteration.hpp index eed41a39a15..9938e174c5e 100644 --- a/SU2_CFD/include/iteration/CIteration.hpp +++ b/SU2_CFD/include/iteration/CIteration.hpp @@ -35,6 +35,7 @@ #include "../../../Common/include/grid_movement/CFreeFormDefBox.hpp" #include "../../../Common/include/parallelization/mpi_structure.hpp" #include "../integration/CIntegration.hpp" +#include "../output/CTurboOutput.hpp" using namespace std; @@ -59,6 +60,9 @@ class CIteration { su2double StartTime{0.0}, /*!< \brief Tracking wall time. */ StopTime{0.0}, UsedTime{0.0}; + std::shared_ptr TurbomachineryPerformance; /*!< \brief turbo performance calculator. */ + CTurbomachineryStagePerformance* TurbomachineryStagePerformance; /*!< \brief turbo stage performance calculator. */ + public: /*! * \brief Constructor of the class. @@ -247,6 +251,21 @@ class CIteration { unsigned short val_iInst) { return false; } + + /*! + * \brief Monitors turbo computation (pressure and turbo ramps). + */ + virtual void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) {}; + + /*! + * \brief Monitors turbo computation (pressure and turbo ramps). + */ + virtual void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) {}; + + /*! + * \brief Monitors turbo computation (pressure and turbo ramps). + */ + virtual void InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid) {} /*! * \brief A virtual member. diff --git a/SU2_CFD/include/iteration/CTurboIteration.hpp b/SU2_CFD/include/iteration/CTurboIteration.hpp index ad52aaa04b4..144fa758986 100644 --- a/SU2_CFD/include/iteration/CTurboIteration.hpp +++ b/SU2_CFD/include/iteration/CTurboIteration.hpp @@ -63,4 +63,9 @@ class CTurboIteration : public CFluidIteration { CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, unsigned short val_iInst) override; + + /*! + * \brief Monitors turbo computation (pressure and turbo ramps). + */ + void InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid) override; }; diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index ab7c173d921..e620da7f2e9 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -38,6 +38,7 @@ #include "../../../Common/include/toolboxes/printing_toolbox.hpp" #include "tools/CWindowingTools.hpp" #include "../../../Common/include/option_structure.hpp" +#include "CTurboOutput.hpp" /*--- AD workaround for a cmath function not defined in CoDi. ---*/ namespace mel { @@ -47,7 +48,7 @@ inline su2double hypot(const su2double& a, const su2double& b) { } } } -#include "mel.hpp" +#include "../../../externals/mel/mel.hpp" class CGeometry; class CSolver; @@ -320,64 +321,7 @@ class COutput { su2double WndCauchy_Value; /*!< \brief Summed value of the convergence indicator. */ bool TimeConvergence; /*!< \brief To indicate, if the windowed time average of the time loop has converged*/ - /*--- Turbomachinery Performance Variable ---*/ - su2double Sum_Total_RadialDistortion, Sum_Total_CircumferentialDistortion; // Add all the distortion to compute a run average. - bool turbo; - unsigned short nSpanWiseSections, nMarkerTurboPerf; - - su2double **TotalStaticEfficiency, - **TotalTotalEfficiency, - **KineticEnergyLoss, - **TRadius, - **TotalPressureLoss, - **MassFlowIn, - **MassFlowOut, - **FlowAngleIn, - **FlowAngleIn_BC, - **FlowAngleOut, - **EulerianWork, - **TotalEnthalpyIn, - **TotalEnthalpyIn_BC, - **EntropyIn, - **EntropyOut, - **EntropyIn_BC, - **PressureRatio, - **TotalTemperatureIn, - **EnthalpyOut, - ***MachIn, - ***MachOut, - **VelocityOutIs, - **DensityIn, - **PressureIn, - ***TurboVelocityIn, - **DensityOut, - **PressureOut, - ***TurboVelocityOut, - **EnthalpyOutIs, - **EntropyGen, - **AbsFlowAngleIn, - **TotalEnthalpyOut, - **RothalpyIn, - **RothalpyOut, - **TotalEnthalpyOutIs, - **AbsFlowAngleOut, - **PressureOut_BC, - **TemperatureIn, - **TemperatureOut, - **TotalPressureIn, - **TotalPressureOut, - **TotalTemperatureOut, - **EnthalpyIn, - **TurbIntensityIn, - **Turb2LamViscRatioIn, - **TurbIntensityOut, - **Turb2LamViscRatioOut, - **NuFactorIn, - **NuFactorOut; - - /*--- End of turbomachinery performance ---*/ public: - /*----------------------------- Public member functions ----------------------------*/ /*! @@ -427,7 +371,26 @@ class COutput { */ void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); + /*! + * \brief Collects Turbomachinery Performance data from the solvers and prints the data in tabular format on screen. + * \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. + * \param[in] TimeIter - Value of the time iteration index + * \param[in] OuterIter - Value of outer iteration index + * \param[in] InnerIter - Value of the inner iteration index + */ + void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, + unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iZone); + + void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config); + void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config, + unsigned short iZone); /*! * \brief Collects history data from the solvers and monitors the convergence. Does not write to screen or file. * \param[in] geometry - Geometrical definition of the problem. diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp new file mode 100644 index 00000000000..ef9d5ff1f6a --- /dev/null +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -0,0 +1,262 @@ +/*! + * \file CTurboOutput.hpp + * \brief Headers of the Turbomachinery Performance class. + * \author S. Vitale, N. Anand + * \version 7.1.1 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + + +#pragma once + +#include +#include +#include +#include +#include +#include "../../../Common/include/geometry/CGeometry.hpp" +#include "../../../Common/include/CConfig.hpp" +#include "../fluid/CFluidModel.hpp" + + +class CTurbomachineryPrimitiveState { + private: + su2double Density, Pressure, TangVelocity; + vector Velocity; + public: + CTurbomachineryPrimitiveState(); + + CTurbomachineryPrimitiveState(vector TurboPrimitives, + unsigned short nDim, + su2double tangVel); + + su2double GetDensity() const & { return Density; } + + su2double GetPressure() const & { return Pressure; } + + su2double GetTangVelocity() const & { return TangVelocity; } + + vector GetVelocity() const & { return Velocity; } + +}; + +class CTurbomachineryCombinedPrimitiveStates { + private: + CTurbomachineryPrimitiveState InletPrimitiveState; + CTurbomachineryPrimitiveState OutletPrimitiveState; + public: + + CTurbomachineryCombinedPrimitiveStates(const CTurbomachineryPrimitiveState &inletPrimitiveState, + const CTurbomachineryPrimitiveState &outletPrimitiveState); + + CTurbomachineryPrimitiveState GetInletPrimitiveState() const & { return InletPrimitiveState; } + + CTurbomachineryPrimitiveState GetOutletPrimitiveState() const & { return OutletPrimitiveState; } +}; + +class CTurbomachineryState { + private: + su2double Density, Pressure, Entropy, Enthalpy, Temperature, TotalTemperature, TotalPressure, TotalEnthalpy; + su2double AbsFlowAngle, FlowAngle, MassFlow, Rothalpy, TotalRelPressure; + vector Velocity, RelVelocity, Mach, RelMach; + su2double Area, Radius; + + + public: + CTurbomachineryState(); + + CTurbomachineryState(unsigned short nDim, su2double area, su2double radius); + + void ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState &primitiveState); + + su2double GetDensity() const { return Density; } + + su2double GetPressure() const { return Pressure; } + + su2double GetEntropy() const { return Entropy; } + + su2double GetEnthalpy() const { return Enthalpy; } + + su2double GetTemperature() const { return Temperature; } + + su2double GetTotalTemperature() const { return TotalTemperature; } + + su2double GetTotalPressure() const { return TotalPressure; } + + su2double GetTotalRelPressure() const { return TotalRelPressure; } + + su2double GetTotalEnthalpy() const { return TotalEnthalpy; } + + su2double GetAbsFlowAngle() const { return AbsFlowAngle; } + + su2double GetFlowAngle() const { return FlowAngle; } + + su2double GetMassFlow() const { return MassFlow; } + + su2double GetRothalpy() const { return Rothalpy; } + + vector GetVelocity() const { return Velocity; } + + vector GetMach() const { return Mach; } + + su2double GetVelocityValue() const { + return Norm(Velocity); + } + + su2double GetMachValue() const { + return Norm(Mach); + } + + su2double GetRelVelocityValue() const { + return Norm(RelVelocity); + } + + su2double GetRelMachValue() const { + return Norm(RelMach); + } + + su2double Norm(vector const& u) const { + su2double accum = 0.; + for (int i = 0; i < u.size(); ++i) { + accum += u[i] * u[i]; + } + return sqrt(accum); + } +}; + + +class CTurbomachineryBladePerformance { + protected: + CTurbomachineryState InletState; + CTurbomachineryState OutletState; + su2double KineticEnergyLoss, TotalPressureLoss, EntropyGen, PressureRatio, EulerianWork; + CFluidModel &FluidModel; + + public: + CTurbomachineryBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut); + + virtual void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) {}; + + const CTurbomachineryState& GetInletState() { return InletState; } + + const CTurbomachineryState& GetOutletState() { return OutletState; } + + su2double GetKineticEnergyLoss() const { return KineticEnergyLoss; } + + su2double GetTotalPressureLoss() const { return TotalPressureLoss; } + + su2double GetEntropyGen() const { return EntropyGen; } + + su2double GetPressureRatio() const { return PressureRatio; } + + su2double GetEulerianWork() const { return EulerianWork; } + +}; + +class CTurbineBladePerformance : public CTurbomachineryBladePerformance { + + public: + CTurbineBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut); + + void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override; + +}; + +class CCompressorBladePerformance : public CTurbomachineryBladePerformance { + + public: + CCompressorBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut); + + void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override; + +}; + +class CPropellorBladePerformance : public CTurbomachineryBladePerformance { + + public: + CPropellorBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut); + + void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override; + +}; + +class CTurbomachineryStagePerformance { + protected: + su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, TotalTotalPressureRatio, EulerianWork; + CFluidModel &fluidModel; + public: + CTurbomachineryStagePerformance(CFluidModel& fluid); + virtual ~CTurbomachineryStagePerformance() = default; + virtual void ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, const CConfig* config); + virtual void ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + virtual void ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } + su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } + su2double GetEulerianWork() const { return EulerianWork; } + su2double GetNormEntropyGen() const { return NormEntropyGen; } + su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } + su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } +}; + +class CTurboOutput { + private: + vector >> + BladesPerformances; + + static void ComputePerBlade(vector > const bladePerformances, + vector const bladePrimitives); + + static void ComputePerSpan(shared_ptr const spanPerformances, + const CTurbomachineryCombinedPrimitiveStates &spanPrimitives); + // vector> StagePerformances; + // shared_ptr MachinePerformances; + public: + CTurboOutput(const CConfig& config, const CGeometry& geometry, CFluidModel& fluidModel); + + vector >> + + GetBladesPerformances() const { return BladesPerformances; } + + // vector> GetStagePerformances() const { return StagePerformances; } + // shared_ptr GetMachinePerformances() const { return MachinePerformances; } + void ComputeTurbomachineryPerformance(vector > const primitives); +}; \ No newline at end of file diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index eecc7a292a0..bfe94ebe976 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -29,6 +29,7 @@ #include "CFVMFlowSolverBase.hpp" #include "../variables/CEulerVariable.hpp" +#include "../../../Common/include/option_structure.hpp" /*! * \class CEulerSolver @@ -108,6 +109,8 @@ class CEulerSolver : public CFVMFlowSolverBase TurbomachineryPerformance; /*!< \brief turbo performance calculator. */ + vector FluidModel; /*!< \brief fluid model used in the solver. */ /*--- Turbomachinery Solver Variables ---*/ @@ -1026,12 +1029,40 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) { + TurboPrimitive.clear(); + if (INLET) { + TurboPrimitive.push_back(DensityIn[iBlade][iSpan]); TurboPrimitive.push_back(PressureIn[iBlade][iSpan]); + TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][0]);TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][1]); + if (nDim==3) + TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][2]); + } + else { + TurboPrimitive.push_back(DensityOut[iBlade][iSpan]); TurboPrimitive.push_back(PressureOut[iBlade][iSpan]); + TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][0]);TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][1]); + if (nDim==3) + TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][2]); + } + return TurboPrimitive; + } /*! * \brief Set the solution using the Freestream values. * \param[in] config - Definition of the particular problem. */ void SetFreeStream_TurboSolution(CConfig *config) final; - + /*! * \brief It computes average quantities along the span for turbomachinery analysis. * \param[in] geometry - Geometrical definition of the problem. @@ -1088,9 +1119,9 @@ class CEulerSolver : public CFVMFlowSolverBase TurboPrimitive; + int *Restart_Vars; /*!< \brief Auxiliary structure for holding the number of variables and points in a restart. */ int Restart_ExtIter; /*!< \brief Auxiliary structure for holding the external iteration offset from a restart. */ passivedouble *Restart_Data; /*!< \brief Auxiliary structure for holding the data values from a restart. */ @@ -3804,6 +3807,14 @@ class CSolver { */ inline virtual void InitTurboContainers(CGeometry *geometry, CConfig *config) { } +/*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + inline virtual void InitTurboPerformance(CGeometry *geometry, CConfig *config) { } + + /*! * \brief virtual member. * \param[in] geometry - Geometrical definition of the problem. @@ -4327,6 +4338,13 @@ class CSolver { */ inline virtual bool GetHasHybridParallel() const { return false; } + /*! + * \brief Get Primal variables for turbo performance computation + * iteration can be executed by multiple threads. + * \return returns Density, pressure and TurboVelocity (IN/OUTLET) + */ + virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) {return TurboPrimitive;} + /*! * \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat, etc. * \return Struct holding streamwise periodic values. diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 4dc172499de..06854fcdce3 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -2462,6 +2462,9 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet const bool fluid_donor = config[donor]->GetFluidProblem(); const bool structural_donor = config[donor]->GetStructuralProblem(); + /*--- Turbomachinery Bool for MIXING PLANE ---*/ + const bool turbo = config[donor]->GetBoolTurbomachinery(); + /*--- Initialize the appropriate transfer strategy. ---*/ if (rank == MASTER_NODE) cout << " Transferring "; @@ -2488,10 +2491,22 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet if (rank == MASTER_NODE) cout << "boundary displacements from the structural solver." << endl; } else if (fluid_donor && fluid_target) { - interface_type = SLIDING_INTERFACE; - auto nVar = solver[donor][INST_0][MESH_0][FLOW_SOL]->GetnPrimVar(); - interface[donor][target] = new CSlidingInterface(nVar, 0); - if (rank == MASTER_NODE) cout << "sliding interface." << endl; + /*--- Mixing plane for turbo machinery applications. ---*/ + if (config[donor]->GetBoolMixingPlaneInterface()) { + interface_type = MIXING_PLANE; + auto nVar = solver[donor][INST_0][MESH_0][FLOW_SOL]->GetnVar(); + interface[donor][target] = new CMixingPlaneInterface(nVar, 0); + if (rank == MASTER_NODE) { + cout << "Set mixing-plane interface from donor zone " + << donor << " to target zone " << target << "." << endl; + } + } + else{ + auto nVar = solver[donor][INST_0][MESH_0][FLOW_SOL]->GetnPrimVar(); + interface_type = SLIDING_INTERFACE; + interface[donor][target] = new CSlidingInterface(nVar, 0); + if (rank == MASTER_NODE) cout << "sliding interface." << endl; + } } else if (heat_donor || heat_target) { if (heat_donor && heat_target) @@ -2526,18 +2541,6 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet } } - /*--- Mixing plane for turbo machinery applications. ---*/ - - if (config[donor]->GetBoolMixingPlaneInterface()) { - interface_type = MIXING_PLANE; - auto nVar = solver[donor][INST_0][MESH_0][FLOW_SOL]->GetnVar(); - interface[donor][target] = new CMixingPlaneInterface(nVar, 0); - if (rank == MASTER_NODE) { - cout << "Set mixing-plane interface from donor zone " - << donor << " to target zone " << target << "." << endl; - } - } - } } @@ -2694,7 +2697,7 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, nSpanMax = config[iZone]->GetnSpanWiseSections(); } - config[ZONE_0]->SetnSpan_iZones(config[iZone]->GetnSpanWiseSections(), iZone); + config[nZone-1]->SetnSpan_iZones(config[iZone]->GetnSpanWiseSections(), iZone); geometry[iZone][INST_0][MESH_0]->SetTurboVertex(config[iZone], iZone, INFLOW, true); geometry[iZone][INST_0][MESH_0]->SetTurboVertex(config[iZone], iZone, OUTFLOW, true); @@ -2710,7 +2713,7 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, if (rank == MASTER_NODE) cout<<"Max number of span-wise sections among all zones: "<< nSpanMax<<"."<< endl; - if (rank == MASTER_NODE) cout<<"Initialize solver containers for average and performance quantities." << endl; + if (rank == MASTER_NODE) cout<<"Initialize solver containers for average quantities." << endl; for (iZone = 0; iZone < nZone; iZone++) { solver[iZone][INST_0][MESH_0][FLOW_SOL]->InitTurboContainers(geometry[iZone][INST_0][MESH_0],config[iZone]); } @@ -2728,16 +2731,17 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, if (rank == MASTER_NODE) cout << "Set span-wise sections between zones on Mixing-Plane interface." << endl; for (donorZone = 0; donorZone < nZone; donorZone++) { for (targetZone = 0; targetZone < nZone; targetZone++) { - if (targetZone != donorZone){ + if (interface_container[donorZone][targetZone] != nullptr){ interface[donorZone][targetZone]->SetSpanWiseLevels(config[donorZone], config[targetZone]); } } } } - if (rank == MASTER_NODE) cout << "Transfer average geometric quantities to zone 0." << endl; - for (iZone = 1; iZone < nZone; iZone++) { - interface[iZone][ZONE_0]->GatherAverageTurboGeoValues(geometry[iZone][INST_0][MESH_0],geometry[ZONE_0][INST_0][MESH_0], iZone); + //TODO: Fix mass flow + for (iZone = 0; iZone < nZone-1; iZone++) { + if (interface[iZone][nZone-1] != nullptr) + interface[iZone][nZone-1]->GatherAverageTurboGeoValues(geometry[iZone][INST_0][MESH_0],geometry[nZone-1][INST_0][MESH_0], iZone); } /*--- Transfer number of blade to ZONE_0 to correctly compute turbo performance---*/ @@ -2764,7 +2768,7 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, nMarkerInt = config_container[donorZone]->GetnMarker_MixingPlaneInterface()/2; for (iMarkerInt = 1; iMarkerInt <= nMarkerInt; iMarkerInt++){ for (targetZone = 0; targetZone < nZone; targetZone++) { - if (targetZone != donorZone){ + if (interface_types[donorZone][targetZone]==MIXING_PLANE){ interface[donorZone][targetZone]->PreprocessAverage(geometry[donorZone][INST_0][MESH_0], geometry[targetZone][INST_0][MESH_0], config[donorZone], config[targetZone], iMarkerInt); diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index 0e2d02a0c65..ec87b210663 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -181,7 +181,6 @@ void CMultizoneDriver::StartSolver() { Preprocess(TimeIter); /*--- Run a block iteration of the multizone problem. ---*/ - switch (driver_config->GetKind_MZSolver()){ case ENUM_MULTIZONE::MZ_BLOCK_GAUSS_SEIDEL: RunGaussSeidel(); break; // Block Gauss-Seidel iteration case ENUM_MULTIZONE::MZ_BLOCK_JACOBI: RunJacobi(); break; // Block-Jacobi iteration @@ -285,21 +284,13 @@ void CMultizoneDriver::RunGaussSeidel() { for (iZone = 0; iZone < nZone; iZone++) { config_container[iZone]->SetOuterIter(0ul); - /*--- This is required for correct restarts with mixing plane interfaces and GS iterations, - * for Jacobi we always do all the transfers before iterating all zones. ---*/ - if (mixingplane) SetMixingPlane(iZone); } /*--- Loop over the number of outer iterations ---*/ - for (auto iOuter_Iter = 0ul; iOuter_Iter < driver_config->GetnOuter_Iter(); iOuter_Iter++) { - - /*--- Ramp turbo values for steady problems here, otherwise do it over time steps. ---*/ - if (!config_container[ZONE_0]->GetTime_Domain()) { - RampTurbomachineryValues(iOuter_Iter); - } + for (auto iOuter_Iter = 0ul; iOuter_Iter < driver_config->GetnOuter_Iter(); iOuter_Iter++){ /*--- Loop over the number of zones (IZONE) ---*/ - for (iZone = 0; iZone < nZone; iZone++) { + for (iZone = 0; iZone < nZone; iZone++){ /*--- In principle, the mesh does not need to be updated ---*/ UpdateMesh = 0; @@ -317,7 +308,6 @@ void CMultizoneDriver::RunGaussSeidel() { if (DeformMesh) UpdateMesh+=1; } } - /*--- If a mesh update is required due to the transfer of data ---*/ if (UpdateMesh > 0) DynamicMeshUpdate(iZone, TimeIter); @@ -326,8 +316,6 @@ void CMultizoneDriver::RunGaussSeidel() { solver_container, numerics_container, config_container, surface_movement, grid_movement, FFDBox, iZone, INST_0); - if (mixingplane) SetMixingPlane(iZone); - /*--- A corrector step can help preventing numerical instabilities ---*/ Corrector(iZone); @@ -351,10 +339,6 @@ void CMultizoneDriver::RunJacobi() { /*--- Loop over the number of outer iterations ---*/ for (auto iOuter_Iter = 0ul; iOuter_Iter < driver_config->GetnOuter_Iter(); iOuter_Iter++){ - /*--- Ramp turbo values for steady problems here, otherwise do it over time steps. ---*/ - if (!config_container[ZONE_0]->GetTime_Domain()) { - RampTurbomachineryValues(iOuter_Iter); - } /*--- Transfer from all zones ---*/ for (iZone = 0; iZone < nZone; iZone++){ @@ -377,7 +361,6 @@ void CMultizoneDriver::RunJacobi() { /*--- If a mesh update is required due to the transfer of data ---*/ if (UpdateMesh > 0) DynamicMeshUpdate(iZone, TimeIter); - if (mixingplane) SetMixingPlane(iZone); } /*--- Loop over the number of zones (IZONE) ---*/ @@ -600,6 +583,26 @@ bool CMultizoneDriver::TransferData(unsigned short donorZone, unsigned short tar BroadcastData(FLOW_SOL, FEA_SOL); break; case MIXING_PLANE: + { + auto nMarkerInt = config_container[donorZone]->GetnMarker_MixingPlaneInterface()/2; + + /* --- transfer the average value from the donorZone to the targetZone*/ + for (auto iMarkerInt = 1; iMarkerInt <= nMarkerInt; iMarkerInt++) { + interface_container[donorZone][targetZone]->AllgatherAverage(solver_container[donorZone][INST_0][MESH_0][FLOW_SOL],solver_container[targetZone][INST_0][MESH_0][FLOW_SOL], + geometry_container[donorZone][INST_0][MESH_0],geometry_container[targetZone][INST_0][MESH_0], + config_container[donorZone], config_container[targetZone], iMarkerInt ); + } + + for (donorZone = 0; donorZone < nZone-1; donorZone++) { + if (interface_types[donorZone][targetZone]==MIXING_PLANE) { + interface_container[donorZone][targetZone]->GatherAverageValues(solver_container[donorZone][INST_0][MESH_0][FLOW_SOL],solver_container[targetZone][INST_0][MESH_0][FLOW_SOL], donorZone); + interface_container[donorZone][targetZone]->GatherAverageTurboGeoValues(geometry_container[donorZone][INST_0][MESH_0],geometry_container[targetZone][INST_0][MESH_0], donorZone); + } + } + + return UpdateMesh; + break; + } case NO_TRANSFER: case ZONES_ARE_EQUAL: case NO_COMMON_INTERFACE: @@ -614,21 +617,7 @@ bool CMultizoneDriver::TransferData(unsigned short donorZone, unsigned short tar return UpdateMesh; } -void CMultizoneDriver::SetMixingPlane(unsigned short donorZone) { - const auto nMarkerInt = config_container[donorZone]->GetnMarker_MixingPlaneInterface() / 2; - - /*--- Transfer the average value from the donor zones to the target zones ---*/ - for (auto iMarkerInt = 1; iMarkerInt <= nMarkerInt; iMarkerInt++) { - for (auto targetZone = 0u; targetZone < nZone; targetZone++) { - if (targetZone == donorZone) continue; - interface_container[donorZone][targetZone]->AllgatherAverage( - solver_container[donorZone][INST_0][MESH_0][FLOW_SOL], solver_container[targetZone][INST_0][MESH_0][FLOW_SOL], - geometry_container[donorZone][INST_0][MESH_0], geometry_container[targetZone][INST_0][MESH_0], - config_container[donorZone], config_container[targetZone], iMarkerInt); - } - } -} void CMultizoneDriver::SetTurboPerformance() { for (auto donorZone = 1u; donorZone < nZone; donorZone++) { @@ -636,7 +625,6 @@ void CMultizoneDriver::SetTurboPerformance() { solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL], donorZone); } - output_container[ZONE_0]->ComputeTurboPerformance(config_container[ZONE_0], geometry_container[ZONE_0][INST_0][MESH_0], solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]); } bool CMultizoneDriver::Monitor(unsigned long TimeIter){ @@ -684,7 +672,6 @@ bool CMultizoneDriver::Monitor(unsigned long TimeIter){ return (FinalTimeReached || MaxIterationsReached); } - if (rank == MASTER_NODE) SetTurboPerformance(); } diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 1da64f36a32..c99311fb3eb 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -89,6 +89,13 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->PreprocessBC_Giles(geometry, config, conv_bound_numerics, OUTFLOW); } + if (config->GetBoolTurbomachinery()){ + /*--- Average quantities at the inflow and outflow boundaries ---*/ + + solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry,config,INFLOW); + solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry, config, OUTFLOW); + } + /*--- Weak boundary conditions ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp index c3b8df8401b..2584b9ff402 100644 --- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp +++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp @@ -668,6 +668,29 @@ void CMultiGridIntegration::NonDimensional_Parameters(CGeometry **geometry, CSol solver_container[FinestMesh][FLOW_SOL]->Momentum_Forces(geometry[FinestMesh], config); solver_container[FinestMesh][FLOW_SOL]->Friction_Forces(geometry[FinestMesh], config); + /*--- Calculate the turbo performance ---*/ + if (config->GetBoolTurbomachinery()){ + + /*--- Average quantities at the inflow and outflow boundaries ---*/ + + solver_container[FinestMesh][FLOW_SOL]->TurboAverageProcess(solver_container[FinestMesh], geometry[FinestMesh],config,INFLOW); + solver_container[FinestMesh][FLOW_SOL]->TurboAverageProcess(solver_container[FinestMesh], geometry[FinestMesh], config, OUTFLOW); + + /*--- Gather Inflow and Outflow quantities on the Master Node to compute performance ---*/ + + solver_container[FinestMesh][FLOW_SOL]->GatherInOutAverageValues(config, geometry[FinestMesh]); + + /* --- compute turboperformance for each stage and the global machine ---*/ + //TODO: for multi-zone turbo this should be move to the last zone ---*/ + // solver_container[FinestMesh][FLOW_SOL]->ComputeTurboPerformance(config, geometry[FinestMesh]); + } + + /*--- Evaluate the buffet metric if requested ---*/ + /* + if(config->GetnMarker_Monitoring() || config->GetKind_ObjFunc() == BUFFET_SENSOR){ + solver_container[FinestMesh][FLOW_SOL]->Buffet_Monitoring(geometry[FinestMesh], config); + } + */ break; case RUNTIME_ADJFLOW_SYS: diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 8a0dd350e88..5cf859b33b1 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -213,10 +213,37 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe UsedTime = StopTime - StartTime; + unsigned long Iter= config[val_iZone]->GetInnerIter(); + output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); + /*--- Turbomachinery Specific Montior ---*/ + if (config[ZONE_0]->GetBoolTurbomachinery()){ + + /*--- Turbomachinery Performance Computation ---*/ + if (val_iZone == config[ZONE_0]->GetnZone()-1){ + ComputeTurboPerformance(solver, geometry, config, config[val_iZone]->GetInnerIter()); + output->LoadTurboHistoryData(TurbomachineryStagePerformance, TurbomachineryPerformance, config[val_iZone], val_iZone); + } + + if (config[ZONE_0]->GetMultizone_Problem()) + Iter = config[ZONE_0]->GetOuterIter(); + + /*--- Turbomachinery Performance Screen summary output---*/ + if (val_iZone == config[ZONE_0]->GetnZone()-1 && Iter%100 == 0) { + output->SetTurboPerformance_Output(TurbomachineryPerformance, config[val_iZone], + config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter(), val_iZone); + if (rank == MASTER_NODE) + output->SetTurboMultiZonePerformance_Output(TurbomachineryStagePerformance, TurbomachineryPerformance, config[val_iZone]); + } + + /*--- Turbomachinery Rotation and Pressure Ramps ---*/ + TurboMonitor(geometry, config, config[val_iZone]->GetInnerIter()); + } + /*--- If convergence was reached --*/ StopCalc = output->GetConvergence(); @@ -230,6 +257,112 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe return StopCalc; } +void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) { + + su2double rot_z_ini, rot_z_final ,rot_z; + su2double outPres_ini, outPres_final, outPres; + unsigned long rampFreq, finalRamp_Iter; + unsigned short iMarker, KindBC, KindBCOption; + unsigned short iZone; + string Marker_Tag; + + bool print; + if (config_container[ZONE_0]->GetMultizone_Problem()) + ExtIter = config_container[ZONE_0]->GetOuterIter(); + + for(iZone = 0; iZone < nZone; iZone++) { + /*--- ROTATING FRAME Ramp: Compute the updated rotational velocity. ---*/ + if (config_container[iZone]->GetGrid_Movement() && config_container[iZone]->GetRampRotatingFrame()) { + rampFreq = SU2_TYPE::Int(config_container[iZone]->GetRampRotatingFrame_Coeff(1)); + finalRamp_Iter = SU2_TYPE::Int(config_container[iZone]->GetRampRotatingFrame_Coeff(2)); + rot_z_ini = config_container[iZone]->GetRampRotatingFrame_Coeff(0); + print = false; + if(ExtIter % rampFreq == 0 && ExtIter <= finalRamp_Iter){ + rot_z_final = config_container[iZone]->GetFinalRotation_Rate_Z(); + if(abs(rot_z_final) > 0.0){ + rot_z = rot_z_ini + ExtIter*( rot_z_final - rot_z_ini)/finalRamp_Iter; + config_container[iZone]->SetRotation_Rate(2, rot_z); + if(rank == MASTER_NODE && print && ExtIter > 0) { + cout << endl << " Updated rotating frame grid velocities"; + cout << " for zone " << iZone << "." << endl; + } + geometry_container[iZone][INST_0][MESH_0]->SetRotationalVelocity(config_container[iZone], print); + geometry_container[iZone][INST_0][MESH_0]->SetShroudVelocity(config_container[iZone]); + } + + for (iZone = 0; iZone < nZone; iZone++) { + geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone], iZone, INFLOW, false); + geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone],iZone, OUTFLOW, false); + geometry_container[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config_container[iZone], false); + + } + } + } + } + + + /*--- Outlet Pressure Ramp: Compute the updated rotational velocity. ---*/ + if (config_container[ZONE_0]->GetRampOutletPressure()) { + rampFreq = SU2_TYPE::Int(config_container[ZONE_0]->GetRampOutletPressure_Coeff(1)); + finalRamp_Iter = SU2_TYPE::Int(config_container[ZONE_0]->GetRampOutletPressure_Coeff(2)); + outPres_ini = config_container[ZONE_0]->GetRampOutletPressure_Coeff(0); + outPres_final = config_container[ZONE_0]->GetFinalOutletPressure(); + + if(ExtIter % rampFreq == 0 && ExtIter <= finalRamp_Iter){ + outPres = outPres_ini + ExtIter*(outPres_final - outPres_ini)/finalRamp_Iter; + if(rank == MASTER_NODE) config_container[ZONE_0]->SetMonitotOutletPressure(outPres); + + for (iZone = 0; iZone < nZone; iZone++) { + for (iMarker = 0; iMarker < config_container[iZone]->GetnMarker_All(); iMarker++) { + KindBC = config_container[iZone]->GetMarker_All_KindBC(iMarker); + switch (KindBC) { + case RIEMANN_BOUNDARY: + Marker_Tag = config_container[iZone]->GetMarker_All_TagBound(iMarker); + KindBCOption = config_container[iZone]->GetKind_Data_Riemann(Marker_Tag); + if(KindBCOption == STATIC_PRESSURE || KindBCOption == RADIAL_EQUILIBRIUM ){ + SU2_MPI::Error("Outlet pressure ramp only implemented for NRBC", CURRENT_FUNCTION); + } + break; + case GILES_BOUNDARY: + Marker_Tag = config_container[iZone]->GetMarker_All_TagBound(iMarker); + KindBCOption = config_container[iZone]->GetKind_Data_Giles(Marker_Tag); + if(KindBCOption == STATIC_PRESSURE || KindBCOption == STATIC_PRESSURE_1D || KindBCOption == RADIAL_EQUILIBRIUM ){ + config_container[iZone]->SetGiles_Var1(outPres, Marker_Tag); + } + break; + } + } + } + } + } +} + +void CFluidIteration::ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) { + unsigned short nDim = geometry_container[ZONE_0][INST_0][MESH_0]->GetnDim(); + unsigned short nBladesRow = config_container[ZONE_0]->GetnMarker_Turbomachinery(); + unsigned short iBlade=0, iSpan; + vector TurboPrimitiveIn, TurboPrimitiveOut; + std::vector> bladesPrimitives; + + if (rank == MASTER_NODE) { + for (iBlade = 0; iBlade < nBladesRow; iBlade++){ + /* Blade Primitive initialized per blade */ + std::vector bladePrimitives; + auto nSpan = config_container[iBlade]->GetnSpanWiseSections(); + for (iSpan = 0; iSpan < nSpan + 1; iSpan++) { + TurboPrimitiveIn= solver[iBlade][INST_0][MESH_0][FLOW_SOL]->GetTurboPrimitive(iBlade, iSpan, true); + TurboPrimitiveOut= solver[iBlade][INST_0][MESH_0][FLOW_SOL]->GetTurboPrimitive(iBlade, iSpan, false); + auto spanInletPrimitive = CTurbomachineryPrimitiveState(TurboPrimitiveIn, nDim, geometry_container[iBlade][INST_0][MESH_0]->GetTangGridVelIn(iBlade, iSpan)); + auto spanOutletPrimitive = CTurbomachineryPrimitiveState(TurboPrimitiveOut, nDim, geometry_container[iBlade][INST_0][MESH_0]->GetTangGridVelOut(iBlade, iSpan)); + auto spanCombinedPrimitive = CTurbomachineryCombinedPrimitiveStates(spanInletPrimitive, spanOutletPrimitive); + bladePrimitives.push_back(spanCombinedPrimitive); + } + bladesPrimitives.push_back(bladePrimitives); + } + TurbomachineryPerformance->ComputeTurbomachineryPerformance(bladesPrimitives); + } +} + void CFluidIteration::Postprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver, CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, CVolumetricMovement*** grid_movement, diff --git a/SU2_CFD/src/iteration/CTurboIteration.cpp b/SU2_CFD/src/iteration/CTurboIteration.cpp index 464ae8186ea..bd73894db42 100644 --- a/SU2_CFD/src/iteration/CTurboIteration.cpp +++ b/SU2_CFD/src/iteration/CTurboIteration.cpp @@ -27,6 +27,7 @@ #include "../../include/iteration/CTurboIteration.hpp" #include "../../include/output/COutput.hpp" +#include "../../include/output/CTurboOutput.hpp" void CTurboIteration::Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver, CNumerics****** numerics, CConfig** config, @@ -37,6 +38,10 @@ void CTurboIteration::Preprocess(COutput* output, CIntegration**** integration, solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], INFLOW); solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->TurboAverageProcess( solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], OUTFLOW); + + if (config[val_iZone]->GetBoolTurbomachinery()) { + InitTurboPerformance(geometry[val_iZone][INST_0][MESH_0], config[val_iZone], solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetFluidModel()); + } } void CTurboIteration::Postprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, @@ -53,3 +58,8 @@ void CTurboIteration::Postprocess(COutput* output, CIntegration**** integration, solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GatherInOutAverageValues(config[val_iZone], geometry[val_iZone][val_iInst][MESH_0]); } + +void CTurboIteration::InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid){ + TurbomachineryPerformance = std::make_shared(*config, *geometry, *fluid); + TurbomachineryStagePerformance = new CTurbomachineryStagePerformance(*fluid); +} diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index 9ca0188ffc0..71d20e42842 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -30,6 +30,7 @@ su2_cfd_src += files(['output/COutputFactory.cpp', 'output/CHeatOutput.cpp', 'output/CMeshOutput.cpp', 'output/CNEMOCompOutput.cpp', + 'output/CTurboOutput.cpp' , 'output/COutput.cpp', 'output/filewriter/CParallelDataSorter.cpp', 'output/filewriter/CFVMDataSorter.cpp', diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index af424a39f7e..0f32bbb2a41 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -97,10 +97,6 @@ CFlowCompOutput::CFlowCompOutput(const CConfig *config, unsigned short nDim) : C } } - if (config->GetBoolTurbomachinery()) { - /*--- Initialise turboperformance variables ---*/ - InitTurboPerformance(config); - } } void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ @@ -214,41 +210,38 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ /// BEGIN_GROUP: TURBO_PERF, DESCRIPTION: Turboperformance variables if (config->GetBoolTurbomachinery()) { - unsigned short iMarker_Monitoring; - for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_TurboPerformance(); iMarker_Monitoring++) { + //Adds zone turboperformance history variables + for (unsigned short iZone = 0; iZone <= config->GetnZone() - 1; iZone++) { stringstream tag; - tag << iMarker_Monitoring + 1; - /// DESCRIPTION: Total pressure loss - AddHistoryOutput("TotalPressureLoss_" + tag.str(), "TotPressureLoss_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Kinetic energy loss - AddHistoryOutput("KineticEnergyLoss_" + tag.str(), "KineticEnergyLoss_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Entropy generation - AddHistoryOutput("EntropyGeneration_" + tag.str(), "EntropyGen_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Eulerian work - AddHistoryOutput("EulerianWork_" + tag.str(), "EulerianWork_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Pressure ratio - AddHistoryOutput("PressureRatio_" + tag.str(), "PressureRatio_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: FLow angle in - AddHistoryOutput("FlowAngleIn_" + tag.str(), "FlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Flow angle out - AddHistoryOutput("FlowAngleOut_" + tag.str(), "FlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Absolute flow angle in - AddHistoryOutput("AbsFlowAngleIn_" + tag.str(), "AbsFlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Absolute flow angle out - AddHistoryOutput("AbsFlowAngleOut_" + tag.str(), "AbsFlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Mass flow in - AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Mass flow out - AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Mach in - AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Mach out - AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Total efficiency - AddHistoryOutput("TotalEfficiency_" + tag.str(), "TotalEfficiency_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); - /// DESCRIPTION: Total-to-static efficiency - AddHistoryOutput("TotalStaticEfficiency_" + tag.str(), "TotalStaticEfficiency_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + tag << iZone + 1; + AddHistoryOutput("EntropyIn_" + tag.str(), "EntropyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("EntropyOut_" + tag.str(), "EntropyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEntahalpyIn_" + tag.str(), "TotalEntahalpyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEnthalpyOut_" + tag.str(), "TotalEnthalpyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureIn_" + tag.str(), "TotPressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureOut_" + tag.str(), "TotPressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureIn_" + tag.str(), "PressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureOut_" + tag.str(), "PressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityIn_" + tag.str(), "DensityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityOut_" + tag.str(), "DensityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityIn_" + tag.str(), "NormalVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityOut_" + tag.str(), "NormalVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityIn_" + tag.str(), "TangentialVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityOut_" + tag.str(), "TangentialVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("FlowAngleIn_" + tag.str(), "FlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("FlowAngleOut_" + tag.str(), "FlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); } + //Adds turbomachinery machine performance variables + AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("EulerianWork", "EulerianWork", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalStaticEfficiency", "TotStaticEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalTotalEfficiency", "TotTotEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureRatioTS", "PRTS", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureRatioTT", "PRTT", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); } } @@ -485,29 +478,6 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol if (config->GetEquivArea()) SetNearfieldInverseDesign(flow_solver, geometry, config); - if (config->GetBoolTurbomachinery()){ - - unsigned short iMarker_Monitoring; - for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_TurboPerformance(); iMarker_Monitoring++) { - stringstream tag; - tag << iMarker_Monitoring + 1; - SetHistoryOutputValue("TotalPressureLoss_" + tag.str(), TotalPressureLoss[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("KineticEnergyLoss_" + tag.str(), KineticEnergyLoss[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("EntropyGeneration_" + tag.str(), EntropyGen[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("EulerianWork_" + tag.str(), EulerianWork[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("PressureRatio_" + tag.str(), PressureRatio[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("FlowAngleIn_" + tag.str(), 180/PI_NUMBER*FlowAngleIn[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("FlowAngleOut_" + tag.str(), 180/PI_NUMBER*FlowAngleOut[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), 180/PI_NUMBER*AbsFlowAngleIn[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), 180/PI_NUMBER*AbsFlowAngleOut[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("MassFlowIn_" + tag.str(), MassFlowIn[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("MassFlowOut_" + tag.str(), MassFlowOut[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("MachIn_" + tag.str(), sqrt(MachIn[iMarker_Monitoring][nSpanWiseSections][1]*MachIn[iMarker_Monitoring][nSpanWiseSections][1] + MachIn[iMarker_Monitoring][nSpanWiseSections][0]*MachIn[iMarker_Monitoring][nSpanWiseSections][0])); - SetHistoryOutputValue("MachOut_" + tag.str(), sqrt(MachOut[iMarker_Monitoring][nSpanWiseSections][1]*MachOut[iMarker_Monitoring][nSpanWiseSections][1] + MachOut[iMarker_Monitoring][nSpanWiseSections][0]*MachOut[iMarker_Monitoring][nSpanWiseSections][0])); - SetHistoryOutputValue("TotalEfficiency_" + tag.str(), TotalTotalEfficiency[iMarker_Monitoring][nSpanWiseSections]); - SetHistoryOutputValue("TotalStaticEfficiency_" + tag.str(), TotalStaticEfficiency[iMarker_Monitoring][nSpanWiseSections]); - } - } /*--- Keep this as last, since it uses the history values that were set. ---*/ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index b95b4ad6018..cae8762b9da 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -29,6 +29,7 @@ #include "../../include/solvers/CSolver.hpp" #include "../../include/output/COutput.hpp" +#include "../../include/output/CTurboOutput.hpp" #include "../../include/output/filewriter/CFVMDataSorter.hpp" #include "../../include/output/filewriter/CFEMDataSorter.hpp" #include "../../include/output/filewriter/CCGNSFileWriter.hpp" @@ -169,7 +170,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): surfaceDataSorter = nullptr; headerNeeded = false; - + } COutput::~COutput(void) { @@ -2477,436 +2478,135 @@ void COutput::PrintVolumeFields(){ } } -void COutput::InitTurboPerformance(const CConfig *config){ - unsigned short iDim, iSpan, iMarker; - - /*--- Initializate quantities for turboperformace ---*/ - nSpanWiseSections = config->GetnSpanMaxAllZones(); - nMarkerTurboPerf = config->GetnMarker_TurboPerformance(); - - - TotalStaticEfficiency = new su2double*[nMarkerTurboPerf]; - TotalTotalEfficiency = new su2double*[nMarkerTurboPerf]; - KineticEnergyLoss = new su2double*[nMarkerTurboPerf]; - TRadius = new su2double*[nMarkerTurboPerf]; - TotalPressureLoss = new su2double*[nMarkerTurboPerf]; - MassFlowIn = new su2double*[nMarkerTurboPerf]; - MassFlowOut = new su2double*[nMarkerTurboPerf]; - FlowAngleIn = new su2double*[nMarkerTurboPerf]; - FlowAngleIn_BC = new su2double*[nMarkerTurboPerf]; - FlowAngleOut = new su2double*[nMarkerTurboPerf]; - EulerianWork = new su2double*[nMarkerTurboPerf]; - TotalEnthalpyIn = new su2double*[nMarkerTurboPerf]; - TotalEnthalpyIn_BC = new su2double*[nMarkerTurboPerf]; - EntropyIn = new su2double*[nMarkerTurboPerf]; - EntropyOut = new su2double*[nMarkerTurboPerf]; - EntropyIn_BC = new su2double*[nMarkerTurboPerf]; - PressureRatio = new su2double*[nMarkerTurboPerf]; - TotalTemperatureIn = new su2double*[nMarkerTurboPerf]; - EnthalpyOut = new su2double*[nMarkerTurboPerf]; - MachIn = new su2double**[nMarkerTurboPerf]; - MachOut = new su2double**[nMarkerTurboPerf]; - VelocityOutIs = new su2double*[nMarkerTurboPerf]; - DensityIn = new su2double*[nMarkerTurboPerf]; - PressureIn = new su2double*[nMarkerTurboPerf]; - TurboVelocityIn = new su2double**[nMarkerTurboPerf]; - DensityOut = new su2double*[nMarkerTurboPerf]; - PressureOut = new su2double*[nMarkerTurboPerf]; - TurboVelocityOut = new su2double**[nMarkerTurboPerf]; - EnthalpyOutIs = new su2double*[nMarkerTurboPerf]; - EntropyGen = new su2double*[nMarkerTurboPerf]; - AbsFlowAngleIn = new su2double*[nMarkerTurboPerf]; - TotalEnthalpyOut = new su2double*[nMarkerTurboPerf]; - TotalEnthalpyOutIs = new su2double*[nMarkerTurboPerf]; - RothalpyIn = new su2double*[nMarkerTurboPerf]; - RothalpyOut = new su2double*[nMarkerTurboPerf]; - AbsFlowAngleOut = new su2double*[nMarkerTurboPerf]; - PressureOut_BC = new su2double*[nMarkerTurboPerf]; - TemperatureIn = new su2double*[nMarkerTurboPerf]; - TemperatureOut = new su2double*[nMarkerTurboPerf]; - TotalPressureIn = new su2double*[nMarkerTurboPerf]; - TotalPressureOut = new su2double*[nMarkerTurboPerf]; - TotalTemperatureOut = new su2double*[nMarkerTurboPerf]; - EnthalpyIn = new su2double*[nMarkerTurboPerf]; - TurbIntensityIn = new su2double*[nMarkerTurboPerf]; - Turb2LamViscRatioIn = new su2double*[nMarkerTurboPerf]; - TurbIntensityOut = new su2double*[nMarkerTurboPerf]; - Turb2LamViscRatioOut = new su2double*[nMarkerTurboPerf]; - NuFactorIn = new su2double*[nMarkerTurboPerf]; - NuFactorOut = new su2double*[nMarkerTurboPerf]; - - for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++){ - TotalStaticEfficiency [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalTotalEfficiency [iMarker] = new su2double [nSpanWiseSections + 1]; - KineticEnergyLoss [iMarker] = new su2double [nSpanWiseSections + 1]; - TRadius [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalPressureLoss [iMarker] = new su2double [nSpanWiseSections + 1]; - MassFlowIn [iMarker] = new su2double [nSpanWiseSections + 1]; - MassFlowOut [iMarker] = new su2double [nSpanWiseSections + 1]; - FlowAngleIn [iMarker] = new su2double [nSpanWiseSections + 1]; - FlowAngleIn_BC [iMarker] = new su2double [nSpanWiseSections + 1]; - FlowAngleOut [iMarker] = new su2double [nSpanWiseSections + 1]; - EulerianWork [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalEnthalpyIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalEnthalpyIn_BC [iMarker] = new su2double [nSpanWiseSections + 1]; - EntropyIn [iMarker] = new su2double [nSpanWiseSections + 1]; - EntropyOut [iMarker] = new su2double [nSpanWiseSections + 1]; - EntropyIn_BC [iMarker] = new su2double [nSpanWiseSections + 1]; - PressureRatio [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalTemperatureIn [iMarker] = new su2double [nSpanWiseSections + 1]; - EnthalpyOut [iMarker] = new su2double [nSpanWiseSections + 1]; - MachIn [iMarker] = new su2double*[nSpanWiseSections + 1]; - MachOut [iMarker] = new su2double*[nSpanWiseSections + 1]; - VelocityOutIs [iMarker] = new su2double [nSpanWiseSections + 1]; - DensityIn [iMarker] = new su2double [nSpanWiseSections + 1]; - PressureIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TurboVelocityIn [iMarker] = new su2double*[nSpanWiseSections + 1]; - DensityOut [iMarker] = new su2double [nSpanWiseSections + 1]; - PressureOut [iMarker] = new su2double [nSpanWiseSections + 1]; - TurboVelocityOut [iMarker] = new su2double*[nSpanWiseSections + 1]; - EnthalpyOutIs [iMarker] = new su2double [nSpanWiseSections + 1]; - EntropyGen [iMarker] = new su2double [nSpanWiseSections + 1]; - AbsFlowAngleIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalEnthalpyOut [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalEnthalpyOutIs [iMarker] = new su2double [nSpanWiseSections + 1]; - RothalpyIn [iMarker] = new su2double [nSpanWiseSections + 1]; - RothalpyOut [iMarker] = new su2double [nSpanWiseSections + 1]; - AbsFlowAngleOut [iMarker] = new su2double [nSpanWiseSections + 1]; - PressureOut_BC [iMarker] = new su2double [nSpanWiseSections + 1]; - TemperatureIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TemperatureOut [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalPressureIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalPressureOut [iMarker] = new su2double [nSpanWiseSections + 1]; - TotalTemperatureOut [iMarker] = new su2double [nSpanWiseSections + 1]; - EnthalpyIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TurbIntensityIn [iMarker] = new su2double [nSpanWiseSections + 1]; - Turb2LamViscRatioIn [iMarker] = new su2double [nSpanWiseSections + 1]; - TurbIntensityOut [iMarker] = new su2double [nSpanWiseSections + 1]; - Turb2LamViscRatioOut [iMarker] = new su2double [nSpanWiseSections + 1]; - NuFactorIn [iMarker] = new su2double [nSpanWiseSections + 1]; - NuFactorOut [iMarker] = new su2double [nSpanWiseSections + 1]; - - - for (iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++){ - TotalStaticEfficiency [iMarker][iSpan] = 0.0; - TotalTotalEfficiency [iMarker][iSpan] = 0.0; - KineticEnergyLoss [iMarker][iSpan] = 0.0; - TRadius [iMarker][iSpan] = 0.0; - TotalPressureLoss [iMarker][iSpan] = 0.0; - MassFlowIn [iMarker][iSpan] = 0.0; - MassFlowOut [iMarker][iSpan] = 0.0; - FlowAngleIn [iMarker][iSpan] = 0.0; - FlowAngleIn_BC [iMarker][iSpan] = config->GetFlowAngleIn_BC(); - FlowAngleOut [iMarker][iSpan] = 0.0; - EulerianWork [iMarker][iSpan] = 0.0; - TotalEnthalpyIn [iMarker][iSpan] = 0.0; - TotalEnthalpyIn_BC [iMarker][iSpan] = 0.0; - EntropyIn [iMarker][iSpan] = 0.0; - EntropyOut [iMarker][iSpan] = 0.0; - EntropyIn_BC [iMarker][iSpan] = 0.0; - PressureRatio [iMarker][iSpan] = 0.0; - TotalTemperatureIn [iMarker][iSpan] = 0.0; - EnthalpyOut [iMarker][iSpan] = 0.0; - - - VelocityOutIs [iMarker][iSpan] = 0.0; - DensityIn [iMarker][iSpan] = 0.0; - PressureIn [iMarker][iSpan] = 0.0; - - DensityOut [iMarker][iSpan] = 0.0; - PressureOut [iMarker][iSpan] = 0.0; - - EnthalpyOutIs [iMarker][iSpan] = 0.0; - EntropyGen [iMarker][iSpan] = 0.0; - AbsFlowAngleIn [iMarker][iSpan] = 0.0; - TotalEnthalpyOut [iMarker][iSpan] = 0.0; - TotalEnthalpyOutIs [iMarker][iSpan] = 0.0; - RothalpyIn [iMarker][iSpan] = 0.0; - RothalpyOut [iMarker][iSpan] = 0.0; - AbsFlowAngleOut [iMarker][iSpan] = 0.0; - PressureOut_BC [iMarker][iSpan] = config->GetPressureOut_BC(); - - TemperatureIn [iMarker][iSpan] = 0.0; - TemperatureOut [iMarker][iSpan] = 0.0; - TotalPressureIn [iMarker][iSpan] = 0.0; - TotalPressureOut [iMarker][iSpan] = 0.0; - TotalTemperatureOut [iMarker][iSpan] = 0.0; - EnthalpyIn [iMarker][iSpan] = 0.0; - TurbIntensityIn [iMarker][iSpan] = 0.0; - Turb2LamViscRatioIn [iMarker][iSpan] = 0.0; - TurbIntensityOut [iMarker][iSpan] = 0.0; - Turb2LamViscRatioOut [iMarker][iSpan] = 0.0; - NuFactorIn [iMarker][iSpan] = 0.0; - NuFactorOut [iMarker][iSpan] = 0.0; - MachIn [iMarker][iSpan] = new su2double[4]; - MachOut [iMarker][iSpan] = new su2double[4]; - TurboVelocityIn [iMarker][iSpan] = new su2double[4]; - TurboVelocityOut [iMarker][iSpan] = new su2double[4]; - - for (iDim = 0; iDim < 4; iDim++){ - MachIn [iMarker][iSpan][iDim] = 0.0; - MachOut [iMarker][iSpan][iDim] = 0.0; - TurboVelocityIn [iMarker][iSpan][iDim] = 0.0; - TurboVelocityOut [iMarker][iSpan][iDim] = 0.0; - } - } - } -} - -void COutput::ComputeTurboPerformance(CConfig *config, CGeometry *geometry, CSolver *solver){ - CFluidModel *FluidModel; - unsigned short nDim = geometry->GetnDim(); - unsigned short iMarkerTP, iSpan, iDim, iStage, iBlade; - unsigned short nMarkerTP = config->GetnMarker_Turbomachinery(); - FluidModel = solver->GetFluidModel(); - su2double area, absVel2, soundSpeed, mach, tangVel, tangVel2, *relVel, relVel2; - su2double relPressureIn, relPressureOut, enthalpyOutIs, relVelOutIs2; - relVel = new su2double[nDim]; - su2double muLam, kine, omega, nu; - bool turbulent = ((config->GetKind_Solver() == MAIN_SOLVER::RANS) || (config->GetKind_Solver() == MAIN_SOLVER::DISC_ADJ_RANS)); - bool menter_sst = (config->GetKind_Turb_Model() == TURB_MODEL::SST); - - unsigned short nBladesRow, nStages; - - nBladesRow = config->GetnMarker_Turbomachinery(); - nStages = SU2_TYPE::Int(nBladesRow/2); - - - /*--- Compute BC imposed value for convergence monitoring ---*/ - for(iMarkerTP = 0; iMarkerTP < nMarkerTP; iMarkerTP++ ){ - for(iSpan = 0; iSpan < config->GetnSpan_iZones(iMarkerTP) + 1; iSpan++){ - if(config->GetRampOutletPressure() && config->GetInnerIter() > 0){ - PressureOut_BC[iMarkerTP][iSpan] = config->GetMonitorOutletPressure()/config->GetPressure_Ref(); - } - FluidModel->SetTDState_PT(config->GetTotalPressureIn_BC(), config->GetTotalTemperatureIn_BC()); - TotalEnthalpyIn_BC[iMarkerTP][iSpan] = FluidModel->GetStaticEnergy()+ FluidModel->GetPressure()/FluidModel->GetDensity(); - EntropyIn_BC[iMarkerTP][iSpan] = FluidModel->GetEntropy(); - } - } - - /*--- Compute performance for each blade ---*/ - for(iMarkerTP = 0; iMarkerTP < nMarkerTP; iMarkerTP++ ){ - for(iSpan = 0; iSpan < config->GetnSpan_iZones(iMarkerTP) + 1; iSpan++){ - - - /*--- INFLOW ---*/ - /*--- Retrieve Inflow primitive quantities ---*/ - DensityIn[iMarkerTP][iSpan] = solver->GetDensityIn(iMarkerTP, iSpan); - PressureIn[iMarkerTP][iSpan] = solver->GetPressureIn(iMarkerTP, iSpan); - - absVel2 = 0.0; - - for (iDim = 0; iDim < nDim; iDim++){ - TurboVelocityIn[iMarkerTP][iSpan][iDim] = solver->GetTurboVelocityIn(iMarkerTP, iSpan)[iDim]; - absVel2 += TurboVelocityIn[iMarkerTP][iSpan][iDim]*TurboVelocityIn[iMarkerTP][iSpan][iDim]; - } - TurboVelocityIn[iMarkerTP][iSpan][nDim] = sqrt(absVel2); - - TRadius[iMarkerTP][iSpan] = geometry->GetTurboRadiusIn(iMarkerTP, iSpan); - area = geometry->GetSpanAreaIn(iMarkerTP, iSpan); - - /*--- Compute static Inflow quantities ---*/ - FluidModel->SetTDState_Prho(PressureIn[iMarkerTP][iSpan], DensityIn[iMarkerTP][iSpan]); - EntropyIn[iMarkerTP][iSpan] = FluidModel->GetEntropy(); - MassFlowIn[iMarkerTP][iSpan] = config->GetnBlades(iMarkerTP)*DensityIn[iMarkerTP][iSpan]*TurboVelocityIn[iMarkerTP][iSpan][0]*area; - AbsFlowAngleIn[iMarkerTP][iSpan] = atan(TurboVelocityIn[iMarkerTP][iSpan][1]/TurboVelocityIn[iMarkerTP][iSpan][0]); - EnthalpyIn[iMarkerTP][iSpan] = FluidModel->GetStaticEnergy() + PressureIn[iMarkerTP][iSpan]/DensityIn[iMarkerTP][iSpan]; - soundSpeed = FluidModel->GetSoundSpeed(); - - - /*--- Compute Total Inflow quantities ---*/ - TotalEnthalpyIn[iMarkerTP][iSpan] = EnthalpyIn[iMarkerTP][iSpan] + 0.5*absVel2; - FluidModel->SetTDState_hs(TotalEnthalpyIn[iMarkerTP][iSpan], EntropyIn[iMarkerTP][iSpan]); - TotalPressureIn[iMarkerTP][iSpan] = FluidModel->GetPressure(); - TotalTemperatureIn[iMarkerTP][iSpan] = FluidModel->GetTemperature(); - - /*--- Retrieve Inflow relative quantities ---*/ - tangVel = geometry->GetTangGridVelIn(iMarkerTP, iSpan); - tangVel2 = tangVel*tangVel; - - for (iDim = 0; iDim < nDim; iDim++){ - relVel[iDim] = TurboVelocityIn[iMarkerTP][iSpan][iDim]; - } - relVel[1] -= tangVel; - - relVel2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - relVel2 += relVel[iDim]*relVel[iDim]; - } - - /*--- Compute Total relative Inflow quantities ---*/ - RothalpyIn[iMarkerTP][iSpan] = EnthalpyIn[iMarkerTP][iSpan] + 0.5*relVel2 - 0.5*tangVel2; - FluidModel->SetTDState_hs(RothalpyIn[iMarkerTP][iSpan], EntropyIn[iMarkerTP][iSpan]); - relPressureIn = FluidModel->GetPressure(); - - /*--- Compute kinematic relative Inflow quantities ---*/ - FlowAngleIn[iMarkerTP][iSpan] = atan(relVel[1]/relVel[0]); - mach = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - MachIn[iMarkerTP][iSpan][iDim] = relVel[iDim]/soundSpeed; - mach = MachIn[iMarkerTP][iSpan][iDim]*MachIn[iMarkerTP][iSpan][iDim]; - } - MachIn[iMarkerTP][iSpan][nDim] = sqrt(mach); - - /*--- Compute Turbulent Inflow quantities ---*/ - if(turbulent){ - FluidModel->SetTDState_Prho(PressureIn[iMarkerTP][iSpan], DensityIn[iMarkerTP][iSpan]); - muLam = FluidModel->GetLaminarViscosity(); - if(menter_sst){ - kine = solver->GetKineIn(iMarkerTP, iSpan); - omega = solver->GetOmegaIn(iMarkerTP, iSpan); - TurbIntensityIn[iMarkerTP][iSpan] = sqrt(2.0/3.0*kine/absVel2); - Turb2LamViscRatioIn[iMarkerTP][iSpan] = DensityIn[iMarkerTP][iSpan]*kine/(muLam*omega); -// TurbIntensityIn[iMarkerTP][iSpan] = kine; -// Turb2LamViscRatioIn[iMarkerTP][iSpan] = omega; - } - else{ - nu = solver->GetNuIn(iMarkerTP, iSpan); - NuFactorIn[iMarkerTP][iSpan] = nu*DensityIn[iMarkerTP][iSpan]/muLam; - } - } - - /*--- OUTFLOW ---*/ - /*--- Retrieve Outflow primitive quantities ---*/ - DensityOut[iMarkerTP][iSpan] = solver->GetDensityOut(iMarkerTP, iSpan); - PressureOut[iMarkerTP][iSpan] = solver->GetPressureOut(iMarkerTP, iSpan); - absVel2 = 0.0; - - for (iDim = 0; iDim < nDim; iDim++){ - TurboVelocityOut[iMarkerTP][iSpan][iDim] = solver->GetTurboVelocityOut(iMarkerTP, iSpan)[iDim]; - absVel2 += TurboVelocityOut[iMarkerTP][iSpan][iDim]*TurboVelocityOut[iMarkerTP][iSpan][iDim]; - } - TurboVelocityOut[iMarkerTP][iSpan][nDim] = sqrt(absVel2); - - - for (iDim = 0; iDim < 3; iDim++){ - } - area = geometry->GetSpanAreaOut(iMarkerTP, iSpan); - - - /*--- Compute all the Outflow quantities ---*/ - FluidModel->SetTDState_Prho(PressureOut[iMarkerTP][iSpan], DensityOut[iMarkerTP][iSpan]); - EntropyOut[iMarkerTP][iSpan] = FluidModel->GetEntropy(); - MassFlowOut[iMarkerTP][iSpan] = config->GetnBlades(iMarkerTP)*DensityOut[iMarkerTP][iSpan]*TurboVelocityOut[iMarkerTP][iSpan][0]*area; - AbsFlowAngleOut[iMarkerTP][iSpan] = atan(TurboVelocityOut[iMarkerTP][iSpan][1]/TurboVelocityOut[iMarkerTP][iSpan][0]); - EnthalpyOut[iMarkerTP][iSpan] = FluidModel->GetStaticEnergy() + PressureOut[iMarkerTP][iSpan]/DensityOut[iMarkerTP][iSpan]; - soundSpeed = FluidModel->GetSoundSpeed(); - - /*--- Compute Total Outflow quantities ---*/ - TotalEnthalpyOut[iMarkerTP][iSpan] = EnthalpyOut[iMarkerTP][iSpan] + 0.5*absVel2; - FluidModel->SetTDState_hs(TotalEnthalpyOut[iMarkerTP][iSpan], EntropyOut[iMarkerTP][iSpan]); - TotalPressureOut[iMarkerTP][iSpan] = FluidModel->GetPressure(); - TotalTemperatureOut[iMarkerTP][iSpan] = FluidModel->GetTemperature(); - - /*--- Retrieve relative Outflow quantities ---*/ - tangVel = geometry->GetTangGridVelOut(iMarkerTP, iSpan); - tangVel2 = tangVel*tangVel; - - for (iDim = 0; iDim < nDim; iDim++){ - relVel[iDim] = TurboVelocityOut[iMarkerTP][iSpan][iDim]; - } - relVel[1] -= tangVel; - - relVel2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - relVel2 += relVel[iDim]*relVel[iDim]; - } - - /*--- Compute Total relative Outflow quantities ---*/ - RothalpyOut[iMarkerTP][iSpan] = EnthalpyOut[iMarkerTP][iSpan] + 0.5*relVel2 - 0.5*tangVel2; - FluidModel->SetTDState_hs(RothalpyOut[iMarkerTP][iSpan], EntropyOut[iMarkerTP][iSpan]); - relPressureOut = FluidModel->GetPressure(); - - /*--- Compute isentropic Outflow quantities ---*/ - FluidModel->SetTDState_Ps(PressureOut[iMarkerTP][iSpan], EntropyIn[iMarkerTP][iSpan]); - enthalpyOutIs = FluidModel->GetStaticEnergy() + PressureOut[iMarkerTP][iSpan]/FluidModel->GetDensity(); - relVelOutIs2 = 2*(RothalpyOut[iMarkerTP][iSpan] - enthalpyOutIs) + tangVel2; - - - /*--- Compute kinematic relative Outflow quantities ---*/ - FlowAngleOut[iMarkerTP][iSpan] = atan(relVel[1]/relVel[0]); - mach = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - MachOut[iMarkerTP][iSpan][iDim] = relVel[iDim]/soundSpeed; - mach = MachOut[iMarkerTP][iSpan][iDim]*MachOut[iMarkerTP][iSpan][iDim]; - } - MachOut[iMarkerTP][iSpan][nDim] = sqrt(mach); - - /*--- Compute Turbulent Outflow quantities ---*/ - if(turbulent){ - FluidModel->SetTDState_Prho(PressureOut[iMarkerTP][iSpan], DensityOut[iMarkerTP][iSpan]); - muLam = FluidModel->GetLaminarViscosity(); - if(menter_sst){ - kine = solver->GetKineOut(iMarkerTP, iSpan); - omega = solver->GetOmegaOut(iMarkerTP, iSpan); - TurbIntensityOut[iMarkerTP][iSpan] = sqrt(2.0/3.0*kine/absVel2); - Turb2LamViscRatioOut[iMarkerTP][iSpan] = DensityOut[iMarkerTP][iSpan]*kine/(muLam*omega); -// TurbIntensityOut[iMarkerTP][iSpan] = kine; -// Turb2LamViscRatioOut[iMarkerTP][iSpan] = omega; - } - else{ - nu = solver->GetNuOut(iMarkerTP, iSpan); - NuFactorOut[iMarkerTP][iSpan] = nu*DensityOut[iMarkerTP][iSpan]/muLam; - } - } +void COutput::SetTurboPerformance_Output(std::shared_ptr TurboPerf, + CConfig *config, + unsigned long TimeIter, + unsigned long OuterIter, + unsigned long InnerIter, + unsigned short val_iZone) { - /*--- TURBO-PERFORMANCE---*/ - EntropyGen[iMarkerTP][iSpan] = (EntropyOut[iMarkerTP][iSpan] - EntropyIn[iMarkerTP][iSpan])/abs(EntropyIn_BC[iMarkerTP][iSpan] + 1); - EulerianWork[iMarkerTP][iSpan] = TotalEnthalpyIn[iMarkerTP][iSpan] - TotalEnthalpyOut[iMarkerTP][iSpan]; - TotalPressureLoss[iMarkerTP][iSpan] = (relPressureIn - relPressureOut)/(relPressureIn - PressureOut[iMarkerTP][iSpan]); - KineticEnergyLoss[iMarkerTP][iSpan] = 2*(EnthalpyOut[iMarkerTP][iSpan] - enthalpyOutIs)/relVelOutIs2; - PressureRatio[iMarkerTP][iSpan] = TotalPressureOut[iMarkerTP][iSpan]/TotalPressureIn[iMarkerTP][iSpan]; - EnthalpyOutIs[iMarkerTP][iSpan] = (pow(TotalPressureOut[iMarkerTP][iSpan]/TotalPressureIn[iMarkerTP][iSpan], 0.4/1.4) - 1.0)/(TotalTemperatureOut[iMarkerTP][iSpan]/TotalTemperatureIn[iMarkerTP][iSpan] -1.0); - } + curTimeIter = TimeIter; + curAbsTimeIter = TimeIter - config->GetRestart_Iter(); + curOuterIter = OuterIter; + curInnerIter = InnerIter; + stringstream TurboInOutTable, TurboPerfTable; + + if(rank == MASTER_NODE) { + auto BladePerformance = TurboPerf->GetBladesPerformances(); + auto nSpan = config->GetnSpan_iZones(val_iZone); + + /*-- Table for Turbomachinery Performance Values --*/ + PrintingToolbox::CTablePrinter TurboInOut(&TurboInOutTable); + + TurboInOutTable<<"-- Turbomachinery inlet and outlet property Summary:"<GetnSpan_iZones(iZone); + + TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetEntropy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy(); + TurboInOut << "Total Enthalpy " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy(); + TurboInOut << "Total Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure(); + TurboInOut << "Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure(); + TurboInOut << "Density " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity(); + TurboInOut << "Normal Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]; + TurboInOut << "Tangential Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]; + TurboInOut << "Mass Flow " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow(); + TurboInOut << "Mach " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue(); + TurboInOut << "Flow Angle " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; + TurboInOut.PrintFooter(); + } + cout< 1){ - /*--- Compute performance for each stage ---*/ - - EulerianWork[nBladesRow + nStages][nSpanWiseSections] = 0.0; - /*---Comnpute performance for each stage---*/ - for(iStage = 0; iStage < nStages; iStage++ ){ - FluidModel->SetTDState_Ps(PressureOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)], EntropyIn[iStage*2][config->GetnSpan_iZones(iStage*2)]); - EnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections] = FluidModel->GetStaticEnergy() + PressureOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)]/FluidModel->GetDensity(); - FluidModel->SetTDState_Prho(PressureOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)], DensityOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)]); - absVel2 = 0.0; - for (iDim = 0; iDimGetnSpan_iZones(iStage*2 +1)][iDim]*TurboVelocityOut[iStage*2 +1][config->GetnSpan_iZones(iStage*2 +1)][iDim]; - TotalEnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections] = EnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections] + 0.5*absVel2; - - TotalTotalEfficiency[nBladesRow + iStage][nSpanWiseSections] = (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - TotalEnthalpyOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2 +1)]); - TotalTotalEfficiency[nBladesRow + iStage][nSpanWiseSections] /= (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - TotalEnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections]); - TotalStaticEfficiency[nBladesRow + iStage][nSpanWiseSections] = (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - TotalEnthalpyOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2+1)]); - TotalStaticEfficiency[nBladesRow + iStage][nSpanWiseSections] /= (TotalEnthalpyIn[iStage*2][config->GetnSpan_iZones(iStage*2)] - EnthalpyOutIs[nBladesRow + iStage][nSpanWiseSections]); - PressureRatio[nBladesRow + iStage][nSpanWiseSections] = (PressureRatio[iStage*2][config->GetnSpan_iZones(iStage*2)]*PressureOut[iStage*2][config->GetnSpan_iZones(iStage*2)]/PressureOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2+1)]); - MassFlowIn[nBladesRow + iStage][nSpanWiseSections] = MassFlowIn[iStage*2][config->GetnSpan_iZones(iStage*2)]; - MassFlowOut[nBladesRow + iStage][nSpanWiseSections] = MassFlowOut[iStage*2 + 1][config->GetnSpan_iZones(iStage*2+1)]; - EntropyGen[nBladesRow + iStage][nSpanWiseSections] = EntropyGen[iStage*2 + 1][config->GetnSpan_iZones(iStage*2 +1)] + EntropyGen[iStage*2][config->GetnSpan_iZones(iStage*2)]; - - } - - /*---Compute turbo performance for full machine---*/ - FluidModel->SetTDState_Ps(PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)], EntropyIn[0][config->GetnSpan_iZones(0)]); - EnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections] = FluidModel->GetStaticEnergy() + PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]/FluidModel->GetDensity(); - FluidModel->SetTDState_Prho(PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)], DensityOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]); - absVel2 = 0.0; - for (iDim = 0; iDimGetnSpan_iZones(nBladesRow-1)][iDim]*TurboVelocityOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)][iDim]; - TotalEnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections] = EnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections] + 0.5*absVel2; +void COutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config) { + + auto nZone = config->GetnZone(); + unsigned short iStage, iZone; + auto nSpan = config->GetnSpanWiseSections(); + stringstream TurboMZPerf; + + PrintingToolbox::CTablePrinter TurboInOut(&TurboMZPerf); + + /*--- Print header for the stage performance computation ---*/ + TurboMZPerf<<"-- Turbomachinery Stage Performance --"<GetBladesPerformances().at(ZONE_0).at(nSpan)->GetInletState(); + auto OutState = TurboPerf->GetBladesPerformances().at(nZone-1).at(nSpan)->GetOutletState(); + + TurboStagePerf->ComputePerformanceStage(InState, OutState, config); + + /*--- Print Machine Performance (In future also add if the performance is TURBINE or COMPRESSOR) ---*/ + TurboInOut<<"MACHINE"<GetNormEntropyGen()*100 + <GetEulerianWork() + <GetTotalStaticEfficiency()*100 + <GetTotalTotalEfficiency()*100 + <GetTotalStaticPressureRatio() + <GetTotalTotalPressureRatio(); + TurboInOut.PrintFooter(); + cout<GetnSpan_iZones(0)] - TotalEnthalpyOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]); - TotalTotalEfficiency[nBladesRow + nStages][nSpanWiseSections] /= (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - TotalEnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections]); - TotalStaticEfficiency[nBladesRow +nStages][nSpanWiseSections] = (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - TotalEnthalpyOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]); - TotalStaticEfficiency[nBladesRow +nStages][nSpanWiseSections] /= (TotalEnthalpyIn[0][config->GetnSpan_iZones(0)] - EnthalpyOutIs[nBladesRow + nStages][nSpanWiseSections]); - PressureRatio[nBladesRow + nStages][nSpanWiseSections] = PressureRatio[0][config->GetnSpan_iZones(0)]*PressureOut[0][config->GetnSpan_iZones(0)]/PressureOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]; - MassFlowIn[nBladesRow + nStages][nSpanWiseSections] = MassFlowIn[0][config->GetnSpan_iZones(0)]; - MassFlowOut[nBladesRow + nStages][nSpanWiseSections] = MassFlowOut[nBladesRow-1][config->GetnSpan_iZones(nBladesRow-1)]; +} - EntropyGen[nBladesRow + nStages][nSpanWiseSections] = 0.0; - for(iBlade = 0; iBlade < nBladesRow; iBlade++ ){ - EntropyGen[nBladesRow + nStages][nSpanWiseSections] += EntropyGen[iBlade][config->GetnSpan_iZones(iBlade)]; +void COutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config, unsigned short val_iZone) { + + if (rank == MASTER_NODE){ + auto BladePerformance = TurboPerf->GetBladesPerformances(); + auto nSpan = config->GetnSpan_iZones(val_iZone); + for (unsigned short iZone = 0; iZone <= val_iZone; iZone++) { + nSpan = config->GetnSpan_iZones(iZone); + stringstream tag; + tag << iZone + 1; + + SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetEntropy()); + SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy()); + SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure()); + SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure()); + SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure()); + SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure()); + SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity()); + SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity()); + SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0]); + SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]); + SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1]); + SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]); + SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow()); + SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow()); + SetHistoryOutputValue("MachIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue()); + SetHistoryOutputValue("MachOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue()); + SetHistoryOutputValue("FlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("FlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); + } + SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); + SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); + SetHistoryOutputValue("TotalStaticEfficiency", TurboStagePerf->GetTotalStaticEfficiency()*100); + SetHistoryOutputValue("TotalTotalEfficiency", TurboStagePerf->GetTotalTotalEfficiency()*100); + SetHistoryOutputValue("PressureRatioTS", TurboStagePerf->GetTotalStaticPressureRatio()); + SetHistoryOutputValue("PressureRatioTT", TurboStagePerf->GetTotalTotalPressureRatio()); } - } - - delete [] relVel; - } \ No newline at end of file diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp new file mode 100644 index 00000000000..c5b1705f6c3 --- /dev/null +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -0,0 +1,304 @@ +/*! + * \file CTurboOutput.cpp + * \brief Source of the Turbomachinery Performance class. + * \author S. Vitale, N. Anand + * \version 7.1.1 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/output/CTurboOutput.hpp" + +CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { + Density = Pressure = TangVelocity = 0.0; +} +CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState(vector TurboPrimitive, + unsigned short nDim, + su2double tangVel) : Density(TurboPrimitive[0]), Pressure(TurboPrimitive[1]), TangVelocity(tangVel) { + // Velocity.assign(TurboPrimitive+2, TurboPrimitive + nDim+2 ); + Velocity = {TurboPrimitive.begin()+2, TurboPrimitive.end()}; +} + +CTurbomachineryCombinedPrimitiveStates::CTurbomachineryCombinedPrimitiveStates(const CTurbomachineryPrimitiveState& inletPrimitiveState, + const CTurbomachineryPrimitiveState& outletPrimitiveState) : InletPrimitiveState(inletPrimitiveState), OutletPrimitiveState(outletPrimitiveState){} + +CTurbomachineryState::CTurbomachineryState(){ + Density = Pressure = Entropy = Enthalpy = Temperature = TotalTemperature = TotalPressure = TotalEnthalpy = 0.0; + AbsFlowAngle = FlowAngle = MassFlow = Rothalpy = TotalRelPressure = 0.0; + Area = Radius = 0.0; +} + +CTurbomachineryState::CTurbomachineryState(unsigned short nDim, su2double area, su2double radius) : CTurbomachineryState() { + generate_n(back_inserter(Velocity),nDim, [] {return 0.0;}); + generate_n(back_inserter(RelVelocity),nDim, [] {return 0.0;}); + generate_n(back_inserter(Mach),nDim, [] {return 0.0;}); + generate_n(back_inserter(RelMach),nDim, [] {return 0.0;}); + Area = area; + Radius = radius; +} + +void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState &primitiveState) { + + /*--- Assign new primitive values ---*/ + Density = primitiveState.GetDensity(); + Pressure = primitiveState.GetPressure(); + std::vector velocity = primitiveState.GetVelocity(); + Velocity.assign(velocity.begin(), velocity.end()); + su2double tangVel = primitiveState.GetTangVelocity(); + + /*--- Compute static TD quantities ---*/ + fluidModel.SetTDState_Prho(Pressure, Density); + Entropy = fluidModel.GetEntropy(); + Enthalpy = fluidModel.GetStaticEnergy() + Pressure / Density; + su2double soundSpeed = fluidModel.GetSoundSpeed(); + + /*--- Compute total TD quantities ---*/ + TotalEnthalpy = Enthalpy + 0.5 * GetVelocityValue() * GetVelocityValue(); + fluidModel.SetTDState_hs(TotalEnthalpy, Entropy); + TotalPressure = fluidModel.GetPressure(); + TotalTemperature = fluidModel.GetTemperature(); + + /*--- Compute absolute kinematic quantities---*/ + MassFlow = Density * Velocity[0] * Area; + AbsFlowAngle = atan(Velocity[1] / Velocity[0]); + Mach.assign(Velocity.begin(), Velocity.end()); + std::for_each(Mach.begin(), Mach.end(), [&](su2double &el) { el /= soundSpeed; }); + + /*--- Compute relative kinematic quantities ---*/ + su2double tangVel2 = tangVel * tangVel; + RelVelocity.assign(Velocity.begin(), Velocity.end()); + RelVelocity[1] -= tangVel; + su2double relVel2 = GetRelVelocityValue(); + FlowAngle = atan(RelVelocity[1] / RelVelocity[0]); + RelMach.assign(RelVelocity.begin(), RelVelocity.end()); + std::for_each(RelMach.begin(), RelMach.end(), [&](su2double &el) { el /= soundSpeed; }); + + /*--- Compute total relative TD quantities ---*/ + Rothalpy = Enthalpy + 0.5 * relVel2 - 0.5 * tangVel2; + fluidModel.SetTDState_hs(Rothalpy, Entropy); + TotalRelPressure = fluidModel.GetPressure(); + + /*--- Compute isentropic quantities ---*/ + fluidModel.SetTDState_Ps(Pressure, Entropy); + +} + +CTurbomachineryBladePerformance::CTurbomachineryBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut) : FluidModel(fluidModel) { + InletState = CTurbomachineryState(nDim, areaIn, radiusIn); + OutletState = CTurbomachineryState(nDim, areaOut,radiusOut); +} + + +CTurbineBladePerformance::CTurbineBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){} + +void CTurbineBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) { + + /*--- Compute Inlet and Outlet state ---*/ + InletState.ComputeState(FluidModel, primitives.GetInletPrimitiveState()); + OutletState.ComputeState(FluidModel, primitives.GetOutletPrimitiveState()); + + /*--- Compute isentropic Outflow quantities ---*/ + FluidModel.SetTDState_Ps(OutletState.GetPressure(), InletState.GetEntropy()); + su2double enthalpyOutIs = FluidModel.GetStaticEnergy() + OutletState.GetPressure() / FluidModel.GetDensity(); + su2double tangVel = primitives.GetOutletPrimitiveState().GetTangVelocity(); + su2double relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel; + + /*--- Compute performance ---*/ + EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); + EulerianWork = InletState.GetTotalEnthalpy() - OutletState.GetTotalEnthalpy(); + TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) / + (OutletState.GetTotalRelPressure() - OutletState.GetPressure()); + KineticEnergyLoss = 2 * (OutletState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2; +} + +CCompressorBladePerformance::CCompressorBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){} + +void CCompressorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) { + /*--- Compute Inlet and Outlet state ---*/ + InletState.ComputeState(FluidModel, primitives.GetInletPrimitiveState()); + OutletState.ComputeState(FluidModel, primitives.GetOutletPrimitiveState()); + + /*--- Compute isentropic Outflow quantities ---*/ + FluidModel.SetTDState_Ps(OutletState.GetPressure(), InletState.GetEntropy()); + su2double enthalpyOutIs = FluidModel.GetStaticEnergy() + OutletState.GetPressure() / FluidModel.GetDensity(); + su2double tangVel = primitives.GetOutletPrimitiveState().GetTangVelocity(); + su2double relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel; + + /*--- Compute performance ---*/ + EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); + EulerianWork = OutletState.GetTotalEnthalpy() - InletState.GetTotalEnthalpy(); + TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) / + (InletState.GetTotalRelPressure() - InletState.GetPressure()); + KineticEnergyLoss = 2 * (OutletState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2; +} + +CPropellorBladePerformance::CPropellorBladePerformance(CFluidModel& fluidModel, + unsigned short nDim, + su2double areaIn, + su2double radiusIn, + su2double areaOut, + su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){} + +void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) { + // TODO: to be implemented +} + +CTurboOutput::CTurboOutput(const CConfig& config, + const CGeometry& geometry, + CFluidModel& fluidModel) { + unsigned short nBladesRow = config.GetnMarker_Turbomachinery(); + unsigned short nDim = geometry.GetnDim(); + unsigned short nStages = SU2_TYPE::Int(nBladesRow / 2); + + for (unsigned short iBladeRow = 0; iBladeRow < nBladesRow; iBladeRow++) { + vector > bladeSpanPerformances; + unsigned short nSpan = config.GetnSpanWiseSections(); + for (unsigned short iSpan = 0; iSpan < nSpan + 1; iSpan++) { + + su2double areaIn = geometry.GetSpanAreaIn(iBladeRow, iSpan); + su2double areaOut = geometry.GetSpanAreaOut(iBladeRow, iSpan); + su2double radiusIn = geometry.GetTurboRadiusIn(iBladeRow, iSpan); + su2double radiusOut = geometry.GetTurboRadiusOut(iBladeRow, iSpan); + // std::cout << "Area In " << areaIn << " Area Out " << areaOut << " blade row " << iBladeRow <(fluidModel, nDim, areaIn, radiusIn, areaOut, + radiusOut)); + break; + + case TURBO_PERF_KIND::COMPRESSOR: + bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, + radiusOut)); + break; + + case TURBO_PERF_KIND::PROPELLOR: + bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, + radiusOut)); + break; + + default: + bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, + radiusOut)); + break; + } + } + } + BladesPerformances.push_back(bladeSpanPerformances); + } +} + +void CTurboOutput::ComputeTurbomachineryPerformance( + vector > const bladesPrimitives) { + for(unsigned i = 0; i < BladesPerformances.size(); ++i) { + ComputePerBlade(BladesPerformances[i], bladesPrimitives[i]); + } +} + +void CTurboOutput::ComputePerBlade( + vector > const bladePerformances, + vector const bladePrimitives) { + for(unsigned i = 0; i < bladePerformances.size(); ++i) { + ComputePerSpan(bladePerformances[i], bladePrimitives[i]); + } +} + +void CTurboOutput::ComputePerSpan(shared_ptr const spanPerformances, + const CTurbomachineryCombinedPrimitiveStates &spanPrimitives) { + spanPerformances->ComputePerformance(spanPrimitives); +} + +CTurbomachineryStagePerformance::CTurbomachineryStagePerformance(CFluidModel& fluid) : fluidModel(fluid) { + +} + +void CTurbomachineryStagePerformance::ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, const CConfig* config) { + + switch (config->GetKind_TurboPerf(ZONE_0)) { + case TURBO_PERF_KIND::TURBINE: + ComputeTurbineStagePerformance(InState, OutState); + break; + + case TURBO_PERF_KIND::COMPRESSOR: + ComputeCompressorStagePerformance(InState, OutState); + break; + + default: + ComputeTurbineStagePerformance(InState, OutState); + break; + } +} + +void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState) { + + /*--- Compute isentropic Outflow quantities ---*/ + fluidModel.SetTDState_Ps(OutState.GetPressure(), InState.GetEntropy()); + su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity(); + su2double totEnthalpyOutIs = enthalpyOutIs + 0.5*OutState.GetVelocityValue()*OutState.GetVelocityValue(); + + /*--- Compute turbine stage performance ---*/ + NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy())/InState.GetEntropy(); + EulerianWork = InState.GetTotalEnthalpy() - OutState.GetTotalEnthalpy(); + TotalStaticEfficiency = EulerianWork/(InState.GetTotalEnthalpy()-enthalpyOutIs); + TotalTotalEfficiency = EulerianWork/(InState.GetTotalEnthalpy()-totEnthalpyOutIs); + TotalStaticPressureRatio = InState.GetTotalPressure()/OutState.GetPressure(); + TotalTotalPressureRatio = InState.GetTotalPressure()/OutState.GetTotalPressure(); +} + +void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState) { + + /*--- Compute isentropic Outflow quantities ---*/ + fluidModel.SetTDState_Ps(OutState.GetPressure(), InState.GetEntropy()); + su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity(); + su2double totEnthalpyOutIs = enthalpyOutIs + 0.5*OutState.GetVelocityValue()*OutState.GetVelocityValue(); + + /*--- Compute compressor stage performance ---*/ + NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy())/InState.GetEntropy(); + EulerianWork = OutState.GetTotalEnthalpy() - InState.GetTotalEnthalpy(); + TotalStaticEfficiency = (enthalpyOutIs-InState.GetTotalEnthalpy())/EulerianWork; + TotalTotalEfficiency = (totEnthalpyOutIs-InState.GetTotalEnthalpy())/EulerianWork; + TotalStaticPressureRatio = OutState.GetPressure()/InState.GetTotalPressure(); + TotalTotalPressureRatio = OutState.GetTotalPressure()/InState.GetTotalPressure(); + +} \ No newline at end of file diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 97fa79e6d15..557f91be237 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -35,6 +35,7 @@ #include "../../include/fluid/CCoolProp.hpp" #include "../../include/numerics_simd/CNumericsSIMD.hpp" #include "../../include/limiters/CLimiterDetails.hpp" +#include "../../include/output/CTurboOutput.hpp" CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, @@ -361,6 +362,10 @@ void CEulerSolver::InstantiateEdgeNumerics(const CSolver* const* solver_containe END_SU2_OMP_SAFE_GLOBAL_ACCESS } +void CEulerSolver::InitTurboPerformance(CGeometry *geometry, CConfig *config){ + TurbomachineryPerformance = std::make_shared(*config, *geometry, *GetFluidModel()); +} + void CEulerSolver::InitTurboContainers(CGeometry *geometry, CConfig *config){ /*--- Initialize quantities for the average process for internal flow ---*/ diff --git a/config_template.cfg b/config_template.cfg index 7a30a6d6fc8..372abfa8040 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -628,6 +628,10 @@ SUBSONIC_ENGINE_VALUES= ( 0.4, 0.0, 0.0, 2116.216, 518.67 ) % CENTRIPETAL_AXIAL, AXIAL_CENTRIFUGAL) TURBOMACHINERY_KIND= CENTRIPETAL CENTRIPETAL_AXIAL % +% Specify the machine architecture for performance analysis (TURBINE, COMPRESSOR, PROPELLOR) +% +TURBO_PERF_KIND = TURBINE TURBINE +% % Specify kind of interpolation for the mixing-plane (LINEAR_INTERPOLATION, % NEAREST_SPAN, MATCHING) MIXINGPLANE_INTERFACE_KIND= LINEAR_INTERPOLATION From 7e6619ccc542c92d5b1e7653825f574b428e8dfd Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Mon, 17 Apr 2023 16:57:22 +0100 Subject: [PATCH 03/47] Changes to address comments --- SU2_CFD/include/SU2_CFD.hpp | 2 +- SU2_CFD/include/iteration/CFluidIteration.hpp | 5 +- SU2_CFD/include/iteration/CTurboIteration.hpp | 8 +- SU2_CFD/include/output/CFlowCompOutput.hpp | 11 + SU2_CFD/include/output/CFlowOutput.hpp | 8 +- SU2_CFD/include/output/COutput.hpp | 89 ++++----- SU2_CFD/include/output/CTurboOutput.hpp | 189 ++++++++---------- SU2_CFD/include/solvers/CEulerSolver.hpp | 4 +- SU2_CFD/include/solvers/CSolver.hpp | 8 +- SU2_CFD/src/drivers/CMultizoneDriver.cpp | 7 +- SU2_CFD/src/iteration/CFluidIteration.cpp | 154 +++++++------- SU2_CFD/src/output/CFlowCompOutput.cpp | 159 +++++++++++---- SU2_CFD/src/output/CFlowOutput.cpp | 36 ++++ SU2_CFD/src/output/COutput.cpp | 164 +++------------ SU2_CFD/src/output/CTurboOutput.cpp | 3 +- 15 files changed, 421 insertions(+), 426 deletions(-) diff --git a/SU2_CFD/include/SU2_CFD.hpp b/SU2_CFD/include/SU2_CFD.hpp index 044cfd7ae58..c23920bb9e4 100644 --- a/SU2_CFD/include/SU2_CFD.hpp +++ b/SU2_CFD/include/SU2_CFD.hpp @@ -29,7 +29,7 @@ #include "../../Common/include/parallelization/mpi_structure.hpp" #include "../../Common/include/parallelization/omp_structure.hpp" -#include "../../externals/CLI11/CLI11.hpp" +#include "CLI11.hpp" #include "drivers/CDriver.hpp" #include "drivers/CSinglezoneDriver.hpp" diff --git a/SU2_CFD/include/iteration/CFluidIteration.hpp b/SU2_CFD/include/iteration/CFluidIteration.hpp index 4b24fec9f80..d73fac3801f 100644 --- a/SU2_CFD/include/iteration/CFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CFluidIteration.hpp @@ -106,13 +106,14 @@ class CFluidIteration : public CIteration { CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, unsigned short val_iInst) override; - /*! + + /*! * \brief Monitors turbo computation (pressure and turbo ramps). */ void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) override; /*! - * \brief Monitors turbo computation (pressure and turbo ramps). + * \brief Computes turboperformance. */ void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) override; diff --git a/SU2_CFD/include/iteration/CTurboIteration.hpp b/SU2_CFD/include/iteration/CTurboIteration.hpp index 144fa758986..9846d99ffe7 100644 --- a/SU2_CFD/include/iteration/CTurboIteration.hpp +++ b/SU2_CFD/include/iteration/CTurboIteration.hpp @@ -64,8 +64,8 @@ class CTurboIteration : public CFluidIteration { CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, unsigned short val_iInst) override; - /*! - * \brief Monitors turbo computation (pressure and turbo ramps). - */ - void InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid) override; + /*! + * \brief Initialises turboperformance classes. + */ + void InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid) override; }; diff --git a/SU2_CFD/include/output/CFlowCompOutput.hpp b/SU2_CFD/include/output/CFlowCompOutput.hpp index fbf27d36f43..e7f38021fa7 100644 --- a/SU2_CFD/include/output/CFlowCompOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompOutput.hpp @@ -92,4 +92,15 @@ class CFlowCompOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem. */ bool WriteHistoryFileOutput(const CConfig *config) override ; + + void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, + unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) override; + + void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config) override; + + void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config) override; }; diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index a3893cfb23c..5730f8a01c1 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -30,6 +30,7 @@ #include "CFVMOutput.hpp" #include "../variables/CVariable.hpp" + /*--- Forward declare to avoid including here. ---*/ template struct CPrimitiveIndices; @@ -44,6 +45,12 @@ class CFlowOutput : public CFVMOutput{ */ CFlowOutput(const CConfig *config, unsigned short nDim, bool femOutput); + /* + * \brief Add turboperformance outputs as history field + * \param[in] nZone - Number of zones in problem + */ + void AddTurboOutput(unsigned short nZone); + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -321,5 +328,4 @@ class CFlowOutput : public CFVMOutput{ * \param[in] config - Definition of the particular problem per zone. */ void SetFixedCLScreenOutput(const CConfig *config); - }; diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index e620da7f2e9..db7bbf607b3 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -48,7 +48,7 @@ inline su2double hypot(const su2double& a, const su2double& b) { } } } -#include "../../../externals/mel/mel.hpp" +#include "mel.hpp" class CGeometry; class CSolver; @@ -372,32 +372,25 @@ class COutput { void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); /*! - * \brief Collects Turbomachinery Performance data from the solvers and prints the data in tabular format on screen. + * \brief Collects history data from the solvers and monitors the convergence. Does not write to screen or file. * \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. - * \param[in] TimeIter - Value of the time iteration index - * \param[in] OuterIter - Value of outer iteration index - * \param[in] InnerIter - Value of the inner iteration index */ - void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, - unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iZone); - - void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config); - - void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config, - unsigned short iZone); + void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config); /*! - * \brief Collects history data from the solvers and monitors the convergence. Does not write to screen or file. + * \brief Collects history data from the solvers, monitors the convergence and writes to screen and history file. * \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. + * \param[in] TimeIter - Value of the time iteration index + * \param[in] OuterIter - Value of outer iteration index + * \param[in] InnerIter - Value of the inner iteration index */ - void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config); + void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config, + CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, unsigned short val_iZone, + unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); /*! * Collects history data from the individual output per zone, @@ -605,34 +598,6 @@ class COutput { */ void WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE format, string fileName = ""); - /* - * \brief Initialize turboperformance variables - * \param[in] config - Definition of the particular problem - */ - void InitTurboPerformance(const CConfig *config); - - /*! - * \brief Compute turboperformance variables - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem - * \param[in] solver - The container holding all solution data - */ - void ComputeTurboPerformance(CConfig *config, CGeometry *geometry, CSolver *solver); - - /*! - * \brief Collects Turbomachinery Performance data from the solvers and prints the data in tabular format on screen. - * \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. - * \param[in] TimeIter - Value of the time iteration index - * \param[in] OuterIter - Value of outer iteration index - * \param[in] InnerIter - Value of the inner iteration index - */ - void SetTurboPerformance_Output(CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iZone); - - void SetTurboMultiZonePerformance_Output(CConfig *config); - - void WriteTurboPerfConvHistory(CConfig *config); protected: @@ -976,6 +941,38 @@ class COutput { */ inline virtual void LoadMultizoneHistoryData(const COutput* const* output, const CConfig* const* config) {} + /*! + * \brief Writes turboperformance to screen + * \param[in] TurboPerf - Turboperformance definition + * \param[in] config - Definition of the particular problem + * \param[in] TimeIter - Value of the time iteration index + * \param[in] OuterIter - Value of outer iteration index + * \param[in] InnerIter - Value of the inner iteration index + */ + inline virtual void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, + unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) {}; + + /*! + * \brief Writes turboperformance to history file + * \param[in] TurboStagePerf - Stage turboperformance definition + * \param[in] TurboPerf - Turboperformance definition + * \param[in] config - Definition of the particular problem + */ + inline virtual void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config) {}; + + /*! + * \brief Writes turboperformance to screen + * \param[in] TurboStagePerf - Stage turboperformance definition + * \param[in] TurboPerf - Turboperformance definition + * \param[in] config - Definition of the particular problem + * \param[in] iZone - Current zone + */ + inline virtual void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + CConfig *config) {}; + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index ef9d5ff1f6a..c31709405ff 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -2,14 +2,14 @@ * \file CTurboOutput.hpp * \brief Headers of the Turbomachinery Performance class. * \author S. Vitale, N. Anand - * \version 7.1.1 "Blackbird" + * \version 7.5.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * * The SU2 Project is maintained by the SU2 Foundation * (http://su2foundation.org) * - * Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md) + * Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md) * * SU2 is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,6 @@ * License along with SU2. If not, see . */ - #pragma once #include @@ -37,56 +36,52 @@ #include "../../../Common/include/CConfig.hpp" #include "../fluid/CFluidModel.hpp" - class CTurbomachineryPrimitiveState { - private: + private: su2double Density, Pressure, TangVelocity; - vector Velocity; - public: - CTurbomachineryPrimitiveState(); + vector Velocity; - CTurbomachineryPrimitiveState(vector TurboPrimitives, - unsigned short nDim, - su2double tangVel); + public: + CTurbomachineryPrimitiveState(); - su2double GetDensity() const & { return Density; } + CTurbomachineryPrimitiveState(vector TurboPrimitives, unsigned short nDim, su2double tangVel); - su2double GetPressure() const & { return Pressure; } + su2double GetDensity() const& { return Density; } - su2double GetTangVelocity() const & { return TangVelocity; } + su2double GetPressure() const& { return Pressure; } - vector GetVelocity() const & { return Velocity; } + su2double GetTangVelocity() const& { return TangVelocity; } + const std::vector& GetVelocity() const& { return Velocity; } }; class CTurbomachineryCombinedPrimitiveStates { - private: + private: CTurbomachineryPrimitiveState InletPrimitiveState; CTurbomachineryPrimitiveState OutletPrimitiveState; - public: - CTurbomachineryCombinedPrimitiveStates(const CTurbomachineryPrimitiveState &inletPrimitiveState, - const CTurbomachineryPrimitiveState &outletPrimitiveState); + public: + CTurbomachineryCombinedPrimitiveStates(const CTurbomachineryPrimitiveState& inletPrimitiveState, + const CTurbomachineryPrimitiveState& outletPrimitiveState); - CTurbomachineryPrimitiveState GetInletPrimitiveState() const & { return InletPrimitiveState; } + CTurbomachineryPrimitiveState GetInletPrimitiveState() const& { return InletPrimitiveState; } - CTurbomachineryPrimitiveState GetOutletPrimitiveState() const & { return OutletPrimitiveState; } + CTurbomachineryPrimitiveState GetOutletPrimitiveState() const& { return OutletPrimitiveState; } }; class CTurbomachineryState { - private: + private: su2double Density, Pressure, Entropy, Enthalpy, Temperature, TotalTemperature, TotalPressure, TotalEnthalpy; su2double AbsFlowAngle, FlowAngle, MassFlow, Rothalpy, TotalRelPressure; - vector Velocity, RelVelocity, Mach, RelMach; + vector Velocity, RelVelocity, Mach, RelMach; su2double Area, Radius; - - public: + public: CTurbomachineryState(); CTurbomachineryState(unsigned short nDim, su2double area, su2double radius); - void ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState &primitiveState); + void ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState& primitiveState); su2double GetDensity() const { return Density; } @@ -114,56 +109,43 @@ class CTurbomachineryState { su2double GetRothalpy() const { return Rothalpy; } - vector GetVelocity() const { return Velocity; } + vector GetVelocity() const { return Velocity; } - vector GetMach() const { return Mach; } + vector GetMach() const { return Mach; } - su2double GetVelocityValue() const { - return Norm(Velocity); - } + su2double GetVelocityValue() const { return Norm(Velocity); } - su2double GetMachValue() const { - return Norm(Mach); - } + su2double GetMachValue() const { return Norm(Mach); } - su2double GetRelVelocityValue() const { - return Norm(RelVelocity); - } + su2double GetRelVelocityValue() const { return Norm(RelVelocity); } - su2double GetRelMachValue() const { - return Norm(RelMach); - } + su2double GetRelMachValue() const { return Norm(RelMach); } su2double Norm(vector const& u) const { su2double accum = 0.; for (int i = 0; i < u.size(); ++i) { - accum += u[i] * u[i]; + accum += u[i] * u[i]; } return sqrt(accum); } }; - class CTurbomachineryBladePerformance { - protected: + protected: CTurbomachineryState InletState; CTurbomachineryState OutletState; su2double KineticEnergyLoss, TotalPressureLoss, EntropyGen, PressureRatio, EulerianWork; - CFluidModel &FluidModel; + CFluidModel& FluidModel; - public: - CTurbomachineryBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut); + public: + CTurbomachineryBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, + su2double areaOut, su2double radiusOut); - virtual void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) {}; + virtual void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives){}; const CTurbomachineryState& GetInletState() { return InletState; } - const CTurbomachineryState& GetOutletState() { return OutletState; } + const CTurbomachineryState& GetOutletState() { return OutletState; } su2double GetKineticEnergyLoss() const { return KineticEnergyLoss; } @@ -174,89 +156,74 @@ class CTurbomachineryBladePerformance { su2double GetPressureRatio() const { return PressureRatio; } su2double GetEulerianWork() const { return EulerianWork; } - }; class CTurbineBladePerformance : public CTurbomachineryBladePerformance { + public: + CTurbineBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, + su2double areaOut, su2double radiusOut); - public: - CTurbineBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut); - - void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override; - + void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) override; }; class CCompressorBladePerformance : public CTurbomachineryBladePerformance { + public: + CCompressorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, + su2double areaOut, su2double radiusOut); - public: - CCompressorBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut); - - void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override; - + void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) override; }; class CPropellorBladePerformance : public CTurbomachineryBladePerformance { + public: + CPropellorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, + su2double areaOut, su2double radiusOut); - public: - CPropellorBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut); - - void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override; - + void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) override; }; class CTurbomachineryStagePerformance { - protected: - su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, TotalTotalPressureRatio, EulerianWork; - CFluidModel &fluidModel; - public: - CTurbomachineryStagePerformance(CFluidModel& fluid); - virtual ~CTurbomachineryStagePerformance() = default; - virtual void ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, const CConfig* config); - virtual void ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); - virtual void ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); - su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } - su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } - su2double GetEulerianWork() const { return EulerianWork; } - su2double GetNormEntropyGen() const { return NormEntropyGen; } - su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } - su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } + protected: + su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, + TotalTotalPressureRatio, EulerianWork; + CFluidModel& fluidModel; + + public: + CTurbomachineryStagePerformance(CFluidModel& fluid); + virtual ~CTurbomachineryStagePerformance() = default; + virtual void ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, + const CConfig* config); + virtual void ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + virtual void ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } + su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } + su2double GetEulerianWork() const { return EulerianWork; } + su2double GetNormEntropyGen() const { return NormEntropyGen; } + su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } + su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } }; class CTurboOutput { - private: - vector >> - BladesPerformances; + private: + vector>> BladesPerformances; - static void ComputePerBlade(vector > const bladePerformances, - vector const bladePrimitives); + static void ComputePerBlade(vector> const bladePerformances, + vector const bladePrimitives); - static void ComputePerSpan(shared_ptr const spanPerformances, - const CTurbomachineryCombinedPrimitiveStates &spanPrimitives); + static void ComputePerSpan(shared_ptr const spanPerformances, + const CTurbomachineryCombinedPrimitiveStates& spanPrimitives); // vector> StagePerformances; // shared_ptr MachinePerformances; - public: + public: CTurboOutput(const CConfig& config, const CGeometry& geometry, CFluidModel& fluidModel); - vector >> + vector>> - GetBladesPerformances() const { return BladesPerformances; } + GetBladesPerformances() const { + return BladesPerformances; + } // vector> GetStagePerformances() const { return StagePerformances; } // shared_ptr GetMachinePerformances() const { return MachinePerformances; } - void ComputeTurbomachineryPerformance(vector > const primitives); -}; \ No newline at end of file + void ComputeTurbomachineryPerformance(vector> const primitives); +};s \ No newline at end of file diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index bfe94ebe976..cb3ae3eb8ca 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -29,8 +29,7 @@ #include "CFVMFlowSolverBase.hpp" #include "../variables/CEulerVariable.hpp" -#include "../../../Common/include/option_structure.hpp" - +#include "../output/CTurboOutput.hpp" /*! * \class CEulerSolver * \ingroup Euler_Equations @@ -1062,7 +1061,6 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) {return TurboPrimitive;} + virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) {return TurboPrimitive;} /*! * \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat, etc. diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index ec87b210663..050ee68da88 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -584,23 +584,22 @@ bool CMultizoneDriver::TransferData(unsigned short donorZone, unsigned short tar break; case MIXING_PLANE: { - auto nMarkerInt = config_container[donorZone]->GetnMarker_MixingPlaneInterface()/2; + const auto nMarkerInt = config_container[donorZone]->GetnMarker_MixingPlaneInterface() / 2; - /* --- transfer the average value from the donorZone to the targetZone*/ + /*--- Transfer the average value from the donorZone to the targetZone ---*/ for (auto iMarkerInt = 1; iMarkerInt <= nMarkerInt; iMarkerInt++) { interface_container[donorZone][targetZone]->AllgatherAverage(solver_container[donorZone][INST_0][MESH_0][FLOW_SOL],solver_container[targetZone][INST_0][MESH_0][FLOW_SOL], geometry_container[donorZone][INST_0][MESH_0],geometry_container[targetZone][INST_0][MESH_0], config_container[donorZone], config_container[targetZone], iMarkerInt ); } - for (donorZone = 0; donorZone < nZone-1; donorZone++) { + for (donorZone = 0; donorZone < nZone; donorZone++) { if (interface_types[donorZone][targetZone]==MIXING_PLANE) { interface_container[donorZone][targetZone]->GatherAverageValues(solver_container[donorZone][INST_0][MESH_0][FLOW_SOL],solver_container[targetZone][INST_0][MESH_0][FLOW_SOL], donorZone); interface_container[donorZone][targetZone]->GatherAverageTurboGeoValues(geometry_container[donorZone][INST_0][MESH_0],geometry_container[targetZone][INST_0][MESH_0], donorZone); } } - return UpdateMesh; break; } case NO_TRANSFER: diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 5cf859b33b1..6658b7854ed 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -28,6 +28,7 @@ #include "../../include/iteration/CFluidIteration.hpp" #include "../../include/output/COutput.hpp" + void CFluidIteration::Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver, CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, CVolumetricMovement*** grid_movement, @@ -213,36 +214,23 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe UsedTime = StopTime - StartTime; - unsigned long Iter= config[val_iZone]->GetInnerIter(); - - output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], - config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), - config[val_iZone]->GetInnerIter()); /*--- Turbomachinery Specific Montior ---*/ if (config[ZONE_0]->GetBoolTurbomachinery()){ - - /*--- Turbomachinery Performance Computation ---*/ - if (val_iZone == config[ZONE_0]->GetnZone()-1){ - ComputeTurboPerformance(solver, geometry, config, config[val_iZone]->GetInnerIter()); - output->LoadTurboHistoryData(TurbomachineryStagePerformance, TurbomachineryPerformance, config[val_iZone], val_iZone); - } - - if (config[ZONE_0]->GetMultizone_Problem()) - Iter = config[ZONE_0]->GetOuterIter(); - - /*--- Turbomachinery Performance Screen summary output---*/ - if (val_iZone == config[ZONE_0]->GetnZone()-1 && Iter%100 == 0) { - output->SetTurboPerformance_Output(TurbomachineryPerformance, config[val_iZone], - config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), - config[val_iZone]->GetInnerIter(), val_iZone); - if (rank == MASTER_NODE) - output->SetTurboMultiZonePerformance_Output(TurbomachineryStagePerformance, TurbomachineryPerformance, config[val_iZone]); + if (val_iZone == config[ZONE_0]->GetnZone()-1) { + ComputeTurboPerformance(solver, geometry, config, config[val_iZone]->GetnInner_Iter()); + + output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], + config[val_iZone], TurbomachineryStagePerformance, TurbomachineryPerformance, val_iZone, config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter()); } - /*--- Turbomachinery Rotation and Pressure Ramps ---*/ TurboMonitor(geometry, config, config[val_iZone]->GetInnerIter()); } + + output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], + config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter()); /*--- If convergence was reached --*/ StopCalc = output->GetConvergence(); @@ -257,79 +245,75 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe return StopCalc; } -void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) { +void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long iter) { - su2double rot_z_ini, rot_z_final ,rot_z; - su2double outPres_ini, outPres_final, outPres; - unsigned long rampFreq, finalRamp_Iter; - unsigned short iMarker, KindBC, KindBCOption; - unsigned short iZone; - string Marker_Tag; + auto* config = config_container[ZONE_0]; - bool print; if (config_container[ZONE_0]->GetMultizone_Problem()) - ExtIter = config_container[ZONE_0]->GetOuterIter(); + iter = config_container[ZONE_0]->GetOuterIter(); + - for(iZone = 0; iZone < nZone; iZone++) { /*--- ROTATING FRAME Ramp: Compute the updated rotational velocity. ---*/ - if (config_container[iZone]->GetGrid_Movement() && config_container[iZone]->GetRampRotatingFrame()) { - rampFreq = SU2_TYPE::Int(config_container[iZone]->GetRampRotatingFrame_Coeff(1)); - finalRamp_Iter = SU2_TYPE::Int(config_container[iZone]->GetRampRotatingFrame_Coeff(2)); - rot_z_ini = config_container[iZone]->GetRampRotatingFrame_Coeff(0); - print = false; - if(ExtIter % rampFreq == 0 && ExtIter <= finalRamp_Iter){ - rot_z_final = config_container[iZone]->GetFinalRotation_Rate_Z(); - if(abs(rot_z_final) > 0.0){ - rot_z = rot_z_ini + ExtIter*( rot_z_final - rot_z_ini)/finalRamp_Iter; + if (config->GetGrid_Movement() && config->GetRampRotatingFrame()) { + const unsigned long rampFreq = SU2_TYPE::Int(config->GetRampRotatingFrame_Coeff(1)); + const unsigned long finalRamp_Iter = SU2_TYPE::Int(config->GetRampRotatingFrame_Coeff(2)); + const su2double rot_z_ini = config->GetRampRotatingFrame_Coeff(0); + const bool print = false; + + if(iter % rampFreq == 0 && iter <= finalRamp_Iter){ + + for (auto iZone = 0u; iZone < nZone; iZone++) { + const su2double rot_z_final = config_container[iZone]->GetFinalRotation_Rate_Z(); + + if (fabs(rot_z_final) > 0.0) { + const su2double rot_z = rot_z_ini + iter * ( rot_z_final - rot_z_ini) / finalRamp_Iter; config_container[iZone]->SetRotation_Rate(2, rot_z); - if(rank == MASTER_NODE && print && ExtIter > 0) { - cout << endl << " Updated rotating frame grid velocities"; - cout << " for zone " << iZone << "." << endl; + if (rank == MASTER_NODE && print && iter > 0) { + cout << "\nUpdated rotating frame grid velocities for zone " << iZone << ".\n"; } geometry_container[iZone][INST_0][MESH_0]->SetRotationalVelocity(config_container[iZone], print); geometry_container[iZone][INST_0][MESH_0]->SetShroudVelocity(config_container[iZone]); } + } - for (iZone = 0; iZone < nZone; iZone++) { - geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone], iZone, INFLOW, false); - geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone],iZone, OUTFLOW, false); - geometry_container[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config_container[iZone], false); - - } + for (auto iZone = 0u; iZone < nZone; iZone++) { + geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone], iZone, INFLOW, false); + geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone],iZone, OUTFLOW, false); + geometry_container[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config_container[iZone], false); } } } - - /*--- Outlet Pressure Ramp: Compute the updated rotational velocity. ---*/ - if (config_container[ZONE_0]->GetRampOutletPressure()) { - rampFreq = SU2_TYPE::Int(config_container[ZONE_0]->GetRampOutletPressure_Coeff(1)); - finalRamp_Iter = SU2_TYPE::Int(config_container[ZONE_0]->GetRampOutletPressure_Coeff(2)); - outPres_ini = config_container[ZONE_0]->GetRampOutletPressure_Coeff(0); - outPres_final = config_container[ZONE_0]->GetFinalOutletPressure(); - - if(ExtIter % rampFreq == 0 && ExtIter <= finalRamp_Iter){ - outPres = outPres_ini + ExtIter*(outPres_final - outPres_ini)/finalRamp_Iter; - if(rank == MASTER_NODE) config_container[ZONE_0]->SetMonitotOutletPressure(outPres); - - for (iZone = 0; iZone < nZone; iZone++) { - for (iMarker = 0; iMarker < config_container[iZone]->GetnMarker_All(); iMarker++) { - KindBC = config_container[iZone]->GetMarker_All_KindBC(iMarker); + /*--- Outlet Pressure Ramp: Compute the updated pressure. ---*/ + if (config->GetRampOutletPressure()) { + const unsigned long rampFreq = SU2_TYPE::Int(config->GetRampOutletPressure_Coeff(1)); + const unsigned long finalRamp_Iter = SU2_TYPE::Int(config->GetRampOutletPressure_Coeff(2)); + const su2double outPres_ini = config->GetRampOutletPressure_Coeff(0); + const su2double outPres_final = config->GetFinalOutletPressure(); + + if (iter % rampFreq == 0 && iter <= finalRamp_Iter) { + const su2double outPres = outPres_ini + iter * (outPres_final - outPres_ini) / finalRamp_Iter; + if (rank == MASTER_NODE) config->SetMonitotOutletPressure(outPres); + + for (auto iZone = 0u; iZone < nZone; iZone++) { + for (auto iMarker = 0; iMarker < config_container[iZone]->GetnMarker_All(); iMarker++) { + const auto KindBC = config_container[iZone]->GetMarker_All_KindBC(iMarker); + const auto Marker_Tag = config_container[iZone]->GetMarker_All_TagBound(iMarker); + unsigned short KindBCOption; switch (KindBC) { - case RIEMANN_BOUNDARY: - Marker_Tag = config_container[iZone]->GetMarker_All_TagBound(iMarker); - KindBCOption = config_container[iZone]->GetKind_Data_Riemann(Marker_Tag); - if(KindBCOption == STATIC_PRESSURE || KindBCOption == RADIAL_EQUILIBRIUM ){ - SU2_MPI::Error("Outlet pressure ramp only implemented for NRBC", CURRENT_FUNCTION); - } - break; - case GILES_BOUNDARY: - Marker_Tag = config_container[iZone]->GetMarker_All_TagBound(iMarker); - KindBCOption = config_container[iZone]->GetKind_Data_Giles(Marker_Tag); - if(KindBCOption == STATIC_PRESSURE || KindBCOption == STATIC_PRESSURE_1D || KindBCOption == RADIAL_EQUILIBRIUM ){ - config_container[iZone]->SetGiles_Var1(outPres, Marker_Tag); - } - break; + case RIEMANN_BOUNDARY: + KindBCOption = config_container[iZone]->GetKind_Data_Riemann(Marker_Tag); + if (KindBCOption == STATIC_PRESSURE || KindBCOption == RADIAL_EQUILIBRIUM) { + SU2_MPI::Error("Outlet pressure ramp only implemented for NRBC", CURRENT_FUNCTION); + } + break; + case GILES_BOUNDARY: + KindBCOption = config_container[iZone]->GetKind_Data_Giles(Marker_Tag); + if (KindBCOption == STATIC_PRESSURE || KindBCOption == STATIC_PRESSURE_1D || + KindBCOption == RADIAL_EQUILIBRIUM ) { + config_container[iZone]->SetGiles_Var1(outPres, Marker_Tag); + } + break; } } } @@ -360,6 +344,16 @@ void CFluidIteration::ComputeTurboPerformance(CSolver***** solver, CGeometry**** bladesPrimitives.push_back(bladePrimitives); } TurbomachineryPerformance->ComputeTurbomachineryPerformance(bladesPrimitives); + + auto nSpan = config_container[ZONE_0]->GetnSpanWiseSections(); + + /*--- Machine Performance (Takes inlet of Zone 0 and Outlet of Zone N-1) ---*/ + // TODO: This still crashed or gives garbage value if there are uneven spans + auto InState = TurbomachineryPerformance->GetBladesPerformances().at(ZONE_0).at(nSpan)->GetInletState(); + nSpan = config_container[nZone-1]->GetnSpanWiseSections(); + auto OutState = TurbomachineryPerformance->GetBladesPerformances().at(nZone-1).at(nSpan)->GetOutletState(); + + TurbomachineryStagePerformance->ComputePerformanceStage(InState, OutState, config_container[nZone-1]); } } diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 0f32bbb2a41..87c2f27a6c2 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -208,41 +208,7 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ AddNearfieldInverseDesignOutput(); - /// BEGIN_GROUP: TURBO_PERF, DESCRIPTION: Turboperformance variables - if (config->GetBoolTurbomachinery()) { - //Adds zone turboperformance history variables - for (unsigned short iZone = 0; iZone <= config->GetnZone() - 1; iZone++) { - stringstream tag; - tag << iZone + 1; - AddHistoryOutput("EntropyIn_" + tag.str(), "EntropyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("EntropyOut_" + tag.str(), "EntropyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalEntahalpyIn_" + tag.str(), "TotalEntahalpyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalEnthalpyOut_" + tag.str(), "TotalEnthalpyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalPressureIn_" + tag.str(), "TotPressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalPressureOut_" + tag.str(), "TotPressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureIn_" + tag.str(), "PressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureOut_" + tag.str(), "PressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("DensityIn_" + tag.str(), "DensityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("DensityOut_" + tag.str(), "DensityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("NormalVelocityIn_" + tag.str(), "NormalVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("NormalVelocityOut_" + tag.str(), "NormalVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TangentialVelocityIn_" + tag.str(), "TangentialVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TangentialVelocityOut_" + tag.str(), "TangentialVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("FlowAngleIn_" + tag.str(), "FlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("FlowAngleOut_" + tag.str(), "FlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - } - //Adds turbomachinery machine performance variables - AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("EulerianWork", "EulerianWork", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalStaticEfficiency", "TotStaticEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalTotalEfficiency", "TotTotEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureRatioTS", "PRTS", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureRatioTT", "PRTT", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - } + if (config->GetBoolTurbomachinery()) AddTurboOutput(config->GetnZone()); } @@ -504,3 +470,126 @@ void CFlowCompOutput::SetAdditionalScreenOutput(const CConfig *config){ bool CFlowCompOutput::WriteHistoryFileOutput(const CConfig *config) { return !config->GetFinite_Difference_Mode() && COutput::WriteHistoryFileOutput(config); } + +void CFlowCompOutput::SetTurboPerformance_Output(std::shared_ptr TurboPerf, + CConfig *config, + unsigned long TimeIter, + unsigned long OuterIter, + unsigned long InnerIter) { + + curTimeIter = TimeIter; + curAbsTimeIter = TimeIter - config->GetRestart_Iter(); + curOuterIter = OuterIter; + curInnerIter = InnerIter; + stringstream TurboInOutTable, TurboPerfTable; + + if(rank == MASTER_NODE) { + auto BladePerformance = TurboPerf->GetBladesPerformances(); + + /*-- Table for Turbomachinery Performance Values --*/ + PrintingToolbox::CTablePrinter TurboInOut(&TurboInOutTable); + + TurboInOutTable<<"-- Turbomachinery inlet and outlet property Summary:"<GetnZone()-1; iZone++) { + auto nSpan = config->GetnSpan_iZones(iZone); + + TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetEntropy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy(); + TurboInOut << "Total Enthalpy " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy(); + TurboInOut << "Total Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure(); + TurboInOut << "Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure(); + TurboInOut << "Density " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity(); + TurboInOut << "Normal Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]; + TurboInOut << "Tangential Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]; + TurboInOut << "Mass Flow " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow(); + TurboInOut << "Mach " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue(); + TurboInOut << "Flow Angle " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; + TurboInOut.PrintFooter(); + } + cout< TurboPerf, + CConfig *config) { + + auto nZone = config->GetnZone(); + unsigned short iStage, iZone; + auto nSpan = config->GetnSpanWiseSections(); + stringstream TurboMZPerf; + + PrintingToolbox::CTablePrinter TurboInOut(&TurboMZPerf); + + /*--- Print header for the stage performance computation ---*/ + TurboMZPerf<<"-- Turbomachinery Stage Performance --"<GetNormEntropyGen()*100 + <GetEulerianWork() + <GetTotalStaticEfficiency()*100 + <GetTotalTotalEfficiency()*100 + <GetTotalStaticPressureRatio() + <GetTotalTotalPressureRatio(); + TurboInOut.PrintFooter(); + cout< TurboPerf, + CConfig *config) { + + if (rank == MASTER_NODE){ + auto BladePerformance = TurboPerf->GetBladesPerformances(); + for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) { + auto nSpan = config->GetnSpan_iZones(iZone); + stringstream tag; + tag << iZone + 1; + + SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetEntropy()); + SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy()); + SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure()); + SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure()); + SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure()); + SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure()); + SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity()); + SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity()); + SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0]); + SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]); + SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1]); + SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]); + SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow()); + SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow()); + SetHistoryOutputValue("MachIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue()); + SetHistoryOutputValue("MachOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue()); + SetHistoryOutputValue("FlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("FlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); + } + SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); + SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); + SetHistoryOutputValue("TotalStaticEfficiency", TurboStagePerf->GetTotalStaticEfficiency()*100); + SetHistoryOutputValue("TotalTotalEfficiency", TurboStagePerf->GetTotalTotalEfficiency()*100); + SetHistoryOutputValue("PressureRatioTS", TurboStagePerf->GetTotalStaticPressureRatio()); + SetHistoryOutputValue("PressureRatioTT", TurboStagePerf->GetTotalTotalPressureRatio()); + } +} diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 5be001f5a5a..28f8716e5ca 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -36,6 +36,7 @@ #include "../../include/variables/CPrimitiveIndices.hpp" #include "../../include/fluid/CCoolProp.hpp" + CFlowOutput::CFlowOutput(const CConfig *config, unsigned short nDim, bool fem_output) : CFVMOutput(config, nDim, fem_output), lastInnerIter(curInnerIter) { @@ -3745,3 +3746,38 @@ void CFlowOutput::SetFixedCLScreenOutput(const CConfig *config){ curInnerIter = config->GetInnerIter(); } } + +void CFlowOutput::AddTurboOutput(unsigned short nZone){ +//Adds zone turboperformance history variables + for (unsigned short iZone = 0; iZone <= nZone-1; iZone++) { + stringstream tag; + tag << iZone + 1; + AddHistoryOutput("EntropyIn_" + tag.str(), "EntropyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("EntropyOut_" + tag.str(), "EntropyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEntahalpyIn_" + tag.str(), "TotalEntahalpyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEnthalpyOut_" + tag.str(), "TotalEnthalpyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureIn_" + tag.str(), "TotPressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureOut_" + tag.str(), "TotPressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureIn_" + tag.str(), "PressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureOut_" + tag.str(), "PressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityIn_" + tag.str(), "DensityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityOut_" + tag.str(), "DensityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityIn_" + tag.str(), "NormalVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityOut_" + tag.str(), "NormalVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityIn_" + tag.str(), "TangentialVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityOut_" + tag.str(), "TangentialVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("FlowAngleIn_" + tag.str(), "FlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("FlowAngleOut_" + tag.str(), "FlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + } + //Adds turbomachinery machine performance variables + AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("EulerianWork", "EulerianWork", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalStaticEfficiency", "TotStaticEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalTotalEfficiency", "TotTotEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureRatioTS", "PRTS", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureRatioTT", "PRTT", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); +} diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index cae8762b9da..e83e4c5e283 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -228,6 +228,37 @@ void COutput::SetHistoryOutput(CGeometry *geometry, } +void COutput::SetHistoryOutput(CGeometry *geometry, + CSolver **solver, + CConfig *config, + CTurbomachineryStagePerformance* TurboStagePerf, + std::shared_ptr TurboPerf, + unsigned short val_iZone, + unsigned long TimeIter, + unsigned long OuterIter, + unsigned long InnerIter){ + + unsigned long Iter= InnerIter; + + if (config->GetMultizone_Problem()) + Iter = OuterIter; + + /*--- Turbomachinery Performance Screen summary output---*/ + if (Iter%100 == 0) { + SetTurboPerformance_Output(TurboPerf, config, TimeIter, OuterIter, InnerIter); + + if (rank == MASTER_NODE) + SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config); + } + + /*--- Update turboperformance history file*/ + LoadTurboHistoryData(TurboStagePerf, TurboPerf, config); + + SetHistoryOutput(geometry, solver, config, TimeIter, OuterIter,InnerIter); + +} + + void COutput::SetMultizoneHistoryOutput(COutput **output, CConfig **config, CConfig *driver_config, unsigned long TimeIter, unsigned long OuterIter){ curTimeIter = TimeIter; @@ -2476,137 +2507,4 @@ void COutput::PrintVolumeFields(){ VolumeFieldTable.PrintFooter(); } -} - -void COutput::SetTurboPerformance_Output(std::shared_ptr TurboPerf, - CConfig *config, - unsigned long TimeIter, - unsigned long OuterIter, - unsigned long InnerIter, - unsigned short val_iZone) { - - curTimeIter = TimeIter; - curAbsTimeIter = TimeIter - config->GetRestart_Iter(); - curOuterIter = OuterIter; - curInnerIter = InnerIter; - stringstream TurboInOutTable, TurboPerfTable; - - if(rank == MASTER_NODE) { - auto BladePerformance = TurboPerf->GetBladesPerformances(); - auto nSpan = config->GetnSpan_iZones(val_iZone); - - /*-- Table for Turbomachinery Performance Values --*/ - PrintingToolbox::CTablePrinter TurboInOut(&TurboInOutTable); - - TurboInOutTable<<"-- Turbomachinery inlet and outlet property Summary:"<GetnSpan_iZones(iZone); - - TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetEntropy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy(); - TurboInOut << "Total Enthalpy " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy(); - TurboInOut << "Total Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure(); - TurboInOut << "Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure(); - TurboInOut << "Density " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity(); - TurboInOut << "Normal Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]; - TurboInOut << "Tangential Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]; - TurboInOut << "Mass Flow " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow(); - TurboInOut << "Mach " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue(); - TurboInOut << "Flow Angle " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; - TurboInOut.PrintFooter(); - } - cout< TurboPerf, - CConfig *config) { - - auto nZone = config->GetnZone(); - unsigned short iStage, iZone; - auto nSpan = config->GetnSpanWiseSections(); - stringstream TurboMZPerf; - - PrintingToolbox::CTablePrinter TurboInOut(&TurboMZPerf); - - /*--- Print header for the stage performance computation ---*/ - TurboMZPerf<<"-- Turbomachinery Stage Performance --"<GetBladesPerformances().at(ZONE_0).at(nSpan)->GetInletState(); - auto OutState = TurboPerf->GetBladesPerformances().at(nZone-1).at(nSpan)->GetOutletState(); - - TurboStagePerf->ComputePerformanceStage(InState, OutState, config); - - /*--- Print Machine Performance (In future also add if the performance is TURBINE or COMPRESSOR) ---*/ - TurboInOut<<"MACHINE"<GetNormEntropyGen()*100 - <GetEulerianWork() - <GetTotalStaticEfficiency()*100 - <GetTotalTotalEfficiency()*100 - <GetTotalStaticPressureRatio() - <GetTotalTotalPressureRatio(); - TurboInOut.PrintFooter(); - cout< TurboPerf, - CConfig *config, unsigned short val_iZone) { - - if (rank == MASTER_NODE){ - auto BladePerformance = TurboPerf->GetBladesPerformances(); - auto nSpan = config->GetnSpan_iZones(val_iZone); - for (unsigned short iZone = 0; iZone <= val_iZone; iZone++) { - nSpan = config->GetnSpan_iZones(iZone); - stringstream tag; - tag << iZone + 1; - - SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetEntropy()); - SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy()); - SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy()); - SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy()); - SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure()); - SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure()); - SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure()); - SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure()); - SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity()); - SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity()); - SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0]); - SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]); - SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1]); - SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]); - SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow()); - SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow()); - SetHistoryOutputValue("MachIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue()); - SetHistoryOutputValue("MachOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue()); - SetHistoryOutputValue("FlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); - SetHistoryOutputValue("FlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); - } - SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); - SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); - SetHistoryOutputValue("TotalStaticEfficiency", TurboStagePerf->GetTotalStaticEfficiency()*100); - SetHistoryOutputValue("TotalTotalEfficiency", TurboStagePerf->GetTotalTotalEfficiency()*100); - SetHistoryOutputValue("PressureRatioTS", TurboStagePerf->GetTotalStaticPressureRatio()); - SetHistoryOutputValue("PressureRatioTT", TurboStagePerf->GetTotalTotalPressureRatio()); - } } \ No newline at end of file diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index c5b1705f6c3..634adf1a145 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -1,6 +1,6 @@ /*! * \file CTurboOutput.cpp - * \brief Source of the Turbomachinery Performance class. + * \brief Source of the Turbomachinery Performance class * \author S. Vitale, N. Anand * \version 7.1.1 "Blackbird" * @@ -27,6 +27,7 @@ #include "../../include/output/CTurboOutput.hpp" + CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { Density = Pressure = TangVelocity = 0.0; } From 1d5c4fce575114f133652d9113127354ac0a83cc Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Mon, 17 Apr 2023 17:02:41 +0100 Subject: [PATCH 04/47] typo --- SU2_CFD/include/output/CTurboOutput.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index c31709405ff..01652af243f 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -226,4 +226,4 @@ class CTurboOutput { // vector> GetStagePerformances() const { return StagePerformances; } // shared_ptr GetMachinePerformances() const { return MachinePerformances; } void ComputeTurbomachineryPerformance(vector> const primitives); -};s \ No newline at end of file +}; \ No newline at end of file From f60220dc3cb43fb59dadbd31712a9ffdddfdab8b Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 19 Apr 2023 16:56:08 +0100 Subject: [PATCH 05/47] Fixed mass flow rate computation --- Common/include/geometry/CGeometry.hpp | 8 ++ Common/include/geometry/CPhysicalGeometry.hpp | 8 ++ Common/src/geometry/CPhysicalGeometry.cpp | 16 ++++ SU2_CFD/include/interfaces/CInterface.hpp | 9 --- .../interfaces/cfd/CMixingPlaneInterface.hpp | 8 -- SU2_CFD/src/drivers/CDriver.cpp | 80 +------------------ SU2_CFD/src/drivers/CMultizoneDriver.cpp | 7 +- SU2_CFD/src/drivers/CSinglezoneDriver.cpp | 2 - SU2_CFD/src/interfaces/CInterface.cpp | 10 --- .../interfaces/cfd/CMixingPlaneInterface.cpp | 15 ---- SU2_CFD/src/iteration/CFluidIteration.cpp | 4 + 11 files changed, 39 insertions(+), 128 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 22280ddf04f..49b56a4347b 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -783,6 +783,14 @@ class CGeometry { */ inline virtual void GatherInOutAverageValues(CConfig* config, bool allocate) {} + /*! + * \brief Store all the turboperformance in the solver in ZONE_0. + * \param[in] donor_geometry - Solution from the donor mesh. + * \param[in] target_geometry - Solution from the target mesh. + * \param[in] donorZone - counter of the donor solution + */ + inline virtual void SetAvgTurboGeoValues(const CConfig *donor_config, CGeometry *donor_geometry, unsigned short donorZone) {}; + /*! * \brief Set max length. * \param[in] config - Definition of the particular problem. diff --git a/Common/include/geometry/CPhysicalGeometry.hpp b/Common/include/geometry/CPhysicalGeometry.hpp index 0f881daeea9..d2812857735 100644 --- a/Common/include/geometry/CPhysicalGeometry.hpp +++ b/Common/include/geometry/CPhysicalGeometry.hpp @@ -408,6 +408,14 @@ class CPhysicalGeometry final : public CGeometry { */ void GatherInOutAverageValues(CConfig* config, bool allocate) override; + /*! + * \brief Store all the turboperformance in the solver in ZONE_0. + * \param[in] donor_geometry - Solution from the donor mesh. + * \param[in] target_geometry - Solution from the target mesh. + * \param[in] donorZone - counter of the donor solution + */ + void SetAvgTurboGeoValues(const CConfig *donor_config, CGeometry *donor_geometry, unsigned short donorZone) override; + /*! * \brief Set the edge structure of the control volume. * \param[in] config - Definition of the particular problem. diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 6ecfb42c140..4d6b9fc0de8 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -6311,6 +6311,22 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig* config, bool allocate) delete[] turboNormal; } +void CPhysicalGeometry::SetAvgTurboGeoValues(const CConfig *donor_config, CGeometry *donor_geometry, + unsigned short donorZone) { + + unsigned short iSpan; + unsigned short nSpanMaxAllZones = donor_config->GetnSpanMaxAllZones(); + + for(iSpan = 0; iSpanGetTurboRadiusIn(donorZone, iSpan), donorZone, iSpan); + SetSpanAreaIn(donor_geometry->GetSpanAreaIn(donorZone, iSpan), donorZone, iSpan); + SetTangGridVelIn(donor_geometry->GetTangGridVelIn(donorZone, iSpan), donorZone, iSpan); + SetTurboRadiusOut(donor_geometry->GetTurboRadiusOut(donorZone, iSpan), donorZone, iSpan); + SetSpanAreaOut(donor_geometry->GetSpanAreaOut(donorZone, iSpan), donorZone, iSpan); + SetTangGridVelOut(donor_geometry->GetTangGridVelOut(donorZone, iSpan), donorZone, iSpan); + } +} + void CPhysicalGeometry::SetMaxLength(CConfig* config) { SU2_OMP_FOR_STAT(roundUpDiv(nPointDomain, omp_get_max_threads())) for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { diff --git a/SU2_CFD/include/interfaces/CInterface.hpp b/SU2_CFD/include/interfaces/CInterface.hpp index 49deb7dbe31..983028e8f0f 100644 --- a/SU2_CFD/include/interfaces/CInterface.hpp +++ b/SU2_CFD/include/interfaces/CInterface.hpp @@ -219,13 +219,4 @@ class CInterface { */ void GatherAverageValues(CSolver *donor_solution, CSolver *target_solution, unsigned short donorZone); - /*! - * \brief Exchange Average geometrical value beteween zones . - * \param[in] donor_geometry - Geometry of the donor mesh. - * \param[in] target_geometry - Geometry of the target mesh. - * \param[in] donor_config - Definition of the problem at the donor mesh. - * \param[in] target_config - Definition of the problem at the target mesh. - */ - void GatherAverageTurboGeoValues(CGeometry *donor_geometry, CGeometry *target_geometry, unsigned short donorZone); - }; diff --git a/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp b/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp index de3fe45340a..59f078778d9 100644 --- a/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp +++ b/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp @@ -81,14 +81,6 @@ class CMixingPlaneInterface : public CInterface { */ void SetAverageValues(CSolver *donor_solution, CSolver *target_solution, unsigned short donorZone) override; - /*! - * \brief Store all the turboperformance in the solver in ZONE_0. - * \param[in] donor_geometry - Solution from the donor mesh. - * \param[in] target_geometry - Solution from the target mesh. - * \param[in] donorZone - counter of the donor solution - */ - void SetAverageTurboGeoValues(CGeometry *donor_geometry, CGeometry *target_geometry, unsigned short donorZone) override; - }; diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index a00867b5528..5c5a12091dd 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -2739,9 +2739,8 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, } //TODO: Fix mass flow - for (iZone = 0; iZone < nZone-1; iZone++) { - if (interface[iZone][nZone-1] != nullptr) - interface[iZone][nZone-1]->GatherAverageTurboGeoValues(geometry[iZone][INST_0][MESH_0],geometry[nZone-1][INST_0][MESH_0], iZone); + for (iZone = 0; iZone < nZone-1; iZone++) { + geometry[nZone-1][INST_0][MESH_0]->SetAvgTurboGeoValues(config[iZone],geometry[iZone][INST_0][MESH_0], iZone); } /*--- Transfer number of blade to ZONE_0 to correctly compute turbo performance---*/ @@ -2923,81 +2922,6 @@ void CDriver::PrintDirectResidual(RECORDING kind_recording) { } -void CDriver::RampTurbomachineryValues(unsigned long iter) { - auto* config = config_container[ZONE_0]; - - /*--- ROTATING FRAME Ramp: Compute the updated rotational velocity. ---*/ - if (config->GetGrid_Movement() && config->GetRampRotatingFrame()) { - const unsigned long rampFreq = SU2_TYPE::Int(config->GetRampRotatingFrame_Coeff(1)); - const unsigned long finalRamp_Iter = SU2_TYPE::Int(config->GetRampRotatingFrame_Coeff(2)); - const su2double rot_z_ini = config->GetRampRotatingFrame_Coeff(0); - const bool print = false; - - if(iter % rampFreq == 0 && iter <= finalRamp_Iter){ - - for (auto iZone = 0u; iZone < nZone; iZone++) { - const su2double rot_z_final = config_container[iZone]->GetFinalRotation_Rate_Z(); - - if (fabs(rot_z_final) > 0.0) { - const su2double rot_z = rot_z_ini + iter * ( rot_z_final - rot_z_ini) / finalRamp_Iter; - config_container[iZone]->SetRotation_Rate(2, rot_z); - if (rank == MASTER_NODE && print && iter > 0) { - cout << "\nUpdated rotating frame grid velocities for zone " << iZone << ".\n"; - } - geometry_container[iZone][INST_0][MESH_0]->SetRotationalVelocity(config_container[iZone], print); - geometry_container[iZone][INST_0][MESH_0]->SetShroudVelocity(config_container[iZone]); - } - } - - for (auto iZone = 0u; iZone < nZone; iZone++) { - geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone], iZone, INFLOW, false); - geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone],iZone, OUTFLOW, false); - geometry_container[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config_container[iZone], false); - } - - for (auto iZone = 1u; iZone < nZone; iZone++) { - interface_container[iZone][ZONE_0]->GatherAverageTurboGeoValues( - geometry_container[iZone][INST_0][MESH_0], geometry_container[ZONE_0][INST_0][MESH_0], iZone); - } - } - } - - /*--- Outlet Pressure Ramp: Compute the updated pressure. ---*/ - if (config->GetRampOutletPressure()) { - const unsigned long rampFreq = SU2_TYPE::Int(config->GetRampOutletPressure_Coeff(1)); - const unsigned long finalRamp_Iter = SU2_TYPE::Int(config->GetRampOutletPressure_Coeff(2)); - const su2double outPres_ini = config->GetRampOutletPressure_Coeff(0); - const su2double outPres_final = config->GetFinalOutletPressure(); - - if (iter % rampFreq == 0 && iter <= finalRamp_Iter) { - const su2double outPres = outPres_ini + iter * (outPres_final - outPres_ini) / finalRamp_Iter; - if (rank == MASTER_NODE) config->SetMonitotOutletPressure(outPres); - - for (auto iZone = 0u; iZone < nZone; iZone++) { - for (auto iMarker = 0; iMarker < config_container[iZone]->GetnMarker_All(); iMarker++) { - const auto KindBC = config_container[iZone]->GetMarker_All_KindBC(iMarker); - const auto Marker_Tag = config_container[iZone]->GetMarker_All_TagBound(iMarker); - unsigned short KindBCOption; - switch (KindBC) { - case RIEMANN_BOUNDARY: - KindBCOption = config_container[iZone]->GetKind_Data_Riemann(Marker_Tag); - if (KindBCOption == STATIC_PRESSURE || KindBCOption == RADIAL_EQUILIBRIUM) { - SU2_MPI::Error("Outlet pressure ramp only implemented for NRBC", CURRENT_FUNCTION); - } - break; - case GILES_BOUNDARY: - KindBCOption = config_container[iZone]->GetKind_Data_Giles(Marker_Tag); - if (KindBCOption == STATIC_PRESSURE || KindBCOption == STATIC_PRESSURE_1D || - KindBCOption == RADIAL_EQUILIBRIUM ) { - config_container[iZone]->SetGiles_Var1(outPres, Marker_Tag); - } - break; - } - } - } - } - } -} CFluidDriver::CFluidDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator) : CDriver(confFile, val_nZone, MPICommunicator, false) { Max_Iter = config_container[ZONE_0]->GetnInner_Iter(); diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index 714cff62a33..4db751f3379 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -246,11 +246,6 @@ void CMultizoneDriver::Preprocess(unsigned long TimeIter) { } } - /*--- Ramp turbo values for unsteady problems here, otherwise do it over outer iterations. ---*/ - if (config_container[ZONE_0]->GetTime_Domain()) { - RampTurbomachineryValues(TimeIter); - } - SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Run a predictor step ---*/ @@ -596,7 +591,7 @@ bool CMultizoneDriver::TransferData(unsigned short donorZone, unsigned short tar for (donorZone = 0; donorZone < nZone; donorZone++) { if (interface_types[donorZone][targetZone]==MIXING_PLANE) { interface_container[donorZone][targetZone]->GatherAverageValues(solver_container[donorZone][INST_0][MESH_0][FLOW_SOL],solver_container[targetZone][INST_0][MESH_0][FLOW_SOL], donorZone); - interface_container[donorZone][targetZone]->GatherAverageTurboGeoValues(geometry_container[donorZone][INST_0][MESH_0],geometry_container[targetZone][INST_0][MESH_0], donorZone); + geometry_container[targetZone][INST_0][MESH_0]->SetAvgTurboGeoValues(config_container[iZone],geometry_container[iZone][INST_0][MESH_0], iZone); } } diff --git a/SU2_CFD/src/drivers/CSinglezoneDriver.cpp b/SU2_CFD/src/drivers/CSinglezoneDriver.cpp index 3a3518d33ab..32cd7d18482 100644 --- a/SU2_CFD/src/drivers/CSinglezoneDriver.cpp +++ b/SU2_CFD/src/drivers/CSinglezoneDriver.cpp @@ -123,8 +123,6 @@ void CSinglezoneDriver::Preprocess(unsigned long TimeIter) { else config_container[ZONE_0]->SetPhysicalTime(0.0); - /*--- Ramp turbo BCs for this time step. ---*/ - RampTurbomachineryValues(TimeIter); /*--- Set the initial condition for EULER/N-S/RANS ---------------------------------------------*/ if (config_container[ZONE_0]->GetFluidProblem()) { diff --git a/SU2_CFD/src/interfaces/CInterface.cpp b/SU2_CFD/src/interfaces/CInterface.cpp index dc068205324..ea4d1d0bfe3 100644 --- a/SU2_CFD/src/interfaces/CInterface.cpp +++ b/SU2_CFD/src/interfaces/CInterface.cpp @@ -645,13 +645,3 @@ void CInterface::GatherAverageValues(CSolver *donor_solution, CSolver *target_so SetAverageValues(donor_solution, target_solution, donorZone); } - -void CInterface::GatherAverageTurboGeoValues(CGeometry *donor_geometry, CGeometry *target_geometry, - unsigned short donorZone){ - - - /*--- here we made the strong assumption that the mesh zone order - * follows the same order of the turbomachinery markers ---*/ - SetAverageTurboGeoValues(donor_geometry, target_geometry, donorZone); - -} diff --git a/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp b/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp index ab7de26be09..d98b61dadeb 100644 --- a/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp @@ -136,18 +136,3 @@ void CMixingPlaneInterface::SetAverageValues(CSolver *donor_solution, CSolver *t } } - -void CMixingPlaneInterface::SetAverageTurboGeoValues(CGeometry *donor_geometry, CGeometry *target_geometry, - unsigned short donorZone){ - unsigned short iSpan; - - for(iSpan = 0; iSpanSetTurboRadiusIn(donor_geometry->GetTurboRadiusIn(donorZone, iSpan), donorZone, iSpan); - target_geometry->SetSpanAreaIn(donor_geometry->GetSpanAreaIn(donorZone, iSpan), donorZone, iSpan); - target_geometry->SetTangGridVelIn(donor_geometry->GetTangGridVelIn(donorZone, iSpan), donorZone, iSpan); - target_geometry->SetTurboRadiusOut(donor_geometry->GetTurboRadiusOut(donorZone, iSpan), donorZone, iSpan); - target_geometry->SetSpanAreaOut(donor_geometry->GetSpanAreaOut(donorZone, iSpan), donorZone, iSpan); - target_geometry->SetTangGridVelOut(donor_geometry->GetTangGridVelOut(donorZone, iSpan), donorZone, iSpan); - } - -} diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index fe0d1dfd374..cfc04c7eac8 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -281,6 +281,10 @@ void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** c geometry_container[iZone][INST_0][MESH_0]->SetAvgTurboValue(config_container[iZone],iZone, OUTFLOW, false); geometry_container[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config_container[iZone], false); } + + for (auto iZone = 0u; iZone < nZone-1; iZone++) { + geometry_container[nZone-1][INST_0][MESH_0]->SetAvgTurboGeoValues(config_container[iZone],geometry_container[iZone][INST_0][MESH_0], iZone); + } } } From 6f1e09b615e2c37ea5500811e3f9592d7fca06c2 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 20 Apr 2023 09:00:04 +0100 Subject: [PATCH 06/47] Some tidying and build warning fixes --- SU2_CFD/include/output/CTurboOutput.hpp | 4 +++- SU2_CFD/src/drivers/CDriver.cpp | 3 --- SU2_CFD/src/iteration/CFluidIteration.cpp | 2 +- SU2_CFD/src/output/CFlowCompOutput.cpp | 3 --- SU2_CFD/src/output/CTurboOutput.cpp | 2 -- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 01652af243f..5471524658d 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -123,7 +123,7 @@ class CTurbomachineryState { su2double Norm(vector const& u) const { su2double accum = 0.; - for (int i = 0; i < u.size(); ++i) { + for (auto i = 0u; i < u.size(); ++i) { accum += u[i] * u[i]; } return sqrt(accum); @@ -141,6 +141,8 @@ class CTurbomachineryBladePerformance { CTurbomachineryBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, su2double areaOut, su2double radiusOut); + virtual ~CTurbomachineryBladePerformance() = default; + virtual void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives){}; const CTurbomachineryState& GetInletState() { return InletState; } diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 5c5a12091dd..4ef240b2f3c 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -2462,9 +2462,6 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet const bool fluid_donor = config[donor]->GetFluidProblem(); const bool structural_donor = config[donor]->GetStructuralProblem(); - /*--- Turbomachinery Bool for MIXING PLANE ---*/ - const bool turbo = config[donor]->GetBoolTurbomachinery(); - /*--- Initialize the appropriate transfer strategy. ---*/ if (rank == MASTER_NODE) cout << " Transferring "; diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index cfc04c7eac8..8175b9ec92b 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -282,7 +282,7 @@ void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** c geometry_container[iZone][INST_0][MESH_0]->GatherInOutAverageValues(config_container[iZone], false); } - for (auto iZone = 0u; iZone < nZone-1; iZone++) { + for (auto iZone = 0; iZone < nZone-1; iZone++) { geometry_container[nZone-1][INST_0][MESH_0]->SetAvgTurboGeoValues(config_container[iZone],geometry_container[iZone][INST_0][MESH_0], iZone); } } diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 87c2f27a6c2..1098fc07eff 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -522,9 +522,6 @@ void CFlowCompOutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePe std::shared_ptr TurboPerf, CConfig *config) { - auto nZone = config->GetnZone(); - unsigned short iStage, iZone; - auto nSpan = config->GetnSpanWiseSections(); stringstream TurboMZPerf; PrintingToolbox::CTablePrinter TurboInOut(&TurboMZPerf); diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index 634adf1a145..68208bed37e 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -182,7 +182,6 @@ CTurboOutput::CTurboOutput(const CConfig& config, CFluidModel& fluidModel) { unsigned short nBladesRow = config.GetnMarker_Turbomachinery(); unsigned short nDim = geometry.GetnDim(); - unsigned short nStages = SU2_TYPE::Int(nBladesRow / 2); for (unsigned short iBladeRow = 0; iBladeRow < nBladesRow; iBladeRow++) { vector > bladeSpanPerformances; @@ -193,7 +192,6 @@ CTurboOutput::CTurboOutput(const CConfig& config, su2double areaOut = geometry.GetSpanAreaOut(iBladeRow, iSpan); su2double radiusIn = geometry.GetTurboRadiusIn(iBladeRow, iSpan); su2double radiusOut = geometry.GetTurboRadiusOut(iBladeRow, iSpan); - // std::cout << "Area In " << areaIn << " Area Out " << areaOut << " blade row " << iBladeRow < Date: Thu, 20 Apr 2023 10:01:51 +0100 Subject: [PATCH 07/47] format changes --- Common/include/geometry/CGeometry.hpp | 3 +- Common/include/geometry/CPhysicalGeometry.hpp | 2 +- Common/src/geometry/CPhysicalGeometry.cpp | 7 +- SU2_CFD/src/output/CTurboOutput.cpp | 223 ++++++++---------- 4 files changed, 105 insertions(+), 130 deletions(-) diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 49b56a4347b..e066b3f6139 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -789,7 +789,8 @@ class CGeometry { * \param[in] target_geometry - Solution from the target mesh. * \param[in] donorZone - counter of the donor solution */ - inline virtual void SetAvgTurboGeoValues(const CConfig *donor_config, CGeometry *donor_geometry, unsigned short donorZone) {}; + inline virtual void SetAvgTurboGeoValues(const CConfig* donor_config, CGeometry* donor_geometry, + unsigned short donorZone){}; /*! * \brief Set max length. diff --git a/Common/include/geometry/CPhysicalGeometry.hpp b/Common/include/geometry/CPhysicalGeometry.hpp index d2812857735..12d70a0f5c2 100644 --- a/Common/include/geometry/CPhysicalGeometry.hpp +++ b/Common/include/geometry/CPhysicalGeometry.hpp @@ -414,7 +414,7 @@ class CPhysicalGeometry final : public CGeometry { * \param[in] target_geometry - Solution from the target mesh. * \param[in] donorZone - counter of the donor solution */ - void SetAvgTurboGeoValues(const CConfig *donor_config, CGeometry *donor_geometry, unsigned short donorZone) override; + void SetAvgTurboGeoValues(const CConfig* donor_config, CGeometry* donor_geometry, unsigned short donorZone) override; /*! * \brief Set the edge structure of the control volume. diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 4d6b9fc0de8..d9a93e66e4b 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -6311,13 +6311,12 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig* config, bool allocate) delete[] turboNormal; } -void CPhysicalGeometry::SetAvgTurboGeoValues(const CConfig *donor_config, CGeometry *donor_geometry, - unsigned short donorZone) { - +void CPhysicalGeometry::SetAvgTurboGeoValues(const CConfig* donor_config, CGeometry* donor_geometry, + unsigned short donorZone) { unsigned short iSpan; unsigned short nSpanMaxAllZones = donor_config->GetnSpanMaxAllZones(); - for(iSpan = 0; iSpanGetTurboRadiusIn(donorZone, iSpan), donorZone, iSpan); SetSpanAreaIn(donor_geometry->GetSpanAreaIn(donorZone, iSpan), donorZone, iSpan); SetTangGridVelIn(donor_geometry->GetTangGridVelIn(donorZone, iSpan), donorZone, iSpan); diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index 68208bed37e..fde9360eeb9 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -27,37 +27,35 @@ #include "../../include/output/CTurboOutput.hpp" - -CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { - Density = Pressure = TangVelocity = 0.0; -} -CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState(vector TurboPrimitive, - unsigned short nDim, - su2double tangVel) : Density(TurboPrimitive[0]), Pressure(TurboPrimitive[1]), TangVelocity(tangVel) { +CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { Density = Pressure = TangVelocity = 0.0; } +CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState(vector TurboPrimitive, unsigned short nDim, + su2double tangVel) + : Density(TurboPrimitive[0]), Pressure(TurboPrimitive[1]), TangVelocity(tangVel) { // Velocity.assign(TurboPrimitive+2, TurboPrimitive + nDim+2 ); - Velocity = {TurboPrimitive.begin()+2, TurboPrimitive.end()}; + Velocity = {TurboPrimitive.begin() + 2, TurboPrimitive.end()}; } -CTurbomachineryCombinedPrimitiveStates::CTurbomachineryCombinedPrimitiveStates(const CTurbomachineryPrimitiveState& inletPrimitiveState, - const CTurbomachineryPrimitiveState& outletPrimitiveState) : InletPrimitiveState(inletPrimitiveState), OutletPrimitiveState(outletPrimitiveState){} +CTurbomachineryCombinedPrimitiveStates::CTurbomachineryCombinedPrimitiveStates( + const CTurbomachineryPrimitiveState& inletPrimitiveState, const CTurbomachineryPrimitiveState& outletPrimitiveState) + : InletPrimitiveState(inletPrimitiveState), OutletPrimitiveState(outletPrimitiveState) {} -CTurbomachineryState::CTurbomachineryState(){ +CTurbomachineryState::CTurbomachineryState() { Density = Pressure = Entropy = Enthalpy = Temperature = TotalTemperature = TotalPressure = TotalEnthalpy = 0.0; AbsFlowAngle = FlowAngle = MassFlow = Rothalpy = TotalRelPressure = 0.0; Area = Radius = 0.0; } -CTurbomachineryState::CTurbomachineryState(unsigned short nDim, su2double area, su2double radius) : CTurbomachineryState() { - generate_n(back_inserter(Velocity),nDim, [] {return 0.0;}); - generate_n(back_inserter(RelVelocity),nDim, [] {return 0.0;}); - generate_n(back_inserter(Mach),nDim, [] {return 0.0;}); - generate_n(back_inserter(RelMach),nDim, [] {return 0.0;}); +CTurbomachineryState::CTurbomachineryState(unsigned short nDim, su2double area, su2double radius) + : CTurbomachineryState() { + generate_n(back_inserter(Velocity), nDim, [] { return 0.0; }); + generate_n(back_inserter(RelVelocity), nDim, [] { return 0.0; }); + generate_n(back_inserter(Mach), nDim, [] { return 0.0; }); + generate_n(back_inserter(RelMach), nDim, [] { return 0.0; }); Area = area; Radius = radius; } -void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState &primitiveState) { - +void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState& primitiveState) { /*--- Assign new primitive values ---*/ Density = primitiveState.GetDensity(); Pressure = primitiveState.GetPressure(); @@ -81,7 +79,7 @@ void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomac MassFlow = Density * Velocity[0] * Area; AbsFlowAngle = atan(Velocity[1] / Velocity[0]); Mach.assign(Velocity.begin(), Velocity.end()); - std::for_each(Mach.begin(), Mach.end(), [&](su2double &el) { el /= soundSpeed; }); + std::for_each(Mach.begin(), Mach.end(), [&](su2double& el) { el /= soundSpeed; }); /*--- Compute relative kinematic quantities ---*/ su2double tangVel2 = tangVel * tangVel; @@ -90,7 +88,7 @@ void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomac su2double relVel2 = GetRelVelocityValue(); FlowAngle = atan(RelVelocity[1] / RelVelocity[0]); RelMach.assign(RelVelocity.begin(), RelVelocity.end()); - std::for_each(RelMach.begin(), RelMach.end(), [&](su2double &el) { el /= soundSpeed; }); + std::for_each(RelMach.begin(), RelMach.end(), [&](su2double& el) { el /= soundSpeed; }); /*--- Compute total relative TD quantities ---*/ Rothalpy = Enthalpy + 0.5 * relVel2 - 0.5 * tangVel2; @@ -99,29 +97,21 @@ void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomac /*--- Compute isentropic quantities ---*/ fluidModel.SetTDState_Ps(Pressure, Entropy); - } -CTurbomachineryBladePerformance::CTurbomachineryBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut) : FluidModel(fluidModel) { - InletState = CTurbomachineryState(nDim, areaIn, radiusIn); - OutletState = CTurbomachineryState(nDim, areaOut,radiusOut); +CTurbomachineryBladePerformance::CTurbomachineryBladePerformance(CFluidModel& fluidModel, unsigned short nDim, + su2double areaIn, su2double radiusIn, + su2double areaOut, su2double radiusOut) + : FluidModel(fluidModel) { + InletState = CTurbomachineryState(nDim, areaIn, radiusIn); + OutletState = CTurbomachineryState(nDim, areaOut, radiusOut); } +CTurbineBladePerformance::CTurbineBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, + su2double radiusIn, su2double areaOut, su2double radiusOut) + : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut) {} -CTurbineBladePerformance::CTurbineBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){} - -void CTurbineBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) { - +void CTurbineBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) { /*--- Compute Inlet and Outlet state ---*/ InletState.ComputeState(FluidModel, primitives.GetInletPrimitiveState()); OutletState.ComputeState(FluidModel, primitives.GetOutletPrimitiveState()); @@ -133,21 +123,18 @@ void CTurbineBladePerformance::ComputePerformance(const CTurbomachineryCombinedP su2double relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel; /*--- Compute performance ---*/ - EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); + EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); EulerianWork = InletState.GetTotalEnthalpy() - OutletState.GetTotalEnthalpy(); TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) / (OutletState.GetTotalRelPressure() - OutletState.GetPressure()); KineticEnergyLoss = 2 * (OutletState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2; } -CCompressorBladePerformance::CCompressorBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){} +CCompressorBladePerformance::CCompressorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, + su2double radiusIn, su2double areaOut, su2double radiusOut) + : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut) {} -void CCompressorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) { +void CCompressorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) { /*--- Compute Inlet and Outlet state ---*/ InletState.ComputeState(FluidModel, primitives.GetInletPrimitiveState()); OutletState.ComputeState(FluidModel, primitives.GetOutletPrimitiveState()); @@ -159,68 +146,60 @@ void CCompressorBladePerformance::ComputePerformance(const CTurbomachineryCombin su2double relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel; /*--- Compute performance ---*/ - EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); + EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); EulerianWork = OutletState.GetTotalEnthalpy() - InletState.GetTotalEnthalpy(); TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) / (InletState.GetTotalRelPressure() - InletState.GetPressure()); KineticEnergyLoss = 2 * (OutletState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2; } -CPropellorBladePerformance::CPropellorBladePerformance(CFluidModel& fluidModel, - unsigned short nDim, - su2double areaIn, - su2double radiusIn, - su2double areaOut, - su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){} +CPropellorBladePerformance::CPropellorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, + su2double radiusIn, su2double areaOut, su2double radiusOut) + : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut) {} -void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) { +void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) { // TODO: to be implemented } -CTurboOutput::CTurboOutput(const CConfig& config, - const CGeometry& geometry, - CFluidModel& fluidModel) { +CTurboOutput::CTurboOutput(const CConfig& config, const CGeometry& geometry, CFluidModel& fluidModel) { unsigned short nBladesRow = config.GetnMarker_Turbomachinery(); unsigned short nDim = geometry.GetnDim(); for (unsigned short iBladeRow = 0; iBladeRow < nBladesRow; iBladeRow++) { - vector > bladeSpanPerformances; + vector> bladeSpanPerformances; unsigned short nSpan = config.GetnSpanWiseSections(); for (unsigned short iSpan = 0; iSpan < nSpan + 1; iSpan++) { - su2double areaIn = geometry.GetSpanAreaIn(iBladeRow, iSpan); su2double areaOut = geometry.GetSpanAreaOut(iBladeRow, iSpan); su2double radiusIn = geometry.GetTurboRadiusIn(iBladeRow, iSpan); su2double radiusOut = geometry.GetTurboRadiusOut(iBladeRow, iSpan); // TODO: I have a feeling this should not be in such a for loop, to be discussed with Salvo (Nitish) - SU2_OMP_PARALLEL - { + SU2_OMP_PARALLEL { const int thread = omp_get_thread_num(); - /* Switch between the Turbomachinery Performance Kind */ - // TODO: This needs to be fixed - switch (config.GetKind_TurboPerf(iBladeRow)) { - - case TURBO_PERF_KIND::TURBINE: - bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, - radiusOut)); - break; - - case TURBO_PERF_KIND::COMPRESSOR: - bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, - radiusOut)); - break; - - case TURBO_PERF_KIND::PROPELLOR: - bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, - radiusOut)); - break; - - default: - bladeSpanPerformances.push_back(make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, - radiusOut)); - break; + /* Switch between the Turbomachinery Performance Kind */ + // TODO: This needs to be fixed + switch (config.GetKind_TurboPerf(iBladeRow)) { + case TURBO_PERF_KIND::TURBINE: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; + + case TURBO_PERF_KIND::COMPRESSOR: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; + + case TURBO_PERF_KIND::PROPELLOR: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; + + default: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; } } } @@ -229,75 +208,71 @@ CTurboOutput::CTurboOutput(const CConfig& config, } void CTurboOutput::ComputeTurbomachineryPerformance( - vector > const bladesPrimitives) { - for(unsigned i = 0; i < BladesPerformances.size(); ++i) { + vector> const bladesPrimitives) { + for (unsigned i = 0; i < BladesPerformances.size(); ++i) { ComputePerBlade(BladesPerformances[i], bladesPrimitives[i]); } } -void CTurboOutput::ComputePerBlade( - vector > const bladePerformances, - vector const bladePrimitives) { - for(unsigned i = 0; i < bladePerformances.size(); ++i) { +void CTurboOutput::ComputePerBlade(vector> const bladePerformances, + vector const bladePrimitives) { + for (unsigned i = 0; i < bladePerformances.size(); ++i) { ComputePerSpan(bladePerformances[i], bladePrimitives[i]); } } -void CTurboOutput::ComputePerSpan(shared_ptr const spanPerformances, - const CTurbomachineryCombinedPrimitiveStates &spanPrimitives) { +void CTurboOutput::ComputePerSpan(shared_ptr const spanPerformances, + const CTurbomachineryCombinedPrimitiveStates& spanPrimitives) { spanPerformances->ComputePerformance(spanPrimitives); } -CTurbomachineryStagePerformance::CTurbomachineryStagePerformance(CFluidModel& fluid) : fluidModel(fluid) { - -} - -void CTurbomachineryStagePerformance::ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, const CConfig* config) { +CTurbomachineryStagePerformance::CTurbomachineryStagePerformance(CFluidModel& fluid) : fluidModel(fluid) {} +void CTurbomachineryStagePerformance::ComputePerformanceStage(CTurbomachineryState InState, + CTurbomachineryState OutState, const CConfig* config) { switch (config->GetKind_TurboPerf(ZONE_0)) { - case TURBO_PERF_KIND::TURBINE: - ComputeTurbineStagePerformance(InState, OutState); - break; + case TURBO_PERF_KIND::TURBINE: + ComputeTurbineStagePerformance(InState, OutState); + break; - case TURBO_PERF_KIND::COMPRESSOR: - ComputeCompressorStagePerformance(InState, OutState); - break; + case TURBO_PERF_KIND::COMPRESSOR: + ComputeCompressorStagePerformance(InState, OutState); + break; - default: - ComputeTurbineStagePerformance(InState, OutState); - break; + default: + ComputeTurbineStagePerformance(InState, OutState); + break; } } -void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState) { - - /*--- Compute isentropic Outflow quantities ---*/ +void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(CTurbomachineryState InState, + CTurbomachineryState OutState) { + /*--- Compute isentropic Outflow quantities ---*/ fluidModel.SetTDState_Ps(OutState.GetPressure(), InState.GetEntropy()); su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity(); - su2double totEnthalpyOutIs = enthalpyOutIs + 0.5*OutState.GetVelocityValue()*OutState.GetVelocityValue(); + su2double totEnthalpyOutIs = enthalpyOutIs + 0.5 * OutState.GetVelocityValue() * OutState.GetVelocityValue(); /*--- Compute turbine stage performance ---*/ - NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy())/InState.GetEntropy(); + NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy()) / InState.GetEntropy(); EulerianWork = InState.GetTotalEnthalpy() - OutState.GetTotalEnthalpy(); - TotalStaticEfficiency = EulerianWork/(InState.GetTotalEnthalpy()-enthalpyOutIs); - TotalTotalEfficiency = EulerianWork/(InState.GetTotalEnthalpy()-totEnthalpyOutIs); - TotalStaticPressureRatio = InState.GetTotalPressure()/OutState.GetPressure(); - TotalTotalPressureRatio = InState.GetTotalPressure()/OutState.GetTotalPressure(); + TotalStaticEfficiency = EulerianWork / (InState.GetTotalEnthalpy() - enthalpyOutIs); + TotalTotalEfficiency = EulerianWork / (InState.GetTotalEnthalpy() - totEnthalpyOutIs); + TotalStaticPressureRatio = InState.GetTotalPressure() / OutState.GetPressure(); + TotalTotalPressureRatio = InState.GetTotalPressure() / OutState.GetTotalPressure(); } -void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState) { - +void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(CTurbomachineryState InState, + CTurbomachineryState OutState) { /*--- Compute isentropic Outflow quantities ---*/ fluidModel.SetTDState_Ps(OutState.GetPressure(), InState.GetEntropy()); su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity(); - su2double totEnthalpyOutIs = enthalpyOutIs + 0.5*OutState.GetVelocityValue()*OutState.GetVelocityValue(); + su2double totEnthalpyOutIs = enthalpyOutIs + 0.5 * OutState.GetVelocityValue() * OutState.GetVelocityValue(); /*--- Compute compressor stage performance ---*/ - NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy())/InState.GetEntropy(); + NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy()) / InState.GetEntropy(); EulerianWork = OutState.GetTotalEnthalpy() - InState.GetTotalEnthalpy(); - TotalStaticEfficiency = (enthalpyOutIs-InState.GetTotalEnthalpy())/EulerianWork; - TotalTotalEfficiency = (totEnthalpyOutIs-InState.GetTotalEnthalpy())/EulerianWork; - TotalStaticPressureRatio = OutState.GetPressure()/InState.GetTotalPressure(); - TotalTotalPressureRatio = OutState.GetTotalPressure()/InState.GetTotalPressure(); - + TotalStaticEfficiency = (enthalpyOutIs - InState.GetTotalEnthalpy()) / EulerianWork; + TotalTotalEfficiency = (totEnthalpyOutIs - InState.GetTotalEnthalpy()) / EulerianWork; + TotalStaticPressureRatio = OutState.GetPressure() / InState.GetTotalPressure(); + TotalTotalPressureRatio = OutState.GetTotalPressure() / InState.GetTotalPressure(); } \ No newline at end of file From 9e02f8871a2d7913528d250036a1feea5c1e3e42 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 20 Apr 2023 10:12:47 +0100 Subject: [PATCH 08/47] SU2_OMP_PARALLEL formatting in CTurboOutput --- .clang-format | 2 +- SU2_CFD/src/output/CTurboOutput.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index cb363900eb6..211546de046 100644 --- a/.clang-format +++ b/.clang-format @@ -2,4 +2,4 @@ BasedOnStyle: Google PointerAlignment: Left DerivePointerAlignment: false ColumnLimit: 120 -SortIncludes: Never +SortIncludes: false diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index fde9360eeb9..b9d85685b64 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -26,6 +26,7 @@ */ #include "../../include/output/CTurboOutput.hpp" +#include "Common/include/parallelization/omp_structure.hpp" CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { Density = Pressure = TangVelocity = 0.0; } CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState(vector TurboPrimitive, unsigned short nDim, @@ -176,7 +177,7 @@ CTurboOutput::CTurboOutput(const CConfig& config, const CGeometry& geometry, CFl // TODO: I have a feeling this should not be in such a for loop, to be discussed with Salvo (Nitish) SU2_OMP_PARALLEL { - const int thread = omp_get_thread_num(); + // const int thread = omp_get_thread_num(); /* Switch between the Turbomachinery Performance Kind */ // TODO: This needs to be fixed @@ -202,6 +203,7 @@ CTurboOutput::CTurboOutput(const CConfig& config, const CGeometry& geometry, CFl break; } } + END_SU2_OMP_PARALLEL } BladesPerformances.push_back(bladeSpanPerformances); } From 42f05a1dd0b1c9bdf5878d922a8ce4eb46125c7a Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 20 Apr 2023 10:43:41 +0100 Subject: [PATCH 09/47] Removed vscode auto addition --- SU2_CFD/src/output/CTurboOutput.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index b9d85685b64..c6b1bc5326f 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -26,7 +26,6 @@ */ #include "../../include/output/CTurboOutput.hpp" -#include "Common/include/parallelization/omp_structure.hpp" CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { Density = Pressure = TangVelocity = 0.0; } CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState(vector TurboPrimitive, unsigned short nDim, From b94ada373420aee6e71c18a98888ef2a3c8610c8 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 20 Apr 2023 11:39:04 +0100 Subject: [PATCH 10/47] Updated transonic stator test case to fix reg test --- .../transonic_stator_2D/transonic_stator_restart.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg b/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg index 87c0f8abaa8..897fab717be 100644 --- a/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg +++ b/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg @@ -75,6 +75,7 @@ SPATIAL_FOURIER= YES %---------------------------- TURBOMACHINERY SIMULATION -----------------------------% % TURBOMACHINERY_KIND = AXIAL +TURBO_PERF_KIND = TURBINE RAMP_OUTLET_PRESSURE= NO RAMP_OUTLET_PRESSURE_COEFF= (700000.0, 10.0, 500) AVERAGE_PROCESS_KIND= MIXEDOUT From 0fa99f36a03791a0bf50e9b1c279e911235413c8 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 20 Apr 2023 12:37:31 +0100 Subject: [PATCH 11/47] updated all turbo cases --- TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg | 1 + TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg | 1 + TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg | 1 + TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg | 1 + 4 files changed, 4 insertions(+) diff --git a/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg b/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg index a766bc072b0..2e93a8f4489 100755 --- a/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg +++ b/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg @@ -75,6 +75,7 @@ SPATIAL_FOURIER= NO %---------------------------- TURBOMACHINERY SIMULATION -----------------------------% % TURBOMACHINERY_KIND= CENTRIPETAL CENTRIPETAL_AXIAL +TURBO_PERF_KIND = TURBINE TURBINE MIXINGPLANE_INTERFACE_KIND= LINEAR_INTERPOLATION TURBULENT_MIXINGPLANE= YES RAMP_OUTLET_PRESSURE= NO diff --git a/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg b/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg index e1b98aee978..2c5cea96d4f 100755 --- a/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg +++ b/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg @@ -78,6 +78,7 @@ SPATIAL_FOURIER= NO %---------------------------- TURBOMACHINERY SIMULATION -----------------------------% % TURBOMACHINERY_KIND= AXIAL AXIAL +TURBO_PERF_KIND = TURBINE TURBINE TURBULENT_MIXINGPLANE= YES RAMP_OUTLET_PRESSURE= NO RAMP_OUTLET_PRESSURE_COEFF= (140000.0, 10.0, 2000) diff --git a/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg b/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg index c50f217363e..b7244e8caf6 100755 --- a/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg +++ b/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg @@ -68,6 +68,7 @@ MARKER_PLOTTING= ( wall1, wall2 ) % % Marker(s) between turbomachinery performance are evaluated. Use BLADE for single blade, STAGE for stage and TURBINE for a multi-stage. MARKER_TURBO_PERFORMANCE= (inflow, outflow, BLADE) +TURBO_PERF_KIND = TURBINE % % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % diff --git a/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg b/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg index 8c4f5ebc038..f1a681659b6 100755 --- a/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg +++ b/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg @@ -68,6 +68,7 @@ MARKER_PERIODIC= (periodic1, periodic2, 0.0, 0.0, 0.0, 0.0, 0.0, 10.29, 0.0, 0.0 MARKER_PLOTTING= ( wall1, wall2 ) MARKER_MONITORING= ( wall1, wall2 ) MARKER_TURBO_PERFORMANCE= (inflow, outflow, STAGE, inflow, outmix, BLADE, inmix, outflow, BLADE) +TURBO_PERF_KIND = TURBINE TURBINE % % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % From 71b62833495e15c697edc2b6ee40b975405c3ba3 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Mon, 24 Apr 2023 13:43:32 +0100 Subject: [PATCH 12/47] Fixed calculation bug for uneven blade spanwisediv --- SU2_CFD/include/iteration/CIteration.hpp | 2 +- SU2_CFD/include/iteration/CTurboIteration.hpp | 2 +- SU2_CFD/include/output/COutput.hpp | 2 +- SU2_CFD/include/output/CTurboOutput.hpp | 2 +- SU2_CFD/include/solvers/CEulerSolver.hpp | 2 +- SU2_CFD/include/solvers/CSolver.hpp | 2 +- SU2_CFD/src/iteration/CFluidIteration.cpp | 7 ++----- SU2_CFD/src/iteration/CTurboIteration.cpp | 7 ++++--- SU2_CFD/src/output/CTurboOutput.cpp | 8 ++++---- SU2_CFD/src/solvers/CEulerSolver.cpp | 4 ++-- 10 files changed, 18 insertions(+), 20 deletions(-) diff --git a/SU2_CFD/include/iteration/CIteration.hpp b/SU2_CFD/include/iteration/CIteration.hpp index 9938e174c5e..7538fc3413b 100644 --- a/SU2_CFD/include/iteration/CIteration.hpp +++ b/SU2_CFD/include/iteration/CIteration.hpp @@ -265,7 +265,7 @@ class CIteration { /*! * \brief Monitors turbo computation (pressure and turbo ramps). */ - virtual void InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid) {} + virtual void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid) {} /*! * \brief A virtual member. diff --git a/SU2_CFD/include/iteration/CTurboIteration.hpp b/SU2_CFD/include/iteration/CTurboIteration.hpp index 9846d99ffe7..4f23244fab2 100644 --- a/SU2_CFD/include/iteration/CTurboIteration.hpp +++ b/SU2_CFD/include/iteration/CTurboIteration.hpp @@ -67,5 +67,5 @@ class CTurboIteration : public CFluidIteration { /*! * \brief Initialises turboperformance classes. */ - void InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid) override; + void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid) override; }; diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 1633ba9fc0d..f3bfd94915b 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -48,7 +48,7 @@ inline su2double hypot(const su2double& a, const su2double& b) { } } } -#include "mel.hpp" +#include "../../../externals/mel/mel.hpp" class CGeometry; class CSolver; diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 5471524658d..34a18aa2559 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -217,7 +217,7 @@ class CTurboOutput { // vector> StagePerformances; // shared_ptr MachinePerformances; public: - CTurboOutput(const CConfig& config, const CGeometry& geometry, CFluidModel& fluidModel); + CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidModel& fluidModel); vector>> diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index cb3ae3eb8ca..c101ee3e330 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -1033,7 +1033,7 @@ class CEulerSolver : public CFVMFlowSolverBaseGetBoolTurbomachinery()){ if (val_iZone == config[ZONE_0]->GetnZone()-1) { ComputeTurboPerformance(solver, geometry, config, config[val_iZone]->GetnInner_Iter()); - + output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], TurbomachineryStagePerformance, TurbomachineryPerformance, val_iZone, config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); @@ -227,7 +227,7 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe TurboMonitor(geometry, config, config[val_iZone]->GetInnerIter()); } - + // should this be in an else statement? output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); @@ -350,9 +350,6 @@ void CFluidIteration::ComputeTurboPerformance(CSolver***** solver, CGeometry**** TurbomachineryPerformance->ComputeTurbomachineryPerformance(bladesPrimitives); auto nSpan = config_container[ZONE_0]->GetnSpanWiseSections(); - - /*--- Machine Performance (Takes inlet of Zone 0 and Outlet of Zone N-1) ---*/ - // TODO: This still crashed or gives garbage value if there are uneven spans auto InState = TurbomachineryPerformance->GetBladesPerformances().at(ZONE_0).at(nSpan)->GetInletState(); nSpan = config_container[nZone-1]->GetnSpanWiseSections(); auto OutState = TurbomachineryPerformance->GetBladesPerformances().at(nZone-1).at(nSpan)->GetOutletState(); diff --git a/SU2_CFD/src/iteration/CTurboIteration.cpp b/SU2_CFD/src/iteration/CTurboIteration.cpp index bd73894db42..257394d00e9 100644 --- a/SU2_CFD/src/iteration/CTurboIteration.cpp +++ b/SU2_CFD/src/iteration/CTurboIteration.cpp @@ -40,7 +40,8 @@ void CTurboIteration::Preprocess(COutput* output, CIntegration**** integration, solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], OUTFLOW); if (config[val_iZone]->GetBoolTurbomachinery()) { - InitTurboPerformance(geometry[val_iZone][INST_0][MESH_0], config[val_iZone], solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetFluidModel()); + InitTurboPerformance(geometry[val_iZone][INST_0][MESH_0], config, + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetFluidModel()); } } @@ -59,7 +60,7 @@ void CTurboIteration::Postprocess(COutput* output, CIntegration**** integration, geometry[val_iZone][val_iInst][MESH_0]); } -void CTurboIteration::InitTurboPerformance(CGeometry *geometry, CConfig *config, CFluidModel *fluid){ - TurbomachineryPerformance = std::make_shared(*config, *geometry, *fluid); +void CTurboIteration::InitTurboPerformance(CGeometry* geometry, CConfig** config, CFluidModel* fluid) { + TurbomachineryPerformance = std::make_shared(config, *geometry, *fluid); TurbomachineryStagePerformance = new CTurbomachineryStagePerformance(*fluid); } diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index c6b1bc5326f..bcd2a2e3126 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -161,13 +161,13 @@ void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombine // TODO: to be implemented } -CTurboOutput::CTurboOutput(const CConfig& config, const CGeometry& geometry, CFluidModel& fluidModel) { - unsigned short nBladesRow = config.GetnMarker_Turbomachinery(); +CTurboOutput::CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidModel& fluidModel) { + unsigned short nBladesRow = config[ZONE_0]->GetnMarker_Turbomachinery(); unsigned short nDim = geometry.GetnDim(); for (unsigned short iBladeRow = 0; iBladeRow < nBladesRow; iBladeRow++) { vector> bladeSpanPerformances; - unsigned short nSpan = config.GetnSpanWiseSections(); + unsigned short nSpan = config[iBladeRow]->GetnSpanWiseSections(); for (unsigned short iSpan = 0; iSpan < nSpan + 1; iSpan++) { su2double areaIn = geometry.GetSpanAreaIn(iBladeRow, iSpan); su2double areaOut = geometry.GetSpanAreaOut(iBladeRow, iSpan); @@ -180,7 +180,7 @@ CTurboOutput::CTurboOutput(const CConfig& config, const CGeometry& geometry, CFl /* Switch between the Turbomachinery Performance Kind */ // TODO: This needs to be fixed - switch (config.GetKind_TurboPerf(iBladeRow)) { + switch (config[iBladeRow]->GetKind_TurboPerf(iBladeRow)) { case TURBO_PERF_KIND::TURBINE: bladeSpanPerformances.push_back( make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index af12fbade90..d2ed4871274 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -362,8 +362,8 @@ void CEulerSolver::InstantiateEdgeNumerics(const CSolver* const* solver_containe END_SU2_OMP_SAFE_GLOBAL_ACCESS } -void CEulerSolver::InitTurboPerformance(CGeometry *geometry, CConfig *config){ - TurbomachineryPerformance = std::make_shared(*config, *geometry, *GetFluidModel()); +void CEulerSolver::InitTurboPerformance(CGeometry *geometry, CConfig** config){ + TurbomachineryPerformance = std::make_shared(config, *geometry, *GetFluidModel()); } void CEulerSolver::InitTurboContainers(CGeometry *geometry, CConfig *config){ From f36f430f3c4603d9b523b182beb9e43e5bed37c4 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 25 Apr 2023 11:26:50 +0100 Subject: [PATCH 13/47] Running AD cases --- .../transonic_stator_2D/transonic_stator.cfg | 1 + TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg | 1 + TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg | 1 + .../transonic_stator_2D/transonic_stator_restart.cfg | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg b/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg index 66c520c0a09..1abba990f96 100644 --- a/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg +++ b/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg @@ -75,6 +75,7 @@ SPATIAL_FOURIER= YES %---------------------------- TURBOMACHINERY SIMULATION -----------------------------% % TURBOMACHINERY_KIND = AXIAL +TURBO_PERF_KIND = TURBINE RAMP_OUTLET_PRESSURE= NO RAMP_OUTLET_PRESSURE_COEFF= (700000.0, 10.0, 500) AVERAGE_PROCESS_KIND= MIXEDOUT diff --git a/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg b/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg index 2e93a8f4489..2f37a975ceb 100755 --- a/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg +++ b/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg @@ -67,6 +67,7 @@ MARKER_PERIODIC= (PER1, PER2, 0.0, 0.0, 0.0, 0.0, 0.0, 18.947368421, 0.0, 0.0, 0 % MARKER_TURBOMACHINERY= (INFLOW, OUTMIX, INMIX, OUTFLOW) MARKER_ANALYZE= (OUTFLOW) +MARKER_ZONE_INTERFACE= (OUTMIX, INMIX) MARKER_MIXINGPLANE_INTERFACE= (OUTMIX, INMIX) MARKER_GILES= (INFLOW, TOTAL_CONDITIONS_PT, 413.6E+03, 477.6, 1.0, 0.0, 0.0, 1.0, 0.0, OUTMIX, MIXING_OUT, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.0, INMIX, MIXING_IN, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.0, OUTFLOW, STATIC_PRESSURE_1D, 67.46E+03, 0.0, 0.0, 0.0, 0.0 , 1.0, 0.0) GILES_EXTRA_RELAXFACTOR= (0.05, 0.05) diff --git a/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg b/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg index 2c5cea96d4f..de28c55c14e 100755 --- a/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg +++ b/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg @@ -69,6 +69,7 @@ MARKER_PERIODIC= ( periodic1, periodic2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04 MARKER_TURBOMACHINERY= (inflow, outmix, inmix, outflow) MARKER_ANALYZE= (outflow) % +MARKER_ZONE_INTERFACE= (outmix, inmix) % Mixing-plane interface markers must be specified to activate the transfer of information between zones MARKER_MIXINGPLANE_INTERFACE= (outmix, inmix) % diff --git a/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg b/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg index 897fab717be..73bdce2370e 100644 --- a/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg +++ b/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg @@ -131,7 +131,7 @@ CFL_REDUCTION_TURB= 1.0 % % --------------------------- CONVERGENCE PARAMETERS --------------------------% % -ITER= 10000 +ITER= 21 CONV_RESIDUAL_MINVAL= -12 CONV_STARTITER= 10 CONV_CAUCHY_ELEMS= 100 From 01dc39e5b4d9a680ade69d5e36cc26dc6516635a Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 25 Apr 2023 18:53:21 +0100 Subject: [PATCH 14/47] Update reg tests, fix threading bug --- SU2_CFD/src/output/CTurboOutput.cpp | 49 +++++++++++++---------------- TestCases/hybrid_regression.py | 10 +++--- TestCases/parallel_regression.py | 10 +++--- TestCases/serial_regression.py | 13 ++++---- externals/codi | 2 +- 5 files changed, 40 insertions(+), 44 deletions(-) diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index bcd2a2e3126..46b37dcc2d4 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -174,35 +174,28 @@ CTurboOutput::CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidMo su2double radiusIn = geometry.GetTurboRadiusIn(iBladeRow, iSpan); su2double radiusOut = geometry.GetTurboRadiusOut(iBladeRow, iSpan); - // TODO: I have a feeling this should not be in such a for loop, to be discussed with Salvo (Nitish) - SU2_OMP_PARALLEL { - // const int thread = omp_get_thread_num(); - - /* Switch between the Turbomachinery Performance Kind */ - // TODO: This needs to be fixed - switch (config[iBladeRow]->GetKind_TurboPerf(iBladeRow)) { - case TURBO_PERF_KIND::TURBINE: - bladeSpanPerformances.push_back( - make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); - break; - - case TURBO_PERF_KIND::COMPRESSOR: - bladeSpanPerformances.push_back( - make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); - break; - - case TURBO_PERF_KIND::PROPELLOR: - bladeSpanPerformances.push_back( - make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); - break; - - default: - bladeSpanPerformances.push_back( - make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); - break; - } + /* Switch between the Turbomachinery Performance Kind */ + switch (config[iBladeRow]->GetKind_TurboPerf(iBladeRow)) { + case TURBO_PERF_KIND::TURBINE: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; + + case TURBO_PERF_KIND::COMPRESSOR: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; + + case TURBO_PERF_KIND::PROPELLOR: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; + + default: + bladeSpanPerformances.push_back( + make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); + break; } - END_SU2_OMP_PARALLEL } BladesPerformances.push_back(bladeSpanPerformances); } diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 04997ff9ba8..77617f49ce1 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -539,7 +539,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.986581, -3.096834, -14.849548, -9.102930, -11.787851, -6.266207, 73266, 73266] + Jones_tc_restart.test_vals = [-6.987181, -3.096835, -14.857733, -9.109735, -11.787852, -6.266208, 73266, 73266] test_list.append(Jones_tc_restart) # 2D axial stage @@ -547,8 +547,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047244, 1.661126, -2.914064, 2.588061, -2.486924, 3.050785, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [1.047244, 1.661126, -2.914064, 2.588061, -2.486924, 3.050785, 106380, 106380] + axial_stage2D.test_vals = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -556,8 +556,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.542642, -6.840866, -6.669194, -1.578593, -6.793009, -0.742574, -471650] - transonic_stator_restart.test_vals_aarch64 = [-7.542642, -6.840866, -6.669194, -1.578593, -6.793009, -0.742574, -471650] + transonic_stator_restart.test_vals = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] + transonic_stator_restart.test_vals_aarch64 = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 95c486de561..7266dd0ccfe 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -987,12 +987,12 @@ def main(): ### Turbomachinery ### ###################################### - # Jones APU Turbocharger restart + # Jones APU Turbocharger restart Jones_tc_restart = TestCase('jones_turbocharger_restart') Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.986563, -3.096834, -14.849532, -9.102914, -11.787851, -6.266208, 7.3266e+04, 7.3266e+04] + Jones_tc_restart.test_vals = [-6.987181, -3.096835, -14.857733, -9.109735, -11.787852, -6.266208, 73266, 73266] test_list.append(Jones_tc_restart) # 2D axial stage @@ -1000,7 +1000,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047301, 1.661328, -2.913923, 2.588194, -2.486769, 3.050953, 106380, 106380] + axial_stage2D.test_vals = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -1008,7 +1009,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.544516, -6.822541, -6.689799, -1.581068, -6.798361, -0.746758, -471650] + transonic_stator_restart.test_vals = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] + transonic_stator_restart.test_vals_aarch64 = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index b7d00c3f3a0..8adde47a16c 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -845,16 +845,15 @@ def main(): ###################################### - ### turbomachinery ### + ### Turbomachinery ### ###################################### - # Jones APU Turbocharger restart + # Jones APU Turbocharger restart Jones_tc_restart = TestCase('jones_turbocharger_restart') Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.986563, -3.096834, -14.849532, -9.102914, -11.787851, -6.266208, 7.3266e+04, 7.3266e+04] - Jones_tc_restart.tol = 0.0001 + Jones_tc_restart.test_vals = [-6.987181, -3.096835, -14.857733, -9.109735, -11.787852, -6.266208, 73266, 73266] test_list.append(Jones_tc_restart) # 2D axial stage @@ -862,7 +861,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047323, 1.661341, -2.913940, 2.588179, -2.486770, 3.050954, 1.0638e+05, 1.0638e+05] + axial_stage2D.test_vals = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -870,7 +870,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.534574, -6.838075, -6.618228, -1.567726, -6.767343, -0.738638, -4.7165e+05] + transonic_stator_restart.test_vals = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] + transonic_stator_restart.test_vals_aarch64 = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] test_list.append(transonic_stator_restart) diff --git a/externals/codi b/externals/codi index 21e4f6e084d..ca5573d50f9 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 21e4f6e084d635e7834ca55dc9d83b667a5aca2b +Subproject commit ca5573d50f9a54ba50d28a8639822a56d556240b From 979b08d9fb85b1fe289b9bbb022ddce696c69b4c Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 26 Apr 2023 15:13:52 +0100 Subject: [PATCH 15/47] Further reg test and formatting updates --- SU2_CFD/include/output/COutput.hpp | 2 +- SU2_CFD/include/solvers/CEulerSolver.hpp | 2 +- SU2_CFD/include/solvers/CSolver.hpp | 13 ++++++------- TestCases/hybrid_regression.py | 8 ++++---- TestCases/serial_regression.py | 8 ++++---- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index f3bfd94915b..1633ba9fc0d 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -48,7 +48,7 @@ inline su2double hypot(const su2double& a, const su2double& b) { } } } -#include "../../../externals/mel/mel.hpp" +#include "mel.hpp" class CGeometry; class CSolver; diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index c101ee3e330..d3ef6fb8c51 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -1055,7 +1055,7 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) const { return TurboPrimitive; } /*! * \brief virtual member. @@ -4281,13 +4287,6 @@ class CSolver { */ inline virtual bool GetHasHybridParallel() const { return false; } - /*! - * \brief Get Primal variables for turbo performance computation - * iteration can be executed by multiple threads. - * \return returns Density, pressure and TurboVelocity (IN/OUTLET) - */ - virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) {return TurboPrimitive;} - /*! * \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat, etc. * \return Struct holding streamwise periodic values. diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 77617f49ce1..2e1ef5db9e9 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -547,8 +547,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] + axial_stage2D.test_vals = [1.047801, 1.661487, -2.916144, 2.586026, -2.486555, 3.050786, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [1.047801, 1.661487, -2.916144, 2.586026, -2.486555, 3.050786, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -556,8 +556,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] - transonic_stator_restart.test_vals_aarch64 = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] + transonic_stator_restart.test_vals = [-7.543335, -6.834312, -6.673129, -1.579553, -6.796362, -0.743829, -471650] + transonic_stator_restart.test_vals_aarch64 = [-7.543335, -6.834312, -6.673129, -1.579553, -6.796362, -0.743829, -471650] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 8adde47a16c..7821a9f1a5a 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -861,8 +861,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] + axial_stage2D.test_vals = [1.047883, 1.661703, -2.916020, 2.586144, -2.486401, 3.050955, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [1.047883, 1.661703, -2.916020, 2.586144, -2.486401, 3.050955, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -870,8 +870,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] - transonic_stator_restart.test_vals_aarch64 = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] + transonic_stator_restart.test_vals = [-7.533443, -6.826845, -6.612243, -1.566209, -6.765890, -0.742094, -471650] + transonic_stator_restart.test_vals_aarch64 = [-7.533443, -6.826845, -6.612243, -1.566209, -6.765890, -0.742094, -471650] test_list.append(transonic_stator_restart) From a8b948a515868b2ef3f119da5480124f4d53d464 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 17 May 2023 13:57:34 +0100 Subject: [PATCH 16/47] Updated screen output, addressed some comments --- SU2_CFD/include/solvers/CEulerSolver.hpp | 2 +- SU2_CFD/include/solvers/CSolver.hpp | 2 +- SU2_CFD/src/output/CFlowCompOutput.cpp | 6 +++--- SU2_CFD/src/output/CTurboOutput.cpp | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index d3ef6fb8c51..9c75d062c74 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -1040,7 +1040,7 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) { + inline vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) override { TurboPrimitive.clear(); if (INLET) { TurboPrimitive.push_back(DensityIn[iBlade][iSpan]); TurboPrimitive.push_back(PressureIn[iBlade][iSpan]); diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index e0e447e1784..fed5667dba6 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -3762,7 +3762,7 @@ class CSolver { * iteration can be executed by multiple threads. * \return returns Density, pressure and TurboVelocity (IN/OUTLET) */ - virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) const { return TurboPrimitive; } + virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) { return TurboPrimitive; } /*! * \brief virtual member. diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 1098fc07eff..bb75677ac34 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -511,7 +511,7 @@ void CFlowCompOutput::SetTurboPerformance_Output(std::shared_ptr T TurboInOut << "Tangential Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]; TurboInOut << "Mass Flow " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow(); TurboInOut << "Mach " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue(); - TurboInOut << "Flow Angle " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; + TurboInOut << "Abs Flow Angle " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; TurboInOut.PrintFooter(); } cout<GetOutletState().GetMassFlow()); SetHistoryOutputValue("MachIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue()); SetHistoryOutputValue("MachOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue()); - SetHistoryOutputValue("FlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); - SetHistoryOutputValue("FlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); } SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index 46b37dcc2d4..485c5f66f2b 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -164,6 +164,7 @@ void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombine CTurboOutput::CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidModel& fluidModel) { unsigned short nBladesRow = config[ZONE_0]->GetnMarker_Turbomachinery(); unsigned short nDim = geometry.GetnDim(); + unsigned short nStages = SU2_TYPE::Int(nBladesRow / 2); for (unsigned short iBladeRow = 0; iBladeRow < nBladesRow; iBladeRow++) { vector> bladeSpanPerformances; @@ -175,7 +176,7 @@ CTurboOutput::CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidMo su2double radiusOut = geometry.GetTurboRadiusOut(iBladeRow, iSpan); /* Switch between the Turbomachinery Performance Kind */ - switch (config[iBladeRow]->GetKind_TurboPerf(iBladeRow)) { + switch (config[ZONE_0]->GetKind_TurboPerf(iBladeRow)) { case TURBO_PERF_KIND::TURBINE: bladeSpanPerformances.push_back( make_shared(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut)); From 84f4617a31a41a50716c2de62fc7b9d4ffcc857b Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 17 May 2023 14:09:15 +0100 Subject: [PATCH 17/47] Removed unused var --- SU2_CFD/src/output/CTurboOutput.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index 485c5f66f2b..600a2987501 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -164,7 +164,6 @@ void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombine CTurboOutput::CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidModel& fluidModel) { unsigned short nBladesRow = config[ZONE_0]->GetnMarker_Turbomachinery(); unsigned short nDim = geometry.GetnDim(); - unsigned short nStages = SU2_TYPE::Int(nBladesRow / 2); for (unsigned short iBladeRow = 0; iBladeRow < nBladesRow; iBladeRow++) { vector> bladeSpanPerformances; From 61fe58a772488b79a28538603c8aa3beb3101ba5 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 17 May 2023 17:27:53 +0100 Subject: [PATCH 18/47] Fixed TURBOMACHINERY special folder output --- SU2 | 1 + SU2_CFD/include/output/CFlowCompOutput.hpp | 10 + SU2_CFD/include/output/COutput.hpp | 12 +- SU2_CFD/include/solvers/CEulerSolver.hpp | 2 +- SU2_CFD/include/solvers/CSolver.hpp | 2 +- SU2_CFD/src/iteration/CFluidIteration.cpp | 2 +- SU2_CFD/src/output/CFlowCompOutput.cpp | 264 ++++++++++++++++++++- SU2_CFD/src/output/CFlowOutput.cpp | 4 +- SU2_CFD/src/output/COutput.cpp | 17 +- 9 files changed, 298 insertions(+), 16 deletions(-) create mode 160000 SU2 diff --git a/SU2 b/SU2 new file mode 160000 index 00000000000..84f4617a31a --- /dev/null +++ b/SU2 @@ -0,0 +1 @@ +Subproject commit 84f4617a31a41a50716c2de62fc7b9d4ffcc857b diff --git a/SU2_CFD/include/output/CFlowCompOutput.hpp b/SU2_CFD/include/output/CFlowCompOutput.hpp index e7f38021fa7..d5ece099e11 100644 --- a/SU2_CFD/include/output/CFlowCompOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompOutput.hpp @@ -103,4 +103,14 @@ class CFlowCompOutput final: public CFlowOutput { void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) override; + + /*! + * \brief Write the kinematic and thermodynamic variables at each spanwise division + * \param[in] TurboPerf - Turboperformance class + * \param[in] geometry - Geometrical definiton of the problem + * \param[in] config - Descripiton of the particular problem + * \param[in] val_iZone - Idientifier of current zone + */ + void WriteTurboSpanwisePerformance(std::shared_ptr TurboPerf, CGeometry *geometry, CConfig **config, + unsigned short val_iZone) override; }; diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 1633ba9fc0d..c68cc98d4bc 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -387,7 +387,7 @@ class COutput { * \param[in] OuterIter - Value of outer iteration index * \param[in] InnerIter - Value of the inner iteration index */ - void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config, + void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig **config, CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, unsigned short val_iZone, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); @@ -972,6 +972,16 @@ class COutput { inline virtual void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) {}; + + /*! + * \brief Write the kinematic and thermodynamic variables at each spanwise division + * \param[in] solver - The container hold all solution data + * \param[in] geometry - Geometrical definiton of the problem + * \param[in] config - Descripiton of the particular problem + * \param[in] val_iZone - Idientifier of current zone + */ + inline virtual void WriteTurboSpanwisePerformance(std::shared_ptr TurboPerf, CGeometry *geometry, CConfig **config, + unsigned short val_iZone) {}; /*! * \brief Set the available history output fields diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index d3ef6fb8c51..9c75d062c74 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -1040,7 +1040,7 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) { + inline vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) override { TurboPrimitive.clear(); if (INLET) { TurboPrimitive.push_back(DensityIn[iBlade][iSpan]); TurboPrimitive.push_back(PressureIn[iBlade][iSpan]); diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index e0e447e1784..fed5667dba6 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -3762,7 +3762,7 @@ class CSolver { * iteration can be executed by multiple threads. * \return returns Density, pressure and TurboVelocity (IN/OUTLET) */ - virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) const { return TurboPrimitive; } + virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) { return TurboPrimitive; } /*! * \brief virtual member. diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 04d4e88a9cf..880ab026859 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -221,7 +221,7 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe ComputeTurboPerformance(solver, geometry, config, config[val_iZone]->GetnInner_Iter()); output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], - config[val_iZone], TurbomachineryStagePerformance, TurbomachineryPerformance, val_iZone, config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), + config, TurbomachineryStagePerformance, TurbomachineryPerformance, val_iZone, config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); } diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 1098fc07eff..fb63c6a69b0 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -579,8 +579,8 @@ void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* Turb SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow()); SetHistoryOutputValue("MachIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue()); SetHistoryOutputValue("MachOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue()); - SetHistoryOutputValue("FlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); - SetHistoryOutputValue("FlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); } SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); @@ -590,3 +590,263 @@ void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* Turb SetHistoryOutputValue("PressureRatioTT", TurboStagePerf->GetTotalTotalPressureRatio()); } } + +void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr TurboPerf, CGeometry *geometry, CConfig **config, + unsigned short val_iZone) { + + string inMarker_Tag, outMarker_Tag, inMarkerTag_Mix; + unsigned short nZone = config[val_iZone]->GetnZone(); + + unsigned short iDim, iSpan; + + unsigned long iExtIter = config[val_iZone]->GetOuterIter(); + const su2double* SpanWiseValuesIn, *SpanWiseValuesOut; + ofstream file; + string spanwise_performance_filename; + + if(rank == MASTER_NODE) { + auto BladePerformance = TurboPerf->GetBladesPerformances(); + + + /*--- Start of write file turboperformance spanwise ---*/ + if (rank == MASTER_NODE){ + SpanWiseValuesIn = geometry->GetSpanWiseValue(1); + SpanWiseValuesOut = geometry->GetSpanWiseValue(2); + + + + /*--- Writing Span wise inflow thermodynamic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_thermodynamic_values.dat"; + char buffer[50]; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Inflow Spanwise Thermodynamic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Pressure[Pa]\""; + file.width(30); file << "\"TotalPressure[Pa]\""; + file.width(30); file << "\"Temperature[K]\""; + file.width(30); file << "\"TotalTemperature[K]\""; + file.width(30); file << "\"Enthalpy[J]\""; + file.width(30); file << "\"TotalEnthalpy[J]\""; + file.width(30); file << "\"Density[kg/m3]\""; + file.width(30); file << "\"Entropy[J/K]\""; + // TODO: These values need to be added to turbomachinery state in CTurboOuput + // file.width(30); file << "\"TurbIntensity[-]\""; + // file.width(30); file << "\"Turb2LamViscRatio[-]\""; + // file.width(30); file << "\"NuFactor[-]\""; + file << endl; + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + + file.width(30); file << SpanWiseValuesIn[iSpan]; + file.width(15); file << iSpan; + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + // TODO: Add the variables back into CTurboOutput + // if(TurbIntensityIn[val_iZone][iSpan] > 1.0){ + // file.width(30); file << TurbIntensityIn [val_iZone][config[ZONE_0]->GetnSpan_iZones(val_iZone)/2]; + // }else{ + // file.width(30); file << TurbIntensityIn [val_iZone][iSpan]; + // } + // file.width(30); file << Turb2LamViscRatioIn [val_iZone][iSpan]; + // file.width(30); file << NuFactorIn [val_iZone][iSpan]; + // file << endl; + } + + file.close(); + + /*--- Writing Span wise outflow thermodynamic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_thermodynamic_values.dat"; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Outflow Span-wise Thermodynamic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Pressure[Pa]\""; + file.width(30); file << "\"TotalPressure[Pa]\""; + file.width(30); file << "\"Temperature[K]\""; + file.width(30); file << "\"TotalTemperature[K]\""; + file.width(30); file << "\"Enthalpy[J]\""; + file.width(30); file << "\"TotalEnthalpy[J]\""; + file.width(30); file << "\"Density[kg/m3]\""; + file.width(30); file << "\"Entropy[J/K]\""; + // file.width(30); file << "\"TurbIntensity[-]\""; + // file.width(30); file << "\"Turb2LamViscRatio[-]\""; + // file.width(30); file << "\"NuFactor[-]\""; + file << endl; + + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + + file.width(30); file << SpanWiseValuesOut[iSpan]; + file.width(15); file << iSpan; + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + // if(TurbIntensityOut[val_iZone][iSpan] > 1.0){ + // file.width(30); file << TurbIntensityOut [val_iZone][config[ZONE_0]->GetnSpan_iZones(val_iZone)/2]; + // }else{ + // file.width(30); file << TurbIntensityOut [val_iZone][iSpan]; + // } + // file.width(30); file << Turb2LamViscRatioOut [val_iZone][iSpan]; + // file.width(30); file << NuFactorOut [val_iZone][iSpan]; + // file << endl; + } + + file.close(); + + /*--- Writing Span wise inflow kinematic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_kinematic_values.dat"; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Inflow Span-wise Kinematic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Normal Mach[-]\""; + file.width(30); file << "\"Tangential Mach[-]\""; + file.width(30); file << "\"3rd Component Mach[-]\""; + file.width(30); file << "\"Mach Module[-]\""; + file.width(30); file << "\"Normal Velocity[m/s]\""; + file.width(30); file << "\"Tangential Velocity[m/s]\""; + file.width(30); file << "\"3rd Component Velocity[m/s]\""; + file.width(30); file << "\"Velocity Module[m/s]\""; + file.width(30); file << "\"Absolute Flow Angle[deg]\""; + file.width(30); file << "\"Relative Flow Angle[deg]\""; + file << endl; + + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + + file.width(30); file << SpanWiseValuesIn[iSpan]; + file.width(15); file << iSpan; + for (iDim = 0; iDim < 4; iDim++){ + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetMach()[iDim]; + } + for (iDim = 0; iDim < 4; iDim++){ + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); + } + // This captures NaNs + if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle())){ + file.width(30); file << "0.0000"; + } + else { + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle()*180.0/PI_NUMBER; + } + if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetFlowAngle())){ + file.width(30); file << "0.0000"; + } + else{ + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetFlowAngle()*180.0/PI_NUMBER; + } + file << endl; + } + + file.close(); + + /*--- Writing Span wise outflow thermodynamic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_kinematic_values.dat"; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Outflow Span-wise Kinematic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Normal Mach[-]\""; + file.width(30); file << "\"Tangential Mach[-]\""; + file.width(30); file << "\"3rd Component Mach[-]\""; + file.width(30); file << "\"Mach Module[-]\""; + file.width(30); file << "\"Normal Velocity[m/s]\""; + file.width(30); file << "\"Tangential Velocity[m/s]\""; + file.width(30); file << "\"3rd Component Velocity[m/s]\""; + file.width(30); file << "\"Velocity Module[m/s]\""; + file.width(30); file << "\"Absolute Flow Angle[deg]\""; + file.width(30); file << "\"Relative Flow Angle[deg]\""; + file << endl; + + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + + file.width(30); file << SpanWiseValuesIn[iSpan]; + file.width(15); file << iSpan; + for (iDim = 0; iDim < 4; iDim++){ + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetMach()[iDim]; + } + for (iDim = 0; iDim < 4; iDim++){ + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); + } + if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle())){ + file.width(30); file << "0.0000"; + } + else { + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetAbsFlowAngle()*180.0/PI_NUMBER; + } + if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle())){ + file.width(30); file << "0.0000"; + } + else{ + file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetFlowAngle()*180.0/PI_NUMBER; + } + file << endl; + } + + file.close(); + + } +} +} \ No newline at end of file diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 0f72dac2abf..25cdc0410cd 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -3770,8 +3770,8 @@ void CFlowOutput::AddTurboOutput(unsigned short nZone){ AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("FlowAngleIn_" + tag.str(), "FlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("FlowAngleOut_" + tag.str(), "FlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("AbsFlowAngleIn_" + tag.str(), "AbsFlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("AbsFlowAngleOut_" + tag.str(), "AbsFlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); } //Adds turbomachinery machine performance variables AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 2899c31d4e2..5351f359b6e 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -230,7 +230,7 @@ void COutput::SetHistoryOutput(CGeometry *geometry, void COutput::SetHistoryOutput(CGeometry *geometry, CSolver **solver, - CConfig *config, + CConfig **config, CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, unsigned short val_iZone, @@ -240,21 +240,22 @@ void COutput::SetHistoryOutput(CGeometry *geometry, unsigned long Iter= InnerIter; - if (config->GetMultizone_Problem()) + if (config[ZONE_0]->GetMultizone_Problem()) Iter = OuterIter; /*--- Turbomachinery Performance Screen summary output---*/ if (Iter%100 == 0) { - SetTurboPerformance_Output(TurboPerf, config, TimeIter, OuterIter, InnerIter); - - if (rank == MASTER_NODE) - SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config); + SetTurboPerformance_Output(TurboPerf, config[val_iZone], TimeIter, OuterIter, InnerIter); + if (rank == MASTER_NODE) SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config[val_iZone]); + for (int iZone = 0; iZone < config[ZONE_0]->GetnZone(); iZone ++){ + WriteTurboSpanwisePerformance(TurboPerf, geometry, config, iZone); + } } /*--- Update turboperformance history file*/ - LoadTurboHistoryData(TurboStagePerf, TurboPerf, config); + LoadTurboHistoryData(TurboStagePerf, TurboPerf, config[val_iZone]); - SetHistoryOutput(geometry, solver, config, TimeIter, OuterIter,InnerIter); + SetHistoryOutput(geometry, solver, config[val_iZone], TimeIter, OuterIter,InnerIter); } From a5bdb92a66716f5fcc02b3f514d67d9009b97b83 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Mon, 22 May 2023 16:43:07 +0100 Subject: [PATCH 19/47] Fixed config input for MZ cases --- SU2_CFD/src/output/COutput.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 5351f359b6e..4e3c49f13d2 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1329,7 +1329,7 @@ void COutput::PreprocessHistoryOutput(CConfig *config, bool wrt){ /*--- Check for consistency and remove fields that are requested but not available --- */ - CheckHistoryOutput(); + CheckHistoryOutput(config->GetnZone()); if (rank == MASTER_NODE && !noWriting){ @@ -1376,7 +1376,7 @@ void COutput::PreprocessMultizoneHistoryOutput(COutput **output, CConfig **confi /*--- Check for consistency and remove fields that are requested but not available --- */ - CheckHistoryOutput(); + CheckHistoryOutput(config[ZONE_0]->GetnZone()); if (rank == MASTER_NODE && !noWriting){ @@ -1418,7 +1418,7 @@ void COutput::PrepareHistoryFile(CConfig *config){ } -void COutput::CheckHistoryOutput() { +void COutput::CheckHistoryOutput(unsigned short nZone) { /*--- Set screen convergence output header and remove unavailable fields ---*/ @@ -1496,6 +1496,18 @@ void COutput::CheckHistoryOutput() { FieldsToRemove.clear(); vector FoundField(nRequestedHistoryFields, false); + /*--- Checks if TURBO_PERF is enabled in config and sets the final zone calculations to be output ---*/ + + for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ + if (requestedHistoryFields[iReqField] == "TURBO_PERF"){ + char buffer [14]; //This makes the assumption the number of zones is 10 or lower + std::string strZones = std::to_string(nZone-1); + char const *valZones = strZones.c_str(); + snprintf(buffer, 14, "TURBO_PERF[%s]", valZones); + requestedHistoryFields[iReqField] = buffer; + } + } + for (const auto& fieldReference : historyOutput_List) { const auto &field = historyOutput_Map.at(fieldReference); for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++) { From 1e7ca730ab434420d5fa8e6d489a33d1a6971aad Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Mon, 22 May 2023 16:43:35 +0100 Subject: [PATCH 20/47] header changes from prior --- SU2_CFD/include/output/COutput.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index c68cc98d4bc..74651c9ad3a 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -763,7 +763,7 @@ class COutput { /*! * \brief CheckHistoryOutput */ - void CheckHistoryOutput(); + void CheckHistoryOutput(unsigned short nZone); /*! * \brief Open the history file and write the header. From 63e4508bcd80359ef1c012ba12c8f873d051733c Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 28 Jun 2023 16:18:16 +0100 Subject: [PATCH 21/47] codi update --- SU2_CFD/src/output/COutput.cpp | 2 +- externals/codi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index edc6f909a6e..664fad76be1 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1503,7 +1503,7 @@ void COutput::CheckHistoryOutput(unsigned short nZone) { char buffer [14]; //This makes the assumption the number of zones is 10 or lower std::string strZones = std::to_string(nZone-1); char const *valZones = strZones.c_str(); - snprintf(buffer, 14, "TURBO_PERF[%s]", valZones); + auto snpCatch = snprintf(buffer, 14, "TURBO_PERF[%s]", valZones); requestedHistoryFields[iReqField] = buffer; } } diff --git a/externals/codi b/externals/codi index ca5573d50f9..375f51e6e97 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit ca5573d50f9a54ba50d28a8639822a56d556240b +Subproject commit 375f51e6e972515dc594bbadbd2bc694dab2c780 From f5346ff550fccf0f3f448c6129c7aa39818df871 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 28 Jun 2023 16:25:21 +0100 Subject: [PATCH 22/47] Merge branch 'develop' of https://github.com/su2code/SU2 into new_turbo_outputs --- externals/codi | 2 +- externals/opdi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/externals/codi b/externals/codi index 4237fe38c90..375f51e6e97 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 4237fe38c90b83541f699bd84e00c656099b7d18 +Subproject commit 375f51e6e972515dc594bbadbd2bc694dab2c780 diff --git a/externals/opdi b/externals/opdi index 913535c4909..f33b507c24f 160000 --- a/externals/opdi +++ b/externals/opdi @@ -1 +1 @@ -Subproject commit 913535c490989ea9aa654e8c7df41c7e3718a5a2 +Subproject commit f33b507c24f7448d4cf4df16ab5c53ea254b8774 From d57281fccf4b82182c8e510ef324c7895b2de1d8 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Fri, 4 Aug 2023 00:50:21 +0100 Subject: [PATCH 23/47] Comments --- SU2_CFD/include/output/COutput.hpp | 37 +++++++++++------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 100626b75f9..acf63efebf9 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -399,7 +399,6 @@ class COutput { /*! * Collects history data from the individual output per zone, * monitors the convergence and writes to screen and history file. - * \param[in] output - Container holding the output instances per zone. * \param[in] config - Definition of the particular problem per zone. * \param[in] driver_config - Base definition of the particular problem. @@ -602,7 +601,6 @@ class COutput { */ void WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE format, string fileName = ""); - protected: /*----------------------------- Protected member functions ----------------------------*/ @@ -937,7 +935,6 @@ class COutput { */ inline virtual void SetVolumeOutputFields(CConfig *config){} - /*! * \brief Load the history output field values * \param[in] config - Definition of the particular problem. @@ -954,36 +951,30 @@ class COutput { inline virtual void LoadMultizoneHistoryData(const COutput* const* output, const CConfig* const* config) {} /*! - * \brief Writes turboperformance to screen - * \param[in] TurboPerf - Turboperformance definition + * \brief Sets the turboperformance screen output + * \param[in] TurboPerf - Turboperformance class * \param[in] config - Definition of the particular problem - * \param[in] TimeIter - Value of the time iteration index - * \param[in] OuterIter - Value of outer iteration index - * \param[in] InnerIter - Value of the inner iteration index + * \param[in] TimeIter - Index of the current time-step + * \param[in] OuterIter - Index of current outer iteration + * \param[in] InnerIter - Index of current inner iteration */ - inline virtual void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, - unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) {}; + inline virtual void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) {} /*! - * \brief Writes turboperformance to history file - * \param[in] TurboStagePerf - Stage turboperformance definition - * \param[in] TurboPerf - Turboperformance definition + * \brief Sets the multizone turboperformacne screen output + * \param[in] TurboStagePerf - Stage turboperformance class + * \param[in] TurboPerf - Turboperformance class * \param[in] config - Definition of the particular problem */ - inline virtual void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config) {}; + inline virtual void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) {} /*! - * \brief Writes turboperformance to screen - * \param[in] TurboStagePerf - Stage turboperformance definition - * \param[in] TurboPerf - Turboperformance definition + * \brief Loads the turboperformacne history data + * \param[in] TurboStagePerf - Stage turboperformance class + * \param[in] TurboPerf - Turboperformance class * \param[in] config - Definition of the particular problem - * \param[in] iZone - Current zone */ - inline virtual void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config) {}; + inline virtual void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) {} /*! * \brief Write the kinematic and thermodynamic variables at each spanwise division From 8a3455bd91b7a81cecaab37e5fe81c4ed5a50ad4 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Fri, 4 Aug 2023 00:50:42 +0100 Subject: [PATCH 24/47] comments --- SU2 | 1 - SU2_CFD/include/output/CFlowCompOutput.hpp | 33 +++-- SU2_CFD/include/output/CFlowOutput.hpp | 3 +- SU2_CFD/include/output/CTurboOutput.hpp | 143 ++++++++++++--------- SU2_CFD/include/solvers/CEulerSolver.hpp | 25 ++-- SU2_CFD/include/solvers/CSolver.hpp | 10 +- SU2_CFD/src/integration/CIntegration.cpp | 1 - SU2_CFD/src/output/CFlowCompOutput.cpp | 137 ++++++++++---------- SU2_CFD/src/solvers/CEulerSolver.cpp | 4 - 9 files changed, 190 insertions(+), 167 deletions(-) delete mode 160000 SU2 diff --git a/SU2 b/SU2 deleted file mode 160000 index 84f4617a31a..00000000000 --- a/SU2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 84f4617a31a41a50716c2de62fc7b9d4ffcc857b diff --git a/SU2_CFD/include/output/CFlowCompOutput.hpp b/SU2_CFD/include/output/CFlowCompOutput.hpp index d5ece099e11..e5da7146adc 100644 --- a/SU2_CFD/include/output/CFlowCompOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompOutput.hpp @@ -93,16 +93,31 @@ class CFlowCompOutput final: public CFlowOutput { */ bool WriteHistoryFileOutput(const CConfig *config) override ; - void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, - unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) override; - - void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config) override; + /*! + * \brief Sets the turboperformance screen output + * \param[in] TurboPerf - Turboperformance class + * \param[in] config - Definition of the particular problem + * \param[in] TimeIter - Index of the current time-step + * \param[in] OuterIter - Index of current outer iteration + * \param[in] InnerIter - Index of current inner iteration + */ + void SetTurboPerformance_Output(std::shared_ptr TurboPerf, CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) override; - void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config) override; + /*! + * \brief Sets the multizone turboperformacne screen output + * \param[in] TurboStagePerf - Stage turboperformance class + * \param[in] TurboPerf - Turboperformance class + * \param[in] config - Definition of the particular problem + */ + void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) override; + + /*! + * \brief Loads the turboperformacne history data + * \param[in] TurboStagePerf - Stage turboperformance class + * \param[in] TurboPerf - Turboperformance class + * \param[in] config - Definition of the particular problem + */ + void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) override; /*! * \brief Write the kinematic and thermodynamic variables at each spanwise division diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index 3a18791186b..47b9dbf3424 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -30,7 +30,6 @@ #include "CFVMOutput.hpp" #include "../variables/CVariable.hpp" - /*--- Forward declare to avoid including here. ---*/ template struct CPrimitiveIndices; @@ -45,7 +44,7 @@ class CFlowOutput : public CFVMOutput{ */ CFlowOutput(const CConfig *config, unsigned short nDim, bool femOutput); - /* + /* * \brief Add turboperformance outputs as history field * \param[in] nZone - Number of zones in problem */ diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 34a18aa2559..4a2c9388caf 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -36,6 +36,11 @@ #include "../../../Common/include/CConfig.hpp" #include "../fluid/CFluidModel.hpp" +/*! + * \brief Class containing the required primitive variables for initiating a turboperformance calculation + * \author S. Vitale, N. Anand, J. Kelly + * \ingroup Output + */ class CTurbomachineryPrimitiveState { private: su2double Density, Pressure, TangVelocity; @@ -46,15 +51,20 @@ class CTurbomachineryPrimitiveState { CTurbomachineryPrimitiveState(vector TurboPrimitives, unsigned short nDim, su2double tangVel); - su2double GetDensity() const& { return Density; } + const su2double& GetDensity() const { return Density; } - su2double GetPressure() const& { return Pressure; } + const su2double& GetPressure() const { return Pressure; } - su2double GetTangVelocity() const& { return TangVelocity; } + const su2double& GetTangVelocity() const { return TangVelocity; } - const std::vector& GetVelocity() const& { return Velocity; } + const std::vector& GetVelocity() const { return Velocity; } }; +/*! + * \brief Class containing the combined primitive inlet and outlet states for a given blade + * \author S. Vitale, N. Anand, J. Kelly + * \ingroup Output + */ class CTurbomachineryCombinedPrimitiveStates { private: CTurbomachineryPrimitiveState InletPrimitiveState; @@ -69,6 +79,11 @@ class CTurbomachineryCombinedPrimitiveStates { CTurbomachineryPrimitiveState GetOutletPrimitiveState() const& { return OutletPrimitiveState; } }; +/*! + * \brief Class containing state information for a turbomachine + * \author S. Vitale, N. Anand, J. Kelly + * \ingroup Output + */ class CTurbomachineryState { private: su2double Density, Pressure, Entropy, Enthalpy, Temperature, TotalTemperature, TotalPressure, TotalEnthalpy; @@ -83,45 +98,45 @@ class CTurbomachineryState { void ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState& primitiveState); - su2double GetDensity() const { return Density; } + const su2double GetDensity() const { return Density; } - su2double GetPressure() const { return Pressure; } + const su2double GetPressure() const { return Pressure; } - su2double GetEntropy() const { return Entropy; } + const su2double GetEntropy() const { return Entropy; } - su2double GetEnthalpy() const { return Enthalpy; } + const su2double GetEnthalpy() const { return Enthalpy; } - su2double GetTemperature() const { return Temperature; } + const su2double GetTemperature() const { return Temperature; } - su2double GetTotalTemperature() const { return TotalTemperature; } + const su2double GetTotalTemperature() const { return TotalTemperature; } - su2double GetTotalPressure() const { return TotalPressure; } + const su2double GetTotalPressure() const { return TotalPressure; } - su2double GetTotalRelPressure() const { return TotalRelPressure; } + const su2double GetTotalRelPressure() const { return TotalRelPressure; } - su2double GetTotalEnthalpy() const { return TotalEnthalpy; } + const su2double GetTotalEnthalpy() const { return TotalEnthalpy; } - su2double GetAbsFlowAngle() const { return AbsFlowAngle; } + const su2double GetAbsFlowAngle() const { return AbsFlowAngle; } - su2double GetFlowAngle() const { return FlowAngle; } + const su2double GetFlowAngle() const { return FlowAngle; } - su2double GetMassFlow() const { return MassFlow; } + const su2double GetMassFlow() const { return MassFlow; } - su2double GetRothalpy() const { return Rothalpy; } + const su2double GetRothalpy() const { return Rothalpy; } - vector GetVelocity() const { return Velocity; } + const vector GetVelocity() const { return Velocity; } - vector GetMach() const { return Mach; } + const vector GetMach() const { return Mach; } - su2double GetVelocityValue() const { return Norm(Velocity); } + const su2double GetVelocityValue() const { return Norm(Velocity); } - su2double GetMachValue() const { return Norm(Mach); } + const su2double GetMachValue() const { return Norm(Mach); } - su2double GetRelVelocityValue() const { return Norm(RelVelocity); } + const su2double GetRelVelocityValue() const { return Norm(RelVelocity); } - su2double GetRelMachValue() const { return Norm(RelMach); } + const su2double GetRelMachValue() const { return Norm(RelMach); } - su2double Norm(vector const& u) const { + const su2double Norm(vector const& u) const { su2double accum = 0.; for (auto i = 0u; i < u.size(); ++i) { accum += u[i] * u[i]; @@ -130,6 +145,11 @@ class CTurbomachineryState { } }; +/*! + * \brief Class containing additional states and performance calculation routines for blades in different turbomachines + * \author S. Vitale, N. Anand, J. Kelly + * \ingroup Output + */ class CTurbomachineryBladePerformance { protected: CTurbomachineryState InletState; @@ -138,8 +158,7 @@ class CTurbomachineryBladePerformance { CFluidModel& FluidModel; public: - CTurbomachineryBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, - su2double areaOut, su2double radiusOut); + CTurbomachineryBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, su2double areaOut, su2double radiusOut); virtual ~CTurbomachineryBladePerformance() = default; @@ -149,83 +168,91 @@ class CTurbomachineryBladePerformance { const CTurbomachineryState& GetOutletState() { return OutletState; } - su2double GetKineticEnergyLoss() const { return KineticEnergyLoss; } + const su2double GetKineticEnergyLoss() const { return KineticEnergyLoss; } - su2double GetTotalPressureLoss() const { return TotalPressureLoss; } + const su2double GetTotalPressureLoss() const { return TotalPressureLoss; } - su2double GetEntropyGen() const { return EntropyGen; } + const su2double GetEntropyGen() const { return EntropyGen; } - su2double GetPressureRatio() const { return PressureRatio; } + const su2double GetPressureRatio() const { return PressureRatio; } - su2double GetEulerianWork() const { return EulerianWork; } + const su2double GetEulerianWork() const { return EulerianWork; } }; class CTurbineBladePerformance : public CTurbomachineryBladePerformance { public: - CTurbineBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, - su2double areaOut, su2double radiusOut); + CTurbineBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, su2double areaOut, su2double radiusOut); void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) override; }; class CCompressorBladePerformance : public CTurbomachineryBladePerformance { public: - CCompressorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, - su2double areaOut, su2double radiusOut); + CCompressorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, su2double areaOut, su2double radiusOut); void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) override; }; class CPropellorBladePerformance : public CTurbomachineryBladePerformance { public: - CPropellorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, - su2double areaOut, su2double radiusOut); + CPropellorBladePerformance(CFluidModel& fluidModel, unsigned short nDim, su2double areaIn, su2double radiusIn, su2double areaOut, su2double radiusOut); void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates& primitives) override; }; +/*! + * \brief Class for computng full stage performance + * \author S. Vitale, N. Anand, J. Kelly + * \ingroup Output + */ class CTurbomachineryStagePerformance { protected: - su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, - TotalTotalPressureRatio, EulerianWork; + su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, TotalTotalPressureRatio, EulerianWork; CFluidModel& fluidModel; public: CTurbomachineryStagePerformance(CFluidModel& fluid); + virtual ~CTurbomachineryStagePerformance() = default; - virtual void ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, - const CConfig* config); + + virtual void ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, const CConfig* config); + virtual void ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + virtual void ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); - su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } - su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } - su2double GetEulerianWork() const { return EulerianWork; } - su2double GetNormEntropyGen() const { return NormEntropyGen; } - su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } - su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } + + const su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } + + const su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } + + const su2double GetEulerianWork() const { return EulerianWork; } + + const su2double GetNormEntropyGen() const { return NormEntropyGen; } + + const su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } + + const su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } }; +/*! + * \brief Class for handling the calculation of turboperformance variables across a blade, span and full machine + * \author S. Vitale, N. Anand, J. Kelly + * \ingroup Output + */ class CTurboOutput { private: vector>> BladesPerformances; - static void ComputePerBlade(vector> const bladePerformances, - vector const bladePrimitives); + static void ComputePerBlade(vector> const bladePerformances, vector const bladePrimitives); - static void ComputePerSpan(shared_ptr const spanPerformances, - const CTurbomachineryCombinedPrimitiveStates& spanPrimitives); - // vector> StagePerformances; - // shared_ptr MachinePerformances; + static void ComputePerSpan(shared_ptr const spanPerformances, const CTurbomachineryCombinedPrimitiveStates& spanPrimitives); + public: CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidModel& fluidModel); vector>> - GetBladesPerformances() const { - return BladesPerformances; - } + const GetBladesPerformances() const { return BladesPerformances; } - // vector> GetStagePerformances() const { return StagePerformances; } - // shared_ptr GetMachinePerformances() const { return MachinePerformances; } void ComputeTurbomachineryPerformance(vector> const primitives); }; \ No newline at end of file diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 9c75d062c74..abafbba222c 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -29,7 +29,7 @@ #include "CFVMFlowSolverBase.hpp" #include "../variables/CEulerVariable.hpp" -#include "../output/CTurboOutput.hpp" + /*! * \class CEulerSolver * \ingroup Euler_Equations @@ -108,7 +108,7 @@ class CEulerSolver : public CFVMFlowSolverBase TurbomachineryPerformance; /*!< \brief turbo performance calculator. */ + vector TurboPrimitive; /*!< \breif Primtive turbo variables vector */ vector FluidModel; /*!< \brief fluid model used in the solver. */ @@ -1027,13 +1027,6 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) override { TurboPrimitive.clear(); if (INLET) { - TurboPrimitive.push_back(DensityIn[iBlade][iSpan]); TurboPrimitive.push_back(PressureIn[iBlade][iSpan]); - TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][0]);TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][1]); + TurboPrimitive.push_back(DensityIn[iBlade][iSpan]); + TurboPrimitive.push_back(PressureIn[iBlade][iSpan]); + TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][0]); + TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][1]); if (nDim==3) - TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][2]); + TurboPrimitive.push_back(TurboVelocityIn[iBlade][iSpan][2]); } else { - TurboPrimitive.push_back(DensityOut[iBlade][iSpan]); TurboPrimitive.push_back(PressureOut[iBlade][iSpan]); - TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][0]);TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][1]); + TurboPrimitive.push_back(DensityOut[iBlade][iSpan]); + TurboPrimitive.push_back(PressureOut[iBlade][iSpan]); + TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][0]); + TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][1]); if (nDim==3) TurboPrimitive.push_back(TurboVelocityOut[iBlade][iSpan][2]); } diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 3915f9b913d..1d9a1be48aa 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -133,8 +133,6 @@ class CSolver { su2activevector iPoint_UndLapl; /*!< \brief Auxiliary variable for the undivided Laplacians. */ su2activevector jPoint_UndLapl; /*!< \brief Auxiliary variable for the undivided Laplacians. */ - vector TurboPrimitive; - int *Restart_Vars; /*!< \brief Auxiliary structure for holding the number of variables and points in a restart. */ int Restart_ExtIter; /*!< \brief Auxiliary structure for holding the external iteration offset from a restart. */ passivedouble *Restart_Data; /*!< \brief Auxiliary structure for holding the data values from a restart. */ @@ -3755,19 +3753,13 @@ class CSolver { * \param[in] config - Definition of the particular problem. */ inline virtual void InitTurboContainers(CGeometry *geometry, CConfig *config) { } - /*! - * \brief A virtual member. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - inline virtual void InitTurboPerformance(CGeometry *geometry, CConfig** config) { } /*! * \brief Get Primal variables for turbo performance computation * iteration can be executed by multiple threads. * \return returns Density, pressure and TurboVelocity (IN/OUTLET) */ - virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) { return TurboPrimitive; } + virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) { return vector(5, 0.0); } /*! * \brief virtual member. diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 06a16a9c688..c1fe4c29bf5 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -91,7 +91,6 @@ void CIntegration::Space_Integration(CGeometry *geometry, if (config->GetBoolTurbomachinery()){ /*--- Average quantities at the inflow and outflow boundaries ---*/ - solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry,config,INFLOW); solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry, config, OUTFLOW); } diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 2e733c0850a..4972581ae86 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -465,7 +465,6 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol if (config->GetEquivArea()) SetNearfieldInverseDesign(flow_solver, geometry, config); - /*--- Keep this as last, since it uses the history values that were set. ---*/ SetCustomOutputs(solver, geometry, config); @@ -519,29 +518,28 @@ void CFlowCompOutput::SetTurboPerformance_Output(std::shared_ptr T for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) { auto nSpan = config->GetnSpan_iZones(iZone); + const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetEntropy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy(); - TurboInOut << "Total Enthalpy " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy(); - TurboInOut << "Total Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure(); - TurboInOut << "Pressure " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure(); - TurboInOut << "Density " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity(); - TurboInOut << "Normal Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]; - TurboInOut << "Tangential Velocity " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1] << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]; - TurboInOut << "Mass Flow " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow(); - TurboInOut << "Mach " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue() << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue(); - TurboInOut << "Abs Flow Angle " << BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; + TurboInOut << "Entropy " << BladePerf->GetInletState().GetEntropy() << BladePerf->GetOutletState().GetEntropy(); + TurboInOut << "Total Enthalpy " << BladePerf->GetInletState().GetTotalEnthalpy() << BladePerf->GetOutletState().GetTotalEnthalpy(); + TurboInOut << "Total Pressure " << BladePerf->GetInletState().GetTotalPressure() << BladePerf->GetOutletState().GetTotalPressure(); + TurboInOut << "Pressure " << BladePerf->GetInletState().GetPressure() << BladePerf->GetOutletState().GetPressure(); + TurboInOut << "Density " << BladePerf->GetInletState().GetDensity() << BladePerf->GetOutletState().GetDensity(); + TurboInOut << "Normal Velocity " << BladePerf->GetInletState().GetVelocity()[0] << BladePerf->GetOutletState().GetVelocity()[0]; + TurboInOut << "Tangential Velocity " << BladePerf->GetInletState().GetVelocity()[1] << BladePerf->GetOutletState().GetVelocity()[1]; + TurboInOut << "Mass Flow " << BladePerf->GetInletState().GetMassFlow() << BladePerf->GetOutletState().GetMassFlow(); + TurboInOut << "Mach " << BladePerf->GetInletState().GetMachValue() << BladePerf->GetOutletState().GetMachValue(); + TurboInOut << "Abs Flow Angle " << BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; TurboInOut.PrintFooter(); } cout< TurboPerf, - CConfig *config) { +void CFlowCompOutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) { stringstream TurboMZPerf; @@ -571,37 +569,37 @@ void CFlowCompOutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePe } -void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - CConfig *config) { +void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) { if (rank == MASTER_NODE){ auto BladePerformance = TurboPerf->GetBladesPerformances(); for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) { auto nSpan = config->GetnSpan_iZones(iZone); + const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); + stringstream tag; tag << iZone + 1; - SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetEntropy()); - SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetEntropy()); - SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalEnthalpy()); - SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalEnthalpy()); - SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetTotalPressure()); - SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetTotalPressure()); - SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetPressure()); - SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetPressure()); - SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetDensity()); - SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetDensity()); - SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[0]); - SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[0]); - SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetVelocity()[1]); - SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetVelocity()[1]); - SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMassFlow()); - SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMassFlow()); - SetHistoryOutputValue("MachIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetMachValue()); - SetHistoryOutputValue("MachOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetMachValue()); - SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); - SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerformance.at(iZone).at(nSpan)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerf->GetInletState().GetEntropy()); + SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerf->GetOutletState().GetEntropy()); + SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerf->GetInletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerf->GetOutletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerf->GetInletState().GetTotalPressure()); + SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerf->GetOutletState().GetTotalPressure()); + SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerf->GetInletState().GetPressure()); + SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerf->GetOutletState().GetPressure()); + SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerf->GetInletState().GetDensity()); + SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerf->GetOutletState().GetDensity()); + SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerf->GetInletState().GetVelocity()[0]); + SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerf->GetOutletState().GetVelocity()[0]); + SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerf->GetInletState().GetVelocity()[1]); + SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerf->GetOutletState().GetVelocity()[1]); + SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerf->GetInletState().GetMassFlow()); + SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerf->GetOutletState().GetMassFlow()); + SetHistoryOutputValue("MachIn_" + tag.str(), BladePerf->GetInletState().GetMachValue()); + SetHistoryOutputValue("MachOut_" + tag.str(), BladePerf->GetOutletState().GetMachValue()); + SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); } SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); @@ -612,8 +610,7 @@ void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* Turb } } -void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr TurboPerf, CGeometry *geometry, CConfig **config, - unsigned short val_iZone) { +void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr TurboPerf, CGeometry *geometry, CConfig **config, unsigned short val_iZone) { string inMarker_Tag, outMarker_Tag, inMarkerTag_Mix; unsigned short nZone = config[val_iZone]->GetnZone(); @@ -634,8 +631,6 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetSpanWiseValue(1); SpanWiseValuesOut = geometry->GetSpanWiseValue(2); - - /*--- Writing Span wise inflow thermodynamic quantities. ---*/ spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_thermodynamic_values.dat"; char buffer[50]; @@ -671,17 +666,18 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); file.width(30); file << SpanWiseValuesIn[iSpan]; file.width(15); file << iSpan; - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetInletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetInletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetInletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); + file.width(30); file << BladePerf->GetInletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); // TODO: Add the variables back into CTurboOutput // if(TurbIntensityIn[val_iZone][iSpan] > 1.0){ // file.width(30); file << TurbIntensityIn [val_iZone][config[ZONE_0]->GetnSpan_iZones(val_iZone)/2]; @@ -728,17 +724,18 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); file.width(30); file << SpanWiseValuesOut[iSpan]; file.width(15); file << iSpan; - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); // if(TurbIntensityOut[val_iZone][iSpan] > 1.0){ // file.width(30); file << TurbIntensityOut [val_iZone][config[ZONE_0]->GetnSpan_iZones(val_iZone)/2]; // }else{ @@ -783,27 +780,28 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); file.width(30); file << SpanWiseValuesIn[iSpan]; file.width(15); file << iSpan; for (iDim = 0; iDim < 4; iDim++){ - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetMach()[iDim]; + file.width(30); file << BladePerf->GetInletState().GetMach()[iDim]; } for (iDim = 0; iDim < 4; iDim++){ - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); + file.width(30); file << BladePerf->GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } // This captures NaNs - if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle())){ + if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ file.width(30); file << "0.0000"; } else { - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle()*180.0/PI_NUMBER; + file.width(30); file << BladePerf->GetInletState().GetAbsFlowAngle()*180.0/PI_NUMBER; } - if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetFlowAngle())){ + if(isnan(BladePerf->GetInletState().GetFlowAngle())){ file.width(30); file << "0.0000"; } else{ - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetFlowAngle()*180.0/PI_NUMBER; + file.width(30); file << BladePerf->GetInletState().GetFlowAngle()*180.0/PI_NUMBER; } file << endl; } @@ -842,26 +840,27 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); file.width(30); file << SpanWiseValuesIn[iSpan]; file.width(15); file << iSpan; for (iDim = 0; iDim < 4; iDim++){ - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetMach()[iDim]; + file.width(30); file << BladePerf->GetOutletState().GetMach()[iDim]; } for (iDim = 0; iDim < 4; iDim++){ - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } - if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle())){ + if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ file.width(30); file << "0.0000"; } else { - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetAbsFlowAngle()*180.0/PI_NUMBER; + file.width(30); file << BladePerf->GetOutletState().GetAbsFlowAngle()*180.0/PI_NUMBER; } - if(isnan(BladePerformance.at(val_iZone).at(iSpan)->GetInletState().GetAbsFlowAngle())){ + if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ file.width(30); file << "0.0000"; } else{ - file.width(30); file << BladePerformance.at(val_iZone).at(iSpan)->GetOutletState().GetFlowAngle()*180.0/PI_NUMBER; + file.width(30); file << BladePerf->GetOutletState().GetFlowAngle()*180.0/PI_NUMBER; } file << endl; } diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 8ac01823f4e..68c9bd3767e 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -363,10 +363,6 @@ void CEulerSolver::InstantiateEdgeNumerics(const CSolver* const* solver_containe END_SU2_OMP_SAFE_GLOBAL_ACCESS } -void CEulerSolver::InitTurboPerformance(CGeometry *geometry, CConfig** config){ - TurbomachineryPerformance = std::make_shared(config, *geometry, *GetFluidModel()); -} - void CEulerSolver::InitTurboContainers(CGeometry *geometry, CConfig *config){ /*--- Initialize quantities for the average process for internal flow ---*/ From 737709e33ab743f9410deb543c928a5a5389bb55 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Fri, 4 Aug 2023 16:43:25 +0100 Subject: [PATCH 25/47] better solution to mz history output --- SU2_CFD/src/output/COutput.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index a5f406d2027..3b741d46b77 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1355,11 +1355,10 @@ void COutput::CheckHistoryOutput(unsigned short nZone) { for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ if (requestedHistoryFields[iReqField] == "TURBO_PERF"){ - char buffer [14]; //This makes the assumption the number of zones is 10 or lower - std::string strZones = std::to_string(nZone-1); - char const *valZones = strZones.c_str(); - auto snpCatch = snprintf(buffer, 14, "TURBO_PERF[%s]", valZones); - requestedHistoryFields[iReqField] = buffer; + std::stringstream reqField; + std::string strZones = std::to_string(nZone-1); + reqField << "TURBO_PERF[" << strZones << "]"; + reqField >> requestedHistoryFields[iReqField]; } } From 26f44c6a4cc3b639582a708b8c311c534ccd7da9 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 23 Aug 2023 15:00:34 +0100 Subject: [PATCH 26/47] Data race fix --- SU2_CFD/src/integration/CIntegration.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index c1fe4c29bf5..446bbdb26ea 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -89,11 +89,14 @@ void CIntegration::Space_Integration(CGeometry *geometry, solver_container[MainSolver]->PreprocessBC_Giles(geometry, config, conv_bound_numerics, OUTFLOW); } - if (config->GetBoolTurbomachinery()){ - /*--- Average quantities at the inflow and outflow boundaries ---*/ - solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry,config,INFLOW); - solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry, config, OUTFLOW); + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + if (config->GetBoolTurbomachinery()){ + /*--- Average quantities at the inflow and outflow boundaries ---*/ + solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry,config,INFLOW); + solver_container[MainSolver]->TurboAverageProcess(solver_container, geometry, config, OUTFLOW); + } } + END_SU2_OMP_SAFE_GLOBAL_ACCESS /*--- Weak boundary conditions ---*/ From 0947f63f7c8aeb712dd8958593230bd800772076 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 30 Aug 2023 20:09:03 +0100 Subject: [PATCH 27/47] Fixed heap use after free and vertex structure out --- SU2_CFD/include/output/COutput.hpp | 5 ++-- SU2_CFD/src/iteration/CFluidIteration.cpp | 4 +-- SU2_CFD/src/output/CFlowCompOutput.cpp | 34 +++++++++++++++-------- SU2_CFD/src/output/COutput.cpp | 11 ++++---- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index acf63efebf9..1128b823e05 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -390,11 +390,12 @@ class COutput { * \param[in] TimeIter - Value of the time iteration index * \param[in] OuterIter - Value of outer iteration index * \param[in] InnerIter - Value of the inner iteration index + * \param[in] val_iInst - Index of the instance layer */ - void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig **config, + void SetHistoryOutput(CGeometry ****geometry, CSolver *****solver_container, CConfig **config, CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, unsigned short val_iZone, - unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); + unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iInst); /*! * Collects history data from the individual output per zone, diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 44de0a83b5f..4083d036f5a 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -220,9 +220,9 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe if (val_iZone == config[ZONE_0]->GetnZone()-1) { ComputeTurboPerformance(solver, geometry, config, config[val_iZone]->GetnInner_Iter()); - output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], + output->SetHistoryOutput(geometry, solver, config, TurbomachineryStagePerformance, TurbomachineryPerformance, val_iZone, config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), - config[val_iZone]->GetInnerIter()); + config[val_iZone]->GetInnerIter(), val_iInst); } TurboMonitor(geometry, config, config[val_iZone]->GetInnerIter()); diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 265ed8ed4d7..9d201c417ea 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -639,8 +639,8 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetSpanWiseValue(1); - SpanWiseValuesOut = geometry->GetSpanWiseValue(2); + SpanWiseValuesIn = geometry->GetSpanWiseValue(INFLOW); + SpanWiseValuesOut = geometry->GetSpanWiseValue(OUTFLOW); /*--- Writing Span wise inflow thermodynamic quantities. ---*/ spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_thermodynamic_values.dat"; @@ -779,11 +779,15 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnDim() == 3) { + file.width(30); file << "\"3rd Component Mach[-]\""; + }; file.width(30); file << "\"Mach Module[-]\""; file.width(30); file << "\"Normal Velocity[m/s]\""; file.width(30); file << "\"Tangential Velocity[m/s]\""; - file.width(30); file << "\"3rd Component Velocity[m/s]\""; + if (geometry->GetnDim() == 3) { + file.width(30); file << "\"3rd Component Velocity[m/s]\""; + }; file.width(30); file << "\"Velocity Module[m/s]\""; file.width(30); file << "\"Absolute Flow Angle[deg]\""; file.width(30); file << "\"Relative Flow Angle[deg]\""; @@ -795,12 +799,14 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnDim(); iDim++){ file.width(30); file << BladePerf->GetInletState().GetMach()[iDim]; } - for (iDim = 0; iDim < 4; iDim++){ + file.width(30); file << BladePerf->GetInletState().GetMachValue(); + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ file.width(30); file << BladePerf->GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } + file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); // This captures NaNs if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ file.width(30); file << "0.0000"; @@ -839,11 +845,15 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnDim() == 3) { + file.width(30); file << "\"3rd Component Mach[-]\""; + }; file.width(30); file << "\"Mach Module[-]\""; file.width(30); file << "\"Normal Velocity[m/s]\""; file.width(30); file << "\"Tangential Velocity[m/s]\""; - file.width(30); file << "\"3rd Component Velocity[m/s]\""; + if (geometry->GetnDim() == 3) { + file.width(30); file << "\"3rd Component Velocity[m/s]\""; + }; file.width(30); file << "\"Velocity Module[m/s]\""; file.width(30); file << "\"Absolute Flow Angle[deg]\""; file.width(30); file << "\"Relative Flow Angle[deg]\""; @@ -853,14 +863,16 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnSpanWiseSections(); iSpan++){ const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); - file.width(30); file << SpanWiseValuesIn[iSpan]; + file.width(30); file << SpanWiseValuesOut[iSpan]; file.width(15); file << iSpan; - for (iDim = 0; iDim < 4; iDim++){ + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ file.width(30); file << BladePerf->GetOutletState().GetMach()[iDim]; } - for (iDim = 0; iDim < 4; iDim++){ + file.width(30); file << BladePerf->GetInletState().GetMachValue(); + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ file.width(30); file << BladePerf->GetOutletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } + file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ file.width(30); file << "0.0000"; } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 3b741d46b77..00d9d182ba3 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -228,15 +228,16 @@ void COutput::SetHistoryOutput(CGeometry *geometry, } -void COutput::SetHistoryOutput(CGeometry *geometry, - CSolver **solver, +void COutput::SetHistoryOutput(CGeometry ****geometry, + CSolver *****solver, CConfig **config, CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, unsigned short val_iZone, unsigned long TimeIter, unsigned long OuterIter, - unsigned long InnerIter){ + unsigned long InnerIter, + unsigned short val_iInst){ unsigned long Iter= InnerIter; @@ -248,14 +249,14 @@ void COutput::SetHistoryOutput(CGeometry *geometry, SetTurboPerformance_Output(TurboPerf, config[val_iZone], TimeIter, OuterIter, InnerIter); if (rank == MASTER_NODE) SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config[val_iZone]); for (int iZone = 0; iZone < config[ZONE_0]->GetnZone(); iZone ++){ - WriteTurboSpanwisePerformance(TurboPerf, geometry, config, iZone); + WriteTurboSpanwisePerformance(TurboPerf, geometry[iZone][val_iInst][MESH_0], config, iZone); } } /*--- Update turboperformance history file*/ LoadTurboHistoryData(TurboStagePerf, TurboPerf, config[val_iZone]); - SetHistoryOutput(geometry, solver, config[val_iZone], TimeIter, OuterIter,InnerIter); + SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], TimeIter, OuterIter,InnerIter); } From 9b386b054d5fd8971f60de49b79335b53bfe6cf0 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 31 Aug 2023 15:06:53 +0100 Subject: [PATCH 28/47] Updated reg tests --- TestCases/hybrid_regression.py | 10 +++++----- TestCases/parallel_regression.py | 10 +++++----- TestCases/parallel_regression_AD.py | 4 ++-- TestCases/serial_regression.py | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 0225ee0ee6c..551cd06a2d8 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -561,7 +561,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.987181, -3.096835, -14.857733, -9.109735, -11.787852, -6.266208, 73266, 73266] + Jones_tc_restart.test_vals = [-6.594590, -2.792279, -14.336129, -8.776066, -11.371439, -5.845633, 73273, 73273] test_list.append(Jones_tc_restart) # 2D axial stage @@ -569,8 +569,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047801, 1.661487, -2.916144, 2.586026, -2.486555, 3.050786, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [1.047801, 1.661487, -2.916144, 2.586026, -2.486555, 3.050786, 106380, 106380] + axial_stage2D.test_vals = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -578,8 +578,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.543335, -6.834312, -6.673129, -1.579553, -6.796362, -0.743829, -471650] - transonic_stator_restart.test_vals_aarch64 = [-7.543335, -6.834312, -6.673129, -1.579553, -6.796362, -0.743829, -471650] + transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630] + transonic_stator_restart.test_vals_aarch64 = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 64f3877fba3..5154c6bffd4 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1039,7 +1039,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.987181, -3.096835, -14.857733, -9.109735, -11.787852, -6.266208, 73266, 73266] + Jones_tc_restart.test_vals = [-6.594590, -2.792281, -14.336129, -8.776067, -11.371439, -5.845633, 73273, 73273] test_list.append(Jones_tc_restart) # 2D axial stage @@ -1047,8 +1047,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [1.047861, 1.661689, -2.916002, 2.586160, -2.486401, 3.050953, 106380, 106380] + axial_stage2D.test_vals = [0.983754, 1.534455, -2.888523, 2.606770, -2.418403, 3.087203, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [0.983754, 1.534455, -2.888523, 2.606770, -2.418403, 3.087203, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -1056,8 +1056,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] - transonic_stator_restart.test_vals_aarch64 = [-7.545560, -6.807355, -6.697808, -1.582515, -6.801911, -0.746306, -471650] + transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630] + transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 10a28c974e1..30309fac00c 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -230,8 +230,8 @@ def main(): discadj_trans_stator.cfg_dir = "disc_adj_turbomachinery/transonic_stator_2D" discadj_trans_stator.cfg_file = "transonic_stator.cfg" discadj_trans_stator.test_iter = 79 - discadj_trans_stator.test_vals = [79, 0.769972, 0.374328, 0.474458, -0.996522, 2.154079, -4.446062] - discadj_trans_stator.test_vals_aarch64 = [79.000000, 0.769908, 0.374328, 0.474687, -0.996522, 2.154079, -4.446062] + discadj_trans_stator.test_vals = [79, 0.769967, 0.374299, 0.474436, -0.996528, 2.154053, -4.446085] + discadj_trans_stator.test_vals_aarch64 = [79, 0.769967, 0.374299, 0.474436, -0.996528, 2.154053, -4.446085] test_list.append(discadj_trans_stator) ################################### diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 6810f88a240..4e72846689a 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -857,7 +857,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.987181, -3.096835, -14.857733, -9.109735, -11.787852, -6.266208, 73266, 73266] + Jones_tc_restart.test_vals = [-6.594586, -2.792279, -14.336132, -8.776068, -11.371439, -5.845632, 73273, 73273] test_list.append(Jones_tc_restart) # 2D axial stage @@ -865,8 +865,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [1.047883, 1.661703, -2.916020, 2.586144, -2.486401, 3.050955, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [1.047883, 1.661703, -2.916020, 2.586144, -2.486401, 3.050955, 106380, 106380] + axial_stage2D.test_vals = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380] + axial_stage2D.test_vals_aarch64 = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -874,8 +874,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-7.533443, -6.826845, -6.612243, -1.566209, -6.765890, -0.742094, -471650] - transonic_stator_restart.test_vals_aarch64 = [-7.533443, -6.826845, -6.612243, -1.566209, -6.765890, -0.742094, -471650] + transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630] + transonic_stator_restart.test_vals_aarch64 = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630] test_list.append(transonic_stator_restart) From fa1096f1c8fcb075adef5dcd89b02f00ec78334d Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 31 Aug 2023 15:19:41 +0100 Subject: [PATCH 29/47] Added catch for dummy driver in turbopreprocessing --- SU2_CFD/include/drivers/CDriver.hpp | 3 ++- SU2_CFD/src/drivers/CDriver.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 5ac33896849..6f7bbe2df58 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -290,9 +290,10 @@ class CDriver : public CDriverBase { * \param[in] geometry - Geometrical definition of the problem. * \param[in] solver - Container vector with all the solutions. * \param[in] interface - Class defining the physical transfer of information. + * \param[in] dummy - Definition of dummy driver */ void PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, CSolver***** solver, - CInterface*** interface); + CInterface*** interface, bool dummy); /*! * \brief Ramp some simulation settings for turbomachinery problems. diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 63f2789731c..8ec9a600bad 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -247,7 +247,7 @@ CDriverBase(confFile, val_nZone, MPICommunicator), StopCalc(false), fsi(false), if (rank == MASTER_NODE) cout << endl <<"---------------------- Turbomachinery Preprocessing ---------------------" << endl; - PreprocessTurbomachinery(config_container, geometry_container, solver_container, interface_container); + PreprocessTurbomachinery(config_container, geometry_container, solver_container, interface_container, dummy_geo); } @@ -2628,7 +2628,7 @@ void CDriver::PreprocessOutput(CConfig **config, CConfig *driver_config, COutput void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, CSolver***** solver, - CInterface*** interface){ + CInterface*** interface, bool dummy){ unsigned short donorZone,targetZone, nMarkerInt, iMarkerInt; unsigned short nSpanMax = 0; @@ -2700,7 +2700,7 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, config[ZONE_0]->SetnBlades(iZone, nBlades); } - if (rank == MASTER_NODE){ + if (rank == MASTER_NODE && !dummy){ for (iZone = 0; iZone < nZone; iZone++) { areaIn = geometry[iZone][INST_0][MESH_0]->GetSpanAreaIn(iZone, config[iZone]->GetnSpanWiseSections()); areaOut = geometry[iZone][INST_0][MESH_0]->GetSpanAreaOut(iZone, config[iZone]->GetnSpanWiseSections()); From 7e29da624edbb62aced1aff1d546d1a249e8a258 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Sat, 23 Sep 2023 10:33:58 -0700 Subject: [PATCH 30/47] Update SU2_CFD/include/output/COutput.hpp --- SU2_CFD/include/output/COutput.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 001a3915091..84036a6b117 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -382,6 +382,7 @@ class COutput { * \param[in] config - Definition of the particular problem. */ void SetHistoryOutput(CGeometry *geometry, CSolver **solver_container, CConfig *config); + /*! * \brief Collects history data from the solvers, monitors the convergence and writes to screen and history file. * \param[in] geometry - Geometrical definition of the problem. From 8bad923d95e6c6ea9c080975080cc991cf9ad490 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 26 Oct 2023 16:58:48 +0100 Subject: [PATCH 31/47] Changes to address comments --- SU2_CFD/include/output/CTurboOutput.hpp | 60 +++++++++---------- SU2_CFD/include/solvers/CEulerSolver.hpp | 5 +- SU2_CFD/include/solvers/CSolver.hpp | 2 +- .../src/integration/CMultiGridIntegration.cpp | 9 --- SU2_CFD/src/output/CFlowOutput.cpp | 55 +++++++++-------- SU2_CFD/src/output/COutput.cpp | 21 ++----- SU2_CFD/src/output/CTurboOutput.cpp | 16 ++--- 7 files changed, 74 insertions(+), 94 deletions(-) diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 4a2c9388caf..a08a845ad8c 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -74,9 +74,9 @@ class CTurbomachineryCombinedPrimitiveStates { CTurbomachineryCombinedPrimitiveStates(const CTurbomachineryPrimitiveState& inletPrimitiveState, const CTurbomachineryPrimitiveState& outletPrimitiveState); - CTurbomachineryPrimitiveState GetInletPrimitiveState() const& { return InletPrimitiveState; } + const CTurbomachineryPrimitiveState& GetInletPrimitiveState() const& { return InletPrimitiveState; } - CTurbomachineryPrimitiveState GetOutletPrimitiveState() const& { return OutletPrimitiveState; } + const CTurbomachineryPrimitiveState& GetOutletPrimitiveState() const& { return OutletPrimitiveState; } }; /*! @@ -98,45 +98,45 @@ class CTurbomachineryState { void ComputeState(CFluidModel& fluidModel, const CTurbomachineryPrimitiveState& primitiveState); - const su2double GetDensity() const { return Density; } + const su2double& GetDensity() const { return Density; } - const su2double GetPressure() const { return Pressure; } + const su2double& GetPressure() const { return Pressure; } - const su2double GetEntropy() const { return Entropy; } + const su2double& GetEntropy() const { return Entropy; } - const su2double GetEnthalpy() const { return Enthalpy; } + const su2double& GetEnthalpy() const { return Enthalpy; } - const su2double GetTemperature() const { return Temperature; } + const su2double& GetTemperature() const { return Temperature; } - const su2double GetTotalTemperature() const { return TotalTemperature; } + const su2double& GetTotalTemperature() const { return TotalTemperature; } - const su2double GetTotalPressure() const { return TotalPressure; } + const su2double& GetTotalPressure() const { return TotalPressure; } - const su2double GetTotalRelPressure() const { return TotalRelPressure; } + const su2double& GetTotalRelPressure() const { return TotalRelPressure; } - const su2double GetTotalEnthalpy() const { return TotalEnthalpy; } + const su2double& GetTotalEnthalpy() const { return TotalEnthalpy; } - const su2double GetAbsFlowAngle() const { return AbsFlowAngle; } + const su2double& GetAbsFlowAngle() const { return AbsFlowAngle; } - const su2double GetFlowAngle() const { return FlowAngle; } + const su2double& GetFlowAngle() const { return FlowAngle; } - const su2double GetMassFlow() const { return MassFlow; } + const su2double& GetMassFlow() const { return MassFlow; } - const su2double GetRothalpy() const { return Rothalpy; } + const su2double& GetRothalpy() const { return Rothalpy; } - const vector GetVelocity() const { return Velocity; } + const vector& GetVelocity() const { return Velocity; } - const vector GetMach() const { return Mach; } + const vector& GetMach() const { return Mach; } - const su2double GetVelocityValue() const { return Norm(Velocity); } + su2double GetVelocityValue() const { return Norm(Velocity); } - const su2double GetMachValue() const { return Norm(Mach); } + const su2double& GetMachValue() const { return Norm(Mach); } - const su2double GetRelVelocityValue() const { return Norm(RelVelocity); } + const su2double& GetRelVelocityValue() const { return Norm(RelVelocity); } - const su2double GetRelMachValue() const { return Norm(RelMach); } + const su2double& GetRelMachValue() const { return Norm(RelMach); } - const su2double Norm(vector const& u) const { + su2double Norm(vector const& u) const { su2double accum = 0.; for (auto i = 0u; i < u.size(); ++i) { accum += u[i] * u[i]; @@ -168,15 +168,15 @@ class CTurbomachineryBladePerformance { const CTurbomachineryState& GetOutletState() { return OutletState; } - const su2double GetKineticEnergyLoss() const { return KineticEnergyLoss; } + const su2double& GetKineticEnergyLoss() const { return KineticEnergyLoss; } - const su2double GetTotalPressureLoss() const { return TotalPressureLoss; } + const su2double& GetTotalPressureLoss() const { return TotalPressureLoss; } - const su2double GetEntropyGen() const { return EntropyGen; } + const su2double& GetEntropyGen() const { return EntropyGen; } - const su2double GetPressureRatio() const { return PressureRatio; } + const su2double& GetPressureRatio() const { return PressureRatio; } - const su2double GetEulerianWork() const { return EulerianWork; } + const su2double& GetEulerianWork() const { return EulerianWork; } }; class CTurbineBladePerformance : public CTurbomachineryBladePerformance { @@ -215,11 +215,11 @@ class CTurbomachineryStagePerformance { virtual ~CTurbomachineryStagePerformance() = default; - virtual void ComputePerformanceStage(CTurbomachineryState InState, CTurbomachineryState OutState, const CConfig* config); + virtual void ComputePerformanceStage(const CTurbomachineryState& InState, const CTurbomachineryState& OutState, const CConfig* config); - virtual void ComputeTurbineStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + virtual void ComputeTurbineStagePerformance(const CTurbomachineryState& InState, const CTurbomachineryState& OutState); - virtual void ComputeCompressorStagePerformance(CTurbomachineryState InState, CTurbomachineryState OutState); + virtual void ComputeCompressorStagePerformance(const CTurbomachineryState& InState, const CTurbomachineryState& OutState); const su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 9611aa24843..1e61c53ca06 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -108,8 +108,6 @@ class CEulerSolver : public CFVMFlowSolverBase TurboPrimitive; /*!< \breif Primtive turbo variables vector */ - vector FluidModel; /*!< \brief fluid model used in the solver. */ /*--- Turbomachinery Solver Variables ---*/ @@ -1034,7 +1032,8 @@ class CEulerSolver : public CFVMFlowSolverBase GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool INLET) override { - TurboPrimitive.clear(); + vector TurboPrimitive; + TurboPrimitive.reserve(5); if (INLET) { TurboPrimitive.push_back(DensityIn[iBlade][iSpan]); TurboPrimitive.push_back(PressureIn[iBlade][iSpan]); diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 57d1176c02a..9134c901174 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -3759,7 +3759,7 @@ class CSolver { * iteration can be executed by multiple threads. * \return returns Density, pressure and TurboVelocity (IN/OUTLET) */ - virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) { return vector(5, 0.0); } + virtual vector GetTurboPrimitive(unsigned short iBlade, unsigned short iSpan, bool Inlet) { return {}; } /*! * \brief virtual member. diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp index 50d37eff541..d335d4d14c4 100644 --- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp +++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp @@ -680,17 +680,8 @@ void CMultiGridIntegration::NonDimensional_Parameters(CGeometry **geometry, CSol solver_container[FinestMesh][FLOW_SOL]->GatherInOutAverageValues(config, geometry[FinestMesh]); - /* --- compute turboperformance for each stage and the global machine ---*/ - //TODO: for multi-zone turbo this should be move to the last zone ---*/ - // solver_container[FinestMesh][FLOW_SOL]->ComputeTurboPerformance(config, geometry[FinestMesh]); } - /*--- Evaluate the buffet metric if requested ---*/ - /* - if(config->GetnMarker_Monitoring() || config->GetKind_ObjFunc() == BUFFET_SENSOR){ - solver_container[FinestMesh][FLOW_SOL]->Buffet_Monitoring(geometry[FinestMesh], config); - } - */ break; case RUNTIME_ADJFLOW_SYS: diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 91ab160ec6d..cb6e75a5999 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -4054,34 +4054,33 @@ void CFlowOutput::SetFixedCLScreenOutput(const CConfig *config){ void CFlowOutput::AddTurboOutput(unsigned short nZone){ //Adds zone turboperformance history variables for (unsigned short iZone = 0; iZone <= nZone-1; iZone++) { - stringstream tag; - tag << iZone + 1; - AddHistoryOutput("EntropyIn_" + tag.str(), "EntropyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("EntropyOut_" + tag.str(), "EntropyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalEntahalpyIn_" + tag.str(), "TotalEntahalpyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalEnthalpyOut_" + tag.str(), "TotalEnthalpyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalPressureIn_" + tag.str(), "TotPressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalPressureOut_" + tag.str(), "TotPressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureIn_" + tag.str(), "PressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureOut_" + tag.str(), "PressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("DensityIn_" + tag.str(), "DensityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("DensityOut_" + tag.str(), "DensityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("NormalVelocityIn_" + tag.str(), "NormalVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("NormalVelocityOut_" + tag.str(), "NormalVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TangentialVelocityIn_" + tag.str(), "TangentialVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TangentialVelocityOut_" + tag.str(), "TangentialVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("AbsFlowAngleIn_" + tag.str(), "AbsFlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("AbsFlowAngleOut_" + tag.str(), "AbsFlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + const auto tag = std::to_string(iZone + 1); + AddHistoryOutput("EntropyIn_" + tag.str(), "EntropyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("EntropyOut_" + tag.str(), "EntropyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEntahalpyIn_" + tag.str(), "TotalEntahalpyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEnthalpyOut_" + tag.str(), "TotalEnthalpyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureIn_" + tag.str(), "TotPressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureOut_" + tag.str(), "TotPressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureIn_" + tag.str(), "PressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureOut_" + tag.str(), "PressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityIn_" + tag.str(), "DensityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityOut_" + tag.str(), "DensityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityIn_" + tag.str(), "NormalVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityOut_" + tag.str(), "NormalVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityIn_" + tag.str(), "TangentialVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityOut_" + tag.str(), "TangentialVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("AbsFlowAngleIn_" + tag.str(), "AbsFlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("AbsFlowAngleOut_" + tag.str(), "AbsFlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); } //Adds turbomachinery machine performance variables - AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("EulerianWork", "EulerianWork", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalStaticEfficiency", "TotStaticEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalTotalEfficiency", "TotTotEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureRatioTS", "PRTS", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureRatioTT", "PRTT", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("EulerianWork", "EulerianWork", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalStaticEfficiency", "TotStaticEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalTotalEfficiency", "TotTotEff", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureRatioTS", "PRTS", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureRatioTT", "PRTT", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index da81bd3a821..3074768b8a5 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -169,8 +169,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output): volumeDataSorter = nullptr; surfaceDataSorter = nullptr; - headerNeeded = false; - + headerNeeded = false; } COutput::~COutput() { @@ -228,16 +227,7 @@ void COutput::SetHistoryOutput(CGeometry *geometry, } -void COutput::SetHistoryOutput(CGeometry ****geometry, - CSolver *****solver, - CConfig **config, - CTurbomachineryStagePerformance* TurboStagePerf, - std::shared_ptr TurboPerf, - unsigned short val_iZone, - unsigned long TimeIter, - unsigned long OuterIter, - unsigned long InnerIter, - unsigned short val_iInst){ +void COutput::SetHistoryOutput(CGeometry ****geometry, CSolver *****solver, CConfig **config, CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, unsigned short val_iZone, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iInst){ unsigned long Iter= InnerIter; @@ -248,9 +238,10 @@ void COutput::SetHistoryOutput(CGeometry ****geometry, if (Iter%100 == 0) { SetTurboPerformance_Output(TurboPerf, config[val_iZone], TimeIter, OuterIter, InnerIter); if (rank == MASTER_NODE) SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config[val_iZone]); - for (int iZone = 0; iZone < config[ZONE_0]->GetnZone(); iZone ++){ - WriteTurboSpanwisePerformance(TurboPerf, geometry[iZone][val_iInst][MESH_0], config, iZone); - } + } + + for (int iZone = 0; iZone < config[ZONE_0]->GetnZone(); iZone ++){ + WriteTurboSpanwisePerformance(TurboPerf, geometry[iZone][val_iInst][MESH_0], config, iZone); } /*--- Update turboperformance history file*/ diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index 600a2987501..335b06e188d 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -2,14 +2,14 @@ * \file CTurboOutput.cpp * \brief Source of the Turbomachinery Performance class * \author S. Vitale, N. Anand - * \version 7.1.1 "Blackbird" + * \version 8.0.0 "Harrier" * * SU2 Project Website: https://su2code.github.io * * The SU2 Project is maintained by the SU2 Foundation * (http://su2foundation.org) * - * Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md) + * Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md) * * SU2 is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -222,8 +222,8 @@ void CTurboOutput::ComputePerSpan(shared_ptr co CTurbomachineryStagePerformance::CTurbomachineryStagePerformance(CFluidModel& fluid) : fluidModel(fluid) {} -void CTurbomachineryStagePerformance::ComputePerformanceStage(CTurbomachineryState InState, - CTurbomachineryState OutState, const CConfig* config) { +void CTurbomachineryStagePerformance::ComputePerformanceStage(const CTurbomachineryState& InState, + const CTurbomachineryState& OutState, const CConfig* config) { switch (config->GetKind_TurboPerf(ZONE_0)) { case TURBO_PERF_KIND::TURBINE: ComputeTurbineStagePerformance(InState, OutState); @@ -239,8 +239,8 @@ void CTurbomachineryStagePerformance::ComputePerformanceStage(CTurbomachinerySta } } -void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(CTurbomachineryState InState, - CTurbomachineryState OutState) { +void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(const CTurbomachineryState& InState, + const CTurbomachineryState& OutState) { /*--- Compute isentropic Outflow quantities ---*/ fluidModel.SetTDState_Ps(OutState.GetPressure(), InState.GetEntropy()); su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity(); @@ -255,8 +255,8 @@ void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(CTurbomachi TotalTotalPressureRatio = InState.GetTotalPressure() / OutState.GetTotalPressure(); } -void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(CTurbomachineryState InState, - CTurbomachineryState OutState) { +void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(const CTurbomachineryState& InState, + const CTurbomachineryState& OutState) { /*--- Compute isentropic Outflow quantities ---*/ fluidModel.SetTDState_Ps(OutState.GetPressure(), InState.GetEntropy()); su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity(); From 4bfcf7b977c8548ec3750f227a60963c833582d9 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 26 Oct 2023 17:49:58 +0100 Subject: [PATCH 32/47] Fixing what I broke --- SU2_CFD/include/output/CTurboOutput.hpp | 6 ++-- SU2_CFD/src/output/CFlowOutput.cpp | 40 ++++++++++++------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index a08a845ad8c..823c1d48c25 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -130,11 +130,11 @@ class CTurbomachineryState { su2double GetVelocityValue() const { return Norm(Velocity); } - const su2double& GetMachValue() const { return Norm(Mach); } + su2double GetMachValue() const { return Norm(Mach); } - const su2double& GetRelVelocityValue() const { return Norm(RelVelocity); } + su2double GetRelVelocityValue() const { return Norm(RelVelocity); } - const su2double& GetRelMachValue() const { return Norm(RelMach); } + su2double GetRelMachValue() const { return Norm(RelMach); } su2double Norm(vector const& u) const { su2double accum = 0.; diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index cb6e75a5999..5ed2862922a 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -4055,26 +4055,26 @@ void CFlowOutput::AddTurboOutput(unsigned short nZone){ //Adds zone turboperformance history variables for (unsigned short iZone = 0; iZone <= nZone-1; iZone++) { const auto tag = std::to_string(iZone + 1); - AddHistoryOutput("EntropyIn_" + tag.str(), "EntropyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("EntropyOut_" + tag.str(), "EntropyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalEntahalpyIn_" + tag.str(), "TotalEntahalpyIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalEnthalpyOut_" + tag.str(), "TotalEnthalpyOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalPressureIn_" + tag.str(), "TotPressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TotalPressureOut_" + tag.str(), "TotPressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureIn_" + tag.str(), "PressureIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("PressureOut_" + tag.str(), "PressureOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("DensityIn_" + tag.str(), "DensityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("DensityOut_" + tag.str(), "DensityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("NormalVelocityIn_" + tag.str(), "NormalVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("NormalVelocityOut_" + tag.str(), "NormalVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TangentialVelocityIn_" + tag.str(), "TangentialVelocityIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("TangentialVelocityOut_" + tag.str(), "TangentialVelocityOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MassFlowIn_" + tag.str(), "MassFlowIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MassFlowOut_" + tag.str(), "MassFlowOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MachIn_" + tag.str(), "MachIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("MachOut_" + tag.str(), "MachOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("AbsFlowAngleIn_" + tag.str(), "AbsFlowAngleIn_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag.str(), HistoryFieldType::DEFAULT); - AddHistoryOutput("AbsFlowAngleOut_" + tag.str(), "AbsFlowAngleOut_" + tag.str(), ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag.str(), HistoryFieldType::DEFAULT); + AddHistoryOutput("EntropyIn_" + tag, "EntropyIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total pressure loss " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("EntropyOut_" + tag, "EntropyOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Kinetic energy loss " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEntahalpyIn_" + tag, "TotalEntahalpyIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Entropy generation " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalEnthalpyOut_" + tag, "TotalEnthalpyOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Eulerian work " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureIn_" + tag, "TotPressureIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("TotalPressureOut_" + tag, "TotPressureOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureIn_" + tag, "PressureIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Pressure ratio " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("PressureOut_" + tag, "PressureOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle in " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityIn_" + tag, "DensityIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Flow angle out " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("DensityOut_" + tag, "DensityOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityIn_" + tag, "NormalVelocityIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("NormalVelocityOut_" + tag, "NormalVelocityOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow in " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityIn_" + tag, "TangentialVelocityIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mass flow out " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("TangentialVelocityOut_" + tag, "TangentialVelocityOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach in " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowIn_" + tag, "MassFlowIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Mach out " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("MassFlowOut_" + tag, "MassFlowOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total efficiency " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("MachIn_" + tag, "MachIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("MachOut_" + tag, "MachOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Total-to-Static efficiency " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("AbsFlowAngleIn_" + tag, "AbsFlowAngleIn_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle in " + tag, HistoryFieldType::DEFAULT); + AddHistoryOutput("AbsFlowAngleOut_" + tag, "AbsFlowAngleOut_" + tag, ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Absolute flow angle out " + tag, HistoryFieldType::DEFAULT); } //Adds turbomachinery machine performance variables AddHistoryOutput("EntropyGeneration", "EntropyGen", ScreenOutputFormat::SCIENTIFIC, "TURBO_PERF", "Machine entropy generation", HistoryFieldType::DEFAULT); From f5b9698370eccd5192e150db4c216a8b8872e0e1 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 8 Nov 2023 15:33:53 +0000 Subject: [PATCH 33/47] Changes to address comments --- Common/src/CConfig.cpp | 2 +- SU2_CFD/include/iteration/CFluidIteration.hpp | 4 ++-- SU2_CFD/include/iteration/CIteration.hpp | 15 --------------- SU2_CFD/include/iteration/CTurboIteration.hpp | 2 +- SU2_CFD/include/output/CTurboOutput.hpp | 2 +- SU2_CFD/src/drivers/CMultizoneDriver.cpp | 10 ++-------- externals/codi | 2 +- externals/mel | 2 +- subprojects/CoolProp | 2 +- 9 files changed, 10 insertions(+), 31 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index cbb1b3546eb..dee2cc63bef 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6895,7 +6895,6 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { break; } } - } else { if (Time_Domain) { cout << "Dynamic structural analysis."<< endl; @@ -6903,6 +6902,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { } else { cout << "Static structural analysis." << endl; } + } if ((Kind_Solver == MAIN_SOLVER::EULER) || (Kind_Solver == MAIN_SOLVER::NAVIER_STOKES) || (Kind_Solver == MAIN_SOLVER::RANS) || (Kind_Solver == MAIN_SOLVER::INC_EULER) || (Kind_Solver == MAIN_SOLVER::INC_NAVIER_STOKES) || (Kind_Solver == MAIN_SOLVER::INC_RANS) || diff --git a/SU2_CFD/include/iteration/CFluidIteration.hpp b/SU2_CFD/include/iteration/CFluidIteration.hpp index 3b340f61960..f8f0f72c624 100644 --- a/SU2_CFD/include/iteration/CFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CFluidIteration.hpp @@ -110,12 +110,12 @@ class CFluidIteration : public CIteration { /*! * \brief Monitors turbo computation (pressure and turbo ramps). */ - void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) override; + void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter); /*! * \brief Computes turboperformance. */ - void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) override; + void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter); /*! * \brief Postprocesses the fluid system before heading to another physics system or the next iteration. diff --git a/SU2_CFD/include/iteration/CIteration.hpp b/SU2_CFD/include/iteration/CIteration.hpp index f518ad34567..ac2581f12c9 100644 --- a/SU2_CFD/include/iteration/CIteration.hpp +++ b/SU2_CFD/include/iteration/CIteration.hpp @@ -252,21 +252,6 @@ class CIteration { return false; } - /*! - * \brief Monitors turbo computation (pressure and turbo ramps). - */ - virtual void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) {}; - - /*! - * \brief Monitors turbo computation (pressure and turbo ramps). - */ - virtual void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter) {}; - - /*! - * \brief Monitors turbo computation (pressure and turbo ramps). - */ - virtual void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid) {} - /*! * \brief A virtual member. * \param[in] output - Pointer to the COutput class. diff --git a/SU2_CFD/include/iteration/CTurboIteration.hpp b/SU2_CFD/include/iteration/CTurboIteration.hpp index ba702d008cf..4b4d9adad04 100644 --- a/SU2_CFD/include/iteration/CTurboIteration.hpp +++ b/SU2_CFD/include/iteration/CTurboIteration.hpp @@ -67,5 +67,5 @@ class CTurboIteration : public CFluidIteration { /*! * \brief Initialises turboperformance classes. */ - void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid) override; + void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid); }; diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 823c1d48c25..38bebf8df09 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -227,7 +227,7 @@ class CTurbomachineryStagePerformance { const su2double GetEulerianWork() const { return EulerianWork; } - const su2double GetNormEntropyGen() const { return NormEntropyGen; } + const su2double& GetNormEntropyGen() const { return NormEntropyGen; } const su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index 6ab4177dd01..36dbdbb4660 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -181,10 +181,8 @@ void CMultizoneDriver::StartSolver() { Preprocess(TimeIter); /*--- Run a block iteration of the multizone problem. ---*/ - switch (driver_config->GetKind_MZSolver()){ - case ENUM_MULTIZONE::MZ_BLOCK_GAUSS_SEIDEL: RunGaussSeidel(); break; // Block Gauss-Seidel iteration - case ENUM_MULTIZONE::MZ_BLOCK_JACOBI: RunJacobi(); break; // Block-Jacobi iteration - } + + Run(); /*--- Update the solution for dual time stepping strategy ---*/ @@ -671,10 +669,6 @@ bool CMultizoneDriver::Monitor(unsigned long TimeIter) { cout << "-------------------------------------------------------------------------" << endl; } - return (FinalTimeReached || MaxIterationsReached); - - - return (FinalTimeReached || MaxIterationsReached); } diff --git a/externals/codi b/externals/codi index eee1b5eea2d..8ee822a9b0b 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2 +Subproject commit 8ee822a9b0bb8235a2494467b774e27fb64ff14f diff --git a/externals/mel b/externals/mel index 46205ab019e..2484cd3258e 160000 --- a/externals/mel +++ b/externals/mel @@ -1 +1 @@ -Subproject commit 46205ab019e5224559091375a6d71aabae6bc5b9 +Subproject commit 2484cd3258ef800a10e361016cb341834ee7930b diff --git a/subprojects/CoolProp b/subprojects/CoolProp index bafdea1f39e..0ce42fcf3bb 160000 --- a/subprojects/CoolProp +++ b/subprojects/CoolProp @@ -1 +1 @@ -Subproject commit bafdea1f39ee873a6bb9833e3a21fe41f90b85e8 +Subproject commit 0ce42fcf3bb2c373512bc825a4f0c1973a78f307 From b9334b10c117e2b4b8a70af1fe44a32214eee39f Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 9 Nov 2023 13:11:54 +0000 Subject: [PATCH 34/47] Fix merge error --- SU2_CFD/src/drivers/CDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 6d7b189c7c9..ff80905273b 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -247,7 +247,7 @@ CDriverBase(confFile, val_nZone, MPICommunicator), StopCalc(false), fsi(false), if (rank == MASTER_NODE) cout << endl <<"---------------------- Turbomachinery Preprocessing ---------------------" << endl; - PreprocessTurbomachinery(config_container, geometry_container, solver_container, interface_container); + PreprocessTurbomachinery(config_container, geometry_container, solver_container, interface_container, dummy_geo); } else { mixingplane = false; } From 9ea23bec4400b9544e71f0d1da883beb43379452 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 9 Nov 2023 14:17:04 +0000 Subject: [PATCH 35/47] submodule update --- externals/codi | 2 +- externals/mel | 2 +- subprojects/CoolProp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/externals/codi b/externals/codi index 8ee822a9b0b..0ad036f2c82 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 8ee822a9b0bb8235a2494467b774e27fb64ff14f +Subproject commit 0ad036f2c8254fa7b77180a443d99248c047c877 diff --git a/externals/mel b/externals/mel index 2484cd3258e..46205ab019e 160000 --- a/externals/mel +++ b/externals/mel @@ -1 +1 @@ -Subproject commit 2484cd3258ef800a10e361016cb341834ee7930b +Subproject commit 46205ab019e5224559091375a6d71aabae6bc5b9 diff --git a/subprojects/CoolProp b/subprojects/CoolProp index 0ce42fcf3bb..bafdea1f39e 160000 --- a/subprojects/CoolProp +++ b/subprojects/CoolProp @@ -1 +1 @@ -Subproject commit 0ce42fcf3bb2c373512bc825a4f0c1973a78f307 +Subproject commit bafdea1f39ee873a6bb9833e3a21fe41f90b85e8 From e0e61c6680526c80998e8c4574ae14d50006b69e Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 16 Jan 2024 14:32:16 +0000 Subject: [PATCH 36/47] github-adv-security comments --- SU2_CFD/include/output/CTurboOutput.hpp | 10 +++++----- SU2_CFD/src/output/CFlowCompOutput.cpp | 24 ------------------------ SU2_CFD/src/output/CTurboOutput.cpp | 5 ++--- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 38bebf8df09..9dc1a88b265 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -221,17 +221,17 @@ class CTurbomachineryStagePerformance { virtual void ComputeCompressorStagePerformance(const CTurbomachineryState& InState, const CTurbomachineryState& OutState); - const su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } + su2double GetTotalStaticEfficiency() const { return TotalStaticEfficiency; } - const su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } + su2double GetTotalTotalEfficiency() const { return TotalTotalEfficiency; } - const su2double GetEulerianWork() const { return EulerianWork; } + su2double GetEulerianWork() const { return EulerianWork; } const su2double& GetNormEntropyGen() const { return NormEntropyGen; } - const su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } + su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } - const su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } + su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; } }; /*! diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 8017a852c51..b12e09ddc99 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -669,10 +669,6 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetnSpanWiseSections(); iSpan++){ @@ -688,15 +684,6 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetInletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); file.width(30); file << BladePerf->GetInletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); file.width(30); file << BladePerf->GetInletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); - // TODO: Add the variables back into CTurboOutput - // if(TurbIntensityIn[val_iZone][iSpan] > 1.0){ - // file.width(30); file << TurbIntensityIn [val_iZone][config[ZONE_0]->GetnSpan_iZones(val_iZone)/2]; - // }else{ - // file.width(30); file << TurbIntensityIn [val_iZone][iSpan]; - // } - // file.width(30); file << Turb2LamViscRatioIn [val_iZone][iSpan]; - // file.width(30); file << NuFactorIn [val_iZone][iSpan]; - // file << endl; } file.close(); @@ -727,9 +714,6 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetOutletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); file.width(30); file << BladePerf->GetOutletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); file.width(30); file << BladePerf->GetOutletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); - // if(TurbIntensityOut[val_iZone][iSpan] > 1.0){ - // file.width(30); file << TurbIntensityOut [val_iZone][config[ZONE_0]->GetnSpan_iZones(val_iZone)/2]; - // }else{ - // file.width(30); file << TurbIntensityOut [val_iZone][iSpan]; - // } - // file.width(30); file << Turb2LamViscRatioOut [val_iZone][iSpan]; - // file.width(30); file << NuFactorOut [val_iZone][iSpan]; - // file << endl; } file.close(); diff --git a/SU2_CFD/src/output/CTurboOutput.cpp b/SU2_CFD/src/output/CTurboOutput.cpp index 335b06e188d..c17f78f87cc 100644 --- a/SU2_CFD/src/output/CTurboOutput.cpp +++ b/SU2_CFD/src/output/CTurboOutput.cpp @@ -31,7 +31,6 @@ CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState() { Density = Press CTurbomachineryPrimitiveState::CTurbomachineryPrimitiveState(vector TurboPrimitive, unsigned short nDim, su2double tangVel) : Density(TurboPrimitive[0]), Pressure(TurboPrimitive[1]), TangVelocity(tangVel) { - // Velocity.assign(TurboPrimitive+2, TurboPrimitive + nDim+2 ); Velocity = {TurboPrimitive.begin() + 2, TurboPrimitive.end()}; } @@ -123,7 +122,7 @@ void CTurbineBladePerformance::ComputePerformance(const CTurbomachineryCombinedP su2double relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel; /*--- Compute performance ---*/ - EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); + EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); EulerianWork = InletState.GetTotalEnthalpy() - OutletState.GetTotalEnthalpy(); TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) / (OutletState.GetTotalRelPressure() - OutletState.GetPressure()); @@ -146,7 +145,7 @@ void CCompressorBladePerformance::ComputePerformance(const CTurbomachineryCombin su2double relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel; /*--- Compute performance ---*/ - EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1); + EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); EulerianWork = OutletState.GetTotalEnthalpy() - InletState.GetTotalEnthalpy(); TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) / (InletState.GetTotalRelPressure() - InletState.GetPressure()); From efeabbdb48d71fd32ef1b7754807ce82377b44b8 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 16 Jan 2024 18:17:21 +0000 Subject: [PATCH 37/47] codeql check & singlezone bugfix --- SU2_CFD/src/output/CFlowCompOutput.cpp | 436 +++++++++++++------------ SU2_CFD/src/output/COutput.cpp | 2 +- 2 files changed, 220 insertions(+), 218 deletions(-) diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index b12e09ddc99..ec1b4a5f8c5 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -637,234 +637,236 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetSpanWiseValue(INFLOW); - SpanWiseValuesOut = geometry->GetSpanWiseValue(OUTFLOW); - - /*--- Writing Span wise inflow thermodynamic quantities. ---*/ - spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_thermodynamic_values.dat"; - char buffer[50]; - if (nZone > 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + if (rank != MASTER_NODE){ + return 0; + } + + SpanWiseValuesIn = geometry->GetSpanWiseValue(INFLOW); + SpanWiseValuesOut = geometry->GetSpanWiseValue(OUTFLOW); + + /*--- Writing Span wise inflow thermodynamic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_thermodynamic_values.dat"; + char buffer[50]; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Inflow Spanwise Thermodynamic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Pressure[Pa]\""; + file.width(30); file << "\"TotalPressure[Pa]\""; + file.width(30); file << "\"Temperature[K]\""; + file.width(30); file << "\"TotalTemperature[K]\""; + file.width(30); file << "\"Enthalpy[J]\""; + file.width(30); file << "\"TotalEnthalpy[J]\""; + file.width(30); file << "\"Density[kg/m3]\""; + file.width(30); file << "\"Entropy[J/K]\""; + file << endl; + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); + + file.width(30); file << SpanWiseValuesIn[iSpan]; + file.width(15); file << iSpan; + file.width(30); file << BladePerf->GetInletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetInletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetInletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetInletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); + file.width(30); file << BladePerf->GetInletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + } + + file.close(); + + /*--- Writing Span wise outflow thermodynamic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_thermodynamic_values.dat"; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Outflow Span-wise Thermodynamic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Pressure[Pa]\""; + file.width(30); file << "\"TotalPressure[Pa]\""; + file.width(30); file << "\"Temperature[K]\""; + file.width(30); file << "\"TotalTemperature[K]\""; + file.width(30); file << "\"Enthalpy[J]\""; + file.width(30); file << "\"TotalEnthalpy[J]\""; + file.width(30); file << "\"Density[kg/m3]\""; + file.width(30); file << "\"Entropy[J/K]\""; + file << endl; + + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); + + file.width(30); file << SpanWiseValuesOut[iSpan]; + file.width(15); file << iSpan; + file.width(30); file << BladePerf->GetOutletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); + file.width(30); file << BladePerf->GetOutletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + } + + file.close(); + + /*--- Writing Span wise inflow kinematic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_kinematic_values.dat"; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Inflow Span-wise Kinematic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Normal Mach[-]\""; + file.width(30); file << "\"Tangential Mach[-]\""; + if (geometry->GetnDim() == 3) { + file.width(30); file << "\"3rd Component Mach[-]\""; + }; + file.width(30); file << "\"Mach Module[-]\""; + file.width(30); file << "\"Normal Velocity[m/s]\""; + file.width(30); file << "\"Tangential Velocity[m/s]\""; + if (geometry->GetnDim() == 3) { + file.width(30); file << "\"3rd Component Velocity[m/s]\""; + }; + file.width(30); file << "\"Velocity Module[m/s]\""; + file.width(30); file << "\"Absolute Flow Angle[deg]\""; + file.width(30); file << "\"Relative Flow Angle[deg]\""; + file << endl; + + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); + + file.width(30); file << SpanWiseValuesIn[iSpan]; + file.width(15); file << iSpan; + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ + file.width(30); file << BladePerf->GetInletState().GetMach()[iDim]; } - - - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); - file.setf(ios::scientific); - file.precision(12); - - file << "TITLE = \"Inflow Spanwise Thermodynamic Values. iOuterIter = " << iExtIter << " \"" << endl; - file << "VARIABLES =" << endl; - - file.width(30); file << "\"SpanWise Value[m]\""; - file.width(15); file << "\"iSpan\""; - file.width(30); file << "\"Pressure[Pa]\""; - file.width(30); file << "\"TotalPressure[Pa]\""; - file.width(30); file << "\"Temperature[K]\""; - file.width(30); file << "\"TotalTemperature[K]\""; - file.width(30); file << "\"Enthalpy[J]\""; - file.width(30); file << "\"TotalEnthalpy[J]\""; - file.width(30); file << "\"Density[kg/m3]\""; - file.width(30); file << "\"Entropy[J/K]\""; - file << endl; - - for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ - const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); - - file.width(30); file << SpanWiseValuesIn[iSpan]; - file.width(15); file << iSpan; - file.width(30); file << BladePerf->GetInletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerf->GetInletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerf->GetInletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerf->GetInletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerf->GetInletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerf->GetInletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerf->GetInletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); - file.width(30); file << BladePerf->GetInletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + file.width(30); file << BladePerf->GetInletState().GetMachValue(); + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ + file.width(30); file << BladePerf->GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } - - file.close(); - - /*--- Writing Span wise outflow thermodynamic quantities. ---*/ - spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_thermodynamic_values.dat"; - if (nZone > 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); + // This captures NaNs + if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ + file.width(30); file << "0.0000"; } - - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); - file.setf(ios::scientific); - file.precision(12); - - file << "TITLE = \"Outflow Span-wise Thermodynamic Values. iOuterIter = " << iExtIter << " \"" << endl; - file << "VARIABLES =" << endl; - - file.width(30); file << "\"SpanWise Value[m]\""; - file.width(15); file << "\"iSpan\""; - file.width(30); file << "\"Pressure[Pa]\""; - file.width(30); file << "\"TotalPressure[Pa]\""; - file.width(30); file << "\"Temperature[K]\""; - file.width(30); file << "\"TotalTemperature[K]\""; - file.width(30); file << "\"Enthalpy[J]\""; - file.width(30); file << "\"TotalEnthalpy[J]\""; - file.width(30); file << "\"Density[kg/m3]\""; - file.width(30); file << "\"Entropy[J/K]\""; - file << endl; - - - for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ - const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); - - file.width(30); file << SpanWiseValuesOut[iSpan]; - file.width(15); file << iSpan; - file.width(30); file << BladePerf->GetOutletState().GetPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetTotalPressure()*config[ZONE_0]->GetPressure_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetTotalTemperature()*config[ZONE_0]->GetTemperature_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetTotalEnthalpy()*config[ZONE_0]->GetEnergy_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetDensity()*config[ZONE_0]->GetDensity_Ref(); - file.width(30); file << BladePerf->GetOutletState().GetEntropy()*config[ZONE_0]->GetEnergy_Ref()/config[ZONE_0]->GetTemperature_Ref(); + else { + file.width(30); file << BladePerf->GetInletState().GetAbsFlowAngle()*180.0/PI_NUMBER; } - - file.close(); - - /*--- Writing Span wise inflow kinematic quantities. ---*/ - spanwise_performance_filename = "TURBOMACHINERY/inflow_spanwise_kinematic_values.dat"; - if (nZone > 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + if(isnan(BladePerf->GetInletState().GetFlowAngle())){ + file.width(30); file << "0.0000"; + } + else{ + file.width(30); file << BladePerf->GetInletState().GetFlowAngle()*180.0/PI_NUMBER; } - - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); - file.setf(ios::scientific); - file.precision(12); - - file << "TITLE = \"Inflow Span-wise Kinematic Values. iOuterIter = " << iExtIter << " \"" << endl; - file << "VARIABLES =" << endl; - - file.width(30); file << "\"SpanWise Value[m]\""; - file.width(15); file << "\"iSpan\""; - file.width(30); file << "\"Normal Mach[-]\""; - file.width(30); file << "\"Tangential Mach[-]\""; - if (geometry->GetnDim() == 3) { - file.width(30); file << "\"3rd Component Mach[-]\""; - }; - file.width(30); file << "\"Mach Module[-]\""; - file.width(30); file << "\"Normal Velocity[m/s]\""; - file.width(30); file << "\"Tangential Velocity[m/s]\""; - if (geometry->GetnDim() == 3) { - file.width(30); file << "\"3rd Component Velocity[m/s]\""; - }; - file.width(30); file << "\"Velocity Module[m/s]\""; - file.width(30); file << "\"Absolute Flow Angle[deg]\""; - file.width(30); file << "\"Relative Flow Angle[deg]\""; file << endl; + } - - for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ - const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); - - file.width(30); file << SpanWiseValuesIn[iSpan]; - file.width(15); file << iSpan; - for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ - file.width(30); file << BladePerf->GetInletState().GetMach()[iDim]; - } - file.width(30); file << BladePerf->GetInletState().GetMachValue(); - for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ - file.width(30); file << BladePerf->GetInletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); - } - file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); - // This captures NaNs - if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ - file.width(30); file << "0.0000"; - } - else { - file.width(30); file << BladePerf->GetInletState().GetAbsFlowAngle()*180.0/PI_NUMBER; - } - if(isnan(BladePerf->GetInletState().GetFlowAngle())){ - file.width(30); file << "0.0000"; - } - else{ - file.width(30); file << BladePerf->GetInletState().GetFlowAngle()*180.0/PI_NUMBER; - } - file << endl; + file.close(); + + /*--- Writing Span wise outflow thermodynamic quantities. ---*/ + spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_kinematic_values.dat"; + if (nZone > 1){ + unsigned short lastindex = spanwise_performance_filename.find_last_of("."); + spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); + SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); + spanwise_performance_filename.append(string(buffer)); + } + + file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); + file.setf(ios::scientific); + file.precision(12); + + file << "TITLE = \"Outflow Span-wise Kinematic Values. iOuterIter = " << iExtIter << " \"" << endl; + file << "VARIABLES =" << endl; + + file.width(30); file << "\"SpanWise Value[m]\""; + file.width(15); file << "\"iSpan\""; + file.width(30); file << "\"Normal Mach[-]\""; + file.width(30); file << "\"Tangential Mach[-]\""; + if (geometry->GetnDim() == 3) { + file.width(30); file << "\"3rd Component Mach[-]\""; + }; + file.width(30); file << "\"Mach Module[-]\""; + file.width(30); file << "\"Normal Velocity[m/s]\""; + file.width(30); file << "\"Tangential Velocity[m/s]\""; + if (geometry->GetnDim() == 3) { + file.width(30); file << "\"3rd Component Velocity[m/s]\""; + }; + file.width(30); file << "\"Velocity Module[m/s]\""; + file.width(30); file << "\"Absolute Flow Angle[deg]\""; + file.width(30); file << "\"Relative Flow Angle[deg]\""; + file << endl; + + + for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ + const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); + + file.width(30); file << SpanWiseValuesOut[iSpan]; + file.width(15); file << iSpan; + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ + file.width(30); file << BladePerf->GetOutletState().GetMach()[iDim]; } - - file.close(); - - /*--- Writing Span wise outflow thermodynamic quantities. ---*/ - spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_kinematic_values.dat"; - if (nZone > 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + file.width(30); file << BladePerf->GetInletState().GetMachValue(); + for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ + file.width(30); file << BladePerf->GetOutletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); } - - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); - file.setf(ios::scientific); - file.precision(12); - - file << "TITLE = \"Outflow Span-wise Kinematic Values. iOuterIter = " << iExtIter << " \"" << endl; - file << "VARIABLES =" << endl; - - file.width(30); file << "\"SpanWise Value[m]\""; - file.width(15); file << "\"iSpan\""; - file.width(30); file << "\"Normal Mach[-]\""; - file.width(30); file << "\"Tangential Mach[-]\""; - if (geometry->GetnDim() == 3) { - file.width(30); file << "\"3rd Component Mach[-]\""; - }; - file.width(30); file << "\"Mach Module[-]\""; - file.width(30); file << "\"Normal Velocity[m/s]\""; - file.width(30); file << "\"Tangential Velocity[m/s]\""; - if (geometry->GetnDim() == 3) { - file.width(30); file << "\"3rd Component Velocity[m/s]\""; - }; - file.width(30); file << "\"Velocity Module[m/s]\""; - file.width(30); file << "\"Absolute Flow Angle[deg]\""; - file.width(30); file << "\"Relative Flow Angle[deg]\""; - file << endl; - - - for(iSpan = 0; iSpan < config[val_iZone]->GetnSpanWiseSections(); iSpan++){ - const auto& BladePerf = BladePerformance.at(val_iZone).at(iSpan); - - file.width(30); file << SpanWiseValuesOut[iSpan]; - file.width(15); file << iSpan; - for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ - file.width(30); file << BladePerf->GetOutletState().GetMach()[iDim]; - } - file.width(30); file << BladePerf->GetInletState().GetMachValue(); - for (iDim = 0; iDim < geometry->GetnDim(); iDim++){ - file.width(30); file << BladePerf->GetOutletState().GetVelocity()[iDim]*config[ZONE_0]->GetVelocity_Ref(); - } - file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); - if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ - file.width(30); file << "0.0000"; - } - else { - file.width(30); file << BladePerf->GetOutletState().GetAbsFlowAngle()*180.0/PI_NUMBER; - } - if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ - file.width(30); file << "0.0000"; - } - else{ - file.width(30); file << BladePerf->GetOutletState().GetFlowAngle()*180.0/PI_NUMBER; - } - file << endl; + file.width(30); file << BladePerf->GetInletState().GetVelocityValue()*config[ZONE_0]->GetVelocity_Ref(); + if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ + file.width(30); file << "0.0000"; } + else { + file.width(30); file << BladePerf->GetOutletState().GetAbsFlowAngle()*180.0/PI_NUMBER; + } + if(isnan(BladePerf->GetInletState().GetAbsFlowAngle())){ + file.width(30); file << "0.0000"; + } + else{ + file.width(30); file << BladePerf->GetOutletState().GetFlowAngle()*180.0/PI_NUMBER; + } + file << endl; + } - file.close(); + file.close(); } } -} \ No newline at end of file diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 29f2cc96a38..5b2695bcfd2 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -1346,7 +1346,7 @@ void COutput::CheckHistoryOutput(unsigned short nZone) { /*--- Checks if TURBO_PERF is enabled in config and sets the final zone calculations to be output ---*/ for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - if (requestedHistoryFields[iReqField] == "TURBO_PERF"){ + if (requestedHistoryFields[iReqField] == "TURBO_PERF" && nZone > 1){ std::stringstream reqField; std::string strZones = std::to_string(nZone-1); reqField << "TURBO_PERF[" << strZones << "]"; From 36c730f042cefea53cd061875ccbe4d77a943b2c Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 16 Jan 2024 18:27:11 +0000 Subject: [PATCH 38/47] typo --- SU2_CFD/src/output/CFlowCompOutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index ec1b4a5f8c5..09f37f9c574 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -638,7 +638,7 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetSpanWiseValue(INFLOW); From 463d001161d5cb9189f64690aef7d157e334d0a7 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 16 Jan 2024 18:30:47 +0000 Subject: [PATCH 39/47] better way --- SU2_CFD/src/output/CFlowCompOutput.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 09f37f9c574..f203c5a9324 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -632,15 +632,13 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetBladesPerformances(); - - - /*--- Start of write file turboperformance spanwise ---*/ if (rank != MASTER_NODE){ return; } + auto BladePerformance = TurboPerf->GetBladesPerformances(); + + /*--- Start of write file turboperformance spanwise ---*/ SpanWiseValuesIn = geometry->GetSpanWiseValue(INFLOW); SpanWiseValuesOut = geometry->GetSpanWiseValue(OUTFLOW); @@ -867,6 +865,4 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr Date: Mon, 22 Jan 2024 12:26:47 +0000 Subject: [PATCH 40/47] Added catch to prevent segfault when not including TURBO_PERF_KIND --- Common/src/CConfig.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 9922838f129..23dafdb1d6d 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1631,9 +1631,6 @@ void CConfig::SetConfig_Options() { \n OPTIONS: see \link TurboPerfKind_Map \endlink \n Default: TURBINE */ addEnumListOption("TURBO_PERF_KIND", nTurboMachineryKind, Kind_TurboPerf, TurboPerfKind_Map); /*!\brief MARKER_SHROUD \n DESCRIPTION: markers in which velocity is forced to 0.0. -========= - /*!\brief MARKER_SHROUD \n DESCRIPTION: markers in which velocity is forced to 0.0. ->>>>>>>>> Temporary merge branch 2 * \n Format: (shroud1, shroud2, ...)*/ addStringListOption("MARKER_SHROUD", nMarker_Shroud, Marker_Shroud); /*!\brief MARKER_SUPERSONIC_INLET \n DESCRIPTION: Supersonic inlet boundary marker(s) @@ -4026,6 +4023,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i SU2_MPI::Error("Giles Boundary conditions can only be used with turbomachinery markers", CURRENT_FUNCTION); } + /*--- Check if turbomachinery performance kind is specified with turbo markers ---*/ + if (GetBoolTurbomachinery() && !(nTurboMachineryKind/nZone == 1)){ + SU2_MPI::Error("Insufficient TURBO_PERF_KIND options specified with turbomachinery markers", CURRENT_FUNCTION); + } + /*--- Check for Boundary condition available for NICFD ---*/ if ((!ideal_gas) && (!noneq_gas)) { From 7eb2d36b816513e7e53e93a3c0cb4e2869f001c1 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 30 Jan 2024 16:57:50 +0000 Subject: [PATCH 41/47] bug fix and update reg tests --- SU2_CFD/src/drivers/CDriver.cpp | 1 - SU2_CFD/src/solvers/CEulerSolver.cpp | 2 +- TestCases/hybrid_regression.py | 10 +++++----- TestCases/parallel_regression.py | 10 +++++----- TestCases/serial_regression.py | 10 +++++----- .../turbomachinery/APU_turbocharger/Jones_restart.cfg | 2 +- .../turbomachinery/axial_stage_2D/Axial_stage2D.cfg | 2 +- .../transonic_stator_2D/transonic_stator_restart.cfg | 2 +- 8 files changed, 19 insertions(+), 20 deletions(-) diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index ff80905273b..0fdfb2c2a2e 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -2691,7 +2691,6 @@ void CDriver::PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, } } - //TODO: Fix mass flow for (iZone = 0; iZone < nZone-1; iZone++) { geometry[nZone-1][INST_0][MESH_0]->SetAvgTurboGeoValues(config[iZone],geometry[iZone][INST_0][MESH_0], iZone); } diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 01fd0903d04..bc8369c55f0 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -9395,7 +9395,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC auto TurboVel = (marker_flag == INFLOW) ? TurboVelocityIn[iMarkerTP - 1][iSpan] : TurboVelocityOut[iMarkerTP - 1][iSpan]; if (performance_average_process == MIXEDOUT) { - for (auto iDim = 0u; iDim < nDim; iDim++) TurboVel[iDim] = avgMixTurboVelocity[iDim]; + for (auto iDim = 0u; iDim < nDim; iDim++) TurboVel[iDim] = avgVelocity[iDim]; } else { ComputeTurboVelocity(avgVelocity, AverageTurboNormal , TurboVel, marker_flag, config->GetKind_TurboMachinery(iZone)); } diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 4ff8d5f4651..2f58282d6fc 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -561,7 +561,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.594590, -2.792279, -14.336129, -8.776066, -11.371439, -5.845633, 73273, 73273] + Jones_tc_restart.test_vals = [-6.594590, -2.792279, -14.336129, -8.776066, -11.371439, -5.845633, 73273, 73273, 0.019884, 82.491] test_list.append(Jones_tc_restart) # 2D axial stage @@ -569,8 +569,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380] + axial_stage2D.test_vals = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380, 5.7325, 64.711] + axial_stage2D.test_vals_aarch64 = [0.983739, 1.534333, -2.888521, 2.606770, -2.418339, 3.087275, 106380, 106380, 5.7325, 64.711] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -578,8 +578,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630] - transonic_stator_restart.test_vals_aarch64 = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630] + transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.0035806] + transonic_stator_restart.test_vals_aarch64 = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.0035806] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index eca22d49b8e..3b1a0d4922a 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1049,7 +1049,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.594590, -2.792281, -14.336129, -8.776067, -11.371439, -5.845633, 73273, 73273] + Jones_tc_restart.test_vals = [-6.594590, -2.792281, -14.336129, -8.776067, -11.371439, -5.845633, 73273, 73273, 0.019884, 82.491] test_list.append(Jones_tc_restart) # 2D axial stage @@ -1057,8 +1057,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [0.983754, 1.534455, -2.888523, 2.606770, -2.418403, 3.087203, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [0.983754, 1.534455, -2.888523, 2.606770, -2.418403, 3.087203, 106380, 106380] + axial_stage2D.test_vals = [0.983754, 1.534455, -2.888523, 2.606770, -2.418403, 3.087203, 106380, 106380, 5.7325, 64.711] + axial_stage2D.test_vals_aarch64 = [0.983754, 1.534455, -2.888523, 2.606770, -2.418403, 3.087203, 106380, 106380, 5.7325, 64.711] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -1066,8 +1066,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630] - transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630] + transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.866, -0.0035806] + transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.866, -0.0035806] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index ad18bc59b3d..b17ffc4a874 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -857,7 +857,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-6.594586, -2.792279, -14.336132, -8.776068, -11.371439, -5.845632, 73273, 73273] + Jones_tc_restart.test_vals = [-6.594586, -2.792279, -14.336132, -8.776068, -11.371439, -5.845632, 73273, 73273, 0.019884, 82.491] test_list.append(Jones_tc_restart) # 2D axial stage @@ -865,8 +865,8 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380] - axial_stage2D.test_vals_aarch64 = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380] + axial_stage2D.test_vals = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380, 5.7325, 64.711] + axial_stage2D.test_vals_aarch64 = [0.983751, 1.534480, -2.888520, 2.606773, -2.418421, 3.087187, 106380, 106380, 5.7325, 64.711] test_list.append(axial_stage2D) # 2D transonic stator restart @@ -874,8 +874,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630] - transonic_stator_restart.test_vals_aarch64 = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630] + transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.0035806] + transonic_stator_restart.test_vals_aarch64 = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.0035806] test_list.append(transonic_stator_restart) diff --git a/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg b/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg index c2dc86d4572..42de00358bd 100755 --- a/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg +++ b/TestCases/turbomachinery/APU_turbocharger/Jones_restart.cfg @@ -139,7 +139,7 @@ CONV_CAUCHY_EPS= 1E-6 % % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % -SCREEN_OUTPUT= OUTER_ITER, AVG_BGS_RES[0], AVG_BGS_RES[1], RMS_DENSITY[0], RMS_ENERGY[0], RMS_DENSITY[1], RMS_ENERGY[1], SURFACE_TOTAL_PRESSURE[1] +SCREEN_OUTPUT= OUTER_ITER, AVG_BGS_RES[0], AVG_BGS_RES[1], RMS_DENSITY[0], RMS_ENERGY[0], RMS_DENSITY[1], RMS_ENERGY[1], SURFACE_TOTAL_PRESSURE[1], MassFlowOut_2[1], TotalStaticEfficiency[1] MESH_FILENAME= mesh_jones_turbine.su2 MESH_FORMAT= SU2 MESH_OUT_FILENAME= meshout.su2 diff --git a/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg b/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg index bae9194f79d..75be16ada08 100755 --- a/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg +++ b/TestCases/turbomachinery/axial_stage_2D/Axial_stage2D.cfg @@ -141,7 +141,7 @@ CONV_CAUCHY_EPS= 1E-6 % % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % -SCREEN_OUTPUT= OUTER_ITER, AVG_BGS_RES[0], AVG_BGS_RES[1], RMS_DENSITY[0], RMS_ENERGY[0], RMS_DENSITY[1], RMS_ENERGY[1], SURFACE_TOTAL_PRESSURE[1] +SCREEN_OUTPUT= OUTER_ITER, AVG_BGS_RES[0], AVG_BGS_RES[1], RMS_DENSITY[0], RMS_ENERGY[0], RMS_DENSITY[1], RMS_ENERGY[1], SURFACE_TOTAL_PRESSURE[1], MassFlowOut_2[1], TotalStaticEfficiency[1] MESH_FILENAME= mesh_axial_stage_2d_turb.su2 MESH_FORMAT= SU2 MESH_OUT_FILENAME= meshout.su2 diff --git a/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg b/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg index 3c5be8144aa..7608b5cebf3 100644 --- a/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg +++ b/TestCases/turbomachinery/transonic_stator_2D/transonic_stator_restart.cfg @@ -139,7 +139,7 @@ CONV_CAUCHY_EPS= 1E-6 % % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % -SCREEN_OUTPUT= INNER_ITER, RMS_RES, SURFACE_PRESSURE_DROP +SCREEN_OUTPUT= INNER_ITER, RMS_RES, SURFACE_PRESSURE_DROP, MassFlowOut_1, TotalStaticEfficiency MESH_FILENAME= mesh_stator_turb.su2 MESH_FORMAT= SU2 MESH_OUT_FILENAME= su2mesh_per.su2 From 10f814fe1ee8d4090546ade75a0f34eccbffc619 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 30 Jan 2024 17:34:52 +0000 Subject: [PATCH 42/47] unused var --- SU2_CFD/src/solvers/CEulerSolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index bc8369c55f0..260f72f3de6 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -9246,7 +9246,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC const bool belowMachLimit = (abs(MachTest)< config->GetAverageMachLimit()); su2double avgDensity{0}, avgPressure{0}, avgKine{0}, avgOmega{0}, avgNu{0}, - avgVelocity[MAXNDIM] = {0}, avgMixTurboVelocity[MAXNDIM] = {0}; + avgVelocity[MAXNDIM] = {0} for (auto iVar = 0u; iVar Date: Tue, 30 Jan 2024 17:48:05 +0000 Subject: [PATCH 43/47] semi-colon --- SU2_CFD/src/solvers/CEulerSolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 260f72f3de6..05aec1c2843 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -9246,7 +9246,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC const bool belowMachLimit = (abs(MachTest)< config->GetAverageMachLimit()); su2double avgDensity{0}, avgPressure{0}, avgKine{0}, avgOmega{0}, avgNu{0}, - avgVelocity[MAXNDIM] = {0} + avgVelocity[MAXNDIM] = {0}; for (auto iVar = 0u; iVar Date: Wed, 31 Jan 2024 11:12:48 +0000 Subject: [PATCH 44/47] update regtest values --- TestCases/hybrid_regression.py | 4 ++-- TestCases/parallel_regression.py | 4 ++-- TestCases/serial_regression.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 2f58282d6fc..16176bd5d8a 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -578,8 +578,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.0035806] - transonic_stator_restart.test_vals_aarch64 = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.0035806] + transonic_stator_restart.test_vals = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.035738] + transonic_stator_restart.test_vals_aarch64 = [-5.007735, -3.099310, -2.751696, 1.091966, -3.542819, 2.163237, -471630, 94.866, -0.035738] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 3b1a0d4922a..3d8f362042b 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1066,8 +1066,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.866, -0.0035806] - transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.866, -0.0035806] + transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.868, -0.0035888] + transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.868, -0.0035888] test_list.append(transonic_stator_restart) ###################################### diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index b17ffc4a874..a75b17d48aa 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -874,8 +874,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.0035806] - transonic_stator_restart.test_vals_aarch64 = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.0035806] + transonic_stator_restart.test_vals = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.035806] + transonic_stator_restart.test_vals_aarch64 = [-5.008547, -3.102420, -2.752033, 1.091152, -3.543849, 2.169844, -471630, 94.866, -0.035806] test_list.append(transonic_stator_restart) From c9c84499e8eaeb0afdf9fbf2912c32b209b918e7 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Wed, 31 Jan 2024 13:08:03 +0000 Subject: [PATCH 45/47] too many zeros --- TestCases/parallel_regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 3d8f362042b..9e3c6b38df1 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1066,8 +1066,8 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.868, -0.0035888] - transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.868, -0.0035888] + transonic_stator_restart.test_vals = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.868, -0.035888] + transonic_stator_restart.test_vals_aarch64 = [-5.011834, -3.091110, -2.757795, 1.087934, -3.544707, 2.166101, -471630, 94.868, -0.035888] test_list.append(transonic_stator_restart) ###################################### From 23883743d1959c49eddf0292ef1ea503a84db066 Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Thu, 1 Feb 2024 16:33:51 +0000 Subject: [PATCH 46/47] indentation and reorganising of output function called for improved stack --- Common/src/CConfig.cpp | 14 +-- SU2_CFD/src/iteration/CFluidIteration.cpp | 1 - SU2_CFD/src/output/CFlowCompOutput.cpp | 135 ++++++++++------------ SU2_CFD/src/output/COutput.cpp | 13 ++- 4 files changed, 78 insertions(+), 85 deletions(-) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 23dafdb1d6d..86a0d31e456 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -6916,14 +6916,14 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { break; } } - else { - if (Time_Domain) { - cout << "Dynamic structural analysis."<< endl; - cout << "Time step provided by the user for the dynamic analysis(s): "<< Time_Step << "." << endl; - } else { - cout << "Static structural analysis." << endl; + else { + if (Time_Domain) { + cout << "Dynamic structural analysis."<< endl; + cout << "Time step provided by the user for the dynamic analysis(s): "<< Time_Step << "." << endl; + } else { + cout << "Static structural analysis." << endl; + } } - } if ((Kind_Solver == MAIN_SOLVER::EULER) || (Kind_Solver == MAIN_SOLVER::NAVIER_STOKES) || (Kind_Solver == MAIN_SOLVER::RANS) || (Kind_Solver == MAIN_SOLVER::INC_EULER) || (Kind_Solver == MAIN_SOLVER::INC_NAVIER_STOKES) || (Kind_Solver == MAIN_SOLVER::INC_RANS) || diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 0f2bf9b5a81..c35dcf6d742 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -227,7 +227,6 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe TurboMonitor(geometry, config, config[val_iZone]->GetInnerIter()); } - // should this be in an else statement? output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index f203c5a9324..efd8c530175 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -513,40 +513,38 @@ void CFlowCompOutput::SetTurboPerformance_Output(std::shared_ptr T curInnerIter = InnerIter; stringstream TurboInOutTable, TurboPerfTable; - if(rank == MASTER_NODE) { - auto BladePerformance = TurboPerf->GetBladesPerformances(); + auto BladePerformance = TurboPerf->GetBladesPerformances(); /*-- Table for Turbomachinery Performance Values --*/ PrintingToolbox::CTablePrinter TurboInOut(&TurboInOutTable); - TurboInOutTable<<"-- Turbomachinery inlet and outlet property Summary:"<GetnZone()-1; iZone++) { - auto nSpan = config->GetnSpan_iZones(iZone); - const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); - - TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetEntropy() << BladePerf->GetOutletState().GetEntropy(); - TurboInOut << "Total Enthalpy " << BladePerf->GetInletState().GetTotalEnthalpy() << BladePerf->GetOutletState().GetTotalEnthalpy(); - TurboInOut << "Total Pressure " << BladePerf->GetInletState().GetTotalPressure() << BladePerf->GetOutletState().GetTotalPressure(); - TurboInOut << "Pressure " << BladePerf->GetInletState().GetPressure() << BladePerf->GetOutletState().GetPressure(); - TurboInOut << "Density " << BladePerf->GetInletState().GetDensity() << BladePerf->GetOutletState().GetDensity(); - TurboInOut << "Normal Velocity " << BladePerf->GetInletState().GetVelocity()[0] << BladePerf->GetOutletState().GetVelocity()[0]; - TurboInOut << "Tangential Velocity " << BladePerf->GetInletState().GetVelocity()[1] << BladePerf->GetOutletState().GetVelocity()[1]; - TurboInOut << "Mass Flow " << BladePerf->GetInletState().GetMassFlow() << BladePerf->GetOutletState().GetMassFlow(); - TurboInOut << "Mach " << BladePerf->GetInletState().GetMachValue() << BladePerf->GetOutletState().GetMachValue(); - TurboInOut << "Abs Flow Angle " << BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; - TurboInOut.PrintFooter(); - } - cout<GetnZone()-1; iZone++) { + auto nSpan = config->GetnSpan_iZones(iZone); + const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); + + TurboInOut<<" BLADE ROW INDEX "<GetInletState().GetEntropy() << BladePerf->GetOutletState().GetEntropy(); + TurboInOut << "Total Enthalpy " << BladePerf->GetInletState().GetTotalEnthalpy() << BladePerf->GetOutletState().GetTotalEnthalpy(); + TurboInOut << "Total Pressure " << BladePerf->GetInletState().GetTotalPressure() << BladePerf->GetOutletState().GetTotalPressure(); + TurboInOut << "Pressure " << BladePerf->GetInletState().GetPressure() << BladePerf->GetOutletState().GetPressure(); + TurboInOut << "Density " << BladePerf->GetInletState().GetDensity() << BladePerf->GetOutletState().GetDensity(); + TurboInOut << "Normal Velocity " << BladePerf->GetInletState().GetVelocity()[0] << BladePerf->GetOutletState().GetVelocity()[0]; + TurboInOut << "Tangential Velocity " << BladePerf->GetInletState().GetVelocity()[1] << BladePerf->GetOutletState().GetVelocity()[1]; + TurboInOut << "Mass Flow " << BladePerf->GetInletState().GetMassFlow() << BladePerf->GetOutletState().GetMassFlow(); + TurboInOut << "Mach " << BladePerf->GetInletState().GetMachValue() << BladePerf->GetOutletState().GetMachValue(); + TurboInOut << "Abs Flow Angle " << BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER; + TurboInOut.PrintFooter(); + } + cout< TurboPerf, CConfig *config) { @@ -580,44 +578,41 @@ void CFlowCompOutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePe } void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr TurboPerf, CConfig *config) { - - if (rank == MASTER_NODE){ - auto BladePerformance = TurboPerf->GetBladesPerformances(); - for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) { - auto nSpan = config->GetnSpan_iZones(iZone); - const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); - - stringstream tag; - tag << iZone + 1; - - SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerf->GetInletState().GetEntropy()); - SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerf->GetOutletState().GetEntropy()); - SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerf->GetInletState().GetTotalEnthalpy()); - SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerf->GetOutletState().GetTotalEnthalpy()); - SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerf->GetInletState().GetTotalPressure()); - SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerf->GetOutletState().GetTotalPressure()); - SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerf->GetInletState().GetPressure()); - SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerf->GetOutletState().GetPressure()); - SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerf->GetInletState().GetDensity()); - SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerf->GetOutletState().GetDensity()); - SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerf->GetInletState().GetVelocity()[0]); - SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerf->GetOutletState().GetVelocity()[0]); - SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerf->GetInletState().GetVelocity()[1]); - SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerf->GetOutletState().GetVelocity()[1]); - SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerf->GetInletState().GetMassFlow()); - SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerf->GetOutletState().GetMassFlow()); - SetHistoryOutputValue("MachIn_" + tag.str(), BladePerf->GetInletState().GetMachValue()); - SetHistoryOutputValue("MachOut_" + tag.str(), BladePerf->GetOutletState().GetMachValue()); - SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); - SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); - } - SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); - SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); - SetHistoryOutputValue("TotalStaticEfficiency", TurboStagePerf->GetTotalStaticEfficiency()*100); - SetHistoryOutputValue("TotalTotalEfficiency", TurboStagePerf->GetTotalTotalEfficiency()*100); - SetHistoryOutputValue("PressureRatioTS", TurboStagePerf->GetTotalStaticPressureRatio()); - SetHistoryOutputValue("PressureRatioTT", TurboStagePerf->GetTotalTotalPressureRatio()); - } + auto BladePerformance = TurboPerf->GetBladesPerformances(); + for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) { + auto nSpan = config->GetnSpan_iZones(iZone); + const auto& BladePerf = BladePerformance.at(iZone).at(nSpan); + + stringstream tag; + tag << iZone + 1; + + SetHistoryOutputValue("EntropyIn_" + tag.str(), BladePerf->GetInletState().GetEntropy()); + SetHistoryOutputValue("EntropyOut_" + tag.str(), BladePerf->GetOutletState().GetEntropy()); + SetHistoryOutputValue("TotalEntahalpyIn_" + tag.str(), BladePerf->GetInletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalEnthalpyOut_" + tag.str(), BladePerf->GetOutletState().GetTotalEnthalpy()); + SetHistoryOutputValue("TotalPressureIn_" + tag.str(), BladePerf->GetInletState().GetTotalPressure()); + SetHistoryOutputValue("TotalPressureOut_" + tag.str(), BladePerf->GetOutletState().GetTotalPressure()); + SetHistoryOutputValue("PressureIn_" + tag.str(), BladePerf->GetInletState().GetPressure()); + SetHistoryOutputValue("PressureOut_" + tag.str(), BladePerf->GetOutletState().GetPressure()); + SetHistoryOutputValue("DensityIn_" + tag.str(), BladePerf->GetInletState().GetDensity()); + SetHistoryOutputValue("DensityOut_" + tag.str(), BladePerf->GetOutletState().GetDensity()); + SetHistoryOutputValue("NormalVelocityIn_" + tag.str(), BladePerf->GetInletState().GetVelocity()[0]); + SetHistoryOutputValue("NormalVelocityOut_" + tag.str(), BladePerf->GetOutletState().GetVelocity()[0]); + SetHistoryOutputValue("TangentialVelocityIn_" + tag.str(), BladePerf->GetInletState().GetVelocity()[1]); + SetHistoryOutputValue("TangentialVelocityOut_" + tag.str(), BladePerf->GetOutletState().GetVelocity()[1]); + SetHistoryOutputValue("MassFlowIn_" + tag.str(), BladePerf->GetInletState().GetMassFlow()); + SetHistoryOutputValue("MassFlowOut_" + tag.str(), BladePerf->GetOutletState().GetMassFlow()); + SetHistoryOutputValue("MachIn_" + tag.str(), BladePerf->GetInletState().GetMachValue()); + SetHistoryOutputValue("MachOut_" + tag.str(), BladePerf->GetOutletState().GetMachValue()); + SetHistoryOutputValue("AbsFlowAngleIn_" + tag.str(), BladePerf->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER); + SetHistoryOutputValue("AbsFlowAngleOut_" + tag.str(), BladePerf->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER); + } + SetHistoryOutputValue("EntropyGeneration", TurboStagePerf->GetNormEntropyGen()*100); + SetHistoryOutputValue("EulerianWork", TurboStagePerf->GetEulerianWork()); + SetHistoryOutputValue("TotalStaticEfficiency", TurboStagePerf->GetTotalStaticEfficiency()*100); + SetHistoryOutputValue("TotalTotalEfficiency", TurboStagePerf->GetTotalTotalEfficiency()*100); + SetHistoryOutputValue("PressureRatioTS", TurboStagePerf->GetTotalStaticPressureRatio()); + SetHistoryOutputValue("PressureRatioTT", TurboStagePerf->GetTotalTotalPressureRatio()); } void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr TurboPerf, CGeometry *geometry, CConfig **config, unsigned short val_iZone) { @@ -632,10 +627,6 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptrGetBladesPerformances(); /*--- Start of write file turboperformance spanwise ---*/ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 5b2695bcfd2..99f6203074a 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -235,18 +235,21 @@ void COutput::SetHistoryOutput(CGeometry ****geometry, CSolver *****solver, CCon Iter = OuterIter; /*--- Turbomachinery Performance Screen summary output---*/ - if (Iter%100 == 0) { + if (Iter%100 == 0 && rank == MASTER_NODE) { SetTurboPerformance_Output(TurboPerf, config[val_iZone], TimeIter, OuterIter, InnerIter); - if (rank == MASTER_NODE) SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config[val_iZone]); + SetTurboMultiZonePerformance_Output(TurboStagePerf, TurboPerf, config[val_iZone]); } for (int iZone = 0; iZone < config[ZONE_0]->GetnZone(); iZone ++){ - WriteTurboSpanwisePerformance(TurboPerf, geometry[iZone][val_iInst][MESH_0], config, iZone); + if (rank == MASTER_NODE) { + WriteTurboSpanwisePerformance(TurboPerf, geometry[iZone][val_iInst][MESH_0], config, iZone); + } } /*--- Update turboperformance history file*/ - LoadTurboHistoryData(TurboStagePerf, TurboPerf, config[val_iZone]); - + if (rank == MASTER_NODE){ + LoadTurboHistoryData(TurboStagePerf, TurboPerf, config[val_iZone]); + } SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], TimeIter, OuterIter,InnerIter); } From 9629bb2fdd2fe11bb2e84c51106236079c54041f Mon Sep 17 00:00:00 2001 From: Josh Kelly Date: Tue, 6 Feb 2024 16:25:03 +0000 Subject: [PATCH 47/47] changes to address comments --- Common/include/option_structure.hpp | 12 ++-- Common/src/geometry/CPhysicalGeometry.cpp | 82 +++++++++++------------ SU2_CFD/include/iteration/CIteration.hpp | 1 - SU2_CFD/include/output/CTurboOutput.hpp | 8 +-- SU2_CFD/src/drivers/CMultizoneDriver.cpp | 5 +- SU2_CFD/src/iteration/CFluidIteration.cpp | 2 - SU2_CFD/src/output/CFlowCompOutput.cpp | 48 +++++-------- TestCases/parallel_regression.py | 2 +- TestCases/serial_regression.py | 2 +- 9 files changed, 72 insertions(+), 90 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index f537ca33637..a2b5f551525 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -1780,12 +1780,12 @@ static const MapType SpanWise_Map = { /*! * \brief Types of mixing process for averaging quantities at the boundaries. */ -enum TURBOMACHINERY_TYPE { - AXIAL = 1, /*!< \brief axial turbomachinery. */ - CENTRIFUGAL = 2, /*!< \brief centrifugal turbomachinery. */ - CENTRIPETAL = 3, /*!< \brief centripetal turbomachinery. */ - CENTRIPETAL_AXIAL = 4, /*!< \brief mixed flow turbine. */ - AXIAL_CENTRIFUGAL = 5 /*!< \brief mixed flow turbine. */ +enum class TURBOMACHINERY_TYPE { + AXIAL, /*!< \brief axial turbomachinery. */ + CENTRIFUGAL, /*!< \brief centrifugal turbomachinery. */ + CENTRIPETAL, /*!< \brief centripetal turbomachinery. */ + CENTRIPETAL_AXIAL, /*!< \brief mixed flow turbine. */ + AXIAL_CENTRIFUGAL /*!< \brief mixed flow turbine. */ }; static const MapType TurboMachinery_Map = { MakePair("AXIAL", TURBOMACHINERY_TYPE::AXIAL) diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 217a05083bc..8be327af7a7 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -4830,23 +4830,23 @@ void CPhysicalGeometry::ComputeNSpan(CConfig* config, unsigned short val_iZone, coord = nodes->GetCoord(iPoint); radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: valueSpan[nSpan_loc] = coord[2]; break; - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: valueSpan[nSpan_loc] = coord[2]; break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: valueSpan[nSpan_loc] = radius; break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: if (marker_flag == OUTFLOW) { valueSpan[nSpan_loc] = radius; } else { valueSpan[nSpan_loc] = coord[2]; } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: if (marker_flag == INFLOW) { valueSpan[nSpan_loc] = radius; } else { @@ -4922,16 +4922,16 @@ void CPhysicalGeometry::ComputeNSpan(CConfig* config, unsigned short val_iZone, coord = nodes->GetCoord(iPoint); radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: if (coord[2] < min) min = coord[2]; if (coord[2] > max) max = coord[2]; break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: if (radius < min) min = radius; if (radius > max) max = radius; break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: if (marker_flag == OUTFLOW) { if (radius < min) min = radius; if (radius > max) max = radius; @@ -4940,7 +4940,7 @@ void CPhysicalGeometry::ComputeNSpan(CConfig* config, unsigned short val_iZone, if (coord[2] > max) max = coord[2]; } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: if (marker_flag == INFLOW) { if (radius < min) min = radius; if (radius > max) max = radius; @@ -5094,8 +5094,8 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone coord = nodes->GetCoord(iPoint); switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { if (dist > (abs(coord[2] - SpanWiseValue[marker_flag - 1][iSpan]))) { dist = abs(coord[2] - SpanWiseValue[marker_flag - 1][iSpan]); @@ -5103,7 +5103,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } } break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { if (dist > (abs(radius - SpanWiseValue[marker_flag - 1][iSpan]))) { @@ -5112,7 +5112,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } } break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: if (marker_flag == OUTFLOW) { radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { @@ -5131,7 +5131,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: if (marker_flag == INFLOW) { radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { @@ -5194,8 +5194,8 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone coord = nodes->GetCoord(iPoint); switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { if (dist > (abs(coord[2] - SpanWiseValue[marker_flag - 1][iSpan]))) { dist = abs(coord[2] - SpanWiseValue[marker_flag - 1][iSpan]); @@ -5203,7 +5203,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } } break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { if (dist > (abs(radius - SpanWiseValue[marker_flag - 1][iSpan]))) { @@ -5212,7 +5212,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } } break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: if (marker_flag == OUTFLOW) { radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { @@ -5231,7 +5231,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: if (marker_flag == INFLOW) { radius = sqrt(coord[0] * coord[0] + coord[1] * coord[1]); for (iSpan = 0; iSpan < nSpanWiseSections[marker_flag - 1]; iSpan++) { @@ -5285,7 +5285,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone /*--- find nodes at minimum pitch among all nodes---*/ if (coord[1] < min) { min = coord[1]; - if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL) { + if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == TURBOMACHINERY_TYPE::AXIAL) { MinAngularCoord[iMarker][iSpan] = coord[1]; } else { MinAngularCoord[iMarker][iSpan] = atan(coord[1] / coord[0]); @@ -5298,7 +5298,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone if (coord[1] < minInt) { if (nodes->GetDomain(iPoint)) { minInt = coord[1]; - if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL) { + if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == TURBOMACHINERY_TYPE::AXIAL) { minIntAngPitch[iSpan] = coord[1]; } else { minIntAngPitch[iSpan] = atan(coord[1] / coord[0]); @@ -5310,7 +5310,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone if (coord[1] > max) { if (nodes->GetDomain(iPoint)) { max = coord[1]; - if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL) { + if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == TURBOMACHINERY_TYPE::AXIAL) { MaxAngularCoord[iMarker][iSpan] = coord[1]; } else { MaxAngularCoord[iMarker][iSpan] = atan(coord[1] / coord[0]); @@ -5329,7 +5329,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone checkAssign[iSpan][kSpanVertex] = true; coord = nodes->GetCoord(ordered[iSpan][iSpanVertex]); target = coord[1]; - if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL) { + if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == TURBOMACHINERY_TYPE::AXIAL) { angPitch[iSpan][iSpanVertex] = coord[1]; } else { angPitch[iSpan][iSpanVertex] = atan(coord[1] / coord[0]); @@ -5350,7 +5350,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone turbovertex[iMarker][iSpan][iInternalVertex]->SetAngularCoord(angPitch[iSpan][iSpanVertex]); turbovertex[iMarker][iSpan][iInternalVertex]->SetDeltaAngularCoord(deltaAngPitch[iSpan][iSpanVertex]); switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == INFLOW) { @@ -5363,7 +5363,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone TurboNormal[2] = 0.0; } break; - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == OUTFLOW) { @@ -5376,7 +5376,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone TurboNormal[2] = 0.0; } break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (nDim == 3) { @@ -5402,7 +5402,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == INFLOW) { @@ -5416,7 +5416,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == INFLOW) { @@ -5720,7 +5720,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone myfile << z_loc[iSpan][iSpanVertex]; myfile.width(20); myfile << radius; - if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone)) { + if (nDim == 2) { myfile.width(20); myfile << angCoord_loc[iSpan][iSpanVertex]; myfile.width(20); @@ -5788,7 +5788,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig* config, unsigned short val_iZ coord = nodes->GetCoord(iPoint); /*--- compute appropriate turbo normal ---*/ switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == INFLOW) { @@ -5801,7 +5801,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig* config, unsigned short val_iZ TurboNormal[2] = 0.0; } break; - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == OUTFLOW) { @@ -5814,7 +5814,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig* config, unsigned short val_iZ TurboNormal[2] = 0.0; } break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (nDim == 3) { @@ -5840,7 +5840,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig* config, unsigned short val_iZ } break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == INFLOW) { @@ -5854,7 +5854,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig* config, unsigned short val_iZ } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: Normal2 = 0.0; for (iDim = 0; iDim < 2; iDim++) Normal2 += coord[iDim] * coord[iDim]; if (marker_flag == INFLOW) { @@ -6030,8 +6030,8 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig* config, unsigned short val_iZo AverageGridVel[iMarker][iSpan][iDim] = TotalGridVel[iDim] / nTotVertexSpan[iMarker][iSpan]; } switch (config->GetKind_TurboMachinery(val_iZone)) { - case CENTRIFUGAL: - case CENTRIPETAL: + case TURBOMACHINERY_TYPE::CENTRIFUGAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL: if (marker_flag == INFLOW) { AverageTangGridVel[iMarker][iSpan] = -(AverageTurboNormal[iMarker][iSpan][0] * AverageGridVel[iMarker][iSpan][1] - @@ -6042,7 +6042,7 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig* config, unsigned short val_iZo AverageTurboNormal[iMarker][iSpan][1] * AverageGridVel[iMarker][iSpan][0]; } break; - case AXIAL: + case TURBOMACHINERY_TYPE::AXIAL: if (marker_flag == INFLOW && nDim == 2) { AverageTangGridVel[iMarker][iSpan] = -AverageTurboNormal[iMarker][iSpan][0] * AverageGridVel[iMarker][iSpan][1] + @@ -6053,7 +6053,7 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig* config, unsigned short val_iZo AverageTurboNormal[iMarker][iSpan][1] * AverageGridVel[iMarker][iSpan][0]; } break; - case CENTRIPETAL_AXIAL: + case TURBOMACHINERY_TYPE::CENTRIPETAL_AXIAL: if (marker_flag == OUTFLOW) { AverageTangGridVel[iMarker][iSpan] = (AverageTurboNormal[iMarker][iSpan][0] * AverageGridVel[iMarker][iSpan][1] - @@ -6064,7 +6064,7 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig* config, unsigned short val_iZo AverageTurboNormal[iMarker][iSpan][1] * AverageGridVel[iMarker][iSpan][0]); } break; - case AXIAL_CENTRIFUGAL: + case TURBOMACHINERY_TYPE::AXIAL_CENTRIFUGAL: if (marker_flag == INFLOW) { AverageTangGridVel[iMarker][iSpan] = AverageTurboNormal[iMarker][iSpan][0] * AverageGridVel[iMarker][iSpan][1] - @@ -6289,7 +6289,7 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig* config, bool allocate) if (iSpan == nSpanWiseSections) { config->SetFreeStreamTurboNormal(turboNormal); - if (config->GetKind_TurboMachinery(config->GetiZone()) == AXIAL && nDim == 2) { + if (config->GetKind_TurboMachinery(config->GetiZone()) == TURBOMACHINERY_TYPE::AXIAL && nDim == 2) { nBlades = 1 / Pitch; } else { nBlades = 2 * PI_NUMBER / Pitch; diff --git a/SU2_CFD/include/iteration/CIteration.hpp b/SU2_CFD/include/iteration/CIteration.hpp index ac2581f12c9..483712a8a16 100644 --- a/SU2_CFD/include/iteration/CIteration.hpp +++ b/SU2_CFD/include/iteration/CIteration.hpp @@ -251,7 +251,6 @@ class CIteration { unsigned short val_iInst) { return false; } - /*! * \brief A virtual member. * \param[in] output - Pointer to the COutput class. diff --git a/SU2_CFD/include/output/CTurboOutput.hpp b/SU2_CFD/include/output/CTurboOutput.hpp index 9dc1a88b265..2d0e08c0489 100644 --- a/SU2_CFD/include/output/CTurboOutput.hpp +++ b/SU2_CFD/include/output/CTurboOutput.hpp @@ -136,7 +136,7 @@ class CTurbomachineryState { su2double GetRelMachValue() const { return Norm(RelMach); } - su2double Norm(vector const& u) const { + su2double Norm(const vector& u) const { su2double accum = 0.; for (auto i = 0u; i < u.size(); ++i) { accum += u[i] * u[i]; @@ -227,7 +227,7 @@ class CTurbomachineryStagePerformance { su2double GetEulerianWork() const { return EulerianWork; } - const su2double& GetNormEntropyGen() const { return NormEntropyGen; } + su2double GetNormEntropyGen() const { return NormEntropyGen; } su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; } @@ -250,9 +250,7 @@ class CTurboOutput { public: CTurboOutput(CConfig** config, const CGeometry& geometry, CFluidModel& fluidModel); - vector>> - - const GetBladesPerformances() const { return BladesPerformances; } + const vector>>& GetBladesPerformances() const { return BladesPerformances; } void ComputeTurbomachineryPerformance(vector> const primitives); }; \ No newline at end of file diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index 36dbdbb4660..0cf6d838a65 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -181,7 +181,6 @@ void CMultizoneDriver::StartSolver() { Preprocess(TimeIter); /*--- Run a block iteration of the multizone problem. ---*/ - Run(); /*--- Update the solution for dual time stepping strategy ---*/ @@ -288,10 +287,10 @@ void CMultizoneDriver::RunGaussSeidel() { } /*--- Loop over the number of outer iterations ---*/ - for (auto iOuter_Iter = 0ul; iOuter_Iter < driver_config->GetnOuter_Iter(); iOuter_Iter++){ + for (auto iOuter_Iter = 0ul; iOuter_Iter < driver_config->GetnOuter_Iter(); iOuter_Iter++) { /*--- Loop over the number of zones (IZONE) ---*/ - for (iZone = 0; iZone < nZone; iZone++){ + for (iZone = 0; iZone < nZone; iZone++) { /*--- In principle, the mesh does not need to be updated ---*/ UpdateMesh = 0; diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index c35dcf6d742..1d29f185ad8 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -28,7 +28,6 @@ #include "../../include/iteration/CFluidIteration.hpp" #include "../../include/output/COutput.hpp" - void CFluidIteration::Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver, CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, CVolumetricMovement*** grid_movement, @@ -231,7 +230,6 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); - /*--- If convergence was reached --*/ StopCalc = output->GetConvergence(); /* --- Checking convergence of Fixed CL mode to target CL, and perform finite differencing if needed --*/ diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index efd8c530175..c44ee947ead 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -95,7 +95,6 @@ CFlowCompOutput::CFlowCompOutput(const CConfig *config, unsigned short nDim) : C cauchySerie.resize(convFields.size(), vector(nCauchy_Elems, 0.0)); } } - } void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ @@ -480,7 +479,6 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol SetCustomOutputs(solver, geometry, config); SetCustomAndComboObjectives(FLOW_SOL, config, solver); - } bool CFlowCompOutput::SetInitResiduals(const CConfig *config){ @@ -635,15 +633,11 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + if (nZone > 1) { + spanwise_performance_filename.append("_" + std::to_string(val_iZone) + ".dat"); + } else { + spanwise_performance_filename.append(".dat"); } - - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); file.setf(ios::scientific); file.precision(12); @@ -682,13 +676,11 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + if (nZone > 1) { + spanwise_performance_filename.append("_" + std::to_string(val_iZone) + ".dat"); + } else { + spanwise_performance_filename.append(".dat"); } - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); file.setf(ios::scientific); file.precision(12); @@ -728,13 +720,11 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); + if (nZone > 1) { + spanwise_performance_filename.append("_" + std::to_string(val_iZone) + ".dat"); + } else { + spanwise_performance_filename.append(".dat"); } - file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); file.setf(ios::scientific); file.precision(12); @@ -793,14 +783,12 @@ void CFlowCompOutput::WriteTurboSpanwisePerformance(std::shared_ptr 1){ - unsigned short lastindex = spanwise_performance_filename.find_last_of("."); - spanwise_performance_filename = spanwise_performance_filename.substr(0, lastindex); - SPRINTF (buffer, "_%d.dat", SU2_TYPE::Int(val_iZone)); - spanwise_performance_filename.append(string(buffer)); - } - + spanwise_performance_filename = "TURBOMACHINERY/outflow_spanwise_kinematic_values"; + if (nZone > 1) { + spanwise_performance_filename.append("_" + std::to_string(val_iZone) + ".dat"); + } else { + spanwise_performance_filename.append(".dat"); + } file.open (spanwise_performance_filename.data(), ios::out | ios::trunc); file.setf(ios::scientific); file.precision(12); diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 9e3c6b38df1..946cc6b52b3 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1044,7 +1044,7 @@ def main(): ### Turbomachinery ### ###################################### - # Jones APU Turbocharger restart + # Jones APU Turbocharger restart Jones_tc_restart = TestCase('jones_turbocharger_restart') Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index a75b17d48aa..8b00b3c8f5b 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -852,7 +852,7 @@ def main(): ### Turbomachinery ### ###################################### - # Jones APU Turbocharger restart + # Jones APU Turbocharger restart Jones_tc_restart = TestCase('jones_turbocharger_restart') Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg"