Skip to content

Commit

Permalink
Merge branch 'develop' into ad_tool_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jblueh authored Sep 24, 2024
2 parents b8a682f + 86e36b0 commit 81bdf8f
Show file tree
Hide file tree
Showing 32 changed files with 509 additions and 114 deletions.
33 changes: 32 additions & 1 deletion Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ 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 @@ -443,6 +444,7 @@ class CConfig {

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

/* Gradient smoothing options */
su2double SmoothingEps1; /*!< \brief Parameter for the identity part in gradient smoothing. */
Expand All @@ -466,6 +468,7 @@ 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 @@ -746,6 +749,7 @@ 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 @@ -763,6 +767,7 @@ 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 @@ -1375,7 +1380,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_TurboBoundIn, string* & Marker_TurboBoundOut, string* & Marker_Turbomachinery);

void addActDiskOption(const string & name,
unsigned short & nMarker_ActDiskInlet, unsigned short & nMarker_ActDiskOutlet, string* & Marker_ActDiskInlet, string* & Marker_ActDiskOutlet,
Expand Down Expand Up @@ -3513,6 +3518,13 @@ 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 @@ -3659,6 +3671,13 @@ 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 @@ -5335,6 +5354,12 @@ 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 @@ -6398,6 +6423,12 @@ 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
18 changes: 17 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,7 @@ 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 @@ -1752,7 +1753,8 @@ enum RIEMANN_TYPE {
TOTAL_CONDITIONS_PT_1D = 11,
STATIC_PRESSURE_1D = 12,
MIXING_IN_1D = 13,
MIXING_OUT_1D =14
MIXING_OUT_1D = 14,
MASS_FLOW_OUTLET = 15
};
static const MapType<std::string, RIEMANN_TYPE> Riemann_Map = {
MakePair("TOTAL_CONDITIONS_PT", TOTAL_CONDITIONS_PT)
Expand All @@ -1769,6 +1771,7 @@ 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 @@ -1786,6 +1789,7 @@ 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 @@ -1862,6 +1866,18 @@ 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
16 changes: 14 additions & 2 deletions Common/include/option_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1606,11 +1606,15 @@ 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)
: size(nMarker_TurboPerf), marker_turboIn(Marker_TurboBoundIn), marker_turboOut(Marker_TurboBoundOut) {
string*& Marker_TurboBoundIn, string*& Marker_TurboBoundOut, string*& Marker_Turbomachinery)
: size(nMarker_TurboPerf),
marker_turboIn(Marker_TurboBoundIn),
marker_turboOut(Marker_TurboBoundOut),
markers(Marker_Turbomachinery) {
this->name = option_field_name;
}

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

Expand All @@ -1634,10 +1639,16 @@ 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 @@ -1654,6 +1665,7 @@ class COptionTurboPerformance : public COptionBase {
this->size = 0;
this->marker_turboIn = nullptr;
this->marker_turboOut = nullptr;
this->markers = nullptr;
}
};

Expand Down
66 changes: 61 additions & 5 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,10 @@ void CConfig::addPeriodicOption(const string & name, unsigned short & nMarker_Pe
}

void CConfig::addTurboPerfOption(const string & name, unsigned short & nMarker_TurboPerf,
string* & Marker_TurboBoundIn, string* & Marker_TurboBoundOut) {
string* & Marker_TurboBoundIn, string* & Marker_TurboBoundOut, string* & Marker_Turbomachinery) {
assert(option_map.find(name) == option_map.end());
all_options.insert(pair<string, bool>(name, true));
COptionBase* val = new COptionTurboPerformance(name, nMarker_TurboPerf, Marker_TurboBoundIn, Marker_TurboBoundOut);
COptionBase* val = new COptionTurboPerformance(name, nMarker_TurboPerf, Marker_TurboBoundIn, Marker_TurboBoundOut, Marker_Turbomachinery);
option_map.insert(pair<string, COptionBase *>(name, val));
}

Expand Down Expand Up @@ -1037,6 +1037,7 @@ void CConfig::SetPointersNull() {
Marker_MixingPlaneInterface = nullptr;
Marker_TurboBoundIn = nullptr;
Marker_TurboBoundOut = nullptr;
Marker_Turbomachinery = nullptr;
Marker_Giles = nullptr;
Marker_Shroud = nullptr;

Expand Down Expand Up @@ -1633,8 +1634,8 @@ void CConfig::SetConfig_Options() {
addStringListOption("MARKER_MIXINGPLANE_INTERFACE", nMarker_MixingPlaneInterface, Marker_MixingPlaneInterface);
/*!\brief TURBULENT_MIXINGPLANE \n DESCRIPTION: Activate mixing plane also for turbulent quantities \ingroup Config*/
addBoolOption("TURBULENT_MIXINGPLANE", turbMixingPlane, false);
/*!\brief MARKER_TURBOMACHINERY \n DESCRIPTION: Identify the inflow and outflow boundaries in which the turbomachinery settings are applied. \ingroup Config*/
addTurboPerfOption("MARKER_TURBOMACHINERY", nMarker_Turbomachinery, Marker_TurboBoundIn, Marker_TurboBoundOut);
/*!\brief MARKER_TURBOMACHINERY \n DESCRIPTION: Identify the boundaries for which the turbomachinery settings are applied. \ingroup Config*/
addTurboPerfOption("MARKER_TURBOMACHINERY", nMarker_Turbomachinery, Marker_TurboBoundIn, Marker_TurboBoundOut, Marker_Turbomachinery);
/*!\brief NUM_SPANWISE_SECTIONS \n DESCRIPTION: Integer number of spanwise sections to compute 3D turbo BC and Performance for turbomachinery */
addUnsignedShortOption("NUM_SPANWISE_SECTIONS", nSpanWiseSections_User, 1);
/*!\brief SPANWISE_KIND \n DESCRIPTION: type of algorithm to identify the span-wise sections at the turbo boundaries.
Expand Down Expand Up @@ -5663,6 +5664,7 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
Marker_All_Turbomachinery = new unsigned short[nMarker_All] (); // Store whether the boundary is in needed for Turbomachinery computations.
Marker_All_TurbomachineryFlag = new unsigned short[nMarker_All] (); // Store whether the boundary has a flag for Turbomachinery computations.
Marker_All_MixingPlaneInterface = new unsigned short[nMarker_All] (); // Store whether the boundary has a in the MixingPlane interface.
Marker_All_Giles = new unsigned short[nMarker_All] (); // Store whether the boundary has is a Giles boundary.
Marker_All_SobolevBC = new unsigned short[nMarker_All] (); // Store wether the boundary should apply to the gradient smoothing.

for (iMarker_All = 0; iMarker_All < nMarker_All; iMarker_All++) {
Expand All @@ -5688,6 +5690,7 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
Marker_CfgFile_Turbomachinery = new unsigned short[nMarker_CfgFile] ();
Marker_CfgFile_TurbomachineryFlag = new unsigned short[nMarker_CfgFile] ();
Marker_CfgFile_MixingPlaneInterface = new unsigned short[nMarker_CfgFile] ();
Marker_CfgFile_Giles = new unsigned short[nMarker_CfgFile] ();
Marker_CfgFile_PyCustom = new unsigned short[nMarker_CfgFile] ();
Marker_CfgFile_SobolevBC = new unsigned short[nMarker_CfgFile] ();

Expand Down Expand Up @@ -5808,7 +5811,7 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {

for (iMarker_Fluid_InterfaceBound = 0; iMarker_Fluid_InterfaceBound < nMarker_Fluid_InterfaceBound; iMarker_Fluid_InterfaceBound++) {
Marker_CfgFile_TagBound[iMarker_CfgFile] = Marker_Fluid_InterfaceBound[iMarker_Fluid_InterfaceBound];
Marker_CfgFile_KindBC[iMarker_CfgFile] = FLUID_INTERFACE;
Marker_CfgFile_KindBC[iMarker_CfgFile] = BC_TYPE::FLUID_INTERFACE;
iMarker_CfgFile++;
}

Expand Down Expand Up @@ -6034,6 +6037,17 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
}
}

/*--- Idenftification fo Giles Markers ---*/
// This is seperate from MP and Turbomachinery Markers as all mixing plane markers are Giles,
// but not all Giles markers are mixing plane
for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) {
Marker_CfgFile_Giles[iMarker_CfgFile] = NO;
for (iMarker_Giles = 0; iMarker_Giles < nMarker_Giles; iMarker_Giles++) {
if (Marker_CfgFile_TagBound[iMarker_CfgFile] == Marker_Giles[iMarker_Giles])
Marker_CfgFile_Giles[iMarker_CfgFile] = YES;
}
}

/*--- Identification of MixingPlane interface markers ---*/

for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) {
Expand All @@ -6045,6 +6059,37 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
Marker_CfgFile_MixingPlaneInterface[iMarker_CfgFile] = indexMarker;
}

/*--- Once we have identified the MixingPlane and Turbomachinery markers
* we next need to determine what type of interface between zones is
* used. It is convenient to do this here as it tidies up the interface
* preproccesing in CDriver ---*/
if (nMarker_Turbomachinery != 0) {
nTurboInterfaces = (nMarker_Turbomachinery - 1)*2; //Two markers per zone minus inlet & outlet
Kind_TurboInterface.resize(nTurboInterfaces);
/*--- Loop over all markers ---*/
for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) {
/*--- Identify mixing plane markers ---*/
if (Marker_MixingPlaneInterface != nullptr){ // Necessary in cases where no mixing plane interfaces are defined
if (Marker_CfgFile_MixingPlaneInterface[iMarker_CfgFile] != 0) { //Is a mixing plane
/*--- Find which list position this marker is in turbomachinery markers ---*/
const auto* target = std::find(Marker_Turbomachinery, &Marker_Turbomachinery[nMarker_Turbomachinery*2-1], Marker_CfgFile_TagBound[iMarker_CfgFile]);
const auto target_index = target - Marker_Turbomachinery;
/*--- Assert that we find the marker within the turbomachienry markers ---*/
assert(target != &Marker_Turbomachinery[nMarker_Turbomachinery*2-1]);
/*--- Assign the correct interface ---*/
Kind_TurboInterface[target_index-1] = TURBO_INTERFACE_KIND::MIXING_PLANE; // Need to subtract 1 from index as to not consider the inlet an interface
}
}
if (Marker_Fluid_InterfaceBound != nullptr){ // No fluid interfaces are defined in the config file (nullptr if no interfaces defined)
if (Marker_CfgFile_KindBC[iMarker_CfgFile] == BC_TYPE::FLUID_INTERFACE) { // iMarker_CfgFile is a fluid interface
const auto* target = std::find(Marker_Turbomachinery, &Marker_Turbomachinery[nMarker_Turbomachinery*2-1], Marker_CfgFile_TagBound[iMarker_CfgFile]);
const auto target_index = target - Marker_Turbomachinery;
Kind_TurboInterface[target_index-1] = TURBO_INTERFACE_KIND::FROZEN_ROTOR;
}
}
}
}

for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++) {
Marker_CfgFile_DV[iMarker_CfgFile] = NO;
for (iMarker_DV = 0; iMarker_DV < nMarker_DV; iMarker_DV++)
Expand Down Expand Up @@ -7938,6 +7983,13 @@ unsigned short CConfig::GetMarker_CfgFile_MixingPlaneInterface(const string& val
return Marker_CfgFile_MixingPlaneInterface[iMarker_CfgFile];
}

unsigned short CConfig::GetMarker_CfgFile_Giles(const string& val_marker) const {
unsigned short iMarker_CfgFile;
for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++)
if (Marker_CfgFile_TagBound[iMarker_CfgFile] == val_marker) break;
return Marker_CfgFile_Giles[iMarker_CfgFile];
}

unsigned short CConfig::GetMarker_CfgFile_DV(const string& val_marker) const {
unsigned short iMarker_CfgFile;
for (iMarker_CfgFile = 0; iMarker_CfgFile < nMarker_CfgFile; iMarker_CfgFile++)
Expand Down Expand Up @@ -8125,6 +8177,9 @@ CConfig::~CConfig() {
delete[] Marker_CfgFile_TurbomachineryFlag;
delete[] Marker_All_TurbomachineryFlag;

delete[] Marker_CfgFile_Giles;
delete[] Marker_All_Giles;

delete[] Marker_CfgFile_MixingPlaneInterface;
delete[] Marker_All_MixingPlaneInterface;

Expand Down Expand Up @@ -8265,6 +8320,7 @@ CConfig::~CConfig() {

delete [] Marker_TurboBoundIn;
delete [] Marker_TurboBoundOut;
delete [] Marker_Turbomachinery;
delete [] Marker_Riemann;
delete [] Marker_Giles;

Expand Down
Loading

0 comments on commit 81bdf8f

Please sign in to comment.