Skip to content

Commit 54ee7cc

Browse files
committed
config method to get the obj fun name (to pass it to the output)
1 parent 2ebf8f0 commit 54ee7cc

4 files changed

Lines changed: 28 additions & 31 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,21 +5135,19 @@ class CConfig {
51355135
bool GetHold_GridFixed(void) const { return Hold_GridFixed; }
51365136

51375137
/*!
5138+
* \author H. Kline
51385139
* \brief Get the kind of objective function. There are several options: Drag coefficient,
51395140
* Lift coefficient, efficiency, etc.
51405141
* \note The objective function will determine the boundary condition of the adjoint problem.
5142+
* \param[in] val_obj
51415143
* \return Kind of objective function.
51425144
*/
5143-
unsigned short GetKind_ObjFunc(void) const { return Kind_ObjFunc[0]; }
5145+
unsigned short GetKind_ObjFunc(unsigned short val_obj = 0) const { return Kind_ObjFunc[val_obj]; }
51445146

51455147
/*!
5146-
* \author H. Kline
5147-
* \brief Get the kind of objective function. There are several options: Drag coefficient,
5148-
* Lift coefficient, efficiency, etc.
5149-
* \note The objective function will determine the boundary condition of the adjoint problem.
5150-
* \return Kind of objective function.
5148+
* \brief Similar to GetKind_ObjFunc but returns the corresponding string.
51515149
*/
5152-
unsigned short GetKind_ObjFunc(unsigned short val_obj) const { return Kind_ObjFunc[val_obj]; }
5150+
string GetName_ObjFunc(unsigned short val_obj = 0) const;
51535151

51545152
/*!
51555153
* \author H. Kline
@@ -5178,12 +5176,6 @@ class CConfig {
51785176
*/
51795177
su2double GetCoeff_ObjChainRule(unsigned short iVar) const { return Obj_ChainRuleCoeff[iVar]; }
51805178

5181-
/*!
5182-
* \author H. Kline
5183-
* \brief Get the flag indicating whether to comput a combined objective.
5184-
*/
5185-
bool GetComboObj(void);
5186-
51875179
/*!
51885180
* \brief Get the kind of sensitivity smoothing technique.
51895181
* \return Kind of sensitivity smoothing technique.

Common/src/CConfig.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9301,6 +9301,13 @@ short CConfig::FindInterfaceMarker(unsigned short iInterface) const {
93019301
return -1;
93029302
}
93039303

9304+
string CConfig::GetName_ObjFunc(unsigned short val_obj) const {
9305+
for (auto item : Objective_Map)
9306+
if (item.second == static_cast<ENUM_OBJECTIVE>(Kind_ObjFunc[val_obj]))
9307+
return item.first;
9308+
return string();
9309+
}
9310+
93049311
void CConfig::Tick(double *val_start_time) {
93059312

93069313
#ifdef PROFILE

SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -703,18 +703,21 @@ void CDiscAdjMultizoneDriver::SetObjFunction(unsigned short kind_recording) {
703703

704704
// Aerodynamic coefficients
705705

706-
case DRAG_COEFFICIENT: FieldName = "DRAG"; break;
707-
case LIFT_COEFFICIENT: FieldName = "LIFT"; break;
708-
case SIDEFORCE_COEFFICIENT: FieldName = "SIDEFORCE"; break;
709-
case EFFICIENCY: FieldName = "EFFICIENCY"; break;
710-
case MOMENT_X_COEFFICIENT: FieldName = "MOMENT_X"; break;
711-
case MOMENT_Y_COEFFICIENT: FieldName = "MOMENT_Y"; break;
712-
case MOMENT_Z_COEFFICIENT: FieldName = "MOMENT_Z"; break;
713-
case FORCE_X_COEFFICIENT: FieldName = "FORCE_X"; break;
714-
case FORCE_Y_COEFFICIENT: FieldName = "FORCE_Y"; break;
715-
case FORCE_Z_COEFFICIENT: FieldName = "FORCE_Z"; break;
706+
case DRAG_COEFFICIENT:
707+
case LIFT_COEFFICIENT:
708+
case SIDEFORCE_COEFFICIENT:
709+
case EFFICIENCY:
710+
case MOMENT_X_COEFFICIENT:
711+
case MOMENT_Y_COEFFICIENT:
712+
case MOMENT_Z_COEFFICIENT:
713+
case FORCE_X_COEFFICIENT:
714+
case FORCE_Y_COEFFICIENT:
715+
case FORCE_Z_COEFFICIENT:
716+
FieldName = config->GetName_ObjFunc();
717+
break;
716718

717719
// Other surface-related output values
720+
// The names are different than in CConfig...
718721

719722
case SURFACE_MASSFLOW: FieldName = "AVG_MASSFLOW"; break;
720723
case SURFACE_MACH: FieldName = "AVG_MACH"; break;

SU2_CFD/src/solvers/CHeatSolver.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ void CHeatSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
10301030

10311031
void CHeatSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker) {
10321032

1033-
unsigned long iVertex, iPoint, total_index;
1034-
unsigned short iDim, iVar;
1033+
unsigned long iVertex, iPoint;
1034+
unsigned short iDim;
10351035

10361036
su2double thermal_diffusivity, rho_cp_solid, Temperature_Ref, T_Conjugate, Tinterface,
10371037
Tnormal_Conjugate, HeatFluxDensity, HeatFlux, Area;
@@ -1066,12 +1066,7 @@ void CHeatSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solv
10661066
LinSysRes(iPoint, 0) = 0.0;
10671067
nodes->SetRes_TruncErrorZero(iPoint);
10681068

1069-
if (implicit) {
1070-
for (iVar = 0; iVar < nVar; iVar++) {
1071-
total_index = iPoint*nVar+iVar;
1072-
Jacobian.DeleteValsRowi(total_index);
1073-
}
1074-
}
1069+
if (implicit) Jacobian.DeleteValsRowi(iPoint);
10751070
}
10761071
}
10771072
}

0 commit comments

Comments
 (0)