diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp
index f863b6eb6ad..864fd36756e 100644
--- a/Common/include/CConfig.hpp
+++ b/Common/include/CConfig.hpp
@@ -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.
@@ -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 TRUE
means that UQ methodology of eigenspace perturbation will be used
diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp
index e2e7577808e..7b9c2336cd8 100644
--- a/Common/include/option_structure.hpp
+++ b/Common/include/option_structure.hpp
@@ -335,7 +335,33 @@ static const MapType 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 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 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. */
diff --git a/Common/include/toolboxes/C1DInterpolation.hpp b/Common/include/toolboxes/C1DInterpolation.hpp
new file mode 100644
index 00000000000..348a9dddefa
--- /dev/null
+++ b/Common/include/toolboxes/C1DInterpolation.hpp
@@ -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 .
+ */
+
+#pragma once
+
+#include
+#include
+#include
+#include
+#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 X; /*!< \brief x for inlet data */
+ vector 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 &X, const vector &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 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 &X, vector &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 &X, const vector &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 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 &X, vector &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 &X, const vector &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 CorrectedInletValues(const vector &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& Inlet_Data_Interpolated, string Marker, unsigned long nVertex, unsigned short nDim, unsigned short nColumns);
diff --git a/Common/lib/Makefile.am b/Common/lib/Makefile.am
index e8e1745efb4..71e5453849b 100644
--- a/Common/lib/Makefile.am
+++ b/Common/lib/Makefile.am
@@ -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 \
diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp
index ed91fd87507..9d29550a4ef 100644
--- a/Common/src/CConfig.cpp
+++ b/Common/src/CConfig.cpp
@@ -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 */
diff --git a/Common/src/toolboxes/C1DInterpolation.cpp b/Common/src/toolboxes/C1DInterpolation.cpp
new file mode 100644
index 00000000000..52b63408ac0
--- /dev/null
+++ b/Common/src/toolboxes/C1DInterpolation.cpp
@@ -0,0 +1,190 @@
+/*!
+ * \file C1DInterpolation.cpp
+ * \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 .
+ */
+
+
+#include "../../include/toolboxes/C1DInterpolation.hpp"
+
+su2double CAkimaInterpolation::EvaluateSpline(su2double Point_Interp){
+ Point_Match = false;
+
+ for (int i=0; i=x[i] && Point_Interp<=x[i+1])
+ Point_Match = true;
+
+ if (Point_Match == false){
+ cout<<"WARNING: Extrapolating data for radius: "<1){
+ int m=(i+j) / 2 ;
+ if (Point_Interp>x[m]) {i=m;}
+ else {j=m;}
+ }
+
+ su2double h=Point_Interp-x[i] ;
+ return y[i]+h*(b[i]+h*(c[i]+h*d[i])) ;
+}
+
+su2double CLinearInterpolation::EvaluateSpline(su2double Point_Interp){
+ Point_Match = false;
+
+ for (int i=0; i=x[i] && Point_Interp<=x[i+1]){
+ Point_Match = true;
+ return (Point_Interp-x[i])*dydx[i]+y[i];
+ }
+ }
+ return 0;
+}
+
+void CLinearInterpolation::SetSpline(const vector &X, const vector &Data){
+ n = X.size();
+ su2double h;
+ x.resize(n);
+ y.resize(n);
+ dydx.resize(n-1);
+
+ x=X;
+ y=Data;
+
+ for (int i=0; i &X,const vector &Data){
+
+ n = X.size();
+ vector h (n-1);
+ vector p (n-1);
+
+ /*---calculating finite differences (h) and gradients (p) ---*/
+ for (int i=0; i CorrectedInletValues(const vector &Inlet_Interpolated ,
+ su2double Theta ,
+ unsigned short nDim,
+ su2double *Coord,
+ unsigned short nVar_Turb,
+ ENUM_INLET_INTERPOLATIONTYPE Interpolation_Type){
+
+ unsigned short size_columns=Inlet_Interpolated.size()+nDim;
+ vector Inlet_Values(size_columns);
+ su2double unit_r, unit_Theta, unit_m, Alpha, Phi;
+
+ /*---For x,y,z,T,P columns---*/
+ for (int i=0;i& Inlet_Data_Interpolated, string Marker, unsigned long nVertex, unsigned short nDim, unsigned short nColumns){
+ ofstream myfile;
+ myfile.precision(16);
+ myfile.open("Interpolated_Data_"+Marker+".dat",ios_base::out);
+
+ if (myfile.is_open()){
+ for (unsigned long iVertex = 0; iVertex < nVertex; iVertex++) {
+ for (unsigned short iVar=0; iVar < nColumns; iVar++){
+ myfile< GetColumnForProfile(int val_iProfile, unsigned short iCol) const {
+ auto nRow = numberOfRowsInProfile[val_iProfile];
+ auto nCol = numberOfColumnsInProfile[val_iProfile];
+ vector ColumnData(nRow);
+ for (unsigned long iRow = 0; iRow < nRow; iRow++)
+ ColumnData[iRow]=profileData[val_iProfile][iRow*nCol+iCol];
+ return ColumnData;
+ }
};
diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp
index 3c26438d6f4..53c32fa67df 100644
--- a/SU2_CFD/src/solvers/CSolver.cpp
+++ b/SU2_CFD/src/solvers/CSolver.cpp
@@ -43,6 +43,7 @@
#include "../../../Common/include/toolboxes/MMS/CTGVSolution.hpp"
#include "../../../Common/include/toolboxes/MMS/CUserDefinedSolution.hpp"
#include "../../../Common/include/toolboxes/printing_toolbox.hpp"
+#include "../../../Common/include/toolboxes/C1DInterpolation.hpp"
#include "../../include/CMarkerProfileReaderFVM.hpp"
@@ -4161,7 +4162,7 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
unsigned short iDim, iVar, iMesh, iMarker, jMarker;
unsigned long iPoint, iVertex, index, iChildren, Point_Fine, iRow;
- su2double Area_Children, Area_Parent, *Coord, dist, min_dist;
+ su2double Area_Children, Area_Parent, *Coord, dist, min_dist, Interp_Radius, Theta;
bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) ||
(config->GetTime_Marching() == DT_STEPPING_2ND));
bool time_stepping = config->GetTime_Marching() == TIME_STEPPING;
@@ -4175,6 +4176,8 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
string Marker_Tag;
string profile_filename = config->GetInlet_FileName();
ifstream inlet_file;
+ string Interpolation_Function, Interpolation_Type;
+ bool Interpolate;
su2double *Normal = new su2double[nDim];
@@ -4204,7 +4207,8 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
excluding the coordinates. Here, we have 2 entries for the total
conditions or mass flow, another nDim for the direction vector, and
finally entries for the number of turbulence variables. This is only
- necessary in case we are writing a template profile file. ---*/
+ necessary in case we are writing a template profile file or for Inlet
+ Interpolation purposes. ---*/
unsigned short nCol_InletFile = 2 + nDim + nVar_Turb;
@@ -4251,74 +4255,187 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
/*--- Get data for this profile. ---*/
vector Inlet_Data = profileReader.GetDataForProfile(jMarker);
-
unsigned short nColumns = profileReader.GetNumberOfColumnsInProfile(jMarker);
+ vector Inlet_Data_Interpolated ((nCol_InletFile+nDim)*geometry[MESH_0]->nVertex[iMarker]);
+
+ /*--- Define Inlet Values vectors before and after interpolation (if needed) ---*/
+ vector Inlet_Values(nCol_InletFile+nDim);
+ vector Inlet_Interpolated(nColumns);
+
+ unsigned long nRows = profileReader.GetNumberOfRowsInProfile(jMarker);
- vector Inlet_Values(nColumns);
+ /*--- Pointer to call Set and Evaluate functions. ---*/
+ vector interpolator (nColumns);
+ string interpolation_function, interpolation_type;
- /*--- Loop through the nodes on this marker. ---*/
+ /*--- Define the reference for interpolation. ---*/
+ unsigned short radius_index=0;
+ vector InletRadii = profileReader.GetColumnForProfile(jMarker, radius_index);
+ vector Interpolation_Column (nRows);
- for (iVertex = 0; iVertex < geometry[MESH_0]->nVertex[iMarker]; iVertex++) {
+ switch(config->GetKindInletInterpolationFunction()){
+
+ case (NONE):
+ Interpolate = false;
+ break;
- iPoint = geometry[MESH_0]->vertex[iMarker][iVertex]->GetNode();
- Coord = geometry[MESH_0]->node[iPoint]->GetCoord();
- min_dist = 1e16;
+ case (AKIMA_1D):
+ for (unsigned short iCol=0; iCol < nColumns; iCol++){
+ Interpolation_Column = profileReader.GetColumnForProfile(jMarker, iCol);
+ interpolator[iCol] = new CAkimaInterpolation(InletRadii,Interpolation_Column);
+ interpolation_function = "AKIMA";
+ Interpolate = true;
+ }
+ break;
+
+ case (LINEAR_1D):
+ for (unsigned short iCol=0; iCol < nColumns; iCol++){
+ Interpolation_Column = profileReader.GetColumnForProfile(jMarker, iCol);
+ interpolator[iCol] = new CLinearInterpolation(InletRadii,Interpolation_Column);
+ interpolation_function = "LINEAR";
+ Interpolate = true;
+ }
+ break;
+
+ default:
+ SU2_MPI::Error("Error in the Kind_InletInterpolation Marker\n",CURRENT_FUNCTION);
+ break;
+ }
- /*--- Find the distance to the closest point in our inlet profile data. ---*/
+ if (Interpolate == true){
+ switch(config->GetKindInletInterpolationType()){
+ case(VR_VTHETA):
+ interpolation_type="VR_VTHETA";
+ break;
+ case(ALPHA_PHI):
+ interpolation_type="ALPHA_PHI";
+ break;
+ }
+ cout<<"Inlet Interpolation being done using "<nVertex[iMarker]; iVertex++) {
+
+ iPoint = geometry[MESH_0]->vertex[iMarker][iVertex]->GetNode();
+ Coord = geometry[MESH_0]->node[iPoint]->GetCoord();
- index = iRow*nColumns;
+ if(Interpolate == false){
- dist = 0.0;
- for (unsigned short iDim = 0; iDim < nDim; iDim++)
- dist += pow(Inlet_Data[index+iDim] - Coord[iDim], 2);
- dist = sqrt(dist);
+ min_dist = 1e16;
- /*--- Check is this is the closest point and store data if so. ---*/
+ /*--- Find the distance to the closest point in our inlet profile data. ---*/
+
+ for (iRow = 0; iRow < nRows; iRow++) {
- if (dist < min_dist) {
- min_dist = dist;
- for (iVar = 0; iVar < nColumns; iVar++)
- Inlet_Values[iVar] = Inlet_Data[index+iVar];
- }
+ /*--- Get the coords for this data point. ---*/
- }
+ index = iRow*nColumns;
- /*--- If the diff is less than the tolerance, match the two.
- We could modify this to simply use the nearest neighbor, or
- eventually add something more elaborate here for interpolation. ---*/
+ dist = 0.0;
+ for (unsigned short iDim = 0; iDim < nDim; iDim++)
+ dist += pow(Inlet_Data[index+iDim] - Coord[iDim], 2);
+ dist = sqrt(dist);
- if (min_dist < tolerance) {
+ /*--- Check is this is the closest point and store data if so. ---*/
- solver[MESH_0][KIND_SOLVER]->SetInletAtVertex(Inlet_Values.data(), iMarker, iVertex);
+ if (dist < min_dist) {
+ min_dist = dist;
+ for (iVar = 0; iVar < nColumns; iVar++)
+ Inlet_Values[iVar] = Inlet_Data[index+iVar];
+ }
- } else {
-
- unsigned long GlobalIndex = geometry[MESH_0]->node[iPoint]->GetGlobalIndex();
- cout << "WARNING: Did not find a match between the points in the inlet file" << endl;
- cout << "and point " << GlobalIndex;
- cout << std::scientific;
- cout << " at location: [" << Coord[0] << ", " << Coord[1];
- if (nDim ==3) error_msg << ", " << Coord[2];
- cout << "]" << endl;
- cout << "Distance to closest point: " << min_dist << endl;
- cout << "Current tolerance: " << tolerance << endl;
- cout << endl;
- cout << "You can widen the tolerance for point matching by changing the value" << endl;
- cout << "of the option INLET_MATCHING_TOLERANCE in your *.cfg file." << endl;
- local_failure++;
+ }
+
+ /*--- If the diff is less than the tolerance, match the two.
+ We could modify this to simply use the nearest neighbor, or
+ eventually add something more elaborate here for interpolation. ---*/
+
+ if (min_dist < tolerance) {
+
+ solver[MESH_0][KIND_SOLVER]->SetInletAtVertex(Inlet_Values.data(), iMarker, iVertex);
+
+ } else {
+
+ unsigned long GlobalIndex = geometry[MESH_0]->node[iPoint]->GetGlobalIndex();
+ cout << "WARNING: Did not find a match between the points in the inlet file" << endl;
+ cout << "and point " << GlobalIndex;
+ cout << std::scientific;
+ cout << " at location: [" << Coord[0] << ", " << Coord[1];
+ if (nDim ==3) error_msg << ", " << Coord[2];
+ cout << "]" << endl;
+ cout << "Distance to closest point: " << min_dist << endl;
+ cout << "Current tolerance: " << tolerance << endl;
+ cout << endl;
+ cout << "You can widen the tolerance for point matching by changing the value" << endl;
+ cout << "of the option INLET_MATCHING_TOLERANCE in your *.cfg file." << endl;
+ local_failure++;
+ break;
+ }
+
+ }
+
+ else if(Interpolate == true){
+
+ /* --- Calculating the radius and angle of the vertex ---*/
+ /* --- Flow should be in z direction for 3D cases ---*/
+ /* --- Or in x direction for 2D cases ---*/
+ Interp_Radius = sqrt(pow(Coord[0],2)+ pow(Coord[1],2));
+ Theta = atan2(Coord[1],Coord[0]);
+
+ /* --- Evaluating and saving the final spline data ---*/
+ for (unsigned short iVar=0; iVar < nColumns; iVar++){
+
+ /*---Evaluate spline will get the respective value of the Data set (column) specified
+ for that interpolator[iVar], cycling through all columns to get all the
+ data for that vertex ---*/
+ Inlet_Interpolated[iVar]=interpolator[iVar]->EvaluateSpline(Interp_Radius);
+ if (interpolator[iVar]->GetPointMatch() == false){
+ cout << "WARNING: Did not find a match between the radius in the inlet file " ;
+ cout << std::scientific;
+ cout << "at location: [" << Coord[0] << ", " << Coord[1];
+ if (nDim == 3) {cout << ", " << Coord[2];}
+ cout << "]";
+ cout << " with Radius: "<< Interp_Radius << endl;
+ cout << "You can add a row for Radius: " << Interp_Radius <<" in the inlet file ";
+ cout << "to eliminate this issue or give proper data" << endl;
+ local_failure++;
+ break;
+ }
+ }
+
+ /* --- Correcting for Interpolation Type ---*/
+ switch(config->GetKindInletInterpolationType()){
+ case(VR_VTHETA):
+ Inlet_Values = CorrectedInletValues(Inlet_Interpolated, Theta, nDim, Coord, nVar_Turb, VR_VTHETA);
break;
+ case(ALPHA_PHI):
+ Inlet_Values = CorrectedInletValues(Inlet_Interpolated, Theta, nDim, Coord, nVar_Turb, ALPHA_PHI);
+ break;
+ }
+ solver[MESH_0][KIND_SOLVER]->SetInletAtVertex(Inlet_Values.data(), iMarker, iVertex);
+
+ for (unsigned short iVar=0; iVar < (nCol_InletFile+nDim); iVar++)
+ Inlet_Data_Interpolated[iVertex*(nCol_InletFile+nDim)+iVar] = Inlet_Values[iVar];
}
}
+ if(config->GetPrintInlet_InterpolatedData() == true)
+ PrintInletInterpolatedData(Inlet_Data_Interpolated,profileReader.GetTagForProfile(jMarker),geometry[MESH_0]->nVertex[iMarker],nDim, nCol_InletFile+nDim);
+
+ for (int i=0; i 0) break;
}
-
- if (local_failure > 0) break;
}
SU2_MPI::Allreduce(&local_failure, &global_failure, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD);
@@ -4342,6 +4459,8 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
for (jMarker = 0; jMarker < profileReader.GetNumberOfProfiles(); jMarker++) {
if (profileReader.GetTagForProfile(jMarker) == Marker_Tag) {
nColumns = profileReader.GetNumberOfColumnsInProfile(jMarker);
+ if(Interpolate == true)
+ nColumns+=nDim;
}
}
vector Inlet_Values(nColumns);
@@ -4390,9 +4509,9 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
}
delete [] Normal;
-
}
+
void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){
/*--- Compute the constant factor to dimensionalize pressure and shear stress. ---*/