Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into hybrid_parallel_…
Browse files Browse the repository at this point in the history
…compressible_rans
  • Loading branch information
pcarruscag committed Feb 22, 2020
2 parents f5d59ad + 864fb4b commit 51e1ab3
Show file tree
Hide file tree
Showing 9 changed files with 601 additions and 50 deletions.
19 changes: 19 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,10 @@ class CConfig {

unsigned long edgeColorGroupSize; /*!< \brief Size of the edge groups colored for OpenMP parallelization of edge loops. */

unsigned short Kind_InletInterpolationFunction; /*!brief type of spanwise interpolation function to use for the inlet face. */
unsigned short Kind_Inlet_InterpolationType; /*!brief type of spanwise interpolation data to use for the inlet face. */
bool PrintInlet_InterpolatedData; /*!brief option for printing the interpolated data file. */

/*!
* \brief Set the default values of config options not set in the config file using another config object.
* \param config - Config object to use the default values from.
Expand Down Expand Up @@ -8710,6 +8714,21 @@ class CConfig {
*/
su2double GetRadialBasisFunctionParameter(void) const { return RadialBasisFunction_Parameter; }

/*!
* \brief Get the kind of inlet face interpolation function to use.
*/
inline unsigned short GetKindInletInterpolationFunction(void) const {return Kind_InletInterpolationFunction;}

/*!
* \brief Get the kind of inlet face interpolation data type.
*/
inline unsigned short GetKindInletInterpolationType (void) const {return Kind_Inlet_InterpolationType;}

/*!
* \brief Get whether to print inlet interpolated data or not.
*/
bool GetPrintInlet_InterpolatedData(void) const { return PrintInlet_InterpolatedData;}

/*!
* \brief Get information about using UQ methodology
* \return <code>TRUE</code> means that UQ methodology of eigenspace perturbation will be used
Expand Down
28 changes: 27 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,33 @@ static const MapType<string, ENUM_RADIALBASIS> RadialBasisFunction_Map = {
};

/*!
* \brief Types of (coupling) transfers between distinct physical zones
* \brief type of radial spanwise interpolation function for the inlet face
*/
enum ENUM_INLET_SPANWISEINTERPOLATION {
NO_INTERPOLATION = 0,
LINEAR_1D = 1,
AKIMA_1D = 2,
};
static const map<string, ENUM_INLET_SPANWISEINTERPOLATION> Inlet_SpanwiseInterpolation_Map = {
MakePair("NONE", NO_INTERPOLATION)
MakePair("LINEAR_1D",LINEAR_1D)
MakePair("AKIMA_1D",AKIMA_1D)
};

/*!
* \brief type of radial spanwise interpolation data type for the inlet face
*/
enum ENUM_INLET_INTERPOLATIONTYPE {
VR_VTHETA = 0,
ALPHA_PHI = 1,
};
static const map<string, ENUM_INLET_INTERPOLATIONTYPE> Inlet_SpanwiseInterpolationType_Map = {
MakePair("VR_VTHETA",VR_VTHETA)
MakePair("ALPHA_PHI",ALPHA_PHI)
};

/*!
* \brief types of (coupling) transfers between distinct physical zones
*/
enum ENUM_TRANSFER {
ZONES_ARE_EQUAL = 0, /*!< \brief Zones are equal - no transfer. */
Expand Down
167 changes: 167 additions & 0 deletions Common/include/toolboxes/C1DInterpolation.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/*!
* \file C1DInterpolation.hpp
* \brief Inlet_interpolation_functions
* \author Aman Baig
* \version 7.0.1 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, 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 <iostream>
#include <cmath>
#include <vector>
#include<fstream>
#include "../datatype_structure.hpp"
#include "../option_structure.hpp"

using namespace std;

class C1DInterpolation{
protected:
bool Point_Match = false; /*!< \brief to make sure all points from the inlet data match the vertex coordinates */
vector<su2double> X; /*!< \brief x for inlet data */
vector<su2double> Data; /*!< \brief f(x) for inlet data */

public:
/*!
* \brief Virtual destructor of the C1DInterpolation class.
*/
virtual ~C1DInterpolation() = default;

/*!
* \brief virtual method for setting the cofficients for the respective spline spline.
* \param[in] X - the x values.
* \param[in] Data - the f(x) values.
*/
virtual void SetSpline(const vector<su2double> &X, const vector<su2double> &Data){}

/*!
* \brief virtual method for evaluating the value of the respective Spline.
* \param[in] Point_Interp - the point where interpolation value is required.
* \returns the interpolated value.
*/
virtual su2double EvaluateSpline(su2double Point_Interp){return 0;}

/*!
* \brief bool variable to make sure all vertex points fell in range of the inlet data.
* \returns the bool variable.
*/
bool GetPointMatch() const {return Point_Match;}
};

class CAkimaInterpolation final: public C1DInterpolation{
private:
vector<su2double> x,y,b,c,d; /*!< \brief local variables for Akima spline cooefficients */
int n; /*!< \brief local variable for holding the size of the vector */
public:

/*!
* \brief Constructor of the CAkimaInterpolation class.
* \param[in] X - the x values.
* \param[in] Data - the f(x) values.
*/
CAkimaInterpolation(vector<su2double> &X, vector<su2double> &Data){
SetSpline(X,Data);
}

/*!
* \brief Destructor of the CAkimaInterpolation class.
*/
~CAkimaInterpolation(){}

/*!
* \brief for setting the cofficients for the Akima spline.
* \param[in] X - the x values.
* \param[in] Data - the f(x) values.
*/
void SetSpline(const vector<su2double> &X, const vector<su2double> &Data) override;

/*!
* \brief For evaluating the value of Akima Spline.
* \param[in] Point_Interp - the point where interpolation value is required.
* \returns the interpolated value.
*/
su2double EvaluateSpline(su2double Point_Interp) override;
};

class CLinearInterpolation final: public C1DInterpolation{
private:
vector<su2double> x,y,dydx; /*!< \brief local variables for linear 'spline' cooefficients */
int n; /*!< \brief local variable for holding the size of the vector */
public:

/*!
* \brief Constructor of the CLinearInterpolation class.
* \param[in] X - the x values.
* \param[in] Data - the f(x) values.
*/
CLinearInterpolation(vector<su2double> &X, vector<su2double> &Data){
SetSpline(X,Data);
}

/*!
* \brief Destructor of the CInletInterpolation class.
*/
~CLinearInterpolation(){}

/*!
* \brief for setting the cofficients for Linear 'spline'.
* \param[in] X - the x values.
* \param[in] Data - the f(x) values.
*/
void SetSpline(const vector<su2double> &X, const vector<su2double> &Data) override;

/*!
* \brief For evaluating the value for Linear 'spline'.
* \param[in] Point_Interp - the point where interpolation value is required.
* \returns the interpolated value.
*/
su2double EvaluateSpline(su2double Point_Interp) override;
};

/*!
* \brief to correct for interpolation type.
* \param[in] Inlet_Interpolated - the interpolated data after spline evaluation.
* \param[in] Theta - the angle of the vertex (in xy plane).
* \param[in] nDim - the dimensions of the case.
* \param[in] Coord - the coordinates of the vertex.
* \param[in] nVar_Turb - the number of turbulence variables as defined by turbulence model
* \param[in] ENUM_INLET_INTERPOLATIONTYPE - enum of the interpolation type to be done
* \returns the corrected Inlet Interpolated Data.
*/
vector<su2double> CorrectedInletValues(const vector<su2double> &Inlet_Interpolated,
su2double Theta ,
unsigned short nDim,
su2double *Coord,
unsigned short nVar_Turb,
ENUM_INLET_INTERPOLATIONTYPE Interpolation_Type);

/*!
* \brief to print the Inlet Interpolated Data
* \param[in] Inlet_Interpolated_Interpolated - the final vector for the interpolated data
* \param[in] Marker - name of the inlet marker
* \param[in] nVertex - total number of vertexes.
* \param[in] nDim - the dimensions of the problem.
* \param[in] nColumns - the number of columns in the final interpolated data
*/
void PrintInletInterpolatedData(const vector<su2double>& Inlet_Data_Interpolated, string Marker, unsigned long nVertex, unsigned short nDim, unsigned short nColumns);
1 change: 1 addition & 0 deletions Common/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ lib_sources = \
../src/wall_model.cpp \
../src/toolboxes/printing_toolbox.cpp \
../src/toolboxes/CLinearPartitioner.cpp \
../src/toolboxes/C1DInterpolation.cpp \
../src/toolboxes/MMS/CVerificationSolution.cpp \
../src/toolboxes/MMS/CIncTGVSolution.cpp \
../src/toolboxes/MMS/CInviscidVortexSolution.cpp \
Expand Down
14 changes: 14 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2522,6 +2522,20 @@ void CConfig::SetConfig_Options() {
/* DESCRIPTION: Radius for radial basis function */
addDoubleOption("RADIAL_BASIS_FUNCTION_PARAMETER", RadialBasisFunction_Parameter, 1);

/*!\par INLETINTERPOLATION \n
* DESCRIPTION: Type of spanwise interpolation to use for the inlet face. \n OPTIONS: see \link Inlet_SpanwiseInterpolation_Map \endlink
* Sets Kind_InletInterpolation \ingroup Config
*/
addEnumOption("INLET_INTERPOLATION_FUNCTION",Kind_InletInterpolationFunction, Inlet_SpanwiseInterpolation_Map, NO_INTERPOLATION);

/*!\par INLETINTERPOLATION \n
* DESCRIPTION: Type of spanwise interpolation to use for the inlet face. \n OPTIONS: see \link Inlet_SpanwiseInterpolation_Map \endlink
* Sets Kind_InletInterpolation \ingroup Config
*/
addEnumOption("INLET_INTERPOLATION_DATA_TYPE", Kind_Inlet_InterpolationType, Inlet_SpanwiseInterpolationType_Map, VR_VTHETA);

addBoolOption("PRINT_INLET_INTERPOLATED_DATA", PrintInlet_InterpolatedData, false);

/* DESCRIPTION: Maximum number of FSI iterations */
addUnsignedShortOption("FSI_ITER", nIterFSI, 1);
/* DESCRIPTION: Number of FSI iterations during which a ramp is applied */
Expand Down
Loading

0 comments on commit 51e1ab3

Please sign in to comment.