Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Multizone discrete adjoints for turbomachinery #2317

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3801e4d
Throw error message in case the multizone discrete adjoint solver wil…
oleburghardt Aug 14, 2024
0e5f95b
Softcode indentifier/index.
oleburghardt Aug 15, 2024
dc38cc3
Add tag type option to build system.
oleburghardt Aug 15, 2024
19a1a70
Add option to use RealReverseTag as AD type.
oleburghardt Aug 25, 2024
36c922e
Temporarily adjust/hardcode type size for memory alignment in vectori…
oleburghardt Aug 25, 2024
84e97f4
added turbo obj funcs
joshkellyjak Aug 29, 2024
e68f844
Merge branch 'develop' into feature_mz_adjoint_for_turbo
joshkellyjak Aug 29, 2024
bb0831d
thems the breaks
joshkellyjak Aug 29, 2024
4327942
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Aug 29, 2024
ae68274
Merge branch 'develop' into feature_mz_adjoint_for_turbo
joshkellyjak Aug 30, 2024
905f1e6
Resource releasing
joshkellyjak Aug 30, 2024
da21602
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Aug 30, 2024
9f1b07c
Merge remote-tracking branch 'upstream/feature_tag_debug_tape' into f…
joshkellyjak Sep 2, 2024
54515e9
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Sep 3, 2024
c002911
Revert "Merge remote-tracking branch 'upstream/feature_tag_debug_tape…
joshkellyjak Sep 3, 2024
5a9773c
formatting
joshkellyjak Sep 4, 2024
6e65dd1
Add config option and indicator for a debug discrete adjoint run.
oleburghardt Sep 24, 2024
82f69e9
Add routines for setting tags to AD structure.
oleburghardt Sep 24, 2024
9de8e93
Add kinds of recording for tag tapes.
oleburghardt Sep 24, 2024
57fbcea
Comment out checks in AD structure whether an identifier is active. T…
oleburghardt Sep 24, 2024
3da17d8
Add first WIP version of the tag debug mode to the (multizone) discre…
oleburghardt Sep 24, 2024
b0e7c86
Fix preaccumulation error in ComputeVorticityAndStrainMag (first debu…
oleburghardt Sep 24, 2024
688797a
Merge branch 'develop' into feature_tag_debug_tape
joshkellyjak Sep 24, 2024
8556c2a
Revert small change (will be added to CoDi soon).
oleburghardt Sep 24, 2024
683de77
Resolves tag errors in turbo mode
joshkellyjak Sep 26, 2024
13ca3f5
Revert "Resolves tag errors in turbo mode"
joshkellyjak Sep 26, 2024
89c95ba
Merge remote-tracking branch 'origin/feature_tag_debug_tape' into fea…
joshkellyjak Sep 26, 2024
e1a04fa
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Sep 26, 2024
887e9e6
Resolving tag errors
joshkellyjak Sep 26, 2024
08b7979
Merge branch 'feature_mz_adjoint_for_turbo' of https://github.com/su2…
joshkellyjak Sep 26, 2024
e40f943
Revert "Merge remote-tracking branch 'origin/feature_tag_debug_tape' …
joshkellyjak Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
args: -b ${{github.ref}} -t feature_solid-solid_cht -c develop -s ${{matrix.testscript}}
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
Expand Down
87 changes: 47 additions & 40 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class CConfig {
su2double Buffet_lambda; /*!< \brief Offset parameter for buffet sensor.*/
su2double Damp_Engine_Inflow; /*!< \brief Damping factor for the engine inlet. */
su2double Damp_Engine_Exhaust; /*!< \brief Damping factor for the engine exhaust. */
unsigned long Bc_Eval_Freq; /*!< \brief Evaluation frequency for Engine and Actuator disk markers. */
su2double Damp_Res_Restric, /*!< \brief Damping factor for the residual restriction. */
Damp_Correc_Prolong; /*!< \brief Damping factor for the correction prolongation. */
su2double Position_Plane; /*!< \brief Position of the Near-Field (y coordinate 2D, and z coordinate 3D). */
Expand Down Expand Up @@ -237,7 +236,6 @@ class CConfig {
*Marker_MixingPlaneInterface, /*!< \brief MixingPlane interface boundary markers. */
*Marker_TurboBoundIn, /*!< \brief Turbomachinery performance boundary markers. */
*Marker_TurboBoundOut, /*!< \brief Turbomachinery performance boundary donor markers. */
*Marker_Turbomachinery, /*!< \breif Turbomachinery markers */
*Marker_NearFieldBound, /*!< \brief Near Field boundaries markers. */
*Marker_Deform_Mesh, /*!< \brief Deformable markers at the boundary. */
*Marker_Deform_Mesh_Sym_Plane, /*!< \brief Marker with symmetric deformation. */
Expand Down Expand Up @@ -444,7 +442,11 @@ class CConfig {

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

/* Turbomachinery objective functions */
su2double *EntropyGeneration;
su2double *TotalPressureLoss;
su2double *KineticEnergyLoss;

/* Gradient smoothing options */
su2double SmoothingEps1; /*!< \brief Parameter for the identity part in gradient smoothing. */
Expand All @@ -468,7 +470,6 @@ class CConfig {
unsigned short* nDV_Value; /*!< \brief Number of values for each design variable (might be different than 1 if we allow arbitrary movement). */
unsigned short nFFDBox; /*!< \brief Number of ffd boxes. */
unsigned short nTurboMachineryKind; /*!< \brief Number turbomachinery types specified. */
unsigned short nTurboInterfaces; /*!< \brief Number of turbomachiery interfaces */
unsigned short nParamDV; /*!< \brief Number of parameters of the design variable. */
string DV_Filename; /*!< \brief Filename for providing surface positions from an external parameterization. */
string DV_Unordered_Sens_Filename; /*!< \brief Filename of volume sensitivities in an unordered ASCII format. */
Expand Down Expand Up @@ -749,7 +750,6 @@ class CConfig {
*Marker_All_Turbomachinery, /*!< \brief Global index for Turbomachinery markers using the grid information. */
*Marker_All_TurbomachineryFlag, /*!< \brief Global index for Turbomachinery markers flag using the grid information. */
*Marker_All_MixingPlaneInterface, /*!< \brief Global index for MixingPlane interface markers using the grid information. */
*Marker_All_Giles, /*!< \brief Global index for Giles markers using the grid information. */
*Marker_All_DV, /*!< \brief Global index for design variable markers using the grid information. */
*Marker_All_Moving, /*!< \brief Global index for moving surfaces using the grid information. */
*Marker_All_Deform_Mesh, /*!< \brief Global index for deformable markers at the boundary. */
Expand All @@ -767,7 +767,6 @@ class CConfig {
*Marker_CfgFile_Turbomachinery, /*!< \brief Global index for Turbomachinery using the config information. */
*Marker_CfgFile_TurbomachineryFlag, /*!< \brief Global index for Turbomachinery flag using the config information. */
*Marker_CfgFile_MixingPlaneInterface, /*!< \brief Global index for MixingPlane interface using the config information. */
*Marker_CfgFile_Giles, /*!< \brief Global index for Giles markers flag using the config information. */
*Marker_CfgFile_Moving, /*!< \brief Global index for moving surfaces using the config information. */
*Marker_CfgFile_Deform_Mesh, /*!< \brief Global index for deformable markers at the boundary. */
*Marker_CfgFile_Deform_Mesh_Sym_Plane, /*!< \brief Global index for markers with symmetric deformations. */
Expand Down Expand Up @@ -1380,7 +1379,7 @@ class CConfig {
su2double** & RotCenter, su2double** & RotAngles, su2double** & Translation);

void addTurboPerfOption(const string & name, unsigned short & nMarker_TurboPerf,
string* & Marker_TurboBoundIn, string* & Marker_TurboBoundOut, string* & Marker_Turbomachinery);
string* & Marker_TurboBoundIn, string* & Marker_TurboBoundOut);

void addActDiskOption(const string & name,
unsigned short & nMarker_ActDiskInlet, unsigned short & nMarker_ActDiskOutlet, string* & Marker_ActDiskInlet, string* & Marker_ActDiskOutlet,
Expand Down Expand Up @@ -3518,13 +3517,6 @@ class CConfig {
*/
void SetMarker_All_MixingPlaneInterface(unsigned short val_marker, unsigned short val_mixpla_interface) { Marker_All_MixingPlaneInterface[val_marker] = val_mixpla_interface; }

/*!
* \brief Set if a marker <i>val_marker</i> is part of the Giles boundary (read from the config file).
* \param[in] val_marker - Index of the marker in which we are interested.
* \param[in] val_giles - 0 if not part of the Giles boundary or greater than 1 if it is part.
*/
void SetMarker_All_Giles(unsigned short val_marker, unsigned short val_giles) { Marker_All_Giles[val_marker] = val_giles; }

/*!
* \brief Set if a marker <i>val_marker</i> is going to be affected by design variables <i>val_moving</i>
* (read from the config file).
Expand Down Expand Up @@ -3671,13 +3663,6 @@ class CConfig {
*/
unsigned short GetMarker_All_TurbomachineryFlag(unsigned short val_marker) const { return Marker_All_TurbomachineryFlag[val_marker]; }

/*!
* \brief Get the Giles boundary information for a marker <i>val_marker</i>.
* \param[in] val_marker value of the marker on the grid.
* \return 0 if is not part of the MixingPlane Interface and greater than 1 if it is part.
*/
unsigned short GetMarker_All_Giles(unsigned short val_marker) const { return Marker_All_Giles[val_marker]; }

/*!
* \brief Get the number of FSI interface markers <i>val_marker</i>.
* \param[in] void.
Expand Down Expand Up @@ -5354,12 +5339,6 @@ class CConfig {
*/
TURBO_PERF_KIND GetKind_TurboPerf(unsigned short val_iZone) const { return Kind_TurboPerf[val_iZone]; };

/*!
* \brief gets interface kind for an interface marker in turbomachinery problem
* \return interface kind
*/
TURBO_INTERFACE_KIND GetKind_TurboInterface(unsigned short interfaceIndex) const { return Kind_TurboInterface[interfaceIndex]; }

/*!
* \brief get outlet bounds name for Turbomachinery performance calculation.
* \return name of the bound.
Expand Down Expand Up @@ -6423,12 +6402,6 @@ class CConfig {
*/
unsigned short GetMarker_CfgFile_MixingPlaneInterface(const string& val_marker) const;

/*!
* \brief Get the Giles boundary information from the config definition for the marker <i>val_marker</i>.
* \return Plotting information of the boundary in the config information for the marker <i>val_marker</i>.
*/
unsigned short GetMarker_CfgFile_Giles(const string& val_marker) const;

/*!
* \brief Get the DV information from the config definition for the marker <i>val_marker</i>.
* \return DV information of the boundary in the config information for the marker <i>val_marker</i>.
Expand Down Expand Up @@ -6547,12 +6520,6 @@ class CConfig {
*/
su2double GetMinLogResidual(void) const { return MinLogResidual; }

/*!
* \brief Evaluation frequency for Engine and Actuator disk markers.
* \return Value Evaluation frequency .
*/
unsigned long GetBc_Eval_Freq(void) const { return Bc_Eval_Freq; }

/*!
* \brief Value of the damping factor for the engine inlet bc.
* \return Value of the damping factor.
Expand Down Expand Up @@ -7978,7 +7945,28 @@ class CConfig {
void SetSurface_Species_Variance(unsigned short val_marker, su2double val_surface_species_variance) { Surface_Species_Variance[val_marker] = val_surface_species_variance; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \brief Set entropy generation for a turbomachinery zone
* \param[in] val_iZone - zone index
* \param[in] val_entropy_generation - value of entropy generation
*/
void SetEntropyGeneration(unsigned short val_iZone, su2double val_entropy_generation) { EntropyGeneration[val_iZone] = val_entropy_generation; }

/*!
* \brief Get total pressure loss for a turbomachinery zone
* \param[in] val_iZone - zone index
* \param[in] val_total_pressure_loss - value of total pressure loss
*/
void SetTotalPressureLoss(unsigned short val_iZone, su2double val_total_pressure_loss) { TotalPressureLoss[val_iZone] = val_total_pressure_loss; }

/*!
* \brief Get kinetic energy loss for a turbomachinery zone
* \param[in] val_iZone - zone index
* \param[in] val_kinetic_energy_loss - value of kinetic energy loss
*/
void SetKineticEnergyLoss(unsigned short val_iZone, su2double val_kinetic_energy_loss) { KineticEnergyLoss[val_iZone] = val_kinetic_energy_loss; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.ß
* \param[in] val_index - Index corresponding to the outlet boundary.
* \return The outlet pressure.
*/
Expand Down Expand Up @@ -8257,6 +8245,25 @@ class CConfig {
*/
su2double GetSurface_Species_Variance(unsigned short val_marker) const { return Surface_Species_Variance[val_marker]; }

/*!
* \brief Get entropy generation for a turbomachine at a boundary
* \param[in] val_iZone - zone index
*/
su2double GetEntropyGeneration(unsigned short val_iZone) const { return EntropyGeneration[val_iZone]; }

/*!
* \brief Get total pressure loss for a turbomachinery zone
* \param[in] val_iZone - zone index
*/
su2double GetTotalPressureLoss(unsigned short val_iZone) const { return TotalPressureLoss[val_iZone]; }

/*!
* \brief Get kinetic energy loss for a turbomachinery zone
* \param[in] val_iZone - zone index
*/
su2double GetKineticEnergyLoss(unsigned short val_iZone) const { return KineticEnergyLoss[val_iZone]; }


/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \param[in] val_index - Index corresponding to the outlet boundary.
Expand Down
24 changes: 7 additions & 17 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,6 @@ enum BC_TYPE {
FLUID_INTERFACE = 39, /*!< \brief Domain interface definition. */
DISP_DIR_BOUNDARY = 40, /*!< \brief Boundary displacement definition. */
DAMPER_BOUNDARY = 41, /*!< \brief Damper. */
MIXING_PLANE_INTERFACE = 42, /*< \breif Mxing plane */
CHT_WALL_INTERFACE = 50, /*!< \brief Domain interface definition. */
SMOLUCHOWSKI_MAXWELL = 55, /*!< \brief Smoluchoski/Maxwell wall boundary condition. */
SEND_RECEIVE = 99, /*!< \brief Boundary send-receive definition. */
Expand Down Expand Up @@ -1753,8 +1752,7 @@ enum RIEMANN_TYPE {
TOTAL_CONDITIONS_PT_1D = 11,
STATIC_PRESSURE_1D = 12,
MIXING_IN_1D = 13,
MIXING_OUT_1D = 14,
MASS_FLOW_OUTLET = 15
MIXING_OUT_1D =14
};
static const MapType<std::string, RIEMANN_TYPE> Riemann_Map = {
MakePair("TOTAL_CONDITIONS_PT", TOTAL_CONDITIONS_PT)
Expand All @@ -1771,7 +1769,6 @@ static const MapType<std::string, RIEMANN_TYPE> Riemann_Map = {
MakePair("RADIAL_EQUILIBRIUM", RADIAL_EQUILIBRIUM)
MakePair("TOTAL_CONDITIONS_PT_1D", TOTAL_CONDITIONS_PT_1D)
MakePair("STATIC_PRESSURE_1D", STATIC_PRESSURE_1D)
MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET)
};

static const MapType<std::string, RIEMANN_TYPE> Giles_Map = {
Expand All @@ -1789,7 +1786,6 @@ static const MapType<std::string, RIEMANN_TYPE> Giles_Map = {
MakePair("RADIAL_EQUILIBRIUM", RADIAL_EQUILIBRIUM)
MakePair("TOTAL_CONDITIONS_PT_1D", TOTAL_CONDITIONS_PT_1D)
MakePair("STATIC_PRESSURE_1D", STATIC_PRESSURE_1D)
MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET)
};

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

/*!
* \brief Types of Turbomachinery interfaces.
*/
enum class TURBO_INTERFACE_KIND{
MIXING_PLANE = ENUM_TRANSFER::MIXING_PLANE,
FROZEN_ROTOR = ENUM_TRANSFER::SLIDING_INTERFACE,
};
static const MapType<std::string, TURBO_INTERFACE_KIND> TurboInterfaceKind_Map = {
MakePair("MIXING_PLANE", TURBO_INTERFACE_KIND::MIXING_PLANE)
MakePair("FROZEN_ROTOR", TURBO_INTERFACE_KIND::FROZEN_ROTOR)
};

/*!
* \brief Types of Turbomachinery performance flag.
*/
Expand Down Expand Up @@ -2010,6 +1994,9 @@ enum ENUM_OBJECTIVE {
TOPOL_DISCRETENESS = 63, /*!< \brief Measure of the discreteness of the current topology. */
TOPOL_COMPLIANCE = 64, /*!< \brief Measure of the discreteness of the current topology. */
STRESS_PENALTY = 65, /*!< \brief Penalty function of VM stresses above a maximum value. */
ENTROPY_GENERATION = 80, /*!< \brief Entropy generation turbomachinery objective function. */
TOTAL_PRESSURE_LOSS = 81, /*!< \brief Total pressure loss turbomachinery objective function. */
KINETIC_ENERGY_LOSS = 82 /*!< \breif Kinetic energy loss coefficient turbomachinery objective function. */
};
static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("DRAG", DRAG_COEFFICIENT)
Expand Down Expand Up @@ -2052,6 +2039,9 @@ static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("TOPOL_DISCRETENESS", TOPOL_DISCRETENESS)
MakePair("TOPOL_COMPLIANCE", TOPOL_COMPLIANCE)
MakePair("STRESS_PENALTY", STRESS_PENALTY)
MakePair("ENTROPY_GENERATION", ENTROPY_GENERATION)
MakePair("TOTAL_PRESSURE_LOSS", TOTAL_PRESSURE_LOSS)
MakePair("KINETIC_ENERGY_LOSS", KINETIC_ENERGY_LOSS)
};

/*!
Expand Down
16 changes: 2 additions & 14 deletions Common/include/option_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1606,15 +1606,11 @@ class COptionTurboPerformance : public COptionBase {
unsigned short& size;
string*& marker_turboIn;
string*& marker_turboOut;
string*& markers;

public:
COptionTurboPerformance(const string option_field_name, unsigned short& nMarker_TurboPerf,
string*& Marker_TurboBoundIn, string*& Marker_TurboBoundOut, string*& Marker_Turbomachinery)
: size(nMarker_TurboPerf),
marker_turboIn(Marker_TurboBoundIn),
marker_turboOut(Marker_TurboBoundOut),
markers(Marker_Turbomachinery) {
string*& Marker_TurboBoundIn, string*& Marker_TurboBoundOut)
: size(nMarker_TurboPerf), marker_turboIn(Marker_TurboBoundIn), marker_turboOut(Marker_TurboBoundOut) {
this->name = option_field_name;
}

Expand All @@ -1628,7 +1624,6 @@ class COptionTurboPerformance : public COptionBase {
this->size = 0;
this->marker_turboIn = nullptr;
this->marker_turboOut = nullptr;
this->markers = nullptr;
return "";
}

Expand All @@ -1639,16 +1634,10 @@ class COptionTurboPerformance : public COptionBase {
this->size = 0;
this->marker_turboIn = nullptr;
this->marker_turboOut = nullptr;
this->markers = nullptr;
;
return newstring;
}

this->markers = new string[totalVals];
for (unsigned long i = 0; i < totalVals; i++) {
this->markers[i].assign(option_value[i]);
}

unsigned long nVals = totalVals / mod_num;
this->size = nVals;
this->marker_turboIn = new string[nVals];
Expand All @@ -1665,7 +1654,6 @@ class COptionTurboPerformance : public COptionBase {
this->size = 0;
this->marker_turboIn = nullptr;
this->marker_turboOut = nullptr;
this->markers = nullptr;
}
};

Expand Down
Loading