Skip to content

Commit 28753f0

Browse files
authored
Merge pull request #541 from su2code/feature_bugs
Bug fixes
2 parents 31897b4 + 4198122 commit 28753f0

18 files changed

+277
-231
lines changed

Common/src/config_structure.cpp

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ void CConfig::SetConfig_Options(unsigned short val_iZone, unsigned short val_nZo
817817
/* DESCRIPTION: Number of iterations to evaluate dCL_dAlpha . */
818818
addUnsignedLongOption("ITER_DCL_DALPHA", Iter_dCL_dAlpha, 500);
819819
/* DESCRIPTION: Damping factor for fixed CL mode. */
820-
addDoubleOption("DNETTHRUST_DBCTHRUST", dNetThrust_dBCThrust, 2.0);
820+
addDoubleOption("DNETTHRUST_DBCTHRUST", dNetThrust_dBCThrust, 1.0);
821821
/* DESCRIPTION: Number of times Alpha is updated in a fix CL problem. */
822822
addUnsignedLongOption("UPDATE_BCTHRUST", Update_BCThrust, 5);
823823

@@ -2477,6 +2477,11 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
24772477

24782478
if (Output_FileFormat != TECPLOT) Low_MemoryOutput = NO;
24792479

2480+
/*--- The that Discard_InFiles is false, owerwise the gradient could be wrong ---*/
2481+
2482+
if ((ContinuousAdjoint || DiscreteAdjoint) && Fixed_CL_Mode && !Eval_dOF_dCX)
2483+
Discard_InFiles = false;
2484+
24802485
/*--- Deactivate the multigrid in the adjoint problem ---*/
24812486

24822487
if ((ContinuousAdjoint && !MG_AdjointFlow) ||
@@ -3482,11 +3487,18 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
34823487

34833488
/*--- To avoid boundary intersections, let's add a small constant to the planes. ---*/
34843489

3485-
Stations_Bounds[0] += EPS;
3486-
Stations_Bounds[1] += EPS;
3487-
3488-
for (unsigned short iSections = 0; iSections < nLocationStations; iSections++) {
3489-
LocationStations[iSections] += EPS;
3490+
if (Geo_Description == NACELLE) {
3491+
for (unsigned short iSections = 0; iSections < nLocationStations; iSections++) {
3492+
if (LocationStations[iSections] == 0) LocationStations[iSections] = 1E-6;
3493+
if (LocationStations[iSections] == 360) LocationStations[iSections] = 359.999999;
3494+
}
3495+
}
3496+
else {
3497+
for (unsigned short iSections = 0; iSections < nLocationStations; iSections++) {
3498+
LocationStations[iSections] += EPS;
3499+
}
3500+
Stations_Bounds[0] += EPS;
3501+
Stations_Bounds[1] += EPS;
34903502
}
34913503

34923504
/*--- Length based parameter for slope limiters uses a default value of
@@ -3528,10 +3540,9 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
35283540
for (unsigned short iSections = 0; iSections < nLocationStations; iSections++) {
35293541
LocationStations[iSections] = LocationStations[iSections]/12.0;
35303542
}
3543+
Stations_Bounds[0] = Stations_Bounds[0]/12.0;
3544+
Stations_Bounds[1] = Stations_Bounds[1]/12.0;
35313545
}
3532-
3533-
Stations_Bounds[0] = Stations_Bounds[0]/12.0;
3534-
Stations_Bounds[1] = Stations_Bounds[1]/12.0;
35353546

35363547
SubsonicEngine_Cyl[0] = SubsonicEngine_Cyl[0]/12.0;
35373548
SubsonicEngine_Cyl[1] = SubsonicEngine_Cyl[1]/12.0;
@@ -4566,16 +4577,16 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
45664577

45674578
if (RefArea == 0.0) cout << "The reference area will be computed using y(2D) or z(3D) projection." << endl;
45684579
else { cout << "The reference area is " << RefArea;
4569-
if (SystemMeasurements == US) cout << " in^2." << endl; else cout << " m^2." << endl;
4580+
if (SystemMeasurements == US) cout << " ft^2." << endl; else cout << " m^2." << endl;
45704581
}
4571-
4582+
45724583
if (SemiSpan == 0.0) cout << "The semi-span will be computed using the max y(3D) value." << endl;
45734584
else { cout << "The semi-span length area is " << SemiSpan;
4574-
if (SystemMeasurements == US) cout << " in." << endl; else cout << " m." << endl;
4585+
if (SystemMeasurements == US) cout << " ft." << endl; else cout << " m." << endl;
45754586
}
4576-
4587+
45774588
cout << "The reference length is " << RefLength;
4578-
if (SystemMeasurements == US) cout << " in." << endl; else cout << " m." << endl;
4589+
if (SystemMeasurements == US) cout << " ft." << endl; else cout << " m." << endl;
45794590

45804591
if ((nRefOriginMoment_X > 1) || (nRefOriginMoment_Y > 1) || (nRefOriginMoment_Z > 1)) {
45814592
cout << "Surface(s) where the force coefficients are evaluated and \n";

Common/src/geometry_structure.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19795,7 +19795,11 @@ void CPhysicalGeometry::Compute_Nacelle(CConfig *config, bool original_surface,
1979519795

1979619796
/*--- Apply roll to cut the nacelle ---*/
1979719797

19798-
Angle = iPlane*dAngle*PI_NUMBER/180.0;
19798+
Angle = MinAngle + iPlane*dAngle*PI_NUMBER/180.0;
19799+
19800+
if (Angle <= 0) Angle = 1E-6;
19801+
if (Angle >= 360) Angle = 359.999999;
19802+
1979919803
Plane_Normal[iPlane][0] = 0.0;
1980019804
Plane_Normal[iPlane][1] = -sin(Angle);
1980119805
Plane_Normal[iPlane][2] = cos(Angle);

Common/src/grid_movement_structure.cpp

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,12 +3292,39 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
32923292

32933293
ParamCoord = FFDBox->GetParametricCoord_Iterative(iPoint, CartCoord, ParamCoordGuess, config);
32943294

3295+
/*--- Compute the cartesian coordinates using the parametric coordinates
3296+
to check that everything is correct ---*/
3297+
3298+
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
3299+
3300+
/*--- Compute max difference between original value and the recomputed value ---*/
3301+
3302+
Diff = 0.0;
3303+
for (iDim = 0; iDim < nDim; iDim++)
3304+
Diff += (CartCoordNew[iDim]-CartCoord[iDim])*(CartCoordNew[iDim]-CartCoord[iDim]);
3305+
Diff = sqrt(Diff);
3306+
my_MaxDiff = max(my_MaxDiff, Diff);
3307+
32953308
/*--- If the parametric coordinates are in (0,1) the point belongs to the FFDBox, using the input tolerance ---*/
32963309

32973310
if (((ParamCoord[0] >= - config->GetFFD_Tol()) && (ParamCoord[0] <= 1.0 + config->GetFFD_Tol())) &&
32983311
((ParamCoord[1] >= - config->GetFFD_Tol()) && (ParamCoord[1] <= 1.0 + config->GetFFD_Tol())) &&
32993312
((ParamCoord[2] >= - config->GetFFD_Tol()) && (ParamCoord[2] <= 1.0 + config->GetFFD_Tol()))) {
33003313

3314+
3315+
/*--- Rectification of the initial tolerance (we have detected situations
3316+
where 0.0 and 1.0 doesn't work properly ---*/
3317+
3318+
su2double lower_limit = config->GetFFD_Tol();
3319+
su2double upper_limit = 1.0-config->GetFFD_Tol();
3320+
3321+
if (ParamCoord[0] < lower_limit) ParamCoord[0] = lower_limit;
3322+
if (ParamCoord[1] < lower_limit) ParamCoord[1] = lower_limit;
3323+
if (ParamCoord[2] < lower_limit) ParamCoord[2] = lower_limit;
3324+
if (ParamCoord[0] > upper_limit) ParamCoord[0] = upper_limit;
3325+
if (ParamCoord[1] > upper_limit) ParamCoord[1] = upper_limit;
3326+
if (ParamCoord[2] > upper_limit) ParamCoord[2] = upper_limit;
3327+
33013328
/*--- Set the value of the parametric coordinate ---*/
33023329

33033330
FFDBox->Set_MarkerIndex(iMarker);
@@ -3306,40 +3333,19 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
33063333
FFDBox->Set_ParametricCoord(ParamCoord);
33073334
FFDBox->Set_CartesianCoord(CartCoord);
33083335

3309-
/*--- Compute the cartesian coordinates using the parametric coordinates
3310-
to check that everithing is right ---*/
3311-
3312-
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
3313-
3314-
/*--- Compute max difference between original value and the recomputed value ---*/
3315-
3316-
Diff = 0.0;
3317-
for (iDim = 0; iDim < nDim; iDim++)
3318-
Diff += (CartCoordNew[iDim]-CartCoord[iDim])*(CartCoordNew[iDim]-CartCoord[iDim]);
3319-
Diff = sqrt(Diff);
3320-
my_MaxDiff = max(my_MaxDiff, Diff);
3321-
33223336
ParamCoordGuess[0] = ParamCoord[0]; ParamCoordGuess[1] = ParamCoord[1]; ParamCoordGuess[2] = ParamCoord[2];
33233337

3338+
if (Diff >= config->GetFFD_Tol()) {
3339+
cout << "Please check this point: Local (" << ParamCoord[0] <<" "<< ParamCoord[1] <<" "<< ParamCoord[2] <<") <-> Global ("
3340+
<< CartCoord[0] <<" "<< CartCoord[1] <<" "<< CartCoord[2] <<") <-> Error "<< Diff <<" vs "<< config->GetFFD_Tol() <<"." << endl;
3341+
}
3342+
33243343
}
33253344
else {
33263345

3327-
/*--- Compute the cartesian coordinates using the parametric coordinates
3328-
to check that everithing is right ---*/
3329-
3330-
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
3331-
3332-
/*--- Compute max difference between original value and the recomputed value ---*/
3333-
3334-
Diff = 0.0;
3335-
for (iDim = 0; iDim < nDim; iDim++)
3336-
Diff += (CartCoordNew[iDim]-CartCoord[iDim])*(CartCoordNew[iDim]-CartCoord[iDim]);
3337-
Diff = sqrt(Diff);
3338-
my_MaxDiff = max(my_MaxDiff, Diff);
3339-
33403346
if (Diff >= config->GetFFD_Tol()) {
33413347
cout << "Please check this point: Local (" << ParamCoord[0] <<" "<< ParamCoord[1] <<" "<< ParamCoord[2] <<") <-> Global ("
3342-
<< CartCoord[0] <<" "<< CartCoord[1] <<" "<< CartCoord[2] <<") <-> Error "<< Diff <<"." <<endl;
3348+
<< CartCoord[0] <<" "<< CartCoord[1] <<" "<< CartCoord[2] <<") <-> Error "<< Diff <<" vs "<< config->GetFFD_Tol() <<"." << endl;
33433349
}
33443350

33453351
}
@@ -3348,7 +3354,7 @@ void CSurfaceMovement::SetParametricCoord(CGeometry *geometry, CConfig *config,
33483354
}
33493355
}
33503356
}
3351-
3357+
33523358
#ifdef HAVE_MPI
33533359
SU2_MPI::Barrier(MPI_COMM_WORLD);
33543360
SU2_MPI::Allreduce(&my_MaxDiff, &MaxDiff, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
@@ -3882,7 +3888,7 @@ void CSurfaceMovement::UpdateParametricCoord(CGeometry *geometry, CConfig *confi
38823888
FFDBox->Set_ParametricCoord(ParamCoord, iSurfacePoints);
38833889

38843890
/*--- Compute the cartesian coordinates using the parametric coordinates
3885-
to check that everithing is right ---*/
3891+
to check that everything is correct ---*/
38863892

38873893
CartCoordNew = FFDBox->EvalCartesianCoord(ParamCoord);
38883894

@@ -8660,22 +8666,22 @@ void CFreeFormDefBox::GetFFDHessian(su2double *uvw, su2double *xyz, su2double **
86608666
su2double *CFreeFormDefBox::GetParametricCoord_Iterative(unsigned long iPoint, su2double *xyz, su2double *ParamCoordGuess, CConfig *config) {
86618667

86628668
su2double *IndepTerm, SOR_Factor = 1.0, MinNormError, NormError, Determinant, AdjHessian[3][3], Temp[3] = {0.0,0.0,0.0};
8663-
unsigned short iDim, jDim, RandonCounter;
8664-
unsigned long iter;
8669+
unsigned short iDim, jDim, RandonCounter;
8670+
unsigned long iter;
86658671

8666-
su2double tol = config->GetFFD_Tol();
8672+
su2double tol = config->GetFFD_Tol()*1E-3;
86678673
unsigned short it_max = config->GetnFFD_Iter();
86688674
unsigned short Random_Trials = 500;
8669-
8675+
86708676
/*--- Allocate the Hessian ---*/
86718677

8672-
Hessian = new su2double* [nDim];
8678+
Hessian = new su2double* [nDim];
86738679
IndepTerm = new su2double [nDim];
8674-
for (iDim = 0; iDim < nDim; iDim++) {
8675-
Hessian[iDim] = new su2double[nDim];
8676-
ParamCoord[iDim] = ParamCoordGuess[iDim];
8677-
IndepTerm [iDim] = 0.0;
8678-
}
8680+
for (iDim = 0; iDim < nDim; iDim++) {
8681+
Hessian[iDim] = new su2double[nDim];
8682+
ParamCoord[iDim] = ParamCoordGuess[iDim];
8683+
IndepTerm [iDim] = 0.0;
8684+
}
86798685

86808686
RandonCounter = 0; MinNormError = 1E6;
86818687

SU2_CFD/include/solver_structure.hpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ class CSolver {
924924
* \param[in] val_marker - Surface marker where the boundary condition is applied.
925925
*/
926926
virtual void BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
927-
CConfig *config, unsigned short val_marker, bool inlet_surface);
927+
CConfig *config, unsigned short val_marker, bool val_inlet_surface);
928928

929929
/*!
930930
* \brief A virtual member.
@@ -1508,7 +1508,7 @@ class CSolver {
15081508
* \brief A virtual member.
15091509
* \param[in] val_Total_CD - Value of the total drag coefficient.
15101510
*/
1511-
virtual void SetTotal_NetCThrust(su2double val_Total_NetCThrust);
1511+
virtual void SetTotal_NetThrust(su2double val_Total_NetThrust);
15121512

15131513
/*!
15141514
* \brief A virtual member.
@@ -2260,7 +2260,7 @@ class CSolver {
22602260
* \brief A virtual member.
22612261
* \return Value of the drag coefficient (inviscid + viscous contribution).
22622262
*/
2263-
virtual su2double GetTotal_NetCThrust(void);
2263+
virtual su2double GetTotal_NetThrust(void);
22642264

22652265
/*!
22662266
* \brief A virtual member.
@@ -4463,7 +4463,7 @@ class CEulerSolver : public CSolver {
44634463
Total_CL_Prev, /*!< \brief Total lift coefficient for all the boundaries (fixed lift mode). */
44644464
Total_SolidCD, /*!< \brief Total drag coefficient for all the boundaries. */
44654465
Total_CD_Prev, /*!< \brief Total drag coefficient for all the boundaries (fixed lift mode). */
4466-
Total_NetCThrust, /*!< \brief Total drag coefficient for all the boundaries. */
4466+
Total_NetThrust, /*!< \brief Total drag coefficient for all the boundaries. */
44674467
Total_Power, /*!< \brief Total drag coefficient for all the boundaries. */
44684468
Total_ReverseFlow, /*!< \brief Total drag coefficient for all the boundaries. */
44694469
Total_IDC, /*!< \brief Total IDC coefficient for all the boundaries. */
@@ -4475,8 +4475,6 @@ class CEulerSolver : public CSolver {
44754475
Total_ByPassProp_Eff, /*!< \brief Total Mass Flow Ratio for all the boundaries. */
44764476
Total_Adiab_Eff, /*!< \brief Total Mass Flow Ratio for all the boundaries. */
44774477
Total_Poly_Eff, /*!< \brief Total Mass Flow Ratio for all the boundaries. */
4478-
Total_NetCThrust_Prev, /*!< \brief Total lift coefficient for all the boundaries. */
4479-
Total_BCThrust_Prev, /*!< \brief Total lift coefficient for all the boundaries. */
44804478
Total_Custom_ObjFunc, /*!< \brief Total custom objective function for all the boundaries. */
44814479
Total_CSF, /*!< \brief Total sideforce coefficient for all the boundaries. */
44824480
Total_CMx, /*!< \brief Total x moment coefficient for all the boundaries. */
@@ -5010,7 +5008,7 @@ class CEulerSolver : public CSolver {
50105008
* \param[in] val_marker - Surface marker where the boundary condition is applied.
50115009
*/
50125010
void BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
5013-
CConfig *config, unsigned short val_marker, bool inlet_surface);
5011+
CConfig *config, unsigned short val_marker, bool val_inlet_surface);
50145012

50155013
/*!
50165014
* \brief Impose the interface boundary condition using the residual.
@@ -5659,7 +5657,7 @@ class CEulerSolver : public CSolver {
56595657
* \brief Provide the total (inviscid + viscous) non dimensional drag coefficient.
56605658
* \return Value of the drag coefficient (inviscid + viscous contribution).
56615659
*/
5662-
su2double GetTotal_NetCThrust(void);
5660+
su2double GetTotal_NetThrust(void);
56635661

56645662
/*!
56655663
* \brief Provide the total (inviscid + viscous) non dimensional drag coefficient.
@@ -5863,7 +5861,7 @@ class CEulerSolver : public CSolver {
58635861
* \brief Store the total (inviscid + viscous) non dimensional drag coefficient.
58645862
* \param[in] val_Total_CD - Value of the total drag coefficient.
58655863
*/
5866-
void SetTotal_NetCThrust(su2double val_Total_NetCThrust);
5864+
void SetTotal_NetThrust(su2double val_Total_NetThrust);
58675865

58685866
/*!
58695867
* \brief Store the total (inviscid + viscous) non dimensional drag coefficient.
@@ -9538,7 +9536,7 @@ class CTurbSASolver: public CTurbSolver {
95389536
* \param[in] val_marker - Surface marker where the boundary condition is applied.
95399537
*/
95409538
void BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
9541-
CConfig *config, unsigned short val_marker, bool inlet_surface);
9539+
CConfig *config, unsigned short val_marker, bool val_inlet_surface);
95429540

95439541
/*!
95449542
* \brief Set the solution using the Freestream values.
@@ -10353,7 +10351,7 @@ class CAdjEulerSolver : public CSolver {
1035310351
* \param[in] val_marker - Surface marker where the boundary condition is applied.
1035410352
*/
1035510353
void BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
10356-
CConfig *config, unsigned short val_marker, bool inlet_surface);
10354+
CConfig *config, unsigned short val_marker, bool val_inlet_surface);
1035710355

1035810356
/*!
1035910357
* \brief Impose via the residual the adjoint symmetry boundary condition.

SU2_CFD/include/solver_structure.inl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ inline su2double CSolver::GetTotal_CL() { return 0; }
338338

339339
inline su2double CSolver::GetTotal_CD() { return 0; }
340340

341-
inline su2double CSolver::GetTotal_NetCThrust() { return 0; }
341+
inline su2double CSolver::GetTotal_NetThrust() { return 0; }
342342

343343
inline su2double CSolver::GetTotal_Power() { return 0; }
344344

@@ -468,7 +468,7 @@ inline void CSolver::SetTotal_CL(su2double val_Total_CL) { }
468468

469469
inline void CSolver::SetTotal_CD(su2double val_Total_CD) { }
470470

471-
inline void CSolver::SetTotal_NetCThrust(su2double val_Total_NetCThrust) { }
471+
inline void CSolver::SetTotal_NetThrust(su2double val_Total_NetThrust) { }
472472

473473
inline void CSolver::SetTotal_Power(su2double val_Total_Power) { }
474474

@@ -732,7 +732,7 @@ inline void CSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_con
732732
CConfig *config, unsigned short val_marker) { }
733733

734734
inline void CSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
735-
CConfig *config, unsigned short val_marker, bool inlet_surface) { }
735+
CConfig *config, unsigned short val_marker, bool val_inlet_surface) { }
736736

737737
inline void CSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
738738
CConfig *config, unsigned short val_marker) { }
@@ -1311,7 +1311,7 @@ inline su2double CEulerSolver::GetTotal_ComboObj() { return Total_ComboObj; }
13111311

13121312
inline su2double CEulerSolver::GetTotal_CD() { return Total_CD; }
13131313

1314-
inline su2double CEulerSolver::GetTotal_NetCThrust() { return Total_NetCThrust; }
1314+
inline su2double CEulerSolver::GetTotal_NetThrust() { return Total_NetThrust; }
13151315

13161316
inline su2double CEulerSolver::GetTotal_Power() { return Total_Power; }
13171317

@@ -1405,7 +1405,7 @@ inline void CEulerSolver::SetTotal_CL(su2double val_Total_CL) { Total_CL = val_T
14051405

14061406
inline void CEulerSolver::SetTotal_CD(su2double val_Total_CD) { Total_CD = val_Total_CD; }
14071407

1408-
inline void CEulerSolver::SetTotal_NetCThrust(su2double val_Total_NetCThrust) { Total_NetCThrust = val_Total_NetCThrust; }
1408+
inline void CEulerSolver::SetTotal_NetThrust(su2double val_Total_NetThrust) { Total_NetThrust = val_Total_NetThrust; }
14091409

14101410
inline void CEulerSolver::SetTotal_Power(su2double val_Total_Power) { Total_Power = val_Total_Power; }
14111411

0 commit comments

Comments
 (0)