Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
98989f7
Fixes from tagging tool
Feb 18, 2025
6082eac
Config catch + fix preacc in ComputeVorticityandStrainMag
Feb 18, 2025
b3267b6
Initial add turbo obj functions
Feb 20, 2025
c459ce9
Initial refactoring of turboperformance into solver for correct recor…
Mar 11, 2025
4a58b8c
Merge remote-tracking branch 'origin/fix_small_AD_issues' into featur…
Mar 21, 2025
1614784
Adding geometry to AD recording for turbo calcs. (NOT WORKING CURRENTLY)
May 1, 2025
d43fef5
Singlezone working with validated gradients and turbo obj funcs. Need…
Jun 9, 2025
6c9de92
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
joshkellyjak Aug 25, 2025
0e03ead
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
joshkellyjak Aug 31, 2025
ae2f001
Messy commit of refactoring
joshkellyjak Oct 6, 2025
32956c4
Cleaned up branch + Euler MZ working / Issues with RANS remain + Init…
joshkellyjak Oct 12, 2025
435bea6
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
joshkellyjak Oct 12, 2025
912aeea
merge issue
joshkellyjak Oct 12, 2025
a0bfb53
Unused var
joshkellyjak Oct 12, 2025
1303145
Unused var
joshkellyjak Oct 12, 2025
23bf8c3
Fixes to fluid interface for disc adj + proper recording of turb vari…
joshkellyjak Nov 10, 2025
af78550
Initial reformat of mixing plane implementation
joshkellyjak Nov 13, 2025
2c8bf76
Fixes
joshkellyjak Nov 13, 2025
a5d0d73
Fixing mixing state data structure
joshkellyjak Nov 13, 2025
542e3cb
Correct targetVars
joshkellyjak Nov 13, 2025
9a201ac
Fixes + working MPI MP interface
joshkellyjak Nov 15, 2025
43f729f
remove test
joshkellyjak Nov 15, 2025
f5566b8
Working RANS mixing-plane 2D (3D tbc)
joshkellyjak Nov 16, 2025
1d7a125
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
joshkellyjak Nov 16, 2025
674545a
MPI + Various Bug Fixes
joshkellyjak Nov 17, 2025
d03e11f
Merge branch 'feature_mz_turbomachinery_adjoint' of https://github.co…
joshkellyjak Nov 17, 2025
6302217
config fix
joshkellyjak Nov 17, 2025
408cda4
fix
joshkellyjak Nov 17, 2025
23d0a6e
bug fixes for 3D MP
joshkellyjak Nov 26, 2025
3c73946
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
joshkellyjak Nov 29, 2025
744d823
Overload compile issues
joshkellyjak Nov 29, 2025
a065954
compiler warnings
Nov 29, 2025
3616b15
compiler warnings
joshkellyjak Nov 29, 2025
ea53796
compiler warnings + unused code
joshkellyjak Nov 29, 2025
c3d8fb5
Grid Velocity fixes for fluid-fluid interfaces
joshkellyjak Nov 30, 2025
2daecb7
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
joshkellyjak Nov 30, 2025
0e331f8
CodeQL Comments
joshkellyjak Nov 30, 2025
79533db
Merge branch 'feature_mz_turbomachinery_adjoint' of https://github.co…
joshkellyjak Nov 30, 2025
75a7160
Compiler warning
joshkellyjak Nov 30, 2025
cdc4bd6
formatting
joshkellyjak Nov 30, 2025
4b25e22
Compiler warnings
joshkellyjak Dec 1, 2025
8f361bf
Resolve casting complaints
joshkellyjak Dec 1, 2025
fac7b3c
Unused var
joshkellyjak Dec 1, 2025
f3daa3d
Added fluid interface testcases
joshkellyjak Dec 1, 2025
030b1b3
Unused var
joshkellyjak Dec 1, 2025
69e812d
Added writing of mixing plane interpolator to file + interpolation fixes
joshkellyjak Dec 7, 2025
ed89e9d
MP bug fix and additional interpolation warning details
joshkellyjak Dec 8, 2025
e440f9c
MPI correction
joshkellyjak Dec 8, 2025
ce08ca6
Proper identification of MP boundaries w/ MPI + filename fix
joshkellyjak Dec 8, 2025
771c098
Interpolator correction
joshkellyjak Dec 8, 2025
3150c51
MPI fixes
joshkellyjak Dec 8, 2025
96e830f
MPI issues
joshkellyjak Dec 8, 2025
51a1a86
Remove SetAverageValues
joshkellyjak Dec 8, 2025
0d1ac6d
Fix type definition of marker buffer
joshkellyjak Dec 8, 2025
fd20657
Assorted MPI Fixes and updates of interpolation classes to account fo…
joshkellyjak Dec 9, 2025
7b78f06
Fix identification of marker boundaries at mixing plane interface
joshkellyjak Dec 9, 2025
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
33 changes: 33 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@ class CConfig {
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. */
su2double SmoothingEps2; /*!< \brief Parameter for the Laplace part in gradient smoothing. */
Expand Down Expand Up @@ -8147,6 +8152,27 @@ class CConfig {
* \param[in] val_surface_species_variance - Value of the species variance.
*/
void SetSurface_Species_Variance(unsigned short val_marker, su2double val_surface_species_variance) { Surface_Species_Variance[val_marker] = val_surface_species_variance; }

/*!
* \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.
Expand Down Expand Up @@ -10009,6 +10035,13 @@ class CConfig {
*/
short FindInterfaceMarker(unsigned short iInterface) const;

/*!
* \brief Find the marker index (if any) that is part of a mixing plane interface pair.
* \param[in] nMarker - Number of the marker in a zone being tested, starting at 0.
* \return value > 1 if (on this mpi rank) the zone defined by config is part of the mixing plane.
*/
short FindMixingPlaneInterfaceMarker(unsigned short nMarker, unsigned short iMarkerInt) const;

/*!
* \brief Get whether or not to save solution data to libROM.
* \return True if specified in config file.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ class CGeometry {
inline virtual void GatherInOutAverageValues(CConfig* config, bool allocate) {}

/*!
* \brief Store all the turboperformance in the solver in ZONE_0.
* \brief Store all the turboperformance in the solver in final zone.
* \param[in] donor_geometry - Solution from the donor mesh.
* \param[in] target_geometry - Solution from the target mesh.
* \param[in] donorZone - counter of the donor solution
Expand Down
13 changes: 12 additions & 1 deletion Common/include/interface_interpolation/CInterpolator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ class CInterpolator {
};
vector<vector<CDonorInfo> > targetVertices; /*! \brief Donor information per marker per vertex of the target. */

struct CSpanDonorInfo {
unsigned long donorSpan; // Refers to donor span
su2double coefficient; // Refers to coefficient
};
vector<vector<CSpanDonorInfo>> targetSpans; // <iMarkerInt<TargetSpan<CSpanDonorInfo>>

/*!
* \brief Constructor of the class.
* \param[in] geometry_container - Geometrical definition of the problem.
Expand All @@ -125,13 +131,18 @@ class CInterpolator {
* \note Main method that derived classes must implement.
* \param[in] config - Definition of the particular problem.
*/
virtual void SetTransferCoeff(const CConfig* const* config) = 0;
virtual void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) = 0;

/*!
* \brief Print information about the interpolation.
*/
virtual void PrintStatistics(void) const {}

/*!
* \brief Write mixing plane interpolation details to file
*/
inline virtual void WriteInterpolationDetails(const string& filename, const CConfig* const* config) {};

/*!
* \brief Check whether an interface should be processed or not, i.e. if it is part of the zones.
* \param[in] val_markDonor - Marker tag from donor zone.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ namespace CInterpolatorFactory {
*/
CInterpolator* CreateInterpolator(CGeometry**** geometry_container, const CConfig* const* config,
const CInterpolator* transpInterpolator, unsigned iZone, unsigned jZone,
bool verbose = true);
bool mixing_plane, bool verbose = true);
} // namespace CInterpolatorFactory
2 changes: 1 addition & 1 deletion Common/include/interface_interpolation/CIsoparametric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CIsoparametric final : public CInterpolator {
* \brief Set up transfer matrix defining relation between two meshes
* \param[in] config - Definition of the particular problem.
*/
void SetTransferCoeff(const CConfig* const* config) override;
void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) override;

/*!
* \brief Print information about the interpolation.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/interface_interpolation/CMirror.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ class CMirror final : public CInterpolator {
* \brief Set up transfer matrix defining relation between two meshes
* \param[in] config - Definition of the particular problem.
*/
void SetTransferCoeff(const CConfig* const* config) override;
void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) override;
};
50 changes: 50 additions & 0 deletions Common/include/interface_interpolation/CMixingPlane.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*!
* \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(CGeometry**** geometry, const CConfig* const* config) override;

/*!
* \brief Write interpolation details to file.
* \param[in] filename - Name of output file.
* \param[in] config - Configuration for all zones.
*/
void WriteInterpolationDetails(const string& filename, const CConfig* const* config) override;
};
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CNearestNeighbor final : public CInterpolator {
* \brief Set up transfer matrix defining relation between two meshes.
* \param[in] config - Definition of the particular problem.
*/
void SetTransferCoeff(const CConfig* const* config) override;
void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) override;

/*!
* \brief Print interpolation statistics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CRadialBasisFunction final : public CInterpolator {
* \brief Set up transfer matrix defining relation between two meshes
* \param[in] config - Definition of the particular problem.
*/
void SetTransferCoeff(const CConfig* const* config) override;
void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) override;

/*!
* \brief Print information about the interpolation.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/interface_interpolation/CSlidingMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CSlidingMesh final : public CInterpolator {
* \brief Set up transfer matrix defining relation between two meshes
* \param[in] config - Definition of the particular problem.
*/
void SetTransferCoeff(const CConfig* const* config) override;
void SetTransferCoeff(CGeometry**** geometry, const CConfig* const* config) override;

private:
/*!
Expand Down
6 changes: 6 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,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 @@ -2109,6 +2112,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
39 changes: 39 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SU2_MPI::Error(string("OUTPUT_WRT_FREQ cannot be specified for this solver "
SU2_MPI::Error("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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I'm pretty sure it is possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one for @oleburghardt

Copy link
Contributor

@oleburghardt oleburghardt Mar 25, 2025

Choose a reason for hiding this comment

The 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.)
The debug mode could eventually pin down where exactly things go wrong.

} 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. ---*/
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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. ---*/
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -9942,6 +9964,23 @@ short CConfig::FindInterfaceMarker(unsigned short iInterface) const {
return -1;
}

short CConfig::FindMixingPlaneInterfaceMarker(unsigned short nMarker, unsigned short iMarkerInt) 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) == iMarkerInt){
/*--- 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
Expand Down
7 changes: 5 additions & 2 deletions Common/src/geometry/CPhysicalGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include "../../include/geometry/primal_grid/CPrism.hpp"
#include "../../include/geometry/primal_grid/CVertexMPI.hpp"

#include "../../../Common/include/tracy_structure.hpp"

#include <sys/types.h>
#include <sys/stat.h>
#include <iterator>
Expand Down Expand Up @@ -5684,9 +5686,9 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone
}
}
if (marker_flag == INFLOW) {
multizone_filename = "TURBOMACHINERY/spanwise_division_inflow.dat";
multizone_filename = "TURBOMACHINERY/spanwise_division_inflow";
} else {
multizone_filename = "TURBOMACHINERY/spanwise_division_outflow.dat";
multizone_filename = "TURBOMACHINERY/spanwise_division_outflow";
}
char buffer[50];

Expand Down Expand Up @@ -6326,6 +6328,7 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig* config, bool allocate)

void CPhysicalGeometry::SetAvgTurboGeoValues(const CConfig* donor_config, CGeometry* donor_geometry,
unsigned short donorZone) {

unsigned short iSpan;
unsigned short nSpanMaxAllZones = donor_config->GetnSpanMaxAllZones();

Expand Down
Loading
Loading