Skip to content

Commit

Permalink
Merge pull request #773 from su2code/feature_periodic_streamwise
Browse files Browse the repository at this point in the history
Streamwise periodicity for incompressible flow
  • Loading branch information
TobiKattmann authored Mar 2, 2021
2 parents 0809781 + 8e7e567 commit fa4e6e4
Show file tree
Hide file tree
Showing 47 changed files with 2,026 additions and 55 deletions.
59 changes: 55 additions & 4 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ class CConfig {
unsigned short Geo_Description; /*!< \brief Description of the geometry. */
unsigned short Mesh_FileFormat; /*!< \brief Mesh input format. */
unsigned short Tab_FileFormat; /*!< \brief Format of the output files. */
unsigned short output_precision; /*!< \brief <ofstream>.precision(value) for SU2_DOT and HISTORY output */
unsigned short ActDisk_Jump; /*!< \brief Format of the output files. */
unsigned long StartWindowIteration; /*!< \brief Starting Iteration for long time Windowing apporach . */
unsigned short nCFL_AdaptParam; /*!< \brief Number of CFL parameters provided in config. */
Expand Down Expand Up @@ -994,6 +995,13 @@ class CConfig {
array<su2double, N_POLY_COEFFS> mu_polycoeffs{{0.0}}; /*!< \brief Array for viscosity polynomial coefficients. */
array<su2double, N_POLY_COEFFS> kt_polycoeffs{{0.0}}; /*!< \brief Array for thermal conductivity polynomial coefficients. */
bool Body_Force; /*!< \brief Flag to know if a body force is included in the formulation. */

unsigned short Kind_Streamwise_Periodic; /*!< \brief Kind of Streamwise periodic flow (pressure drop or massflow) */
bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or otherwise outlet source term. */
su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */
su2double Streamwise_Periodic_TargetMassFlow; /*!< \brief Value of prescribed massflow [kg/s] which results in an delta p and therefore an artificial body force vector. */
su2double Streamwise_Periodic_OutletHeat; /*!< /brief Heatflux boundary [W/m^2] imposed at streamwise periodic outlet. */

su2double *FreeStreamTurboNormal; /*!< \brief Direction to initialize the flow in turbomachinery computation */
su2double Restart_Bandwidth_Agg; /*!< \brief The aggregate of the bandwidth for writing binary restarts (to be averaged later). */
su2double Max_Vel2; /*!< \brief The maximum velocity^2 in the domain for the incompressible preconditioner. */
Expand Down Expand Up @@ -2786,7 +2794,7 @@ class CConfig {
const su2double *GetWeightsIntegrationADER_DG(void) const { return WeightsIntegrationADER_DG; }

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

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

/*!
* \brief Get the total number of heat flux markers.
* \brief Get the total (local) number of heat flux markers.
* \return Total number of heat flux markers.
*/
unsigned short GetnMarker_HeatFlux(void) const { return nMarker_HeatFlux; }
Expand Down Expand Up @@ -5170,6 +5178,12 @@ class CConfig {
*/
unsigned short GetTabular_FileFormat(void) const { return Tab_FileFormat; }

/*!
* \brief Get the output precision to be used in <ofstream>.precision(value) for history and SU2_DOT output.
* \return Output precision.
*/
unsigned short GetOutput_Precision(void) const { return output_precision; }

/*!
* \brief Get the format of the output solution.
* \return Format of the output solution.
Expand Down Expand Up @@ -5729,6 +5743,36 @@ class CConfig {
*/
const su2double* GetBody_Force_Vector(void) const { return body_force; }

/*!
* \brief Get information about the streamwise periodicity (None, Pressure_Drop, Massflow).
* \return Driving force identification.
*/
unsigned short GetKind_Streamwise_Periodic(void) const { return Kind_Streamwise_Periodic; }

/*!
* \brief Get information about the streamwise periodicity Energy equation handling.
* \return Real periodic treatment of energy equation.
*/
bool GetStreamwise_Periodic_Temperature(void) const { return Streamwise_Periodic_Temperature; }

/*!
* \brief Get the value of the artificial periodic outlet heat.
* \return Heat value.
*/
su2double GetStreamwise_Periodic_OutletHeat(void) const { return Streamwise_Periodic_OutletHeat; }

/*!
* \brief Get the value of the pressure delta from which body force vector is computed.
* \return Delta Pressure for body force computation.
*/
su2double GetStreamwise_Periodic_PressureDrop(void) const { return Streamwise_Periodic_PressureDrop; }

/*!
* \brief Get the value of the massflow from which body force vector is computed.
* \return Massflow for body force computation.
*/
su2double GetStreamwise_Periodic_TargetMassFlow(void) const { return Streamwise_Periodic_TargetMassFlow; }

/*!
* \brief Get information about the volumetric heat source.
* \return <code>TRUE</code> if it uses a volumetric heat source; otherwise <code>FALSE</code>.
Expand Down Expand Up @@ -6147,10 +6191,17 @@ class CConfig {
const su2double *GetPeriodicRotAngles(string val_marker) const;

/*!
* \brief Translation vector for a rotational periodic boundary.
* \brief Translation vector for a translational periodic boundary.
*/
const su2double *GetPeriodicTranslation(string val_marker) const;

/*!
* \brief Get the translation vector for a periodic transformation.
* \param[in] val_index - Index corresponding to the periodic transformation.
* \return The translation vector.
*/
const su2double* GetPeriodic_Translation(unsigned short val_index ) const { return Periodic_Translation[val_index]; }

/*!
* \brief Get the rotationally periodic donor marker for boundary <i>val_marker</i>.
* \return Periodic donor marker from the config information for the marker <i>val_marker</i>.
Expand Down
12 changes: 12 additions & 0 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,5 +1711,17 @@ class CGeometry {
* \param[out] nNonconvexElements- amount of nonconvex elements in the mesh
*/
unsigned long GetnNonconvexElements() const {return nNonconvexElements;}

/*!
* \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet.
* \param[in] config - Definition of the particular problem.
*/
inline virtual void FindUniqueNode_PeriodicBound(const CConfig *config) {}

/*!
* \brief Get a pointer to the reference node coordinate vector.
* \return A pointer to the reference node coordinate vector.
*/
inline virtual const su2double* GetStreamwise_Periodic_RefNode(void) const { return nullptr; }
};

13 changes: 13 additions & 0 deletions Common/include/geometry/CPhysicalGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class CPhysicalGeometry final : public CGeometry {
vector<int> GlobalMarkerStorageDispl;
vector<su2double> GlobalRoughness_Height;

su2double Streamwise_Periodic_RefNode[MAXNDIM] = {0}; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure/temperature computation only.*/

public:
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
using CGeometry::SetVertex;
Expand Down Expand Up @@ -784,4 +786,15 @@ class CPhysicalGeometry final : public CGeometry {
*/
void SetGlobalMarkerRoughness(const CConfig* config);

/*!
* \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet.
* \param[in] config - Definition of the particular problem.
*/
void FindUniqueNode_PeriodicBound(const CConfig *config) final;

/*!
* \brief Get a pointer to the reference node coordinate vector.
* \return A pointer to the reference node coordinate vector.
*/
inline const su2double* GetStreamwise_Periodic_RefNode(void) const final { return Streamwise_Periodic_RefNode;}
};
24 changes: 24 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,30 @@ static const MapType<string, ENUM_VERIFICATION_SOLUTIONS> Verification_Solution_
MakePair("USER_DEFINED_SOLUTION", USER_DEFINED_SOLUTION)
};

/*!
* \brief Types of streamwise periodicity.
*/
enum ENUM_STREAMWISE_PERIODIC {
NO_STREAMWISE_PERIODIC = 0, /*!< \brief No streamwise periodic flow. */
PRESSURE_DROP = 1, /*!< \brief Prescribed pressure drop. */
STREAMWISE_MASSFLOW = 2, /*!< \brief Prescribed massflow. */
};
static const MapType<string, ENUM_STREAMWISE_PERIODIC> Streamwise_Periodic_Map = {
MakePair("NONE", NO_STREAMWISE_PERIODIC)
MakePair("PRESSURE_DROP", PRESSURE_DROP)
MakePair("MASSFLOW", STREAMWISE_MASSFLOW)
};

/*!
* \brief Container to hold Variables for streamwise Periodic flow as they are often used together in places.
*/
struct StreamwisePeriodicValues {
su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */
su2double Streamwise_Periodic_MassFlow; /*!< \brief Value of current massflow [kg/s] which results in a delta p and therefore an artificial body force vector. */
su2double Streamwise_Periodic_IntegratedHeatFlow; /*!< \brief Value of of the net sum of heatflow [W] into the domain. */
su2double Streamwise_Periodic_InletTemperature; /*!< \brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */
};

#undef MakePair
/* END_CONFIG_ENUMS */

Expand Down
38 changes: 37 additions & 1 deletion Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,18 @@ void CConfig::SetConfig_Options() {
body_force[0] = 0.0; body_force[1] = 0.0; body_force[2] = 0.0;
/* DESCRIPTION: Vector of body force values (BodyForce_X, BodyForce_Y, BodyForce_Z) */
addDoubleArrayOption("BODY_FORCE_VECTOR", 3, body_force);

/* DESCRIPTION: Apply a body force as a source term for periodic boundary conditions \n Options: NONE, PRESSURE_DROP, MASSFLOW \n DEFAULT: NONE \ingroup Config */
addEnumOption("KIND_STREAMWISE_PERIODIC", Kind_Streamwise_Periodic, Streamwise_Periodic_Map, NO_STREAMWISE_PERIODIC);
/* DESCRIPTION: Use real periodicity for temperature \n Options: NO, YES \n DEFAULT: NO \ingroup Config */
addBoolOption("STREAMWISE_PERIODIC_TEMPERATURE", Streamwise_Periodic_Temperature, false);
/* 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 */
addDoubleOption("STREAMWISE_PERIODIC_OUTLET_HEAT", Streamwise_Periodic_OutletHeat, 0.0);
/* 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 */
addDoubleOption("STREAMWISE_PERIODIC_PRESSURE_DROP", Streamwise_Periodic_PressureDrop, 1.0);
/* DESCRIPTION: Target Massflow [kg/s], Delta P will be adapted until m_dot is met. \n DEFAULT: 0.0 \ingroup Config */
addDoubleOption("STREAMWISE_PERIODIC_MASSFLOW", Streamwise_Periodic_TargetMassFlow, 0.0);

/*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */
addBoolOption("RESTART_SOL", Restart, false);
/*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */
Expand Down Expand Up @@ -1924,6 +1936,8 @@ void CConfig::SetConfig_Options() {

/*!\brief OUTPUT_FORMAT \n DESCRIPTION: I/O format for output plots. \n OPTIONS: see \link TabOutput_Map \endlink \n DEFAULT: TECPLOT \ingroup Config */
addEnumOption("TABULAR_FORMAT", Tab_FileFormat, TabOutput_Map, TAB_CSV);
/*!\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 */
addUnsignedShortOption("OUTPUT_PRECISION", output_precision, 10);
/*!\brief ACTDISK_JUMP \n DESCRIPTION: The jump is given by the difference in values or a ratio */
addEnumOption("ACTDISK_JUMP", ActDisk_Jump, Jump_Map, DIFFERENCE);
/*!\brief MESH_FORMAT \n DESCRIPTION: Mesh input file format \n OPTIONS: see \link Input_Map \endlink \n DEFAULT: SU2 \ingroup Config*/
Expand Down Expand Up @@ -2253,7 +2267,7 @@ void CConfig::SetConfig_Options() {
addDoubleOption("REFERENCE_GEOMETRY_PENALTY", RefGeom_Penalty, 1E6);
/*!\brief REFERENCE_GEOMETRY_FILENAME \n DESCRIPTION: Reference geometry filename \n Default: reference_geometry.dat \ingroup Config */
addStringOption("REFERENCE_GEOMETRY_FILENAME", RefGeom_FEMFileName, string("reference_geometry.dat"));
/*!\brief REFERENCE_GEOMETRY_FORMAT \n DESCRIPTION: Reference geometry format \n DEFAULT: SU2 \ingroup Config*/
/*!\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*/
addEnumOption("REFERENCE_GEOMETRY_FORMAT", RefGeom_FileFormat, Input_Ref_Map, SU2_REF);
/*!\brief REFERENCE_GEOMETRY_SURFACE\n DESCRIPTION: If true consider only the surfaces where loads are applied. \ingroup Config*/
addBoolOption("REFERENCE_GEOMETRY_SURFACE", RefGeomSurf, false);
Expand Down Expand Up @@ -4585,6 +4599,28 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
SU2_MPI::Error("Must list two markers for the pressure drop objective function.\n Expected format: MARKER_ANALYZE= (outlet_name, inlet_name).", CURRENT_FUNCTION);
}
}

/*--- Check feassbility for Streamwise Periodic flow ---*/
if (Kind_Streamwise_Periodic != NONE) {
if (Kind_Regime != INCOMPRESSIBLE)
SU2_MPI::Error("Streamwise Periodic Flow currently only implemented for incompressible flow.", CURRENT_FUNCTION);
if (Kind_Solver == INC_EULER)
SU2_MPI::Error("Streamwise Periodic Flow + Incompressible Euler: Not tested yet.", CURRENT_FUNCTION);
if (nMarker_PerBound != 2)
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);
if (Energy_Equation && Streamwise_Periodic_Temperature && nMarker_Isothermal != 0)
SU2_MPI::Error("No MARKER_ISOTHERMAL marker allowed with STREAMWISE_PERIODIC_TEMPERATURE= YES, only MARKER_HEATFLUX & MARKER_SYM.", CURRENT_FUNCTION);
if (DiscreteAdjoint && Kind_Streamwise_Periodic == MASSFLOW)
SU2_MPI::Error("Discrete Adjoint currently not validated for prescribed MASSFLOW.", CURRENT_FUNCTION);
if (Ref_Inc_NonDim != DIMENSIONAL)
SU2_MPI::Error("Streamwise Periodicity only works with \"INC_NONDIM= DIMENSIONAL\", the nondimensionalization with source terms doesn;t work in general.", CURRENT_FUNCTION);
if (Axisymmetric)
SU2_MPI::Error("Streamwise Periodicity terms does not not have axisymmetric corrections.", CURRENT_FUNCTION);
if (!Energy_Equation) Streamwise_Periodic_Temperature = false;
} else {
/*--- Safety measure ---*/
Streamwise_Periodic_Temperature = false;
}

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

0 comments on commit fa4e6e4

Please sign in to comment.