-
Notifications
You must be signed in to change notification settings - Fork 904
[WIP] Multizone adjoints for turbomachinery #2446
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
base: develop
Are you sure you want to change the base?
Changes from all commits
98989f7
6082eac
b3267b6
c459ce9
4a58b8c
1614784
d43fef5
6c9de92
0e03ead
ae2f001
32956c4
435bea6
912aeea
a0bfb53
1303145
23bf8c3
af78550
2c8bf76
a5d0d73
542e3cb
9a201ac
43f729f
f5566b8
1d7a125
674545a
d03e11f
6302217
408cda4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /*! | ||
| * \file CMixingPlane.hpp | ||
| * \brief Header of mixing plane interpolation methods. | ||
| * \author J. Kelly | ||
| * \version 8.3.0 "Harrier" | ||
| * | ||
| * SU2 Project Website: https://su2code.github.io | ||
| * | ||
| * The SU2 Project is maintained by the SU2 Foundation | ||
| * (http://su2foundation.org) | ||
| * | ||
| * Copyright 2012-2025, SU2 Contributors (cf. AUTHORS.md) | ||
| * | ||
| * SU2 is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 2.1 of the License, or (at your option) any later version. | ||
| * | ||
| * SU2 is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with SU2. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include "CInterpolator.hpp" | ||
|
|
||
| /*! | ||
| * \brief Mixing plane interpolation. | ||
| * \note This contains several interpolation methods used in the mixing plane interpolation | ||
| * and enables the mixing state class structure for proper recording in AD mode | ||
| * \ingroup Interfaces | ||
| */ | ||
| class CMixingPlane final : public CInterpolator { | ||
| public: | ||
| CMixingPlane(CGeometry**** geometry_container, const CConfig* const* config, unsigned int iZone, | ||
| unsigned int jZone); | ||
|
|
||
| void SetTransferCoeff(const CConfig* const* config) override; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1049,6 +1049,11 @@ void CConfig::SetPointersNull() { | |
| nBlades = nullptr; | ||
| FreeStreamTurboNormal = nullptr; | ||
|
|
||
| /*--- Turbomachinery Objective Functions ---*/ | ||
| EntropyGeneration = nullptr; | ||
| TotalPressureLoss = nullptr; | ||
| KineticEnergyLoss = nullptr; | ||
|
|
||
| top_optim_kernels = nullptr; | ||
| top_optim_kernel_params = nullptr; | ||
| top_optim_filter_radius = nullptr; | ||
|
|
@@ -3479,6 +3484,10 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i | |
| VolumeOutputFrequencies[iVolumeFreq] = Time_Domain ? 1 : 250; | ||
| } | ||
| } | ||
| } else if (Multizone_Problem && DiscreteAdjoint) { | ||
| SU2_MPI::Error(string("OUTPUT_WRT_FREQ cannot be specified for this solver " | ||
| "(writing of restart and sensitivity files not possible for multizone discrete adjoint during runtime yet).\n" | ||
| "Please remove this option from the config file, output files will be written when solver finalizes.\n"), CURRENT_FUNCTION); | ||
|
Comment on lines
+3489
to
+3490
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm I'm pretty sure it is possible
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one for @oleburghardt
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes and no, writing the files is fine, but the continuation of the multi-zone discrete adjoint solver is erratic. My guess is that some indices aren't cleared properly before re-recording the tape. (Writing adjoint solution variables to file only, without re-recording at all and without sensitivities, might give us some hints.) |
||
| } else if (nVolumeOutputFrequencies < nVolumeOutputFiles) { | ||
| /*--- If there are fewer frequencies than files, repeat the last frequency. | ||
| * This is useful to define 1 frequency for the restart file and 1 frequency for all the visualization files. ---*/ | ||
|
|
@@ -6172,6 +6181,11 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) { | |
| Marker_CfgFile_ZoneInterface[iMarker_CfgFile] = YES; | ||
| } | ||
|
|
||
| /*--- Allocate memory for turbomachinery objective functions ---*/ | ||
| EntropyGeneration = new su2double[nZone] (); | ||
| TotalPressureLoss = new su2double[nZone] (); | ||
| KineticEnergyLoss = new su2double[nZone] (); | ||
|
|
||
| /*--- Identification of Turbomachinery markers and flag them---*/ | ||
|
|
||
| for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) { | ||
|
|
@@ -6956,6 +6970,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { | |
| case TOPOL_DISCRETENESS: cout << "Topology discreteness objective function." << endl; break; | ||
| case TOPOL_COMPLIANCE: cout << "Topology compliance objective function." << endl; break; | ||
| case STRESS_PENALTY: cout << "Stress penalty objective function." << endl; break; | ||
| case ENTROPY_GENERATION: cout << "Entropy generation objective function." << endl; break; | ||
| } | ||
| } | ||
| else { | ||
|
|
@@ -8521,6 +8536,10 @@ CConfig::~CConfig() { | |
|
|
||
| delete [] nBlades; | ||
| delete [] FreeStreamTurboNormal; | ||
|
|
||
| delete [] EntropyGeneration; | ||
| delete [] TotalPressureLoss; | ||
| delete [] KineticEnergyLoss; | ||
| } | ||
|
|
||
| /*--- Input is the filename base, output is the completed filename. ---*/ | ||
|
|
@@ -8664,6 +8683,9 @@ string CConfig::GetObjFunc_Extension(string val_filename) const { | |
| case TOPOL_DISCRETENESS: AdjExt = "_topdisc"; break; | ||
| case TOPOL_COMPLIANCE: AdjExt = "_topcomp"; break; | ||
| case STRESS_PENALTY: AdjExt = "_stress"; break; | ||
| case ENTROPY_GENERATION: AdjExt = "_entg"; break; | ||
| case TOTAL_PRESSURE_LOSS: AdjExt = "_tot_press_loss"; break; | ||
| case KINETIC_ENERGY_LOSS: AdjExt = "_kin_en_loss"; break; | ||
| } | ||
| } | ||
| else{ | ||
|
|
@@ -9942,6 +9964,23 @@ short CConfig::FindInterfaceMarker(unsigned short iInterface) const { | |
| return -1; | ||
| } | ||
|
|
||
| short CConfig::FindMixingPlaneInterfaceMarker(unsigned short nMarker) const { | ||
| short mark; | ||
| for (auto iMarker = 0; iMarker < nMarker; iMarker++){ | ||
| /*--- If the tag GetMarker_All_MixingPlaneInterface equals the index we are looping at ---*/ | ||
| if (GetMarker_All_MixingPlaneInterface(iMarker)){ | ||
| /*--- We have identified the local index of the marker ---*/ | ||
| /*--- Store the identifier for the marker ---*/ | ||
| mark = iMarker; | ||
| /*--- Exit the for loop: we have found the local index for Mixing-Plane interface ---*/ | ||
| return mark; | ||
| } | ||
| /*--- If the tag hasn't matched any tag within the donor markers ---*/ | ||
| mark = -1; | ||
| } | ||
| return mark; | ||
| } | ||
|
|
||
| void CConfig::Tick(double *val_start_time) { | ||
|
|
||
| #ifdef PROFILE | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.