3131#include " ../../include/toolboxes/CSymmetricMatrix.hpp"
3232
3333/* !
34- * \class CLinearElasticity
34+ * \class CRadialBasisFunctionInterpolation
3535 * \brief Class for moving the volumetric numerical grid using Radial Basis Function interpolation.
3636 * \author F. van Steen
3737 */
3838
3939class CRadialBasisFunctionInterpolation : public CVolumetricMovement {
4040protected:
4141
42- vector<CRadialBasisFunctionNode*> boundaryNodes; /* !< \brief Vector with boundary nodes.*/
43- vector<unsigned long > internalNodes; /* !< \brief Vector with internal nodes.*/
44- unsigned long nBoundaryNodes, /* !< \brief Number of boundary nodes*/
45- nInternalNodes; /* !< \brief Number of internal nodes*/
46-
47- vector<CRadialBasisFunctionNode*>* controlNodes; /* !< \brief Vector with control nodes*/
42+ vector<CRadialBasisFunctionNode*>* ControlNodes = nullptr ; /* !< \brief Vector with control nodes*/
43+ vector<CRadialBasisFunctionNode*> BoundNodes; /* !< \brief Vector with boundary nodes.*/
44+ vector<CRadialBasisFunctionNode*> ReducedControlNodes; /* !< \brief Vector with selected control nodes in data reduction algorithm. */
4845
49- vector<passivedouble> deformationVector; /* !< \brief Deformation vector.*/
50-
51- vector<passivedouble> coefficients; /* !< \brief Control node interpolation coefficients.*/
52- CSymmetricMatrix interpMat; /* !< \brief Interpolation matrix.*/
53- // su2activematrix interpMat;
54-
55- RADIAL_BASIS kindRBF; /* !< \brief Type of Radial Basis Function.*/
56- su2double radius; /* !< \brief Support radius of compact Radial Basis Function.*/
57-
58-
59- /* --- data reduction parameters ---*/
60- vector<CRadialBasisFunctionNode*> greedyNodes; /* !< \brief Vector with selected control nodes in greedy algorithm. */
61- bool dataReduction; /* !< \brief Determines whether data reduction is used. */
62- unsigned long MaxErrorNode;
63- su2double MaxError;
64- su2double GreedyTolerance;
65- su2double GreedyCorrectionFactor;
66-
67- unsigned long Global_nControlNodes{0 };
68- /* --- mpi related*/
69-
70- unsigned long Local_nControlNodes;
71- vector<unsigned long > Local_nControlNodesVec;
72-
73- // vector<su2double> LocalCoords;
74- vector<su2double> GlobalCoords;
7546
47+ vector<su2double> CtrlNodeDeformation; /* !< \brief Control Node Deformation.*/
48+ vector<su2double> InterpCoeff; /* !< \brief Control node interpolation coefficients.*/
7649
50+ unsigned long nCtrlNodesGlobal{0 }; /* !< \brief Total number of control nodes.*/
51+ su2activematrix CtrlCoords; /* !< \brief Coordinates of the control nodes.*/
7752
53+ su2double MaxErrorGlobal{0.0 }; /* !< \brief Maximum error data reduction algorithm.*/
7854
7955
8056public:
@@ -99,53 +75,155 @@ class CRadialBasisFunctionInterpolation : public CVolumetricMovement {
9975 void SetVolume_Deformation (CGeometry* geometry, CConfig* config, bool UpdateGeo, bool Derivative,
10076 bool ForwardProjectionDerivative);
10177
102- /* !
103- * \brief Obtaining the interpolation coefficients based on displacement of the control nodes .
78+ /* !
79+ * \brief Selecting unique set of boundary nodes based on marker information .
10480 * \param[in] geometry - Geometrical definition of the problem.
10581 * \param[in] config - Definition of the particular problem.
106- * \param[in] iNonlinear_Iter - Surface deformation step.
10782 */
108- void GetInterpolationCoefficients (CGeometry* geometry, CConfig* config, unsigned long iNonlinear_Iter);
83+ void SetBoundNodes (CGeometry* geometry, CConfig* config);
84+
85+ /* !
86+ * \brief Selecting internal nodes for the volumetric deformation.
87+ * \param[in] geometry - Geometrical definition of the problem.
88+ * \param[in] config - Definition of the particular problem.
89+ * \param[in] internalNode - Internal nodes.
90+ */
91+ void SetInternalNodes (CGeometry* geometry, CConfig* config, vector<unsigned long >& internalNodes);
92+
93+ /* !
94+ * \brief Assigning the control nodes.
95+ * \param[in] config -Definition of the particular problem.
96+ * */
97+
98+ void SetCtrlNodes (CConfig* config);
10999
110100 /* !
111- * \brief Compute the interpolation matrix with Radial Basis Function evaluations .
101+ * \brief Solving the RBF system to obtain the interpolation coefficients .
112102 * \param[in] geometry - Geometrical definition of the problem.
113103 * \param[in] config - Definition of the particular problem.
104+ * \param[in] type - Type of radial basis function.
105+ * \param[in] radius - Support radius of the radial basis function.
114106 */
115- void SetInterpolationMatrix (CGeometry* geometry, CConfig* config);
107+
108+ void SolveRBF_System (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const su2double radius);
116109
117110 /* !
118- * \brief Build the deformation vector with surface displacements of the control nodes.
111+ * \brief Obtaining the interpolation coefficients of the control nodes.
119112 * \param[in] geometry - Geometrical definition of the problem.
120113 * \param[in] config - Definition of the particular problem.
114+ * \param[in] type - Type of radial basis function.
115+ * \param[in] radius - Support radius of the radial basis function.
121116 */
122- void SetDeformationVector (CGeometry* geometry, CConfig* config);
117+
118+ void GetInterpCoeffs (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const su2double radius);
119+
123120
124121 /* !
125- * \brief Selecting unique set of control nodes based on marker information.
122+ * \brief Gathering of all control node coordinates.
123+ * \param[in] geometry - Geometrical definition of the problem.
124+ */
125+ void SetCtrlNodeCoords (CGeometry* geometry);
126+
127+ /* !
128+ * \brief Build the deformation vector with surface displacements of the control nodes.
126129 * \param[in] geometry - Geometrical definition of the problem.
127130 * \param[in] config - Definition of the particular problem.
128131 */
129- void SetControlNodes (CGeometry* geometry, CConfig* config);
132+ void SetDeformation (CGeometry* geometry, CConfig* config);
130133
131134 /* !
132- * \brief Selecting internal nodes for the volumetric deformation .
135+ * \brief Computation of the interpolation matrix and inverting in .
133136 * \param[in] geometry - Geometrical definition of the problem.
137+ * \param[in] type - Type of radial basis function.
138+ * \param[in] radius - Support radius of the radial basis function.
139+ * \param[in] invInterpMat - Inverse of the interpolation matrix.
134140 */
135- void SetInternalNodes (CGeometry* geometry, CConfig* config );
141+ void ComputeInterpolationMatrix (CGeometry* geometry, const RADIAL_BASIS& type, const su2double radius, su2passivematrix& invInterpMat );
136142
137143 /* !
138- * \brief Solving of the Radial Basis Function interpolation system, yielding the interpolation coefficients
144+ * \brief Computation of interpolation coefficients
145+ * \param[in] invInterpMat - Inverse of interpolation matrix
139146 */
140- void SolveRBF_System (void );
147+ void ComputeInterpCoeffs (su2passivematrix& invInterpMat);
148+
149+ /* !
150+ * \brief Finding initial data reduction control nodes based on maximum deformation.
151+ * \param[in] geometry - Geometrical definition of the problem.
152+ * \param[in] config - Definition of the particular problem.
153+ * \param[in] maxErrorNodeLocal - Local maximum error node.
154+ * \param[in] maxErrorLocal - Local maximum error.
155+ */
156+ void GetInitMaxErrorNode (CGeometry* geometry, CConfig* config, unsigned long & maxErrorNodeLocal, su2double& maxErrorLocal);
157+
158+ /* !
159+ * \brief Addition of control node to the reduced set.
160+ * \param[in] maxErrorNode - Node with maximum error to be added.
161+ */
162+ void AddControlNode (unsigned long maxErrorNode);
163+
164+ /* !
165+ * \brief Compute global number of control nodes.
166+ */
167+ void Get_nCtrlNodesGlobal ();
168+
169+ /* !
170+ * \brief Compute interpolation error.
171+ * \param[in] geometry - Geometrical definition of the problem.
172+ * \param[in] config - Definition of the particular problem.
173+ * \param[in] type - Type of radial basis function.
174+ * \param[in] radius - Support radius of the radial basis function.
175+ * \param[in] maxErrorNodeLocal - Local maximum error node.
176+ * \param[in] maxErrorLocal - Local maximum error.
177+ */
178+ void GetInterpError (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const su2double radius, unsigned long & maxErrorNodeLocal, su2double& maxErrorLocal);
179+
180+ /* !
181+ * \brief Compute error of single node.
182+ * \param[in] geometry - Geometrical definition of the problem.
183+ * \param[in] config - Definition of the particular problem.
184+ * \param[in] type - Type of radial basis function.
185+ * \param[in] radius - Support radius of the radial basis function.
186+ * \param[in] iNode - Local node in consideration.
187+ * \param[in] localError - Local error.
188+ */
189+ void GetNodalError (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const su2double radius, unsigned long iNode, su2double* localError);
141190
142-
143191 /* !
144192 * \brief Updating the grid coordinates.
145193 * \param[in] geometry - Geometrical definition of the problem.
146194 * \param[in] config - Definition of the particular problem.
195+ * \param[in] type - Type of radial basis function.
196+ * \param[in] radius - Support radius of the radial basis function.
197+ * \param[in] internalNodes - Internal nodes.
198+ */
199+ void UpdateGridCoord (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const su2double radius, const vector<unsigned long >& internalNodes);
200+
201+ /* !
202+ * \brief Updating the internal node coordinates.
203+ * \param[in] geometry - Geometrical definition of the problem.
204+ * \param[in] type - Type of radial basis function.
205+ * \param[in] radius - Support radius of the radial basis function.
206+ * \param[in] internalNodes - Internal nodes.
207+ */
208+ void UpdateInternalCoords (CGeometry* geometry, const RADIAL_BASIS& type, const su2double radius, const vector<unsigned long >& internalNodes);
209+
210+ /* !
211+ * \brief Updating the internal node coordinates.
212+ * \param[in] geometry - Geometrical definition of the problem.
213+ * \param[in] config - Definition of the particular problem.
214+ * \param[in] type - Type of radial basis function.
215+ * \param[in] radius - Support radius of the radial basis function.
216+ */
217+ void UpdateBoundCoords (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const su2double radius);
218+
219+ /* !
220+ * \brief Apply correction to the nonzero error boundary nodes.
221+ * \param[in] geometry - Geometrical definition of the problem.
222+ * \param[in] config - Definition of the particular problem.
223+ * \param[in] type - Type of radial basis function.
224+ * \param[in] internalNodes - Internal nodes.
147225 */
148- void UpdateGridCoord (CGeometry* geometry, CConfig* config);
226+ void SetCorrection (CGeometry* geometry, CConfig* config, const RADIAL_BASIS& type, const vector< unsigned long >& internalNodes );
149227
150228 /* !
151229 * \brief Custom comparison function, for sorting the CRadialBasisFunctionNode objects based on their index.
@@ -164,22 +242,4 @@ class CRadialBasisFunctionInterpolation : public CVolumetricMovement {
164242 inline static bool Equal (CRadialBasisFunctionNode* a, CRadialBasisFunctionNode* b){
165243 return a->GetIndex () == b->GetIndex ();
166244 }
167-
168- inline static bool Equal2 (unsigned long a, unsigned long b){
169- return a == b;
170- };
171-
172-
173- /* --- Data reduction functions ---*/
174- void GreedyIteration (CGeometry* geometry, CConfig* config);
175-
176- void GetInitMaxErrorNode (CGeometry* geometry, CConfig* config);
177-
178- void MPI_Operations (CGeometry* geometry);
179-
180- su2double GetError (CGeometry* geometry, CConfig* config);
181-
182- su2double* GetNodalError (CGeometry* geometry, CConfig* config, unsigned long iNode, su2double* localError);
183-
184- void SetCorrection (CGeometry* geometry);
185245};
0 commit comments