3636 * \author F. Palacios
3737 */
3838class CMultiGridGeometry final : public CGeometry {
39-
40- public:
41- /* --- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
42- using CGeometry::SetVertex;
43- using CGeometry::SetControlVolume;
44- using CGeometry::SetBoundControlVolume;
45- using CGeometry::SetPoint_Connectivity;
46-
47- /* !
48- * \brief Constructor of the class.
49- * \param[in] geometry - Geometrical definition of the problem.
50- * \param[in] config - Definition of the particular problem.
51- * \param[in] iMesh - Level of the multigrid.
52- * \param[in] iZone - Current zone in the mesh.
53- */
54- CMultiGridGeometry (CGeometry **geometry, CConfig *config_container, unsigned short iMesh);
55-
39+ private:
5640 /* !
5741 * \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
5842 * \param[in] CVPoint - Control volume to be agglomerated.
@@ -61,101 +45,159 @@ class CMultiGridGeometry final : public CGeometry {
6145 * \param[in] config - Definition of the particular problem.
6246 * \return <code>TRUE</code> or <code>FALSE</code> depending if the control volume can be agglomerated.
6347 */
64- bool SetBoundAgglomeration (unsigned long CVPoint, short marker_seed, CGeometry *fine_grid, CConfig *config);
48+ bool SetBoundAgglomeration (unsigned long CVPoint, short marker_seed, const CGeometry *fine_grid,
49+ const CConfig *config) const ;
6550
6651 /* !
6752 * \brief Determine if a can be agglomerated using geometrical criteria.
6853 * \param[in] iPoint - Seed point.
6954 * \param[in] fine_grid - Geometrical definition of the problem.
7055 * \param[in] config - Definition of the particular problem.
7156 */
72- bool GeometricalCheck (unsigned long iPoint, CGeometry *fine_grid, CConfig *config);
57+ bool GeometricalCheck (unsigned long iPoint, const CGeometry *fine_grid, const CConfig *config) const ;
7358
7459 /* !
7560 * \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
76- * \param[in ] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated.
61+ * \param[out ] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated.
7762 * \param[in] iPoint - Seed point.
7863 * \param[in] Index_CoarseCV - Index of agglomerated point.
7964 * \param[in] fine_grid - Geometrical definition of the problem.
8065 */
81- void SetSuitableNeighbors (vector<unsigned long > * Suitable_Indirect_Neighbors, unsigned long iPoint,
82- unsigned long Index_CoarseCV, CGeometry *fine_grid);
66+ void SetSuitableNeighbors (vector<unsigned long >& Suitable_Indirect_Neighbors, unsigned long iPoint,
67+ unsigned long Index_CoarseCV, const CGeometry *fine_grid) const ;
8368
8469 /* !
85- * \brief Set boundary vertex.
86- * \param[in] geometry - Geometrical definition of the problem.
87- * \param[in] config - Definition of the particular problem.
70+ * \brief Set a representative wall value of the agglomerated control volumes on a particular boundary marker.
71+ * \param[in] fine_grid - Geometrical definition of the problem.
72+ * \param[in] val_marker - Index of the boundary marker.
73+ * \param[in] wall_quantity - Object with methods Get(iVertex_fine) and Set(iVertex_coarse, val).
8874 */
89- void SetVertex (CGeometry *geometry, CConfig *config) override ;
75+ template <class T >
76+ void SetMultiGridWallQuantity (const CGeometry *fine_grid, unsigned short val_marker, T& wall_quantity) {
77+
78+ for (auto iVertex = 0ul ; iVertex < nVertex[val_marker]; iVertex++) {
79+ const auto Point_Coarse = vertex[val_marker][iVertex]->GetNode ();
80+
81+ if (!nodes->GetDomain (Point_Coarse)) continue ;
82+
83+ su2double Area_Parent = 0.0 ;
84+
85+ /* --- Compute area parent by taking into account only volumes that are on the marker. ---*/
86+ for (auto iChildren = 0u ; iChildren < nodes->GetnChildren_CV (Point_Coarse); iChildren++) {
87+ const auto Point_Fine = nodes->GetChildren_CV (Point_Coarse, iChildren);
88+ const auto isVertex = fine_grid->nodes ->GetDomain (Point_Fine) &&
89+ (fine_grid->nodes ->GetVertex (Point_Fine, val_marker) != -1 );
90+ if (isVertex) {
91+ Area_Parent += fine_grid->nodes ->GetVolume (Point_Fine);
92+ }
93+ }
94+
95+ su2double Quantity_Coarse = 0.0 ;
96+
97+ /* --- Loop again to average coarser value. ---*/
98+ for (auto iChildren = 0u ; iChildren < nodes->GetnChildren_CV (Point_Coarse); iChildren++) {
99+ const auto Point_Fine = nodes->GetChildren_CV (Point_Coarse, iChildren);
100+ const auto isVertex = fine_grid->nodes ->GetDomain (Point_Fine) &&
101+ (fine_grid->nodes ->GetVertex (Point_Fine, val_marker) != -1 );
102+ if (isVertex) {
103+ const auto Vertex_Fine = fine_grid->nodes ->GetVertex (Point_Fine, val_marker);
104+ const auto Area_Children = fine_grid->nodes ->GetVolume (Point_Fine);
105+ Quantity_Coarse += wall_quantity.Get (Vertex_Fine) * Area_Children / Area_Parent;
106+ }
107+ }
108+
109+ /* --- Set the value at the coarse level. ---*/
110+ wall_quantity.Set (iVertex, Quantity_Coarse);
111+ }
112+
113+ }
114+
115+ public:
116+ /* --- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
117+ using CGeometry::SetVertex;
118+ using CGeometry::SetControlVolume;
119+ using CGeometry::SetBoundControlVolume;
120+ using CGeometry::SetPoint_Connectivity;
90121
91122 /* !
92- * \brief Set points which surround a point.
93- * \param[in] geometry - Geometrical definition of the problem.
123+ * \brief Constructor of the class.
124+ * \param[in] fine_grid - Geometrical definition of the problem.
125+ * \param[in] config - Definition of the particular problem.
126+ * \param[in] iMesh - Level of the multigrid.
94127 */
95- void SetPoint_Connectivity (CGeometry *geometry) override ;
128+ CMultiGridGeometry (CGeometry *fine_grid, CConfig *config, unsigned short iMesh) ;
96129
97130 /* !
98- * \brief Set the edge structure of the agglomerated control volume.
131+ * \brief Set boundary vertex.
132+ * \param[in] fine_grid - Geometrical definition of the problem.
99133 * \param[in] config - Definition of the particular problem.
100- * \param[in] geometry - Geometrical definition of the problem.
101- * \param[in] action - Allocate or not the new elements.
102134 */
103- void SetControlVolume (CConfig *config, CGeometry *geometry, unsigned short action ) override ;
135+ void SetVertex ( const CGeometry *fine_grid, const CConfig *config ) override ;
104136
105137 /* !
106- * \brief Mach the near field boundary condition .
107- * \param[in] config - Definition of the particular problem .
138+ * \brief Set points which surround a point .
139+ * \param[in] fine_grid - Geometrical definition of the child grid .
108140 */
109- void MatchActuator_Disk (CConfig *config ) override ;
141+ void SetPoint_Connectivity ( const CGeometry *fine_grid ) override ;
110142
111143 /* !
112- * \brief Mach the periodic boundary conditions .
113- * \param[in] config - Definition of the particular problem.
114- * \param[in] val_periodic - Index of the first periodic face in a pair .
144+ * \brief Set the edge structure of the agglomerated control volume .
145+ * \param[in] fine_grid - Geometrical definition of the problem.
146+ * \param[in] action - Allocate or not the new elements .
115147 */
116- void MatchPeriodic (CConfig *config , unsigned short val_periodic ) override ;
148+ void SetControlVolume ( const CGeometry *fine_grid , unsigned short action ) override ;
117149
118150 /* !
119151 * \brief Set boundary vertex structure of the agglomerated control volume.
120- * \param[in] config - Definition of the particular problem.
121- * \param[in] geometry - Geometrical definition of the problem.
152+ * \param[in] fine_grid - Geometrical definition of the problem.
122153 * \param[in] action - Allocate or not the new elements.
123154 */
124- void SetBoundControlVolume (CConfig *config, CGeometry *geometry , unsigned short action) override ;
155+ void SetBoundControlVolume (const CGeometry *fine_grid , unsigned short action) override ;
125156
126157 /* !
127158 * \brief Set a representative coordinates of the agglomerated control volume.
128- * \param[in] geometry - Geometrical definition of the problem.
159+ * \param[in] fine_grid - Geometrical definition of the problem.
129160 */
130- void SetCoord (CGeometry *geometry ) override ;
161+ void SetCoord (const CGeometry *fine_grid ) override ;
131162
132163 /* !
133- * \brief Set a representative wall normal heat flux of the agglomerated control volume on a particular boundary marker.
134- * \param[in] geometry - Geometrical definition of the problem .
135- * \param[in] val_marker - Index of the boundary marker .
164+ * \brief Set the grid velocity at each node in the coarse mesh level based
165+ * on a restriction from a finer mesh .
166+ * \param[in] fine_grid - Geometry container for the finer mesh level .
136167 */
137- void SetMultiGridWallHeatFlux ( CGeometry *geometry, unsigned short val_marker ) override ;
168+ void SetRestricted_GridVelocity ( const CGeometry *fine_grid ) override ;
138169
139170 /* !
140- * \brief Set a representative wall temperature of the agglomerated control volume on a particular boundary marker.
141- * \param[in] geometry - Geometrical definition of the problem.
142- * \param[in] val_marker - Index of the boundary marker.
171+ * \brief Find and store the closest neighbor to a vertex.
172+ * \param[in] config - Definition of the particular problem.
143173 */
144- void SetMultiGridWallTemperature (CGeometry *geometry, unsigned short val_marker ) override ;
174+ void FindNormal_Neighbor ( const CConfig *config ) override ;
145175
146176 /* !
147- * \brief Set the grid velocity at each node in the coarse mesh level based
148- * on a restriction from a finer mesh.
149- * \param[in] fine_mesh - Geometry container for the finer mesh level.
177+ * \brief Mach the near field boundary condition.
150178 * \param[in] config - Definition of the particular problem.
151179 */
152- void SetRestricted_GridVelocity (CGeometry *fine_mesh, const CConfig *config) override ;
180+ void MatchActuator_Disk ( const CConfig *config) override ;
153181
154182 /* !
155- * \brief Find and store the closest neighbor to a vertex .
183+ * \brief Mach the periodic boundary conditions .
156184 * \param[in] config - Definition of the particular problem.
185+ * \param[in] val_periodic - Index of the first periodic face in a pair.
157186 */
158- void FindNormal_Neighbor ( CConfig *config) override ;
187+ void MatchPeriodic ( const CConfig *config, unsigned short val_periodic ) override ;
159188
160- };
189+ /* !
190+ * \brief Set a representative wall normal heat flux of the agglomerated control volume on a particular boundary marker.
191+ * \param[in] fine_grid - Geometrical definition of the problem.
192+ * \param[in] val_marker - Index of the boundary marker.
193+ */
194+ void SetMultiGridWallHeatFlux (const CGeometry *fine_grid, unsigned short val_marker) override ;
161195
196+ /* !
197+ * \brief Set a representative wall temperature of the agglomerated control volume on a particular boundary marker.
198+ * \param[in] fine_grid - Geometrical definition of the problem.
199+ * \param[in] val_marker - Index of the boundary marker.
200+ */
201+ void SetMultiGridWallTemperature (const CGeometry *fine_grid, unsigned short val_marker) override ;
202+
203+ };
0 commit comments