Skip to content

Commit 7321299

Browse files
committed
Change to ramp muscl paramater structure
1 parent 957b574 commit 7321299

File tree

3 files changed

+19
-31
lines changed

3 files changed

+19
-31
lines changed

Common/include/CConfig.hpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,10 +1114,12 @@ class CConfig {
11141114
array<su2double, N_POLY_COEFFS> kt_polycoeffs{{0.0}}; /*!< \brief Array for thermal conductivity polynomial coefficients. */
11151115
bool Body_Force; /*!< \brief Flag to know if a body force is included in the formulation. */
11161116

1117+
struct CMUSCLRampParam {
1118+
su2double RampMUSCLPower; /*!< \brief Exponent by which to raise the MUSCL ramp to the power of */
1119+
MUSCL_RAMP_TYPE Kind_MUSCLRamp; /*!< \brief The kind of MUSCL ramp */
1120+
unsigned long rampMUSCLCoeff[3]; /*!< \brief ramp MUSCL value coefficients for the COption class. */
1121+
} RampMUSCLParam;
11171122
su2double rampMUSCLValue; /*!< \brief Current value of the MUSCL ramp */
1118-
su2double RampMUSCLPower; /*!< \brief Exponent by which to raise the MUSCL ramp to the power of */
1119-
MUSCL_RAMP_TYPE Kind_MUSCLRamp;
1120-
unsigned long rampMUSCLCoeff[3]; /*!< \brief ramp MUSCL value coefficients for the COption class. */
11211123

11221124
ENUM_STREAMWISE_PERIODIC Kind_Streamwise_Periodic; /*!< \brief Kind of Streamwise periodic flow (pressure drop or massflow) */
11231125
bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or otherwise outlet source term. */
@@ -5203,14 +5205,6 @@ class CConfig {
52035205
else return 0;
52045206
};
52055207

5206-
/*!
5207-
* \brief Interface for accessing MUSCL ramp coefficient information
5208-
* \return coeff for ramps
5209-
*/
5210-
unsigned long GetMUSCLRampCoeff(RAMP_COEFF val_coeff) const {
5211-
return rampMUSCLCoeff[val_coeff];
5212-
}
5213-
52145208
/*!
52155209
* \brief Set MUSCL ramp value.
52165210
*/
@@ -5223,16 +5217,10 @@ class CConfig {
52235217
su2double GetMUSCLRampValue(void) const { return rampMUSCLValue; }
52245218

52255219
/*!
5226-
* \brief Get MUSCL ramp power.
5227-
* \return Ramp MUSCL power
5228-
*/
5229-
su2double GetMUSCLRampPower(void) const { return RampMUSCLPower; }
5230-
5231-
/*!
5232-
* \brief Get MUSCL ramp kind.
5220+
* \brief Get MUSCL ramp paramaters.
52335221
* \return Ramp MUSCL kind
52345222
*/
5235-
MUSCL_RAMP_TYPE GetKindMUSCLRamp(void) const { return Kind_MUSCLRamp; }
5223+
const CMUSCLRampParam& GetMUSCLRampParam(void) const { return RampMUSCLParam; }
52365224

52375225
/*!
52385226
* \brief Generic interface for setting monitor outlet values for the ramp.

Common/src/CConfig.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,12 +1997,12 @@ void CConfig::SetConfig_Options() {
19971997
addBoolOption("RAMP_MUSCL", RampMUSCL, false);
19981998
/*! brief RAMP_OUTLET_COEFF \n DESCRIPTION: the 1st coeff is the ramp start iteration,
19991999
* the 2nd coeff is the iteration update frequenct, 3rd coeff is the total number of iterations */
2000-
rampMUSCLCoeff[0] = 0.0; rampMUSCLCoeff[1] = 1.0; rampMUSCLCoeff[2] = 500.0;
2001-
addULongArrayOption("RAMP_MUSCL_COEFF", 3, false, rampMUSCLCoeff);
2000+
RampMUSCLParam.rampMUSCLCoeff[0] = 0.0; RampMUSCLParam.rampMUSCLCoeff[1] = 1.0; RampMUSCLParam.rampMUSCLCoeff[2] = 500.0;
2001+
addULongArrayOption("RAMP_MUSCL_COEFF", 3, false, RampMUSCLParam.rampMUSCLCoeff);
20022002
/*!\brief RAMP_MUSCL_POWER \n DESRCIPTION: Exponent of the MUSCL ramp formulation */
2003-
addDoubleOption("RAMP_MUSCL_POWER", RampMUSCLPower, 1.0);
2003+
addDoubleOption("RAMP_MUSCL_POWER", RampMUSCLParam.RampMUSCLPower, 1.0);
20042004
/*!\brief KIND_MUSCL_RAMP \n DESCRIPTION: The kind of MUSCL Ramp to be applied */
2005-
addEnumOption("KIND_MUSCL_RAMP", Kind_MUSCLRamp, MUSCLRamp_Map, MUSCL_RAMP_TYPE::ITERATION);
2005+
addEnumOption("KIND_MUSCL_RAMP", RampMUSCLParam.Kind_MUSCLRamp, MUSCLRamp_Map, MUSCL_RAMP_TYPE::ITERATION);
20062006
/*!\brief SLOPE_LIMITER_FLOW
20072007
* DESCRIPTION: Slope limiter for the direct solution. \n OPTIONS: See \link Limiter_Map \endlink \n DEFAULT VENKATAKRISHNAN \ingroup Config*/
20082008
addEnumOption("SLOPE_LIMITER_FLOW", Kind_SlopeLimit_Flow, Limiter_Map, LIMITER::VENKATAKRISHNAN);
@@ -4497,7 +4497,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
44974497
}
44984498

44994499
if(RampMUSCL && !DiscreteAdjoint){
4500-
if (RampMUSCLPower <= 0.0) SU2_MPI::Error("RAMP_MUSCL_POWER cannot be less than or equal to zero!");
4500+
if (RampMUSCLParam.RampMUSCLPower <= 0.0) SU2_MPI::Error("RAMP_MUSCL_POWER cannot be less than or equal to zero!", CURRENT_FUNCTION);
45014501
rampMUSCLValue = 0.0;
45024502
} else {
45034503
rampMUSCLValue = 1.0;

SU2_CFD/src/iteration/CFluidIteration.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,20 +335,20 @@ void CFluidIteration::UpdateRamp(CGeometry**** geometry_container, CConfig** con
335335
}
336336

337337
if (ramp_flag == RAMP_TYPE::MUSCL) {
338-
const long unsigned startIter = config->GetMUSCLRampCoeff(RAMP_COEFF::INITIAL_VALUE);
339-
const long unsigned updateFreq = config->GetMUSCLRampCoeff(RAMP_COEFF::UPDATE_FREQ);
340-
const long unsigned finalIter = config->GetMUSCLRampCoeff(RAMP_COEFF::FINAL_ITER);
341-
const auto power = config->GetMUSCLRampPower();
338+
const auto RampMUSCLParam = config->GetMUSCLRampParam();
339+
const long unsigned startIter = RampMUSCLParam.rampMUSCLCoeff[RAMP_COEFF::INITIAL_VALUE];
340+
const long unsigned updateFreq = RampMUSCLParam.rampMUSCLCoeff[RAMP_COEFF::UPDATE_FREQ];
341+
const long unsigned finalIter = RampMUSCLParam.rampMUSCLCoeff[RAMP_COEFF::FINAL_ITER];
342342
auto iterFrac = (static_cast<double>(iter - startIter)/static_cast<double>(finalIter - startIter));
343343
if (iter < startIter) return;
344344
if ((iter == startIter) && (rank == MASTER_NODE)) cout << "Beginning to ramp MUSCL scheme..." << endl;
345345
if ((iter % updateFreq == 0 && iter < finalIter) || (iter == finalIter)) {
346-
switch (config->GetKindMUSCLRamp()) {
346+
switch (RampMUSCLParam.Kind_MUSCLRamp) {
347347
case MUSCL_RAMP_TYPE::ITERATION:
348-
config->SetMUSCLRampValue(std::pow(std::min<double>(1.0, iterFrac), power));
348+
config->SetMUSCLRampValue(std::pow(std::min<double>(1.0, iterFrac), RampMUSCLParam.RampMUSCLPower));
349349
break;
350350
case MUSCL_RAMP_TYPE::SMOOTH_FUNCTION:
351-
config->SetMUSCLRampValue(std::pow((0.5 * (1 - cos(M_PI * std::min(1.0, iterFrac)))), power));
351+
config->SetMUSCLRampValue(std::pow((0.5 * (1 - cos(M_PI * std::min(1.0, iterFrac)))), RampMUSCLParam.RampMUSCLPower));
352352
break;
353353
default:
354354
break;

0 commit comments

Comments
 (0)