Skip to content

Commit f197a31

Browse files
committed
add some const
1 parent aaaf386 commit f197a31

File tree

4 files changed

+29
-41
lines changed

4 files changed

+29
-41
lines changed

Common/include/CConfig.hpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,8 @@ class CConfig {
11461146
jst_coeff[2], /*!< \brief artificial dissipation (flow) array for the COption class. */
11471147
ffd_coeff[3], /*!< \brief artificial dissipation (flow) array for the COption class. */
11481148
mixedout_coeff[3], /*!< \brief default mixedout algorithm coefficients for the COption class. */
1149-
rampMotionFrame_coeff[3], /*!< \brief ramp motion frame coefficients for the COption class. */
1150-
rampOutlet_coeff[3], /*!< \brief ramp outlet value coefficients for the COption class. */
1149+
rampMotionFrameCoeff[3], /*!< \brief ramp motion frame coefficients for the COption class. */
1150+
rampOutletCoeff[3], /*!< \brief ramp outlet value coefficients for the COption class. */
11511151
jst_adj_coeff[2], /*!< \brief artificial dissipation (adjoint) array for the COption class. */
11521152
mesh_box_length[3], /*!< \brief mesh box length for the COption class. */
11531153
mesh_box_offset[3], /*!< \brief mesh box offset for the COption class. */
@@ -5121,31 +5121,19 @@ class CConfig {
51215121
*/
51225122
bool GetRampMotionFrame(void) const { return RampMotionFrame; }
51235123

5124-
/*!
5125-
* \brief Get coeff for ramping the frame of motion (translation/rotation) [TURBO ONLY]
5126-
* \return coeff Ramp for frame of motion
5127-
*/
5128-
su2double GetRampMotionFrame_Coeff(unsigned short iCoeff) const { return rampMotionFrame_coeff[iCoeff];}
5129-
51305124
/*!
51315125
* \brief Get outflow ramp option.
51325126
* \return Ramp outflow option.
51335127
*/
51345128
bool GetRampOutflow(void) const { return RampOutlet; }
51355129

5136-
/*!
5137-
* \brief Get coeff for ramping the Giles boundary outflow (pressure/mass flow) [TURBO ONLY]
5138-
* \return coeff Ramp for Giles outflow
5139-
*/
5140-
su2double GetRampOutflow_Coeff(unsigned short iCoeff) const { return rampOutlet_coeff[iCoeff]; }
5141-
51425130
/*!
51435131
* \brief General interface for accessing ramp coefficient information
51445132
* \return coeff for ramps
51455133
*/
5146-
su2double GetRamp_Coeff(RAMP_TYPE ramp_flag, RAMP_COEFF val_coeff) {
5147-
if (ramp_flag == RAMP_TYPE::GRID) return rampMotionFrame_coeff[val_coeff];
5148-
else if (ramp_flag == RAMP_TYPE::BOUNDARY) return rampOutlet_coeff[val_coeff];
5134+
su2double GetRampCoeff(RAMP_TYPE ramp_flag, RAMP_COEFF val_coeff) const {
5135+
if (ramp_flag == RAMP_TYPE::GRID) return rampMotionFrameCoeff[val_coeff];
5136+
else if (ramp_flag == RAMP_TYPE::BOUNDARY) return rampOutletCoeff[val_coeff];
51495137
else return 0;
51505138
};
51515139

@@ -6148,11 +6136,11 @@ class CConfig {
61486136
* \brief General interface for setting the rate of motion in grid ramps
61496137
* \param[in] ramp_flag - flag for type of ramp
61506138
* \param[in] val - new value of rate of motion
6151-
*/
6139+
*/
61526140
void SetRate(su2double val) {
61536141
if (RampRotatingFrame) Rotation_Rate[2] = val;
61546142
else if (RampTranslationFrame) Translation_Rate[1] = val;
6155-
};
6143+
}
61566144

61576145
/*!
61586146
* \brief Get the rotation rate of the marker.
@@ -6251,13 +6239,13 @@ class CConfig {
62516239
* \brief Generic interface for retrieving final value of a turbomachinery ramp
62526240
* \return Final value of a specified ramp
62536241
*/
6254-
su2double GetFinalValue(RAMP_TYPE ramp_flag) {
6242+
su2double GetFinalValue(RAMP_TYPE ramp_flag) const {
62556243
if (ramp_flag == RAMP_TYPE::GRID && RampRotatingFrame) return FinalRotation_Rate_Z;
62566244
else if (ramp_flag == RAMP_TYPE::GRID && RampTranslationFrame) return FinalTranslation_Rate_Y;
62576245
else if (ramp_flag == RAMP_TYPE::BOUNDARY && RampOutletPressure) return FinalOutletPressure;
62586246
else if (ramp_flag == RAMP_TYPE::BOUNDARY && RampOutletMassFlow) return FinalOutletMassFlow;
62596247
else return 0.0;
6260-
};
6248+
}
62616249

62626250
/*!
62636251
* \brief Get the Harmonic Balance frequency pointer.

Common/src/CConfig.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,18 +1640,18 @@ void CConfig::SetConfig_Options() {
16401640
addDoubleArrayOption("MIXEDOUT_COEFF", 3, mixedout_coeff);
16411641
/*!\brief RAMP_MOTION_FRAME\n DESCRIPTION: option to ramp up or down the frame of motion velocity value*/
16421642
addBoolOption("RAMP_MOTION_FRAME", RampMotionFrame, false);
1643-
rampMotionFrame_coeff[0] = 100.0; rampMotionFrame_coeff[1] = 1.0; rampMotionFrame_coeff[2] = 1000.0;
1643+
rampMotionFrameCoeff[0] = 100.0; rampMotionFrameCoeff[1] = 1.0; rampMotionFrameCoeff[2] = 1000.0;
16441644
/*!\brief RAMP_MOTION_FRAME_COEFF \n DESCRIPTION: the 1st coeff is the staring outlet value,
16451645
* 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 */
1646-
addDoubleArrayOption("RAMP_MOTION_FRAME_COEFF", 3, rampMotionFrame_coeff);
1646+
addDoubleArrayOption("RAMP_MOTION_FRAME_COEFF", 3, rampMotionFrameCoeff);
16471647
/* DESCRIPTION: AVERAGE_MACH_LIMIT is a limit value for average procedure based on the mass flux. */
16481648
addDoubleOption("AVERAGE_MACH_LIMIT", AverageMachLimit, 0.03);
16491649
/*!\brief RAMP_OUTLET\n DESCRIPTION: option to ramp up or down the Giles outlet value*/
16501650
addBoolOption("RAMP_OUTLET", RampOutlet, false);
1651-
rampOutlet_coeff[0] = 100000.0; rampOutlet_coeff[1] = 1.0; rampOutlet_coeff[2] = 1000.0;
1651+
rampOutletCoeff[0] = 100000.0; rampOutletCoeff[1] = 1.0; rampOutletCoeff[2] = 1000.0;
16521652
/*!\brief RAMP_OUTLET_COEFF \n DESCRIPTION: the 1st coeff is the staring outlet value,
16531653
* 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 */
1654-
addDoubleArrayOption("RAMP_OUTLET_COEFF", 3, rampOutlet_coeff);
1654+
addDoubleArrayOption("RAMP_OUTLET_COEFF", 3, rampOutletCoeff);
16551655
/*!\brief MARKER_MIXINGPLANE \n DESCRIPTION: Identify the boundaries in which the mixing plane is applied. \ingroup Config*/
16561656
addStringListOption("MARKER_MIXINGPLANE_INTERFACE", nMarker_MixingPlaneInterface, Marker_MixingPlaneInterface);
16571657
/*!\brief TURBULENT_MIXINGPLANE \n DESCRIPTION: Activate mixing plane also for turbulent quantities \ingroup Config*/
@@ -4435,28 +4435,28 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
44354435
if(GetGrid_Movement() && RampRotatingFrame && !DiscreteAdjoint){
44364436
FinalRotation_Rate_Z = Rotation_Rate[2];
44374437
if(abs(FinalRotation_Rate_Z) > 0.0){
4438-
Rotation_Rate[2] = rampMotionFrame_coeff[RAMP_COEFF::INITIAL_VALUE];
4438+
Rotation_Rate[2] = rampMotionFrameCoeff[RAMP_COEFF::INITIAL_VALUE];
44394439
}
44404440
}
44414441

44424442
if(GetGrid_Movement() && RampTranslationFrame && !DiscreteAdjoint){
44434443
FinalTranslation_Rate_Y = Translation_Rate[1];
44444444
if(abs(FinalTranslation_Rate_Y) > 0.0){
4445-
Translation_Rate[1] = rampMotionFrame_coeff[RAMP_COEFF::INITIAL_VALUE];
4445+
Translation_Rate[1] = rampMotionFrameCoeff[RAMP_COEFF::INITIAL_VALUE];
44464446
}
44474447
}
44484448

44494449
if(RampOutletPressure && !DiscreteAdjoint){
44504450
for (iMarker = 0; iMarker < nMarker_Giles; iMarker++){
44514451
if (Kind_Data_Giles[iMarker] == STATIC_PRESSURE || Kind_Data_Giles[iMarker] == STATIC_PRESSURE_1D || Kind_Data_Giles[iMarker] == RADIAL_EQUILIBRIUM ){
44524452
FinalOutletPressure = Giles_Var1[iMarker];
4453-
Giles_Var1[iMarker] = rampOutlet_coeff[RAMP_COEFF::INITIAL_VALUE];
4453+
Giles_Var1[iMarker] = rampOutletCoeff[RAMP_COEFF::INITIAL_VALUE];
44544454
}
44554455
}
44564456
for (iMarker = 0; iMarker < nMarker_Riemann; iMarker++){
44574457
if (Kind_Data_Riemann[iMarker] == STATIC_PRESSURE || Kind_Data_Riemann[iMarker] == RADIAL_EQUILIBRIUM){
44584458
FinalOutletPressure = Riemann_Var1[iMarker];
4459-
Riemann_Var1[iMarker] = rampOutlet_coeff[RAMP_COEFF::INITIAL_VALUE];
4459+
Riemann_Var1[iMarker] = rampOutletCoeff[RAMP_COEFF::INITIAL_VALUE];
44604460
}
44614461
}
44624462
}
@@ -4465,7 +4465,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
44654465
for (iMarker = 0; iMarker < nMarker_Giles; iMarker++){
44664466
if (Kind_Data_Giles[iMarker] == MASS_FLOW_OUTLET){
44674467
FinalOutletMassFlow = Giles_Var1[iMarker];
4468-
Giles_Var1[iMarker] = rampOutlet_coeff[RAMP_COEFF::INITIAL_VALUE];
4468+
Giles_Var1[iMarker] = rampOutletCoeff[RAMP_COEFF::INITIAL_VALUE];
44694469
}
44704470
}
44714471
}

SU2_CFD/src/iteration/CFluidIteration.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,20 @@ void CFluidIteration::UpdateRamp(CGeometry**** geometry_container, CConfig** con
264264
auto* geometry = geometry_container[iZone][INST_0][ZONE_0];
265265

266266
std::string msg = "\nUpdated rotating frame grid velocities for zone ";
267-
if (ramp_flag == RAMP_TYPE::GRID && config->GetKind_GridMovement() == ENUM_GRIDMOVEMENT::STEADY_TRANSLATION)
267+
if (ramp_flag == RAMP_TYPE::GRID && config->GetKind_GridMovement() == ENUM_GRIDMOVEMENT::STEADY_TRANSLATION)
268268
msg = "\nUpdated translation frame grid velocities for zone ";
269269

270270
if (config_container[ZONE_0]->GetMultizone_Problem())
271271
iter = config_container[ZONE_0]->GetOuterIter();
272272

273273
/*-- Update grid velocities (ROTATING_FRAME, STEADY_TRANSLATION)*/
274274
if (ramp_flag == RAMP_TYPE::GRID && config->GetGrid_Movement()) {
275-
const auto ini_vel = config->GetRamp_Coeff(ramp_flag, RAMP_COEFF::INITIAL_VALUE);
276-
const long unsigned rampFreq = SU2_TYPE::Int(config->GetRamp_Coeff(ramp_flag, RAMP_COEFF::UPDATE_FREQ));
277-
const long unsigned finalRamp_Iter = SU2_TYPE::Int(config->GetRamp_Coeff(ramp_flag, RAMP_COEFF::FINAL_ITER));
278-
279-
// Two options needed as if finalRamp_Iter % rampFreq != 0 final value is not set correctly
280-
if((iter % rampFreq == 0 && iter < finalRamp_Iter) || (iter == finalRamp_Iter)){
275+
const auto ini_vel = config->GetRampCoeff(ramp_flag, RAMP_COEFF::INITIAL_VALUE);
276+
const long unsigned rampFreq = SU2_TYPE::Int(config->GetRampCoeff(ramp_flag, RAMP_COEFF::UPDATE_FREQ));
277+
const long unsigned finalRamp_Iter = SU2_TYPE::Int(config->GetRampCoeff(ramp_flag, RAMP_COEFF::FINAL_ITER));
278+
279+
// Two options needed as if finalRamp_Iter % rampFreq != 0 final value is not set correctly
280+
if((iter % rampFreq == 0 && iter < finalRamp_Iter) || (iter == finalRamp_Iter)){
281281
const auto final_vel = config->GetFinalValue(ramp_flag);
282282
if(fabs(final_vel) > 0.0) {
283283
const auto vel = ini_vel + iter * (final_vel - ini_vel)/finalRamp_Iter;
@@ -299,9 +299,9 @@ void CFluidIteration::UpdateRamp(CGeometry**** geometry_container, CConfig** con
299299

300300
// Boundary ramps (pressure/mass flow)
301301
if (ramp_flag == RAMP_TYPE::BOUNDARY){
302-
const auto outVal_ini = config->GetRamp_Coeff(ramp_flag, RAMP_COEFF::INITIAL_VALUE);
303-
const long unsigned rampFreq = SU2_TYPE::Int(config->GetRamp_Coeff(ramp_flag, RAMP_COEFF::UPDATE_FREQ));
304-
const long unsigned finalRamp_Iter = SU2_TYPE::Int(config->GetRamp_Coeff(ramp_flag, RAMP_COEFF::FINAL_ITER));
302+
const auto outVal_ini = config->GetRampCoeff(ramp_flag, RAMP_COEFF::INITIAL_VALUE);
303+
const long unsigned rampFreq = SU2_TYPE::Int(config->GetRampCoeff(ramp_flag, RAMP_COEFF::UPDATE_FREQ));
304+
const long unsigned finalRamp_Iter = SU2_TYPE::Int(config->GetRampCoeff(ramp_flag, RAMP_COEFF::FINAL_ITER));
305305
const auto outVal_final = config->GetFinalValue(ramp_flag);
306306

307307
if ((iter % rampFreq == 0 && iter < finalRamp_Iter) || (iter == finalRamp_Iter)) {

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3604,7 +3604,7 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
36043604
// are stored in p_value and t_value and the flow direction in flow_dir_or_vel, while for a
36053605
// supersonic inlet the static conditions are stored in p_value and t_value and the flow
36063606
// velocity in flow_dir_or_vel.
3607-
su2double p_value, t_value;
3607+
su2double p_value{}, t_value{};
36083608
const su2double* flow_dir_or_vel = nullptr;
36093609

36103610
if (KIND_MARKER == INLET_FLOW) {

0 commit comments

Comments
 (0)