Skip to content

Commit fa4e6e4

Browse files
authored
Merge pull request #773 from su2code/feature_periodic_streamwise
Streamwise periodicity for incompressible flow
2 parents 0809781 + 8e7e567 commit fa4e6e4

47 files changed

Lines changed: 2026 additions & 55 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/include/CConfig.hpp

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ class CConfig {
716716
unsigned short Geo_Description; /*!< \brief Description of the geometry. */
717717
unsigned short Mesh_FileFormat; /*!< \brief Mesh input format. */
718718
unsigned short Tab_FileFormat; /*!< \brief Format of the output files. */
719+
unsigned short output_precision; /*!< \brief <ofstream>.precision(value) for SU2_DOT and HISTORY output */
719720
unsigned short ActDisk_Jump; /*!< \brief Format of the output files. */
720721
unsigned long StartWindowIteration; /*!< \brief Starting Iteration for long time Windowing apporach . */
721722
unsigned short nCFL_AdaptParam; /*!< \brief Number of CFL parameters provided in config. */
@@ -994,6 +995,13 @@ class CConfig {
994995
array<su2double, N_POLY_COEFFS> mu_polycoeffs{{0.0}}; /*!< \brief Array for viscosity polynomial coefficients. */
995996
array<su2double, N_POLY_COEFFS> kt_polycoeffs{{0.0}}; /*!< \brief Array for thermal conductivity polynomial coefficients. */
996997
bool Body_Force; /*!< \brief Flag to know if a body force is included in the formulation. */
998+
999+
unsigned short Kind_Streamwise_Periodic; /*!< \brief Kind of Streamwise periodic flow (pressure drop or massflow) */
1000+
bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or otherwise outlet source term. */
1001+
su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */
1002+
su2double Streamwise_Periodic_TargetMassFlow; /*!< \brief Value of prescribed massflow [kg/s] which results in an delta p and therefore an artificial body force vector. */
1003+
su2double Streamwise_Periodic_OutletHeat; /*!< /brief Heatflux boundary [W/m^2] imposed at streamwise periodic outlet. */
1004+
9971005
su2double *FreeStreamTurboNormal; /*!< \brief Direction to initialize the flow in turbomachinery computation */
9981006
su2double Restart_Bandwidth_Agg; /*!< \brief The aggregate of the bandwidth for writing binary restarts (to be averaged later). */
9991007
su2double Max_Vel2; /*!< \brief The maximum velocity^2 in the domain for the incompressible preconditioner. */
@@ -2786,7 +2794,7 @@ class CConfig {
27862794
const su2double *GetWeightsIntegrationADER_DG(void) const { return WeightsIntegrationADER_DG; }
27872795

27882796
/*!
2789-
* \brief Get the total number of boundary markers including send/receive domains.
2797+
* \brief Get the total number of boundary markers of the local process including send/receive domains.
27902798
* \return Total number of boundary markers.
27912799
*/
27922800
unsigned short GetnMarker_All(void) const { return nMarker_All; }
@@ -2810,7 +2818,7 @@ class CConfig {
28102818
unsigned short GetnMarker_SymWall(void) const { return nMarker_SymWall; }
28112819

28122820
/*!
2813-
* \brief Get the total number of boundary markers.
2821+
* \brief Get the total number of boundary markers in the cfg plus the possible send/receive domains.
28142822
* \return Total number of boundary markers.
28152823
*/
28162824
unsigned short GetnMarker_Max(void) const { return nMarker_Max; }
@@ -2906,7 +2914,7 @@ class CConfig {
29062914
unsigned short GetnMarker_Periodic(void) const { return nMarker_PerBound; }
29072915

29082916
/*!
2909-
* \brief Get the total number of heat flux markers.
2917+
* \brief Get the total (local) number of heat flux markers.
29102918
* \return Total number of heat flux markers.
29112919
*/
29122920
unsigned short GetnMarker_HeatFlux(void) const { return nMarker_HeatFlux; }
@@ -5170,6 +5178,12 @@ class CConfig {
51705178
*/
51715179
unsigned short GetTabular_FileFormat(void) const { return Tab_FileFormat; }
51725180

5181+
/*!
5182+
* \brief Get the output precision to be used in <ofstream>.precision(value) for history and SU2_DOT output.
5183+
* \return Output precision.
5184+
*/
5185+
unsigned short GetOutput_Precision(void) const { return output_precision; }
5186+
51735187
/*!
51745188
* \brief Get the format of the output solution.
51755189
* \return Format of the output solution.
@@ -5729,6 +5743,36 @@ class CConfig {
57295743
*/
57305744
const su2double* GetBody_Force_Vector(void) const { return body_force; }
57315745

5746+
/*!
5747+
* \brief Get information about the streamwise periodicity (None, Pressure_Drop, Massflow).
5748+
* \return Driving force identification.
5749+
*/
5750+
unsigned short GetKind_Streamwise_Periodic(void) const { return Kind_Streamwise_Periodic; }
5751+
5752+
/*!
5753+
* \brief Get information about the streamwise periodicity Energy equation handling.
5754+
* \return Real periodic treatment of energy equation.
5755+
*/
5756+
bool GetStreamwise_Periodic_Temperature(void) const { return Streamwise_Periodic_Temperature; }
5757+
5758+
/*!
5759+
* \brief Get the value of the artificial periodic outlet heat.
5760+
* \return Heat value.
5761+
*/
5762+
su2double GetStreamwise_Periodic_OutletHeat(void) const { return Streamwise_Periodic_OutletHeat; }
5763+
5764+
/*!
5765+
* \brief Get the value of the pressure delta from which body force vector is computed.
5766+
* \return Delta Pressure for body force computation.
5767+
*/
5768+
su2double GetStreamwise_Periodic_PressureDrop(void) const { return Streamwise_Periodic_PressureDrop; }
5769+
5770+
/*!
5771+
* \brief Get the value of the massflow from which body force vector is computed.
5772+
* \return Massflow for body force computation.
5773+
*/
5774+
su2double GetStreamwise_Periodic_TargetMassFlow(void) const { return Streamwise_Periodic_TargetMassFlow; }
5775+
57325776
/*!
57335777
* \brief Get information about the volumetric heat source.
57345778
* \return <code>TRUE</code> if it uses a volumetric heat source; otherwise <code>FALSE</code>.
@@ -6147,10 +6191,17 @@ class CConfig {
61476191
const su2double *GetPeriodicRotAngles(string val_marker) const;
61486192

61496193
/*!
6150-
* \brief Translation vector for a rotational periodic boundary.
6194+
* \brief Translation vector for a translational periodic boundary.
61516195
*/
61526196
const su2double *GetPeriodicTranslation(string val_marker) const;
61536197

6198+
/*!
6199+
* \brief Get the translation vector for a periodic transformation.
6200+
* \param[in] val_index - Index corresponding to the periodic transformation.
6201+
* \return The translation vector.
6202+
*/
6203+
const su2double* GetPeriodic_Translation(unsigned short val_index ) const { return Periodic_Translation[val_index]; }
6204+
61546205
/*!
61556206
* \brief Get the rotationally periodic donor marker for boundary <i>val_marker</i>.
61566207
* \return Periodic donor marker from the config information for the marker <i>val_marker</i>.

Common/include/geometry/CGeometry.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,5 +1711,17 @@ class CGeometry {
17111711
* \param[out] nNonconvexElements- amount of nonconvex elements in the mesh
17121712
*/
17131713
unsigned long GetnNonconvexElements() const {return nNonconvexElements;}
1714+
1715+
/*!
1716+
* \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet.
1717+
* \param[in] config - Definition of the particular problem.
1718+
*/
1719+
inline virtual void FindUniqueNode_PeriodicBound(const CConfig *config) {}
1720+
1721+
/*!
1722+
* \brief Get a pointer to the reference node coordinate vector.
1723+
* \return A pointer to the reference node coordinate vector.
1724+
*/
1725+
inline virtual const su2double* GetStreamwise_Periodic_RefNode(void) const { return nullptr; }
17141726
};
17151727

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class CPhysicalGeometry final : public CGeometry {
107107
vector<int> GlobalMarkerStorageDispl;
108108
vector<su2double> GlobalRoughness_Height;
109109

110+
su2double Streamwise_Periodic_RefNode[MAXNDIM] = {0}; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure/temperature computation only.*/
111+
110112
public:
111113
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
112114
using CGeometry::SetVertex;
@@ -784,4 +786,15 @@ class CPhysicalGeometry final : public CGeometry {
784786
*/
785787
void SetGlobalMarkerRoughness(const CConfig* config);
786788

789+
/*!
790+
* \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet.
791+
* \param[in] config - Definition of the particular problem.
792+
*/
793+
void FindUniqueNode_PeriodicBound(const CConfig *config) final;
794+
795+
/*!
796+
* \brief Get a pointer to the reference node coordinate vector.
797+
* \return A pointer to the reference node coordinate vector.
798+
*/
799+
inline const su2double* GetStreamwise_Periodic_RefNode(void) const final { return Streamwise_Periodic_RefNode;}
787800
};

Common/include/option_structure.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,30 @@ static const MapType<string, ENUM_VERIFICATION_SOLUTIONS> Verification_Solution_
22562256
MakePair("USER_DEFINED_SOLUTION", USER_DEFINED_SOLUTION)
22572257
};
22582258

2259+
/*!
2260+
* \brief Types of streamwise periodicity.
2261+
*/
2262+
enum ENUM_STREAMWISE_PERIODIC {
2263+
NO_STREAMWISE_PERIODIC = 0, /*!< \brief No streamwise periodic flow. */
2264+
PRESSURE_DROP = 1, /*!< \brief Prescribed pressure drop. */
2265+
STREAMWISE_MASSFLOW = 2, /*!< \brief Prescribed massflow. */
2266+
};
2267+
static const MapType<string, ENUM_STREAMWISE_PERIODIC> Streamwise_Periodic_Map = {
2268+
MakePair("NONE", NO_STREAMWISE_PERIODIC)
2269+
MakePair("PRESSURE_DROP", PRESSURE_DROP)
2270+
MakePair("MASSFLOW", STREAMWISE_MASSFLOW)
2271+
};
2272+
2273+
/*!
2274+
* \brief Container to hold Variables for streamwise Periodic flow as they are often used together in places.
2275+
*/
2276+
struct StreamwisePeriodicValues {
2277+
su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */
2278+
su2double Streamwise_Periodic_MassFlow; /*!< \brief Value of current massflow [kg/s] which results in a delta p and therefore an artificial body force vector. */
2279+
su2double Streamwise_Periodic_IntegratedHeatFlow; /*!< \brief Value of of the net sum of heatflow [W] into the domain. */
2280+
su2double Streamwise_Periodic_InletTemperature; /*!< \brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */
2281+
};
2282+
22592283
#undef MakePair
22602284
/* END_CONFIG_ENUMS */
22612285

Common/src/CConfig.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,18 @@ void CConfig::SetConfig_Options() {
11041104
body_force[0] = 0.0; body_force[1] = 0.0; body_force[2] = 0.0;
11051105
/* DESCRIPTION: Vector of body force values (BodyForce_X, BodyForce_Y, BodyForce_Z) */
11061106
addDoubleArrayOption("BODY_FORCE_VECTOR", 3, body_force);
1107+
1108+
/* DESCRIPTION: Apply a body force as a source term for periodic boundary conditions \n Options: NONE, PRESSURE_DROP, MASSFLOW \n DEFAULT: NONE \ingroup Config */
1109+
addEnumOption("KIND_STREAMWISE_PERIODIC", Kind_Streamwise_Periodic, Streamwise_Periodic_Map, NO_STREAMWISE_PERIODIC);
1110+
/* DESCRIPTION: Use real periodicity for temperature \n Options: NO, YES \n DEFAULT: NO \ingroup Config */
1111+
addBoolOption("STREAMWISE_PERIODIC_TEMPERATURE", Streamwise_Periodic_Temperature, false);
1112+
/* DESCRIPTION: Heatflux boundary at streamwise periodic 'outlet', choose heat [W] such that net domain heatflux is zero. Only active if STREAMWISE_PERIODIC_TEMPERATURE is active. \n DEFAULT: 0.0 \ingroup Config */
1113+
addDoubleOption("STREAMWISE_PERIODIC_OUTLET_HEAT", Streamwise_Periodic_OutletHeat, 0.0);
1114+
/* DESCRIPTION: Delta pressure [Pa] on which basis body force will be computed, serves as initial value if MASSFLOW is chosen. \n DEFAULT: 1.0 \ingroup Config */
1115+
addDoubleOption("STREAMWISE_PERIODIC_PRESSURE_DROP", Streamwise_Periodic_PressureDrop, 1.0);
1116+
/* DESCRIPTION: Target Massflow [kg/s], Delta P will be adapted until m_dot is met. \n DEFAULT: 0.0 \ingroup Config */
1117+
addDoubleOption("STREAMWISE_PERIODIC_MASSFLOW", Streamwise_Periodic_TargetMassFlow, 0.0);
1118+
11071119
/*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */
11081120
addBoolOption("RESTART_SOL", Restart, false);
11091121
/*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */
@@ -1924,6 +1936,8 @@ void CConfig::SetConfig_Options() {
19241936

19251937
/*!\brief OUTPUT_FORMAT \n DESCRIPTION: I/O format for output plots. \n OPTIONS: see \link TabOutput_Map \endlink \n DEFAULT: TECPLOT \ingroup Config */
19261938
addEnumOption("TABULAR_FORMAT", Tab_FileFormat, TabOutput_Map, TAB_CSV);
1939+
/*!\brief OUTPUT_PRECISION \n DESCRIPTION: Set <ofstream>.precision(value) to specified value for SU2_DOT and HISTORY output. Useful for exact gradient validation. \n DEFAULT: 6 \ingroup Config */
1940+
addUnsignedShortOption("OUTPUT_PRECISION", output_precision, 10);
19271941
/*!\brief ACTDISK_JUMP \n DESCRIPTION: The jump is given by the difference in values or a ratio */
19281942
addEnumOption("ACTDISK_JUMP", ActDisk_Jump, Jump_Map, DIFFERENCE);
19291943
/*!\brief MESH_FORMAT \n DESCRIPTION: Mesh input file format \n OPTIONS: see \link Input_Map \endlink \n DEFAULT: SU2 \ingroup Config*/
@@ -2253,7 +2267,7 @@ void CConfig::SetConfig_Options() {
22532267
addDoubleOption("REFERENCE_GEOMETRY_PENALTY", RefGeom_Penalty, 1E6);
22542268
/*!\brief REFERENCE_GEOMETRY_FILENAME \n DESCRIPTION: Reference geometry filename \n Default: reference_geometry.dat \ingroup Config */
22552269
addStringOption("REFERENCE_GEOMETRY_FILENAME", RefGeom_FEMFileName, string("reference_geometry.dat"));
2256-
/*!\brief REFERENCE_GEOMETRY_FORMAT \n DESCRIPTION: Reference geometry format \n DEFAULT: SU2 \ingroup Config*/
2270+
/*!\brief REFERENCE_GEOMETRY_FORMAT \n DESCRIPTION: Format of the reference geometry file \n OPTIONS: see \link Input_Ref_Map \endlink \n DEFAULT: SU2 \ingroup Config*/
22572271
addEnumOption("REFERENCE_GEOMETRY_FORMAT", RefGeom_FileFormat, Input_Ref_Map, SU2_REF);
22582272
/*!\brief REFERENCE_GEOMETRY_SURFACE\n DESCRIPTION: If true consider only the surfaces where loads are applied. \ingroup Config*/
22592273
addBoolOption("REFERENCE_GEOMETRY_SURFACE", RefGeomSurf, false);
@@ -4585,6 +4599,28 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
45854599
SU2_MPI::Error("Must list two markers for the pressure drop objective function.\n Expected format: MARKER_ANALYZE= (outlet_name, inlet_name).", CURRENT_FUNCTION);
45864600
}
45874601
}
4602+
4603+
/*--- Check feassbility for Streamwise Periodic flow ---*/
4604+
if (Kind_Streamwise_Periodic != NONE) {
4605+
if (Kind_Regime != INCOMPRESSIBLE)
4606+
SU2_MPI::Error("Streamwise Periodic Flow currently only implemented for incompressible flow.", CURRENT_FUNCTION);
4607+
if (Kind_Solver == INC_EULER)
4608+
SU2_MPI::Error("Streamwise Periodic Flow + Incompressible Euler: Not tested yet.", CURRENT_FUNCTION);
4609+
if (nMarker_PerBound != 2)
4610+
SU2_MPI::Error("Streamwise Periodic Flow currently only implemented for one Periodic Marker pair. Combining Streamwise and Spanwise periodicity not possible in the moment.", CURRENT_FUNCTION);
4611+
if (Energy_Equation && Streamwise_Periodic_Temperature && nMarker_Isothermal != 0)
4612+
SU2_MPI::Error("No MARKER_ISOTHERMAL marker allowed with STREAMWISE_PERIODIC_TEMPERATURE= YES, only MARKER_HEATFLUX & MARKER_SYM.", CURRENT_FUNCTION);
4613+
if (DiscreteAdjoint && Kind_Streamwise_Periodic == MASSFLOW)
4614+
SU2_MPI::Error("Discrete Adjoint currently not validated for prescribed MASSFLOW.", CURRENT_FUNCTION);
4615+
if (Ref_Inc_NonDim != DIMENSIONAL)
4616+
SU2_MPI::Error("Streamwise Periodicity only works with \"INC_NONDIM= DIMENSIONAL\", the nondimensionalization with source terms doesn;t work in general.", CURRENT_FUNCTION);
4617+
if (Axisymmetric)
4618+
SU2_MPI::Error("Streamwise Periodicity terms does not not have axisymmetric corrections.", CURRENT_FUNCTION);
4619+
if (!Energy_Equation) Streamwise_Periodic_Temperature = false;
4620+
} else {
4621+
/*--- Safety measure ---*/
4622+
Streamwise_Periodic_Temperature = false;
4623+
}
45884624

45894625
/*--- Check that if the wall roughness array are compatible and set deafult values if needed. ---*/
45904626
if ((nMarker_HeatFlux > 0) || (nMarker_Isothermal > 0) || (nMarker_CHTInterface > 0)) {

0 commit comments

Comments
 (0)