Skip to content

Commit 8e7bd69

Browse files
authored
Merge pull request #1329 from snow54/fix_SpecialOutput_SonicBoom
Fix equivalent area calculation
2 parents 3f745be + d5b43fa commit 8e7bd69

16 files changed

Lines changed: 906 additions & 777 deletions

SU2_CFD/include/output/CFlowOutput.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ class CFlowOutput : public CFVMOutput{
8888
*/
8989
void Set_CpInverseDesign(CSolver *solver, const CGeometry *geometry, const CConfig *config);
9090

91+
/*!
92+
* \brief Add nearfield inverse design output as history fields
93+
*/
94+
void Add_NearfieldInverseDesignOutput();
95+
96+
/*!
97+
* \brief Set nearfield inverse design output field values (and also into the solver).
98+
* \param[in,out] solver - The container holding all solution data.
99+
* \param[in] geometry - Geometrical definition of the problem.
100+
* \param[in] config - Definition of the particular problem.
101+
*/
102+
void Set_NearfieldInverseDesign(CSolver *solver, const CGeometry *geometry, const CConfig *config);
103+
91104
/*!
92105
* \brief Compute value of the Q criteration for vortex idenfitication
93106
* \param[in] VelocityGradient - Velocity gradients

SU2_CFD/include/output/COutputLegacy.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,6 @@ class COutputLegacy {
127127
*/
128128
~COutputLegacy(void);
129129

130-
/*!
131-
* \brief Writes equivalent area.
132-
* \param[in] solver - Container vector with all the solutions.
133-
* \param[in] geometry - Geometrical definition of the problem.
134-
* \param[in] config - Definition of the particular problem.
135-
* \param[in] output - Create output files.
136-
*/
137-
void SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry, CConfig *config, bool output) const;
138-
139130
/*!
140131
* \brief Writes inverse design.
141132
* \param[in] solver_container - Container vector with all the solutions.

SU2_CFD/include/solvers/CEulerSolver.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,6 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, ENUM_REGIME::COMP
836836
*/
837837
inline su2double GetInflow_Mach(unsigned short val_marker) const final { return Inflow_Mach[val_marker]; }
838838

839-
/*!
840-
* \brief Provide the total (inviscid + viscous) non dimensional Equivalent Area coefficient.
841-
* \return Value of the Equivalent Area coefficient (inviscid + viscous contribution).
842-
*/
843-
inline su2double GetTotal_CEquivArea() const final { return Total_CEquivArea; }
844-
845839
/*!
846840
* \brief Provide the total (inviscid + viscous) non dimensional aero CD.
847841
* \return Value of the Aero CD coefficient (inviscid + viscous contribution).
@@ -861,12 +855,6 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, ENUM_REGIME::COMP
861855
*/
862856
inline void AddTotal_ComboObj(su2double val_obj) final {Total_ComboObj +=val_obj;}
863857

864-
/*!
865-
* \brief Set the value of the Equivalent Area coefficient.
866-
* \param[in] val_cequivarea - Value of the Equivalent Area coefficient.
867-
*/
868-
inline void SetTotal_CEquivArea(su2double val_cequivarea) final { Total_CEquivArea = val_cequivarea; }
869-
870858
/*!
871859
* \brief Set the value of the Aero drag.
872860
* \param[in] val_cequivarea - Value of the aero drag.

SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class CFVMFlowSolverBase : public CSolver {
154154
su2double Total_Custom_ObjFunc = 0.0; /*!< \brief Total custom objective function for all the boundaries. */
155155
su2double Total_CpDiff = 0.0; /*!< \brief Total Equivalent Area coefficient for all the boundaries. */
156156
su2double Total_HeatFluxDiff = 0.0; /*!< \brief Total Equivalent Area coefficient for all the boundaries. */
157+
su2double Total_CEquivArea = 0.0; /*!< \brief Total Equivalent Area coefficient for all the boundaries. */
157158
su2double Total_MassFlowRate = 0.0; /*!< \brief Total Mass Flow Rate on monitored boundaries. */
158159
su2double Total_CNearFieldOF = 0.0; /*!< \brief Total Near-Field Pressure coefficient for all the boundaries. */
159160
su2double Total_Heat = 0.0; /*!< \brief Total heat load for all the boundaries. */
@@ -2091,6 +2092,12 @@ class CFVMFlowSolverBase : public CSolver {
20912092
*/
20922093
inline void SetTotal_HeatFluxDiff(su2double val_heat) final { Total_HeatFluxDiff = val_heat; }
20932094

2095+
/*!
2096+
* \brief Set the value of the Equivalent Area coefficient.
2097+
* \param[in] val_equiv - Value of the Equivalent Area coefficient.
2098+
*/
2099+
inline void SetTotal_CEquivArea(su2double val_equiv) final { Total_CEquivArea = val_equiv; }
2100+
20942101
/*!
20952102
* \brief Set the value of the Near-Field pressure oefficient.
20962103
* \param[in] val_cnearfieldpress - Value of the Near-Field pressure coefficient.
@@ -2122,6 +2129,12 @@ class CFVMFlowSolverBase : public CSolver {
21222129
* \return Value of the Equivalent Area coefficient (inviscid + viscous contribution).
21232130
*/
21242131
inline su2double GetTotal_HeatFluxDiff() const final { return Total_HeatFluxDiff; }
2132+
2133+
/*!
2134+
* \brief Provide the total (inviscid + viscous) non dimensional Equivalent Area coefficient.
2135+
* \return Value of the Equivalent Area coefficient (inviscid + viscous contribution).
2136+
*/
2137+
inline su2double GetTotal_CEquivArea() const final { return Total_CEquivArea; }
21252138

21262139
/*!
21272140
* \brief Set the value of the custom objective function.

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,9 @@ su2double CFVMFlowSolverBase<V,R>::EvaluateCommonObjFunc(const CConfig& config)
29002900
case INVERSE_DESIGN_HEATFLUX:
29012901
objFun += weight * Total_HeatFluxDiff;
29022902
break;
2903+
case EQUIVALENT_AREA:
2904+
objFun += weight*Total_CEquivArea;
2905+
break;
29032906
case THRUST_COEFFICIENT:
29042907
objFun += weight * TotalCoeff.CT;
29052908
break;

SU2_CFD/src/output/CFlowCompOutput.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){
223223
/// END_GROUP
224224

225225
/// BEGIN_GROUP: EQUIVALENT_AREA, DESCRIPTION: Equivalent area.
226-
/// DESCRIPTION: Equivalent area
227-
AddHistoryOutput("EQUIV_AREA", "CEquiv_Area", ScreenOutputFormat::SCIENTIFIC, "EQUIVALENT_AREA", "Equivalent area", HistoryFieldType::COEFFICIENT);
228226
/// DESCRIPTION: Nearfield obj. function
229227
AddHistoryOutput("NEARFIELD_OF", "CNearFieldOF", ScreenOutputFormat::SCIENTIFIC, "EQUIVALENT_AREA", "Nearfield obj. function", HistoryFieldType::COEFFICIENT);
230228
/// END_GROUP
@@ -279,6 +277,10 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){
279277

280278
Add_CpInverseDesignOutput();
281279

280+
/*--- Add nearfield diff fields ---*/
281+
282+
Add_NearfieldInverseDesignOutput();
283+
282284
}
283285

284286
void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){
@@ -694,6 +696,9 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol
694696

695697
Set_CpInverseDesign(flow_solver, geometry, config);
696698

699+
/*--- Set nearfield diff fields ---*/
700+
if (config->GetEquivArea()) Set_NearfieldInverseDesign(flow_solver, geometry, config);
701+
697702
}
698703

699704
bool CFlowCompOutput::SetInit_Residuals(const CConfig *config){

0 commit comments

Comments
 (0)