Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Multizone discrete adjoints for turbomachinery #2317

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3801e4d
Throw error message in case the multizone discrete adjoint solver wil…
oleburghardt Aug 14, 2024
0e5f95b
Softcode indentifier/index.
oleburghardt Aug 15, 2024
dc38cc3
Add tag type option to build system.
oleburghardt Aug 15, 2024
19a1a70
Add option to use RealReverseTag as AD type.
oleburghardt Aug 25, 2024
36c922e
Temporarily adjust/hardcode type size for memory alignment in vectori…
oleburghardt Aug 25, 2024
84e97f4
added turbo obj funcs
joshkellyjak Aug 29, 2024
e68f844
Merge branch 'develop' into feature_mz_adjoint_for_turbo
joshkellyjak Aug 29, 2024
bb0831d
thems the breaks
joshkellyjak Aug 29, 2024
4327942
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Aug 29, 2024
ae68274
Merge branch 'develop' into feature_mz_adjoint_for_turbo
joshkellyjak Aug 30, 2024
905f1e6
Resource releasing
joshkellyjak Aug 30, 2024
da21602
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Aug 30, 2024
9f1b07c
Merge remote-tracking branch 'upstream/feature_tag_debug_tape' into f…
joshkellyjak Sep 2, 2024
54515e9
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Sep 3, 2024
c002911
Revert "Merge remote-tracking branch 'upstream/feature_tag_debug_tape…
joshkellyjak Sep 3, 2024
5a9773c
formatting
joshkellyjak Sep 4, 2024
6e65dd1
Add config option and indicator for a debug discrete adjoint run.
oleburghardt Sep 24, 2024
82f69e9
Add routines for setting tags to AD structure.
oleburghardt Sep 24, 2024
9de8e93
Add kinds of recording for tag tapes.
oleburghardt Sep 24, 2024
57fbcea
Comment out checks in AD structure whether an identifier is active. T…
oleburghardt Sep 24, 2024
3da17d8
Add first WIP version of the tag debug mode to the (multizone) discre…
oleburghardt Sep 24, 2024
b0e7c86
Fix preaccumulation error in ComputeVorticityAndStrainMag (first debu…
oleburghardt Sep 24, 2024
688797a
Merge branch 'develop' into feature_tag_debug_tape
joshkellyjak Sep 24, 2024
8556c2a
Revert small change (will be added to CoDi soon).
oleburghardt Sep 24, 2024
683de77
Resolves tag errors in turbo mode
joshkellyjak Sep 26, 2024
13ca3f5
Revert "Resolves tag errors in turbo mode"
joshkellyjak Sep 26, 2024
89c95ba
Merge remote-tracking branch 'origin/feature_tag_debug_tape' into fea…
joshkellyjak Sep 26, 2024
e1a04fa
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Sep 26, 2024
887e9e6
Resolving tag errors
joshkellyjak Sep 26, 2024
08b7979
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Sep 26, 2024
e40f943
Revert "Merge remote-tracking branch 'origin/feature_tag_debug_tape' …
joshkellyjak Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ jobs:
# flags: '--buildtype=debug -Denable-directdiff=true -Denable-normal=false -Dwith-omp=true -Denable-mixedprec=true -Denable-pywrapper=true -Denable-tecio=false --warnlevel=3 --werror'
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
steps:
- name: Reduce ASLR entropy for tsan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Cache Object Files
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -130,8 +128,6 @@ jobs:
flags: '--buildtype=debugoptimized -Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled --warnlevel=3 --werror'
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
steps:
- name: Reduce ASLR entropy for asan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Cache Object Files
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -229,8 +225,6 @@ jobs:
matrix:
testscript: ['hybrid_regression.py', 'hybrid_regression_AD.py']
steps:
- name: Reduce ASLR entropy for tsan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
with:
Expand Down Expand Up @@ -276,8 +270,6 @@ jobs:
matrix:
testscript: ['serial_regression.py', 'serial_regression_AD.py']
steps:
- name: Reduce ASLR entropy for asan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
with:
Expand Down
47 changes: 46 additions & 1 deletion Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ class CConfig {
TURBO_PERF_KIND *Kind_TurboPerf; /*!< \brief Kind of turbomachynery architecture.*/
TURBOMACHINERY_TYPE *Kind_TurboMachinery;

/* Turbomachinery objective functions */
su2double *EntropyGeneration;
su2double *TotalPressureLoss;
su2double *KineticEnergyLoss;

/* 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. */
Expand Down Expand Up @@ -7930,7 +7935,28 @@ class CConfig {
void SetSurface_Species_Variance(unsigned short val_marker, su2double val_surface_species_variance) { Surface_Species_Variance[val_marker] = val_surface_species_variance; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \brief Set entropy generation for a turbomachinery zone
* \param[in] val_iZone - zone index
* \param[in] val_entropy_generation - value of entropy generation
*/
void SetEntropyGeneration(unsigned short val_iZone, su2double val_entropy_generation) { EntropyGeneration[val_iZone] = val_entropy_generation; }

/*!
* \brief Get total pressure loss for a turbomachinery zone
* \param[in] val_iZone - zone index
* \param[in] val_total_pressure_loss - value of total pressure loss
*/
void SetTotalPressureLoss(unsigned short val_iZone, su2double val_total_pressure_loss) { TotalPressureLoss[val_iZone] = val_total_pressure_loss; }

/*!
* \brief Get kinetic energy loss for a turbomachinery zone
* \param[in] val_iZone - zone index
* \param[in] val_kinetic_energy_loss - value of kinetic energy loss
*/
void SetKineticEnergyLoss(unsigned short val_iZone, su2double val_kinetic_energy_loss) { KineticEnergyLoss[val_iZone] = val_kinetic_energy_loss; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.ß
* \param[in] val_index - Index corresponding to the outlet boundary.
* \return The outlet pressure.
*/
Expand Down Expand Up @@ -8209,6 +8235,25 @@ class CConfig {
*/
su2double GetSurface_Species_Variance(unsigned short val_marker) const { return Surface_Species_Variance[val_marker]; }

/*!
* \brief Get entropy generation for a turbomachine at a boundary
* \param[in] val_iZone - zone index
*/
su2double GetEntropyGeneration(unsigned short val_iZone) const { return EntropyGeneration[val_iZone]; }

/*!
* \brief Get total pressure loss for a turbomachinery zone
* \param[in] val_iZone - zone index
*/
su2double GetTotalPressureLoss(unsigned short val_iZone) const { return TotalPressureLoss[val_iZone]; }

/*!
* \brief Get kinetic energy loss for a turbomachinery zone
* \param[in] val_iZone - zone index
*/
su2double GetKineticEnergyLoss(unsigned short val_iZone) const { return KineticEnergyLoss[val_iZone]; }


/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \param[in] val_index - Index corresponding to the outlet boundary.
Expand Down
6 changes: 6 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,9 @@ enum ENUM_OBJECTIVE {
TOPOL_DISCRETENESS = 63, /*!< \brief Measure of the discreteness of the current topology. */
TOPOL_COMPLIANCE = 64, /*!< \brief Measure of the discreteness of the current topology. */
STRESS_PENALTY = 65, /*!< \brief Penalty function of VM stresses above a maximum value. */
ENTROPY_GENERATION = 80, /*!< \brief Entropy generation turbomachinery objective function. */
TOTAL_PRESSURE_LOSS = 81, /*!< \brief Total pressure loss turbomachinery objective function. */
KINETIC_ENERGY_LOSS = 82 /*!< \breif Kinetic energy loss coefficient turbomachinery objective function. */
};
static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("DRAG", DRAG_COEFFICIENT)
Expand Down Expand Up @@ -2035,6 +2038,9 @@ static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("TOPOL_DISCRETENESS", TOPOL_DISCRETENESS)
MakePair("TOPOL_COMPLIANCE", TOPOL_COMPLIANCE)
MakePair("STRESS_PENALTY", STRESS_PENALTY)
MakePair("ENTROPY_GENERATION", ENTROPY_GENERATION)
MakePair("TOTAL_PRESSURE_LOSS", TOTAL_PRESSURE_LOSS)
MakePair("KINETIC_ENERGY_LOSS", KINETIC_ENERGY_LOSS)
};

/*!
Expand Down
31 changes: 30 additions & 1 deletion Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,11 @@
nBlades = nullptr;
FreeStreamTurboNormal = nullptr;

/*--- Turbomachinery Objective Functions ---*/
EntropyGeneration = nullptr;
TotalPressureLoss = nullptr;
KineticEnergyLoss = nullptr;

top_optim_kernels = nullptr;
top_optim_kernel_params = nullptr;
top_optim_filter_radius = nullptr;
Expand Down Expand Up @@ -3391,8 +3396,17 @@

/*--- Using default frequency of 250 for all files when steady, and 1 for unsteady. ---*/
for (auto iVolumeFreq = 0; iVolumeFreq < nVolumeOutputFrequencies; iVolumeFreq++){
VolumeOutputFrequencies[iVolumeFreq] = Time_Domain ? 1 : 250;
if (Multizone_Problem && DiscreteAdjoint) {
VolumeOutputFrequencies[iVolumeFreq] = nOuterIter;
}
else {
VolumeOutputFrequencies[iVolumeFreq] = Time_Domain ? 1 : 250;
}
}
} else if (Multizone_Problem && DiscreteAdjoint) {
SU2_MPI::Error(string("OUTPUT_WRT_FREQ cannot be specified for this solver "
"(writing of restart and sensitivity files not possible for multizone discrete adjoint during runtime yet).\n"
"Please remove this option from the config file, output files will be written when solver finalizes.\n"), CURRENT_FUNCTION);
} else if (nVolumeOutputFrequencies < nVolumeOutputFiles) {
/*--- If there are fewer frequencies than files, repeat the last frequency.
* This is useful to define 1 frequency for the restart file and 1 frequency for all the visualization files. ---*/
Expand Down Expand Up @@ -3920,6 +3934,13 @@
SU2_MPI::Error("The use of FLUID_MIXTURE requires the INC_DENSITY_MODEL option to be VARIABLE",
CURRENT_FUNCTION);
}
/*--- Check whether the Kind scalar model used is correct, in the case of FLUID_MIXTURE the kind scalar model must
be SPECIES_TRANSPORT. Otherwise, if the scalar model is NONE, the species transport equations will not be solved.
--- */
if (Kind_Species_Model != SPECIES_MODEL::SPECIES_TRANSPORT) {
SU2_MPI::Error("The use of FLUID_MIXTURE requires the KIND_SCALAR_MODEL option to be SPECIES_TRANSPORT",
CURRENT_FUNCTION);
}

switch (Kind_ViscosityModel) {
case VISCOSITYMODEL::CONSTANT:
Expand Down Expand Up @@ -5984,6 +6005,11 @@
Marker_CfgFile_ZoneInterface[iMarker_CfgFile] = YES;
}

/*--- Allocate memory for turbomachinery objective functions ---*/
EntropyGeneration = new su2double[nZone] ();
Fixed Show fixed Hide fixed
TotalPressureLoss = new su2double[nZone] ();
Fixed Show fixed Hide fixed
KineticEnergyLoss = new su2double[nZone] ();
Fixed Show fixed Hide fixed

/*--- Identification of Turbomachinery markers and flag them---*/

for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) {
Expand Down Expand Up @@ -8417,6 +8443,9 @@
case TOPOL_DISCRETENESS: AdjExt = "_topdisc"; break;
case TOPOL_COMPLIANCE: AdjExt = "_topcomp"; break;
case STRESS_PENALTY: AdjExt = "_stress"; break;
case ENTROPY_GENERATION: AdjExt = "_entg"; break;
case TOTAL_PRESSURE_LOSS: AdjExt = "_tot_press_loss"; break;
case KINETIC_ENERGY_LOSS: AdjExt = "_kin_en_loss"; break;
}
}
else{
Expand Down
10 changes: 8 additions & 2 deletions SU2_CFD/include/output/CTurboOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CTurbomachineryCombinedPrimitiveStates {
class CTurbomachineryState {
private:
su2double Density, Pressure, Entropy, Enthalpy, Temperature, TotalTemperature, TotalPressure, TotalEnthalpy;
su2double AbsFlowAngle, FlowAngle, MassFlow, Rothalpy, TotalRelPressure;
su2double AbsFlowAngle, FlowAngle, MassFlow, Rothalpy, TangVelocity, TotalRelPressure;
vector<su2double> Velocity, RelVelocity, Mach, RelMach;
su2double Area, Radius;

Expand Down Expand Up @@ -124,6 +124,8 @@ class CTurbomachineryState {

const su2double& GetRothalpy() const { return Rothalpy; }

const su2double& GetTangVelocity() const { return TangVelocity; }

const vector<su2double>& GetVelocity() const { return Velocity; }

const vector<su2double>& GetMach() const { return Mach; }
Expand Down Expand Up @@ -207,7 +209,7 @@ class CPropellorBladePerformance : public CTurbomachineryBladePerformance {
*/
class CTurbomachineryStagePerformance {
protected:
su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, TotalTotalPressureRatio, EulerianWork;
su2double TotalStaticEfficiency, TotalTotalEfficiency, NormEntropyGen, TotalStaticPressureRatio, TotalTotalPressureRatio, EulerianWork, TotalPressureLoss, KineticEnergyLoss;
CFluidModel& fluidModel;

public:
Expand All @@ -232,6 +234,10 @@ class CTurbomachineryStagePerformance {
su2double GetTotalStaticPressureRatio() const { return TotalStaticPressureRatio; }

su2double GetTotalTotalPressureRatio() const { return TotalTotalPressureRatio; }

su2double GetTotalPressureLoss() const { return TotalPressureLoss; }

su2double GetKineticEnergyLoss() const { return KineticEnergyLoss; }
};

/*!
Expand Down
6 changes: 6 additions & 0 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,12 @@ su2double CFVMFlowSolverBase<V,R>::EvaluateCommonObjFunc(const CConfig& config)
case SURFACE_SPECIES_VARIANCE:
objFun += weight * config.GetSurface_Species_Variance(0);
break;
case ENTROPY_GENERATION:
objFun += weight * config.GetEntropyGeneration(config.GetnMarker_Turbomachinery());
case TOTAL_PRESSURE_LOSS:
objFun += weight * config.GetTotalPressureLoss(config.GetnMarker_Turbomachinery());
case KINETIC_ENERGY_LOSS:
objFun += weight * config.GetKineticEnergyLoss(config.GetnMarker_Turbomachinery());
case CUSTOM_OBJFUNC:
objFun += weight * Total_Custom_ObjFunc;
break;
Expand Down
20 changes: 17 additions & 3 deletions SU2_CFD/src/iteration/CFluidIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,15 @@ void CFluidIteration::TurboMonitor(CGeometry**** geometry_container, CConfig** c
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<su2double> TurboPrimitiveIn, TurboPrimitiveOut;
std::vector<std::vector<CTurbomachineryCombinedPrimitiveStates>> bladesPrimitives;

if (rank == MASTER_NODE) {
for (iBlade = 0; iBlade < nBladesRow; iBlade++){
for (auto iBlade = 0u; iBlade < nBladesRow; iBlade++){
/* Blade Primitive initialized per blade */
std::vector<CTurbomachineryCombinedPrimitiveStates> bladePrimitives;
auto nSpan = config_container[iBlade]->GetnSpanWiseSections();
for (iSpan = 0; iSpan < nSpan + 1; iSpan++) {
for (auto iSpan = 0u; 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));
Expand All @@ -352,6 +351,21 @@ void CFluidIteration::ComputeTurboPerformance(CSolver***** solver, CGeometry****
auto OutState = TurbomachineryPerformance->GetBladesPerformances().at(nZone-1).at(nSpan)->GetOutletState();

TurbomachineryStagePerformance->ComputePerformanceStage(InState, OutState, config_container[nZone-1]);

/*--- Set turbomachinery objective function value in each zone ---*/
for (auto iBlade = 0u; iBlade < nBladesRow; iBlade++) {
// Should we set in ZONE_0 or nZone-1?
auto iBladePerf = TurbomachineryPerformance->GetBladesPerformances().at(iBlade).at(nSpan);
InState = iBladePerf->GetInletState();
OutState = iBladePerf->GetOutletState();
config_container[nZone-1]->SetEntropyGeneration(iBlade, (OutState.GetEntropy() - InState.GetEntropy())/InState.GetEntropy() * 100);
config_container[nZone-1]->SetTotalPressureLoss(iBlade, iBladePerf->GetTotalPressureLoss());
config_container[nZone-1]->SetKineticEnergyLoss(iBlade, iBladePerf->GetKineticEnergyLoss());
}
/*--- Set global turbomachinery objective function ---*/
config_container[nZone-1]->SetEntropyGeneration(nBladesRow, TurbomachineryStagePerformance->GetNormEntropyGen()*100);
config_container[nZone-1]->SetTotalPressureLoss(nBladesRow, TurbomachineryStagePerformance->GetTotalPressureLoss());
config_container[nZone-1]->SetKineticEnergyLoss(nBladesRow, TurbomachineryStagePerformance->GetKineticEnergyLoss());
}
}

Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/output/CFlowCompOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ void CFlowCompOutput::SetTurboMultiZonePerformance_Output(std::shared_ptr<CTurbo

void CFlowCompOutput::LoadTurboHistoryData(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {
auto BladePerformance = TurboPerf->GetBladesPerformances();
for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) {
for (auto iZone = 0u; iZone < config->GetnZone(); iZone++) {
auto nSpan = config->GetnSpan_iZones(iZone);
const auto& BladePerf = BladePerformance.at(iZone).at(nSpan);

Expand Down
19 changes: 16 additions & 3 deletions SU2_CFD/src/output/CTurboOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomac
Pressure = primitiveState.GetPressure();
std::vector<su2double> velocity = primitiveState.GetVelocity();
Velocity.assign(velocity.begin(), velocity.end());
su2double tangVel = primitiveState.GetTangVelocity();
TangVelocity = primitiveState.GetTangVelocity();

/*--- Compute static TD quantities ---*/
fluidModel.SetTDState_Prho(Pressure, Density);
Expand All @@ -81,9 +81,9 @@ void CTurbomachineryState::ComputeState(CFluidModel& fluidModel, const CTurbomac
std::for_each(Mach.begin(), Mach.end(), [&](su2double& el) { el /= soundSpeed; });

/*--- Compute relative kinematic quantities ---*/
su2double tangVel2 = tangVel * tangVel;
su2double tangVel2 = TangVelocity * TangVelocity;
RelVelocity.assign(Velocity.begin(), Velocity.end());
RelVelocity[1] -= tangVel;
RelVelocity[1] -= TangVelocity;
su2double relVel2 = GetRelVelocityValue();
FlowAngle = atan(RelVelocity[1] / RelVelocity[0]);
RelMach.assign(RelVelocity.begin(), RelVelocity.end());
Expand Down Expand Up @@ -245,13 +245,20 @@ void CTurbomachineryStagePerformance::ComputeTurbineStagePerformance(const CTurb
su2double enthalpyOutIs = fluidModel.GetStaticEnergy() + OutState.GetPressure() / fluidModel.GetDensity();
su2double totEnthalpyOutIs = enthalpyOutIs + 0.5 * OutState.GetVelocityValue() * OutState.GetVelocityValue();

su2double tangVel = OutState.GetTangVelocity();
su2double relVelOutIs2 = 2 * (OutState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel;

/*--- 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();

TotalPressureLoss = (InState.GetTotalRelPressure() - OutState.GetTotalRelPressure()) /
(OutState.GetTotalRelPressure() - OutState.GetPressure());
KineticEnergyLoss = 2 * (OutState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2;
}

void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(const CTurbomachineryState& InState,
Expand All @@ -260,6 +267,8 @@ void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(const CT
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 tangVel = OutState.GetTangVelocity();
su2double relVelOutIs2 = 2 * (OutState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel;

/*--- Compute compressor stage performance ---*/
NormEntropyGen = (OutState.GetEntropy() - InState.GetEntropy()) / InState.GetEntropy();
Expand All @@ -268,4 +277,8 @@ void CTurbomachineryStagePerformance::ComputeCompressorStagePerformance(const CT
TotalTotalEfficiency = (totEnthalpyOutIs - InState.GetTotalEnthalpy()) / EulerianWork;
TotalStaticPressureRatio = OutState.GetPressure() / InState.GetTotalPressure();
TotalTotalPressureRatio = OutState.GetTotalPressure() / InState.GetTotalPressure();

TotalPressureLoss = (InState.GetTotalRelPressure() - OutState.GetTotalRelPressure()) /
(InState.GetTotalRelPressure() - InState.GetPressure());
KineticEnergyLoss = 2 * (OutState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2;
}
Loading