Skip to content

Commit 89c95ba

Browse files
committed
Merge remote-tracking branch 'origin/feature_tag_debug_tape' into feature_mz_adjoint_for_turbo
2 parents c002911 + 13ca3f5 commit 89c95ba

40 files changed

+922
-372
lines changed

.github/workflows/regression.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
210210
with:
211211
# -t <Tutorials-branch> -c <Testcases-branch>
212-
args: -b ${{github.ref}} -t feature_solid-solid_cht -c develop -s ${{matrix.testscript}}
212+
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
213213
- name: Cleanup
214214
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
215215
with:

Common/include/CConfig.hpp

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class CConfig {
138138
su2double Buffet_lambda; /*!< \brief Offset parameter for buffet sensor.*/
139139
su2double Damp_Engine_Inflow; /*!< \brief Damping factor for the engine inlet. */
140140
su2double Damp_Engine_Exhaust; /*!< \brief Damping factor for the engine exhaust. */
141+
unsigned long Bc_Eval_Freq; /*!< \brief Evaluation frequency for Engine and Actuator disk markers. */
141142
su2double Damp_Res_Restric, /*!< \brief Damping factor for the residual restriction. */
142143
Damp_Correc_Prolong; /*!< \brief Damping factor for the correction prolongation. */
143144
su2double Position_Plane; /*!< \brief Position of the Near-Field (y coordinate 2D, and z coordinate 3D). */
@@ -236,6 +237,7 @@ class CConfig {
236237
*Marker_MixingPlaneInterface, /*!< \brief MixingPlane interface boundary markers. */
237238
*Marker_TurboBoundIn, /*!< \brief Turbomachinery performance boundary markers. */
238239
*Marker_TurboBoundOut, /*!< \brief Turbomachinery performance boundary donor markers. */
240+
*Marker_Turbomachinery, /*!< \breif Turbomachinery markers */
239241
*Marker_NearFieldBound, /*!< \brief Near Field boundaries markers. */
240242
*Marker_Deform_Mesh, /*!< \brief Deformable markers at the boundary. */
241243
*Marker_Deform_Mesh_Sym_Plane, /*!< \brief Marker with symmetric deformation. */
@@ -442,6 +444,7 @@ class CConfig {
442444

443445
TURBO_PERF_KIND *Kind_TurboPerf; /*!< \brief Kind of turbomachynery architecture.*/
444446
TURBOMACHINERY_TYPE *Kind_TurboMachinery;
447+
su2vector<TURBO_INTERFACE_KIND> Kind_TurboInterface;
445448

446449
/* Turbomachinery objective functions */
447450
su2double *EntropyGeneration;
@@ -470,6 +473,7 @@ class CConfig {
470473
unsigned short* nDV_Value; /*!< \brief Number of values for each design variable (might be different than 1 if we allow arbitrary movement). */
471474
unsigned short nFFDBox; /*!< \brief Number of ffd boxes. */
472475
unsigned short nTurboMachineryKind; /*!< \brief Number turbomachinery types specified. */
476+
unsigned short nTurboInterfaces; /*!< \brief Number of turbomachiery interfaces */
473477
unsigned short nParamDV; /*!< \brief Number of parameters of the design variable. */
474478
string DV_Filename; /*!< \brief Filename for providing surface positions from an external parameterization. */
475479
string DV_Unordered_Sens_Filename; /*!< \brief Filename of volume sensitivities in an unordered ASCII format. */
@@ -750,6 +754,7 @@ class CConfig {
750754
*Marker_All_Turbomachinery, /*!< \brief Global index for Turbomachinery markers using the grid information. */
751755
*Marker_All_TurbomachineryFlag, /*!< \brief Global index for Turbomachinery markers flag using the grid information. */
752756
*Marker_All_MixingPlaneInterface, /*!< \brief Global index for MixingPlane interface markers using the grid information. */
757+
*Marker_All_Giles, /*!< \brief Global index for Giles markers using the grid information. */
753758
*Marker_All_DV, /*!< \brief Global index for design variable markers using the grid information. */
754759
*Marker_All_Moving, /*!< \brief Global index for moving surfaces using the grid information. */
755760
*Marker_All_Deform_Mesh, /*!< \brief Global index for deformable markers at the boundary. */
@@ -767,6 +772,7 @@ class CConfig {
767772
*Marker_CfgFile_Turbomachinery, /*!< \brief Global index for Turbomachinery using the config information. */
768773
*Marker_CfgFile_TurbomachineryFlag, /*!< \brief Global index for Turbomachinery flag using the config information. */
769774
*Marker_CfgFile_MixingPlaneInterface, /*!< \brief Global index for MixingPlane interface using the config information. */
775+
*Marker_CfgFile_Giles, /*!< \brief Global index for Giles markers flag using the config information. */
770776
*Marker_CfgFile_Moving, /*!< \brief Global index for moving surfaces using the config information. */
771777
*Marker_CfgFile_Deform_Mesh, /*!< \brief Global index for deformable markers at the boundary. */
772778
*Marker_CfgFile_Deform_Mesh_Sym_Plane, /*!< \brief Global index for markers with symmetric deformations. */
@@ -1051,7 +1057,8 @@ class CConfig {
10511057
long ParMETIS_pointWgt; /*!< \brief Load balancing weight given to points. */
10521058
long ParMETIS_edgeWgt; /*!< \brief Load balancing weight given to edges. */
10531059
unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */
1054-
bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */
1060+
bool DiscreteAdjoint, /*!< \brief AD-based discrete adjoint mode. */
1061+
DiscreteAdjointDebug; /*!< \brief Discrete adjoint debug mode using tags. */
10551062
su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */
10561063
WINDOW_FUNCTION Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
10571064
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
@@ -1379,7 +1386,7 @@ class CConfig {
13791386
su2double** & RotCenter, su2double** & RotAngles, su2double** & Translation);
13801387

13811388
void addTurboPerfOption(const string & name, unsigned short & nMarker_TurboPerf,
1382-
string* & Marker_TurboBoundIn, string* & Marker_TurboBoundOut);
1389+
string* & Marker_TurboBoundIn, string* & Marker_TurboBoundOut, string* & Marker_Turbomachinery);
13831390

13841391
void addActDiskOption(const string & name,
13851392
unsigned short & nMarker_ActDiskInlet, unsigned short & nMarker_ActDiskOutlet, string* & Marker_ActDiskInlet, string* & Marker_ActDiskOutlet,
@@ -3517,6 +3524,13 @@ class CConfig {
35173524
*/
35183525
void SetMarker_All_MixingPlaneInterface(unsigned short val_marker, unsigned short val_mixpla_interface) { Marker_All_MixingPlaneInterface[val_marker] = val_mixpla_interface; }
35193526

3527+
/*!
3528+
* \brief Set if a marker <i>val_marker</i> is part of the Giles boundary (read from the config file).
3529+
* \param[in] val_marker - Index of the marker in which we are interested.
3530+
* \param[in] val_giles - 0 if not part of the Giles boundary or greater than 1 if it is part.
3531+
*/
3532+
void SetMarker_All_Giles(unsigned short val_marker, unsigned short val_giles) { Marker_All_Giles[val_marker] = val_giles; }
3533+
35203534
/*!
35213535
* \brief Set if a marker <i>val_marker</i> is going to be affected by design variables <i>val_moving</i>
35223536
* (read from the config file).
@@ -3663,6 +3677,13 @@ class CConfig {
36633677
*/
36643678
unsigned short GetMarker_All_TurbomachineryFlag(unsigned short val_marker) const { return Marker_All_TurbomachineryFlag[val_marker]; }
36653679

3680+
/*!
3681+
* \brief Get the Giles boundary information for a marker <i>val_marker</i>.
3682+
* \param[in] val_marker value of the marker on the grid.
3683+
* \return 0 if is not part of the MixingPlane Interface and greater than 1 if it is part.
3684+
*/
3685+
unsigned short GetMarker_All_Giles(unsigned short val_marker) const { return Marker_All_Giles[val_marker]; }
3686+
36663687
/*!
36673688
* \brief Get the number of FSI interface markers <i>val_marker</i>.
36683689
* \param[in] void.
@@ -5339,6 +5360,12 @@ class CConfig {
53395360
*/
53405361
TURBO_PERF_KIND GetKind_TurboPerf(unsigned short val_iZone) const { return Kind_TurboPerf[val_iZone]; };
53415362

5363+
/*!
5364+
* \brief gets interface kind for an interface marker in turbomachinery problem
5365+
* \return interface kind
5366+
*/
5367+
TURBO_INTERFACE_KIND GetKind_TurboInterface(unsigned short interfaceIndex) const { return Kind_TurboInterface[interfaceIndex]; }
5368+
53425369
/*!
53435370
* \brief get outlet bounds name for Turbomachinery performance calculation.
53445371
* \return name of the bound.
@@ -6402,6 +6429,12 @@ class CConfig {
64026429
*/
64036430
unsigned short GetMarker_CfgFile_MixingPlaneInterface(const string& val_marker) const;
64046431

6432+
/*!
6433+
* \brief Get the Giles boundary information from the config definition for the marker <i>val_marker</i>.
6434+
* \return Plotting information of the boundary in the config information for the marker <i>val_marker</i>.
6435+
*/
6436+
unsigned short GetMarker_CfgFile_Giles(const string& val_marker) const;
6437+
64056438
/*!
64066439
* \brief Get the DV information from the config definition for the marker <i>val_marker</i>.
64076440
* \return DV information of the boundary in the config information for the marker <i>val_marker</i>.
@@ -6520,6 +6553,12 @@ class CConfig {
65206553
*/
65216554
su2double GetMinLogResidual(void) const { return MinLogResidual; }
65226555

6556+
/*!
6557+
* \brief Evaluation frequency for Engine and Actuator disk markers.
6558+
* \return Value Evaluation frequency .
6559+
*/
6560+
unsigned long GetBc_Eval_Freq(void) const { return Bc_Eval_Freq; }
6561+
65236562
/*!
65246563
* \brief Value of the damping factor for the engine inlet bc.
65256564
* \return Value of the damping factor.
@@ -8911,6 +8950,12 @@ class CConfig {
89118950
*/
89128951
bool GetDiscrete_Adjoint(void) const { return DiscreteAdjoint; }
89138952

8953+
/*!
8954+
* \brief Get the indicator whether a debug run for the discrete adjoint solver will be started.
8955+
* \return the discrete adjoint debug indicator.
8956+
*/
8957+
bool GetDiscrete_Adjoint_Debug(void) const { return DiscreteAdjointDebug; }
8958+
89148959
/*!
89158960
* \brief Get the number of subiterations while a ramp is applied.
89168961
* \return Number of FSI subiters.

Common/include/basic_types/ad_structure.hpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ inline void SetExtFuncOut(T&& data, const int size_x, const int size_y) {}
261261
*/
262262
inline void SetIndex(int& index, const su2double& data) {}
263263

264+
/*!
265+
* \brief Sets the tag tape to a specific tag.
266+
* \param[in] tag - the number to which the tag is set.
267+
*/
268+
inline void SetTag(int tag) {}
269+
264270
/*!
265271
* \brief Pushes back the current tape position to the tape position's vector.
266272
*/
@@ -472,6 +478,8 @@ FORCEINLINE void EndUseAdjoints() { AD::getTape().endUseAdjointVector(); }
472478

473479
FORCEINLINE void SetIndex(int& index, const su2double& data) { index = data.getIdentifier(); }
474480

481+
FORCEINLINE void SetTag(int tag) { AD::getTape().setCurTag(tag); }
482+
475483
// WARNING: For performance reasons, this method does not perform bounds checking.
476484
// When using it, please ensure sufficient adjoint vector size by a call to AD::ResizeAdjoints().
477485
// This method does not perform locking either.
@@ -502,7 +510,8 @@ FORCEINLINE void SetPreaccIn() {}
502510
template <class T, class... Ts, su2enable_if<std::is_same<T, su2double>::value> = 0>
503511
FORCEINLINE void SetPreaccIn(const T& data, Ts&&... moreData) {
504512
if (!PreaccActive) return;
505-
if (IsIdentifierActive(data)) PreaccHelper.addInput(data);
513+
// if (IsIdentifierActive(data))
514+
PreaccHelper.addInput(data);
506515
SetPreaccIn(moreData...);
507516
}
508517

@@ -515,9 +524,9 @@ template <class T>
515524
FORCEINLINE void SetPreaccIn(const T& data, const int size) {
516525
if (PreaccActive) {
517526
for (int i = 0; i < size; i++) {
518-
if (IsIdentifierActive(data[i])) {
527+
// if (IsIdentifierActive(data[i])) {
519528
PreaccHelper.addInput(data[i]);
520-
}
529+
// }
521530
}
522531
}
523532
}
@@ -527,9 +536,9 @@ FORCEINLINE void SetPreaccIn(const T& data, const int size_x, const int size_y)
527536
if (!PreaccActive) return;
528537
for (int i = 0; i < size_x; i++) {
529538
for (int j = 0; j < size_y; j++) {
530-
if (IsIdentifierActive(data[i][j])) {
539+
// if (IsIdentifierActive(data[i][j])) {
531540
PreaccHelper.addInput(data[i][j]);
532-
}
541+
// }
533542
}
534543
}
535544
}
@@ -547,17 +556,18 @@ FORCEINLINE void SetPreaccOut() {}
547556
template <class T, class... Ts, su2enable_if<std::is_same<T, su2double>::value> = 0>
548557
FORCEINLINE void SetPreaccOut(T& data, Ts&&... moreData) {
549558
if (!PreaccActive) return;
550-
if (IsIdentifierActive(data)) PreaccHelper.addOutput(data);
559+
// if (IsIdentifierActive(data))
560+
PreaccHelper.addOutput(data);
551561
SetPreaccOut(moreData...);
552562
}
553563

554564
template <class T>
555565
FORCEINLINE void SetPreaccOut(T&& data, const int size) {
556566
if (PreaccActive) {
557567
for (int i = 0; i < size; i++) {
558-
if (IsIdentifierActive(data[i])) {
568+
// if (IsIdentifierActive(data[i])) {
559569
PreaccHelper.addOutput(data[i]);
560-
}
570+
// }
561571
}
562572
}
563573
}
@@ -567,9 +577,9 @@ FORCEINLINE void SetPreaccOut(T&& data, const int size_x, const int size_y) {
567577
if (!PreaccActive) return;
568578
for (int i = 0; i < size_x; i++) {
569579
for (int j = 0; j < size_y; j++) {
570-
if (IsIdentifierActive(data[i][j])) {
580+
// if (IsIdentifierActive(data[i][j])) {
571581
PreaccHelper.addOutput(data[i][j]);
572-
}
582+
// }
573583
}
574584
}
575585
}

Common/include/option_structure.hpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ enum BC_TYPE {
16221622
FLUID_INTERFACE = 39, /*!< \brief Domain interface definition. */
16231623
DISP_DIR_BOUNDARY = 40, /*!< \brief Boundary displacement definition. */
16241624
DAMPER_BOUNDARY = 41, /*!< \brief Damper. */
1625+
MIXING_PLANE_INTERFACE = 42, /*< \breif Mxing plane */
16251626
CHT_WALL_INTERFACE = 50, /*!< \brief Domain interface definition. */
16261627
SMOLUCHOWSKI_MAXWELL = 55, /*!< \brief Smoluchoski/Maxwell wall boundary condition. */
16271628
SEND_RECEIVE = 99, /*!< \brief Boundary send-receive definition. */
@@ -1752,7 +1753,8 @@ enum RIEMANN_TYPE {
17521753
TOTAL_CONDITIONS_PT_1D = 11,
17531754
STATIC_PRESSURE_1D = 12,
17541755
MIXING_IN_1D = 13,
1755-
MIXING_OUT_1D =14
1756+
MIXING_OUT_1D = 14,
1757+
MASS_FLOW_OUTLET = 15
17561758
};
17571759
static const MapType<std::string, RIEMANN_TYPE> Riemann_Map = {
17581760
MakePair("TOTAL_CONDITIONS_PT", TOTAL_CONDITIONS_PT)
@@ -1769,6 +1771,7 @@ static const MapType<std::string, RIEMANN_TYPE> Riemann_Map = {
17691771
MakePair("RADIAL_EQUILIBRIUM", RADIAL_EQUILIBRIUM)
17701772
MakePair("TOTAL_CONDITIONS_PT_1D", TOTAL_CONDITIONS_PT_1D)
17711773
MakePair("STATIC_PRESSURE_1D", STATIC_PRESSURE_1D)
1774+
MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET)
17721775
};
17731776

17741777
static const MapType<std::string, RIEMANN_TYPE> Giles_Map = {
@@ -1786,6 +1789,7 @@ static const MapType<std::string, RIEMANN_TYPE> Giles_Map = {
17861789
MakePair("RADIAL_EQUILIBRIUM", RADIAL_EQUILIBRIUM)
17871790
MakePair("TOTAL_CONDITIONS_PT_1D", TOTAL_CONDITIONS_PT_1D)
17881791
MakePair("STATIC_PRESSURE_1D", STATIC_PRESSURE_1D)
1792+
MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET)
17891793
};
17901794

17911795
/*!
@@ -1862,6 +1866,18 @@ static const MapType<std::string, TURBO_PERF_KIND> TurboPerfKind_Map = {
18621866
MakePair("PROPELLOR", TURBO_PERF_KIND::PROPELLOR)
18631867
};
18641868

1869+
/*!
1870+
* \brief Types of Turbomachinery interfaces.
1871+
*/
1872+
enum class TURBO_INTERFACE_KIND{
1873+
MIXING_PLANE = ENUM_TRANSFER::MIXING_PLANE,
1874+
FROZEN_ROTOR = ENUM_TRANSFER::SLIDING_INTERFACE,
1875+
};
1876+
static const MapType<std::string, TURBO_INTERFACE_KIND> TurboInterfaceKind_Map = {
1877+
MakePair("MIXING_PLANE", TURBO_INTERFACE_KIND::MIXING_PLANE)
1878+
MakePair("FROZEN_ROTOR", TURBO_INTERFACE_KIND::FROZEN_ROTOR)
1879+
};
1880+
18651881
/*!
18661882
* \brief Types of Turbomachinery performance flag.
18671883
*/
@@ -2483,6 +2499,8 @@ enum class RECORDING {
24832499
MESH_COORDS,
24842500
MESH_DEFORM,
24852501
SOLUTION_AND_MESH,
2502+
TAG_INIT_SOLUTION_VARIABLES,
2503+
TAG_CHECK_SOLUTION_VARIABLES
24862504
};
24872505

24882506
/*!

Common/include/option_structure.inl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,11 +1606,15 @@ class COptionTurboPerformance : public COptionBase {
16061606
unsigned short& size;
16071607
string*& marker_turboIn;
16081608
string*& marker_turboOut;
1609+
string*& markers;
16091610

16101611
public:
16111612
COptionTurboPerformance(const string option_field_name, unsigned short& nMarker_TurboPerf,
1612-
string*& Marker_TurboBoundIn, string*& Marker_TurboBoundOut)
1613-
: size(nMarker_TurboPerf), marker_turboIn(Marker_TurboBoundIn), marker_turboOut(Marker_TurboBoundOut) {
1613+
string*& Marker_TurboBoundIn, string*& Marker_TurboBoundOut, string*& Marker_Turbomachinery)
1614+
: size(nMarker_TurboPerf),
1615+
marker_turboIn(Marker_TurboBoundIn),
1616+
marker_turboOut(Marker_TurboBoundOut),
1617+
markers(Marker_Turbomachinery) {
16141618
this->name = option_field_name;
16151619
}
16161620

@@ -1624,6 +1628,7 @@ class COptionTurboPerformance : public COptionBase {
16241628
this->size = 0;
16251629
this->marker_turboIn = nullptr;
16261630
this->marker_turboOut = nullptr;
1631+
this->markers = nullptr;
16271632
return "";
16281633
}
16291634

@@ -1634,10 +1639,16 @@ class COptionTurboPerformance : public COptionBase {
16341639
this->size = 0;
16351640
this->marker_turboIn = nullptr;
16361641
this->marker_turboOut = nullptr;
1642+
this->markers = nullptr;
16371643
;
16381644
return newstring;
16391645
}
16401646

1647+
this->markers = new string[totalVals];
1648+
for (unsigned long i = 0; i < totalVals; i++) {
1649+
this->markers[i].assign(option_value[i]);
1650+
}
1651+
16411652
unsigned long nVals = totalVals / mod_num;
16421653
this->size = nVals;
16431654
this->marker_turboIn = new string[nVals];
@@ -1654,6 +1665,7 @@ class COptionTurboPerformance : public COptionBase {
16541665
this->size = 0;
16551666
this->marker_turboIn = nullptr;
16561667
this->marker_turboOut = nullptr;
1668+
this->markers = nullptr;
16571669
}
16581670
};
16591671

0 commit comments

Comments
 (0)