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

Update turbo ramps #2419

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Johannes Blühdorn
JonathanSmith1936
Joseph Signorelli
Josy P. Pullockara
Joshua A. Kelly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

H is before Y

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling my own name is a challenge on occasion

Kedar Naik
Kürşat Yurt
LaSerpe
Expand Down
92 changes: 62 additions & 30 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,12 +1067,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 @@ -1121,8 +1128,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 @@ -5158,45 +5165,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(TURBO_RAMP_TYPE ramp_flag, TURBO_RAMP_COEFF val_coeff) {
if (ramp_flag == TURBO_RAMP_TYPE::GRID) return rampMotionFrame_coeff[val_coeff];
else if (ramp_flag == TURBO_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 @@ -6055,6 +6063,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 All @@ -6073,6 +6091,12 @@ class CConfig {
MarkerRotation_Rate[3 * iMarkerMoving + iDim] = val;
}

/*!
* \brief Get the final translation velocity of the mesh in the y-direction
* \return Velocity of the mesh in the y-direction
*/
su2double GetFinalTranslation_Rate_Y() const { return FinalTranslation_Rate_Y;}

Comment on lines +6094 to +6099
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed now? And maybe some of the older functions to set/get Z rotation?

/*!
* \brief Get the pitching rate of the mesh.
* \param[in] iDim - spatial component
Expand Down Expand Up @@ -6160,6 +6184,14 @@ class CConfig {
*/
void SetRotation_Rate_Z(su2double newRotation_Rate_Z);

su2double GetFinalValue(TURBO_RAMP_TYPE ramp_flag) {
if (ramp_flag == TURBO_RAMP_TYPE::GRID && RampRotatingFrame) return FinalRotation_Rate_Z;
else if (ramp_flag == TURBO_RAMP_TYPE::GRID && RampTranslationFrame) return FinalTranslation_Rate_Y;
else if (ramp_flag == TURBO_RAMP_TYPE::BOUNDARY && RampOutletPressure) return FinalOutletPressure;
else if (ramp_flag == TURBO_RAMP_TYPE::BOUNDARY && RampOutletMassFlow) return FinalOutletMassFlow;
else return 0.0;
};

/*!
* \brief Get the Harmonic Balance frequency pointer.
* \return 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 @@ -961,6 +961,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
11 changes: 11 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,17 @@ enum TURBO_MARKER_TYPE{
OUTFLOW = 2 /*!< \brief flag for outflow marker for compute turboperformance. */
};

enum TURBO_RAMP_TYPE{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enum TURBO_RAMP_TYPE{
enum class TURBO_RAMP_TYPE{

GRID = 1, /*!< \brief flag for rotational/translational ramps */
BOUNDARY = 2 /*!< \brief flag for pressure/mass flow ramps*/
Comment on lines +1890 to +1891
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GRID = 1, /*!< \brief flag for rotational/translational ramps */
BOUNDARY = 2 /*!< \brief flag for pressure/mass flow ramps*/
GRID, /*!< \brief flag for rotational/translational ramps */
BOUNDARY /*!< \brief flag for pressure/mass flow ramps*/

};

enum TURBO_RAMP_COEFF{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document that these are used to access the entries in the coefficient ramps and thus are numbered in a particular way.

INITIAL_VALUE = 0, /*!< \brief intial value of the ramp */
UPDATE_FREQ = 1, /*<! \brief update frequency of the ramp */
FINAL_ITER = 2 /*<! \brief final iteration of the ramp */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FINAL_ITER = 2 /*<! \brief final iteration of the ramp */
FINAL_ITER = 2 /*<! \brief final iteration of the ramp */

};

/*!
* \brief Types inlet boundary treatments
*/
Expand Down
58 changes: 44 additions & 14 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,20 +1621,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,
Comment on lines -1632 to -1635
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add entries to the deprecated options so that users with old configs are pointed to the new option.

/*!\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 @@ -4355,25 +4355,55 @@ 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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency please

Suggested change
if(GetGrid_Movement() && RampMotionFrame && !DiscreteAdjoint){
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++){
if (Kind_Data_Giles[iMarker] == STATIC_PRESSURE || Kind_Data_Giles[iMarker] == STATIC_PRESSURE_1D || Kind_Data_Giles[iMarker] == RADIAL_EQUILIBRIUM )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Kind_Data_Giles[iMarker] == STATIC_PRESSURE || Kind_Data_Giles[iMarker] == STATIC_PRESSURE_1D || Kind_Data_Giles[iMarker] == RADIAL_EQUILIBRIUM )
switch (Kind_Data_Giles[iMarker]) {

RampOutletPressure = true;
else if (Kind_Data_Giles[iMarker] == MASS_FLOW_OUTLET) RampOutletMassFlow = true;
}
}

/*--- 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[TURBO_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[TURBO_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[TURBO_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[TURBO_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[TURBO_RAMP_COEFF::INITIAL_VALUE];
}
}
}
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 turbo computation 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);
virtual void TurboRamp(CGeometry**** geometry_container, CConfig** config_container, unsigned long iter, unsigned short iZone, TURBO_RAMP_TYPE ramp_flag) {};

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

/*!
* \brief Monitors turbo computation 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 TurboRamp(CGeometry**** geometry_container, CConfig** config_container, unsigned long iter, unsigned short iZone, TURBO_RAMP_TYPE ramp_flag) override;
};
Loading
Loading