Skip to content

Update turbo ramps #2419

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

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2b74501
Added extra turbo ramp options, generalised function
joshkellyjak Jan 13, 2025
e7cb52b
Update documentation
joshkellyjak Jan 13, 2025
f4b65fc
Resolve compilation error and minor bug
joshkellyjak Jan 13, 2025
5c40247
Incorrect type conversion
joshkellyjak Jan 13, 2025
6d4fa45
Compilation warning fix
joshkellyjak Jan 13, 2025
03aefd6
Slight bug
joshkellyjak Jan 16, 2025
12d2bc0
Added catch for if update freq is not a factor of final ramp iter & a…
joshkellyjak Jan 16, 2025
543e062
Merge branch 'develop' into feature_turbo_ramps
joshkellyjak Jan 16, 2025
583f249
Changes for comments w/ update docs & reg test configs
joshkellyjak Jan 17, 2025
92cf538
clang-format
joshkellyjak Jan 17, 2025
56f7c8a
A slightly overdue modification
joshkellyjak Jan 17, 2025
1531b59
Merge branch 'develop' into feature_turbo_ramps
bigfooted Feb 4, 2025
1dd0903
Changes for comments
joshkellyjak Feb 17, 2025
f019e65
Merge branch 'feature_turbo_ramps' of https://github.com/su2code/SU2 …
joshkellyjak Feb 17, 2025
83719f8
comments
joshkellyjak Feb 17, 2025
e1b1c2d
Changes for comments
joshkellyjak Feb 18, 2025
dfd3a2f
Merge branch 'develop' into feature_turbo_ramps
joshkellyjak Feb 18, 2025
789b404
switch case fall through
joshkellyjak Feb 18, 2025
b4f00a9
Merge branch 'feature_turbo_ramps' of https://github.com/su2code/SU2 …
joshkellyjak Feb 18, 2025
485683e
added some auto's
joshkellyjak Feb 18, 2025
e50b96a
fix
joshkellyjak Feb 18, 2025
cd85c27
CodeQL
joshkellyjak Feb 18, 2025
992fae2
Merge branch 'develop' into feature_turbo_ramps
bigfooted Mar 5, 2025
44ac01d
Merge branch 'develop' into feature_turbo_ramps
joshkellyjak Apr 4, 2025
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
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ João Loureiro
Johannes Blühdorn
JonathanSmith1936
Joseph Signorelli
Joshua A. Kelly
Josy P. Pullockara
Kedar Naik
Kürşat Yurt
Expand Down
96 changes: 57 additions & 39 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,12 +1065,19 @@ class CConfig {
unsigned short *nSpan_iZones; /*!< \brief number of span-wise sections for each zones */
bool turbMixingPlane; /*!< \brief option for turbulent mixingplane */
bool SpatialFourier; /*!< \brief option for computing the fourier transforms for subsonic non-reflecting BC. */
bool RampRotatingFrame; /*!< \brief option for ramping up or down the Rotating Frame values */
bool RampOutletPressure; /*!< \brief option for ramping up or down the outlet pressure */
bool RampMotionFrame; /*!< \brief option for ramping up or down the motion Frame values */
bool RampOutlet; /*!< \brief option for ramping up or down the outlet values */
bool RampRotatingFrame; /*!< \brief option for ramping up or down the motion Frame values */
bool RampTranslationFrame; /*!< \brief option for ramping up or down the outlet values */
bool RampOutletMassFlow; /*!< \brief option for ramping up or down the motion Frame values */
bool RampOutletPressure; /*!< \brief option for ramping up or down the outlet values */
su2double AverageMachLimit; /*!< \brief option for turbulent mixingplane */
su2double FinalRotation_Rate_Z; /*!< \brief Final rotation rate Z if Ramp rotating frame is activated. */
su2double FinalTranslation_Rate_Y; /*!< \brief Final translation rate Y if Ramp translation frame is activated. */
su2double FinalOutletPressure; /*!< \brief Final outlet pressure if Ramp outlet pressure is activated. */
su2double FinalOutletMassFlow; /*!< \brief Final outlet mass flow rate if Ramp outlet mass flow rate is activated */
su2double MonitorOutletPressure; /*!< \brief Monitor outlet pressure if Ramp outlet pressure is activated. */
su2double MonitorOutletMassFlow; /*!< \brief Monitor outlet mass flow rate if ramp outlet mass flow rate is activated. */
array<su2double, N_POLY_COEFFS> cp_polycoeffs{{0.0}}; /*!< \brief Array for specific heat polynomial coefficients. */
array<su2double, N_POLY_COEFFS> mu_polycoeffs{{0.0}}; /*!< \brief Array for viscosity polynomial coefficients. */
array<su2double, N_POLY_COEFFS> kt_polycoeffs{{0.0}}; /*!< \brief Array for thermal conductivity polynomial coefficients. */
Expand Down Expand Up @@ -1119,8 +1126,8 @@ class CConfig {
jst_coeff[2], /*!< \brief artificial dissipation (flow) array for the COption class. */
ffd_coeff[3], /*!< \brief artificial dissipation (flow) array for the COption class. */
mixedout_coeff[3], /*!< \brief default mixedout algorithm coefficients for the COption class. */
rampRotFrame_coeff[3], /*!< \brief ramp rotating frame coefficients for the COption class. */
rampOutPres_coeff[3], /*!< \brief ramp outlet pressure coefficients for the COption class. */
rampMotionFrame_coeff[3], /*!< \brief ramp motion frame coefficients for the COption class. */
rampOutlet_coeff[3], /*!< \brief ramp outlet value coefficients for the COption class. */
jst_adj_coeff[2], /*!< \brief artificial dissipation (adjoint) array for the COption class. */
mesh_box_length[3], /*!< \brief mesh box length for the COption class. */
mesh_box_offset[3], /*!< \brief mesh box offset for the COption class. */
Expand Down Expand Up @@ -5012,45 +5019,46 @@ class CConfig {
void SetKind_PerformanceAverageProcess(unsigned short new_AverageProcess) { Kind_PerformanceAverageProcess = new_AverageProcess; }

/*!
* \brief Get coeff for Rotating Frame Ramp.
* \return coeff Ramp Rotating Frame.
* \brief Get Motion Frame Ramp option.
* \return Ramp Motion Frame option.
*/
su2double GetRampRotatingFrame_Coeff(unsigned short iCoeff) const { return rampRotFrame_coeff[iCoeff];}
bool GetRampMotionFrame(void) const { return RampMotionFrame; }

/*!
* \brief Get Rotating Frame Ramp option.
* \return Ramp Rotating Frame option.
*/
bool GetRampRotatingFrame(void) const { return RampRotatingFrame;}

/*!
* \brief Get coeff for Outlet Pressure Ramp.
* \return coeff Ramp Outlet Pressure.
*/
su2double GetRampOutletPressure_Coeff(unsigned short iCoeff) const { return rampOutPres_coeff[iCoeff];}
* \brief Get coeff for ramping the frame of motion (translation/rotation) [TURBO ONLY]
* \return coeff Ramp for frame of motion
*/
su2double GetRampMotionFrame_Coeff(unsigned short iCoeff) const { return rampMotionFrame_coeff[iCoeff];}

/*!
* \brief Get final Outlet Pressure value for the ramp.
* \return final Outlet Pressure value.
* \brief Get outflow ramp option.
* \return Ramp outflow option.
*/
su2double GetFinalOutletPressure(void) const { return FinalOutletPressure; }
bool GetRampOutflow(void) const { return RampOutlet; }

/*!
* \brief Get final Outlet Pressure value for the ramp.
* \return Monitor Outlet Pressure value.
*/
su2double GetMonitorOutletPressure(void) const { return MonitorOutletPressure; }
* \brief Get coeff for ramping the Giles boundary outflow (pressure/mass flow) [TURBO ONLY]
* \return coeff Ramp for Giles outflow
*/
su2double GetRampOutflow_Coeff(unsigned short iCoeff) const { return rampOutlet_coeff[iCoeff]; }

/*!
* \brief Set Monitor Outlet Pressure value for the ramp.
*/
void SetMonitorOutletPressure(su2double newMonPres) { MonitorOutletPressure = newMonPres;}
* \brief General interface for accessing ramp coefficient information
* \return coeff for ramps
*/
su2double GetRamp_Coeff(RAMP_TYPE ramp_flag, RAMP_COEFF val_coeff) {
if (ramp_flag == RAMP_TYPE::GRID) return rampMotionFrame_coeff[val_coeff];
else if (ramp_flag == RAMP_TYPE::BOUNDARY) return rampOutlet_coeff[val_coeff];
else return 0;
};

/*!
* \brief Get Outlet Pressure Ramp option.
* \return Ramp Outlet pressure option.
* \brief Generic interface for setting monitor outlet values for the ramp.
*/
bool GetRampOutletPressure(void) const { return RampOutletPressure;}
void SetMonitorValue(su2double newMon_val) {
if (RampOutletPressure) MonitorOutletPressure = newMon_val;
else if (RampOutletMassFlow) MonitorOutletMassFlow = newMon_val;
}

/*!
* \brief Get mixedout coefficients.
Expand Down Expand Up @@ -5909,6 +5917,16 @@ class CConfig {
*/
void SetRotation_Rate(unsigned short iDim, su2double val) { Rotation_Rate[iDim] = val;}

/*!
* \brief General interface for setting the rate of motion in grid ramps
* \param[in] ramp_flag - flag for type of ramp
* \param[in] val - new value of rate of motion
*/
void SetRate(su2double val) {
if (RampRotatingFrame) Rotation_Rate[2] = val;
else if (RampTranslationFrame) Translation_Rate[1] = val;
};

/*!
* \brief Get the rotation rate of the marker.
* \param[in] iMarkerMoving - Index of the moving marker (as specified in Marker_Moving)
Expand Down Expand Up @@ -6003,16 +6021,16 @@ class CConfig {
su2double GetMarkerPlunging_Ampl(unsigned short iMarkerMoving, unsigned short iDim) const { return MarkerPlunging_Ampl[3*iMarkerMoving + iDim];}

/*!
* \brief Get the angular velocity of the mesh about the z-axis.
* \return Angular velocity of the mesh about the z-axis.
*/
su2double GetFinalRotation_Rate_Z() const { return FinalRotation_Rate_Z;}

/*!
* \brief Set the angular velocity of the mesh about the z-axis.
* \param[in] newRotation_Rate_Z - new rotation rate after computing the ramp value.
* \brief Generic interface for retrieving final value of a turbomachinery ramp
* \return Final value of a specified ramp
*/
void SetRotation_Rate_Z(su2double newRotation_Rate_Z);
su2double GetFinalValue(RAMP_TYPE ramp_flag) {
if (ramp_flag == RAMP_TYPE::GRID && RampRotatingFrame) return FinalRotation_Rate_Z;
else if (ramp_flag == RAMP_TYPE::GRID && RampTranslationFrame) return FinalTranslation_Rate_Y;
else if (ramp_flag == RAMP_TYPE::BOUNDARY && RampOutletPressure) return FinalOutletPressure;
else if (ramp_flag == RAMP_TYPE::BOUNDARY && RampOutletMassFlow) return FinalOutletMassFlow;
else return 0.0;
};

/*!
* \brief Get the Harmonic Balance frequency pointer.
Expand Down
13 changes: 13 additions & 0 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,19 @@ class CGeometry {
*/
void SetCustomBoundary(CConfig* config);

/*!
* \brief General interface for setting the velocity in the geometry during motion ramps
* \param[in] config - config class
* \param[in] ramp_flag - flag for type of ramp
* \param[in] print - bool to print update to screen
*/
void SetVelocity(CConfig* config, bool print) {
if (config->GetKind_GridMovement() == ENUM_GRIDMOVEMENT::ROTATING_FRAME)
SetRotationalVelocity(config, print);
else if (config->GetKind_GridMovement() == ENUM_GRIDMOVEMENT::STEADY_TRANSLATION)
SetTranslationalVelocity(config, print);
};

/*!
* \brief Set cartesian grid velocity based on rotational speed and axis.
* \param[in] config - Definition of the particular problem.
Expand Down
73 changes: 59 additions & 14 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,20 +1620,20 @@ void CConfig::SetConfig_Options() {
* the 2nd coefficient is the tolerance for the Newton method, 3rd coefficient is the maximum number of
* iteration for the Newton Method.*/
addDoubleArrayOption("MIXEDOUT_COEFF", 3, mixedout_coeff);
/*!\brief RAMP_ROTATING_FRAME\n DESCRIPTION: option to ramp up or down the rotating frame velocity value*/
addBoolOption("RAMP_ROTATING_FRAME", RampRotatingFrame, false);
rampRotFrame_coeff[0] = 0; rampRotFrame_coeff[1] = 1.0; rampRotFrame_coeff[2] = 1000.0;
/*!\brief RAMP_ROTATING_FRAME_COEFF \n DESCRIPTION: the 1st coeff is the staring velocity,
* the 2nd coeff is the number of iterations for the update, 3rd is the number of iteration */
addDoubleArrayOption("RAMP_ROTATING_FRAME_COEFF", 3, rampRotFrame_coeff);
/*!\brief RAMP_MOTION_FRAME\n DESCRIPTION: option to ramp up or down the frame of motion velocity value*/
addBoolOption("RAMP_MOTION_FRAME", RampMotionFrame, false);
rampMotionFrame_coeff[0] = 100.0; rampMotionFrame_coeff[1] = 1.0; rampMotionFrame_coeff[2] = 1000.0;
/*!\brief RAMP_MOTION_FRAME_COEFF \n DESCRIPTION: the 1st coeff is the staring outlet value,
* the 2nd coeff is the number of iterations for the update, 3rd is the number of total iteration till reaching the final outlet pressure value */
addDoubleArrayOption("RAMP_MOTION_FRAME_COEFF", 3, rampMotionFrame_coeff);
/* DESCRIPTION: AVERAGE_MACH_LIMIT is a limit value for average procedure based on the mass flux. */
addDoubleOption("AVERAGE_MACH_LIMIT", AverageMachLimit, 0.03);
/*!\brief RAMP_OUTLET_PRESSURE\n DESCRIPTION: option to ramp up or down the rotating frame velocity value*/
addBoolOption("RAMP_OUTLET_PRESSURE", RampOutletPressure, false);
rampOutPres_coeff[0] = 100000.0; rampOutPres_coeff[1] = 1.0; rampOutPres_coeff[2] = 1000.0;
/*!\brief RAMP_OUTLET_PRESSURE_COEFF \n DESCRIPTION: the 1st coeff is the staring outlet pressure,
/*!\brief RAMP_OUTLET\n DESCRIPTION: option to ramp up or down the Giles outlet value*/
addBoolOption("RAMP_OUTLET", RampOutlet, false);
rampOutlet_coeff[0] = 100000.0; rampOutlet_coeff[1] = 1.0; rampOutlet_coeff[2] = 1000.0;
/*!\brief RAMP_OUTLET_COEFF \n DESCRIPTION: the 1st coeff is the staring outlet value,
* the 2nd coeff is the number of iterations for the update, 3rd is the number of total iteration till reaching the final outlet pressure value */
addDoubleArrayOption("RAMP_OUTLET_PRESSURE_COEFF", 3, rampOutPres_coeff);
addDoubleArrayOption("RAMP_OUTLET_COEFF", 3, rampOutlet_coeff);
/*!\brief MARKER_MIXINGPLANE \n DESCRIPTION: Identify the boundaries in which the mixing plane is applied. \ingroup Config*/
addStringListOption("MARKER_MIXINGPLANE_INTERFACE", nMarker_MixingPlaneInterface, Marker_MixingPlaneInterface);
/*!\brief TURBULENT_MIXINGPLANE \n DESCRIPTION: Activate mixing plane also for turbulent quantities \ingroup Config*/
Expand Down Expand Up @@ -3073,6 +3073,14 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){
newString.append("SPECIES_USE_STRONG_BC is deprecated. Use MARKER_SPECIES_STRONG_BC= (marker1, ...) instead.\n\n");
else if (!option_name.compare("DEAD_LOAD"))
newString.append("DEAD_LOAD is deprecated. Use GRAVITY_FORCE or BODY_FORCE instead.\n\n");
else if (!option_name.compare("RAMP_OUTLET_PRESSURE"))
newString.append("RAMP_OUTLET_PRESSURE is deprectaed. Use RAMP_OUTLET instead");
else if (!option_name.compare("RAMP_OUTLET_PRESSURE_COEFF"))
newString.append("RAMP_OUTLET_PRESSURE_COEFF is deprectaed. Use RAMP_OUTLET_COEFF instead");
else if (!option_name.compare("RAMP_ROTATION_FRAME"))
newString.append("RAMP_ROTATION_FRAME is deprectaed. Use RAMP_MOTION_FRAME instead");
else if (!option_name.compare("RAMP_ROTATION_FRAME_COEFF"))
newString.append("RAMP_ROTATION_FRAME_COEFF is deprectaed. Use RAMP_MOTION_FRAME_COEFF instead");
else {
/*--- Find the most likely candidate for the unrecognized option, based on the length
of start and end character sequences shared by candidates and the option. ---*/
Expand Down Expand Up @@ -4354,25 +4362,60 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
nSpan_iZones = new unsigned short[nZone];
}

/*--- Interface for handling turbo ramps ---*/
if (GetGrid_Movement() && RampMotionFrame && !DiscreteAdjoint) {
if (Kind_GridMovement == ENUM_GRIDMOVEMENT::ROTATING_FRAME) RampRotatingFrame = true;
else if (Kind_GridMovement == ENUM_GRIDMOVEMENT::STEADY_TRANSLATION) RampTranslationFrame = true;
}

if(RampOutlet && !DiscreteAdjoint) {
for (iMarker = 0; iMarker < nMarker_Giles; iMarker++){
switch (Kind_Data_Giles[iMarker]) {
case STATIC_PRESSURE: case STATIC_PRESSURE_1D: case RADIAL_EQUILIBRIUM:
RampOutletPressure = true;
break;
case MASS_FLOW_OUTLET:
RampOutletMassFlow = true;
break;
}
}
}

/*--- Set number of TurboPerformance markers ---*/
if(GetGrid_Movement() && RampRotatingFrame && !DiscreteAdjoint){
FinalRotation_Rate_Z = Rotation_Rate[2];
if(abs(FinalRotation_Rate_Z) > 0.0){
Rotation_Rate[2] = rampRotFrame_coeff[0];
Rotation_Rate[2] = rampMotionFrame_coeff[RAMP_COEFF::INITIAL_VALUE];
}
}

if(GetGrid_Movement() && RampTranslationFrame && !DiscreteAdjoint){
FinalTranslation_Rate_Y = Translation_Rate[1];
if(abs(FinalTranslation_Rate_Y) > 0.0){
Translation_Rate[1] = rampMotionFrame_coeff[RAMP_COEFF::INITIAL_VALUE];
}
}

if(RampOutletPressure && !DiscreteAdjoint){
for (iMarker = 0; iMarker < nMarker_Giles; iMarker++){
if (Kind_Data_Giles[iMarker] == STATIC_PRESSURE || Kind_Data_Giles[iMarker] == STATIC_PRESSURE_1D || Kind_Data_Giles[iMarker] == RADIAL_EQUILIBRIUM ){
FinalOutletPressure = Giles_Var1[iMarker];
Giles_Var1[iMarker] = rampOutPres_coeff[0];
Giles_Var1[iMarker] = rampOutlet_coeff[RAMP_COEFF::INITIAL_VALUE];
}
}
for (iMarker = 0; iMarker < nMarker_Riemann; iMarker++){
if (Kind_Data_Riemann[iMarker] == STATIC_PRESSURE || Kind_Data_Riemann[iMarker] == RADIAL_EQUILIBRIUM){
FinalOutletPressure = Riemann_Var1[iMarker];
Riemann_Var1[iMarker] = rampOutPres_coeff[0];
Riemann_Var1[iMarker] = rampOutlet_coeff[RAMP_COEFF::INITIAL_VALUE];
}
}
}

if(RampOutletMassFlow && !DiscreteAdjoint){
for (iMarker = 0; iMarker < nMarker_Giles; iMarker++){
if (Kind_Data_Giles[iMarker] == MASS_FLOW_OUTLET){
FinalOutletMassFlow = Giles_Var1[iMarker];
Giles_Var1[iMarker] = rampOutlet_coeff[RAMP_COEFF::INITIAL_VALUE];
}
}
}
Expand Down Expand Up @@ -5417,7 +5460,9 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
}

RampOutletPressure = false;
RampOutletMassFlow = false;
RampRotatingFrame = false;
RampTranslationFrame = false;
}

/* 2nd-order MUSCL is not possible for the continuous adjoint
Expand Down
5 changes: 3 additions & 2 deletions SU2_CFD/include/iteration/CFluidIteration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ class CFluidIteration : public CIteration {
unsigned short val_iInst) override;

/*!
* \brief Monitors turbo computation (pressure and turbo ramps).
* \brief Monitors and updates ramps
* \param[in] geometry_container - Geometrical definition of the problem
* \param[in] config_container - Defintion of the particular problem
* \param[in] ExtIter - The current iteration of the problem
* \param[in] iZone - The current zone
* \param[in] ramp_flag - Flag indicating type of ramp (grid or boundary)
*/
void TurboMonitor(CGeometry**** geometry_container, CConfig** config_container, unsigned long ExtIter, unsigned short iZone);
void UpdateRamp(CGeometry**** geometry_container, CConfig** config_container, unsigned long iter, unsigned short iZone, RAMP_TYPE ramp_flag);

/*!
* \brief Computes turboperformance.
Expand Down
1 change: 1 addition & 0 deletions SU2_CFD/include/iteration/CTurboIteration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ class CTurboIteration : public CFluidIteration {
* \brief Initialises turboperformance classes.
*/
void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid);

};
Loading