Documentation 6b54b78464
Loading...
Searching...
No Matches
CMultiGridGeometry.hpp
Go to the documentation of this file.
1/*!
2 * \file CMultiGridGeometry.hpp
3 * \brief Headers of the multigrid geometry class.
4 * \author F. Palacios, T. Economon
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "CGeometry.hpp"
31
32class CMultiGridQueue;
33
34/*!
35 * \class CMultiGridGeometry
36 * \brief Class for defining the multigrid geometry, the main dedicated part is the
37 * agglomeration stage, which is done in the declaration.
38 * \author F. Palacios
39 */
40class CMultiGridGeometry final : public CGeometry {
41 private:
42 /*!
43 * \brief Determine if a CVPoint can be agglomerated, if it has the same marker point as the seed.
44 * \param[in] CVPoint - Control volume to be agglomerated.
45 * \param[in] marker_seed - Marker of the seed.
46 * \param[in] fine_grid - Geometrical definition of the problem.
47 * \param[in] config - Definition of the particular problem.
48 * \return <code>TRUE</code> or <code>FALSE</code> depending if the control volume can be agglomerated.
49 */
50 bool SetBoundAgglomeration(unsigned long CVPoint, vector<short> marker_seed, const CGeometry* fine_grid,
51 const CConfig* config, const vector<char>& mixedBC) const;
52
53 /*!
54 * \brief Find nodes where two boundary conditions of different type meet. These are never
55 * agglomerated, since a coarse CV holding one would average both conditions.
56 * \param[in] fine_grid - Geometrical definition of the problem.
57 * \param[in] config - Definition of the particular problem.
58 * \return One flag per fine grid point, set where that point must stay on its own.
59 */
60 vector<char> FindMixedBoundaryNodes(const CGeometry* fine_grid, const CConfig* config) const;
61
62 /*!
63 * \brief Determine if a Point can be agglomerated using geometrical criteria.
64 * \param[in] iPoint - Seed point.
65 * \param[in] fine_grid - Geometrical definition of the problem.
66 * \param[in] config - Definition of the particular problem.
67 */
68 bool GeometricalCheck(unsigned long iPoint, const CGeometry* fine_grid, const CConfig* config) const;
69
70 /*!
71 * \brief Determine if a CVPoint can be agglomerated, if it has the same marker point as the seed.
72 * \param[out] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated.
73 * \param[in] iPoint - Seed point.
74 * \param[in] fine_grid - Geometrical definition of the problem.
75 */
76 void SetSuitableNeighbors(vector<unsigned long>& Suitable_Indirect_Neighbors, unsigned long iPoint,
77 const CGeometry* fine_grid) const;
78
79 /*!
80 * \brief Compute local curvature at a boundary vertex on Euler wall.
81 * \param[in] fine_grid - Fine grid geometry.
82 * \param[in] iPoint - Point index.
83 * \param[in] iMarker - Marker index.
84 * \return Maximum angle (in degrees) between this vertex normal and adjacent vertex normals.
85 */
86 su2double ComputeLocalCurvature(const CGeometry* fine_grid, unsigned long iPoint, unsigned short iMarker) const;
87
88 /*!
89 * \brief Pave the domain with columns grown from the boundary patches by one breadth first walk,
90 * so that every node goes to the patch that reaches it in the fewest steps.
91 * \param[in,out] Index_CoarseCV - Current coarse CV index, incremented as new coarse CVs are created.
92 * \param[in] fine_grid - Fine grid geometry.
93 * \param[in] config - Configuration.
94 * \param[in] iMesh - Multigrid level being built, used to label the summary.
95 * \param[in] mixedBC - Nodes that must stay on their own, from FindMixedBoundaryNodes.
96 * \param[in] onPhysBoundary - Nodes carrying a physical boundary condition, excluding SEND_RECEIVE.
97 * \param[in] onPeriodic - Nodes on a periodic marker, which a column never claims.
98 * \param[out] neverGrewCV - Coarse CV index of every column that never grew past its seed layer.
99 * \return Summary of the paving, empty except on the master rank.
100 */
101 string PaveAdvancingFronts(unsigned long& Index_CoarseCV, const CGeometry* fine_grid, const CConfig* config,
102 unsigned short iMesh, const vector<char>& mixedBC, const vector<char>& onPhysBoundary,
103 const vector<char>& onPeriodic, vector<unsigned long>& neverGrewCV);
104
105 /*!
106 * \brief Boundary nodes that seed a column, ordered with the most anisotropic first.
107 */
108 struct CFrontSeeds {
109 vector<unsigned long> node; /*!< \brief Seed node on the boundary. */
110 vector<std::array<su2double, MAXNDIM>> normal; /*!< \brief Unit normal there, pointing into the domain. */
111 vector<su2double> strength; /*!< \brief Local anisotropy, the ordering key. */
112 vector<char> tier; /*!< \brief Paving order: 0 viscous wall, 1 Euler
113 wall, 2 anything else. */
114 unsigned long nRefusedCurvature = 0; /*!< \brief Euler wall nodes the curvature limit kept out. */
115 };
116
117 /*!
118 * \brief Collect the boundary nodes that seed a column: those where the stiffest edge is also the
119 * edge most nearly along the boundary normal, so the mesh is layered against this boundary.
120 * \param[in] fine_grid - Fine grid geometry.
121 * \param[in] config - Definition of the particular problem.
122 * \return Seed nodes and their inward boundary normals, most anisotropic first.
123 */
124 CFrontSeeds SeedFrontNodes(const CGeometry* fine_grid, const CConfig* config) const;
125
126 /*!
127 * \brief Element strip a column follows while the mesh is extruded along it.
128 */
129 struct CWalkState {
130 unsigned long elem; /*!< \brief Element the column stands in, or NO_ELEM once it is lost. */
131 unsigned short face; /*!< \brief Local face it entered that element through. */
132 };
133
134 /*!
135 * \brief Partition the seed nodes into compact surface patches. A patch is a boundary face where
136 * the primal grid gives one, otherwise it is built by repeated pairwise matching.
137 * \param[in] seeds - Seed nodes from SeedFrontNodes.
138 * \param[in] fine_grid - Fine grid geometry.
139 * \param[in] config - Definition of the particular problem.
140 * \param[in] mixedBC - Nodes that must stay on their own, from FindMixedBoundaryNodes.
141 * \param[out] walk - Element and face each patch starts from, NO_ELEM where it has none.
142 * \return One vector of indices into seeds.node per patch, at most two entries in 2D, four in 3D.
143 */
144 vector<vector<unsigned long>> BuildFrontPatches(const CFrontSeeds& seeds, const CGeometry* fine_grid,
145 const CConfig* config, const vector<char>& mixedBC,
146 vector<CWalkState>& walk) const;
147
148 string levelReport; /*!< \brief Console summary for this level. */
149
150 public:
151 /*!
152 * \brief Get the console summary for this level, held back so it does not interleave with the
153 * multigrid table.
154 * \return Summary text, empty except on the master rank.
155 */
156 const string& GetLevelReport() const { return levelReport; }
157
158 /*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
163
164 /*!
165 * \brief Constructor of the class.
166 * \param[in] fine_grid - Geometrical definition of the problem.
167 * \param[in] config - Definition of the particular problem.
168 * \param[in] iMesh - Level of the multigrid.
169 */
170 CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, unsigned short iMesh);
171
172 /*!
173 * \brief Set boundary vertex.
174 * \param[in] fine_grid - Geometrical definition of the problem.
175 * \param[in] config - Definition of the particular problem.
176 */
177 void SetVertex(const CGeometry* fine_grid, const CConfig* config) override;
178
179 /*!
180 * \brief Set points which surround a point.
181 * \param[in] fine_grid - Geometrical definition of the child grid.
182 */
183 void SetPoint_Connectivity(const CGeometry* fine_grid) override;
184
185 /*!
186 * \brief Set the edge structure of the agglomerated control volume.
187 * \param[in] fine_grid - Geometrical definition of the problem.
188 * \param[in] action - Allocate or not the new elements.
189 */
190 void SetControlVolume(const CGeometry* fine_grid, unsigned short action) override;
191
192 /*!
193 * \brief Set boundary vertex structure of the agglomerated control volume.
194 * \param[in] fine_grid - Geometrical definition of the problem.
195 * \param[in] config - Definition of the particular problem.
196 * \param[in] action - Allocate or not the new elements.
197 */
198 void SetBoundControlVolume(const CGeometry* fine_grid, const CConfig* config, unsigned short action) override;
199
200 /*!
201 * \brief Set a representative coordinates of the agglomerated control volume.
202 * \param[in] fine_grid - Geometrical definition of the problem.
203 */
204 void SetCoord(const CGeometry* fine_grid) override;
205
206 /*!
207 * \brief Set the grid velocity at each node in the coarse mesh level based
208 * on a restriction from a finer mesh.
209 * \param[in] fine_grid - Geometry container for the finer mesh level.
210 */
211 void SetRestricted_GridVelocity(const CGeometry* fine_grid) override;
212
213 /*!
214 * \brief Find and store the closest, most normal, neighbor to a vertex.
215 * \param[in] config - Definition of the particular problem.
216 */
217 void FindNormal_Neighbor(const CConfig* config) override;
218
219 /*!
220 * \brief Mach the near field boundary condition.
221 * \param[in] config - Definition of the particular problem.
222 */
223 void MatchActuator_Disk(const CConfig* config) override;
224
225 /*!
226 * \brief Set a representative wall normal heat flux of the agglomerated control volume on a particular boundary
227 * marker. \param[in] fine_grid - Geometrical definition of the problem. \param[in] val_marker - Index of the boundary
228 * marker.
229 */
230 void SetMultiGridWallHeatFlux(const CGeometry* fine_grid, unsigned short val_marker) override;
231
232 /*!
233 * \brief Set a representative wall temperature of the agglomerated control volume on a particular boundary marker.
234 * \param[in] fine_grid - Geometrical definition of the problem.
235 * \param[in] val_marker - Index of the boundary marker.
236 */
237 void SetMultiGridWallTemperature(const CGeometry* fine_grid, unsigned short val_marker) override;
238};
Headers of the main subroutines for creating the geometrical structure. The subroutines and functions...
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
virtual void SetBoundControlVolume(const CConfig *config, unsigned short action)
A virtual member.
Definition CGeometry.hpp:946
virtual void SetPoint_Connectivity()
Set connectivity between points.
Definition CGeometry.hpp:819
virtual void SetVertex(const CConfig *config)
Sets the vertices.
Definition CGeometry.hpp:851
virtual void SetControlVolume(CConfig *config, unsigned short action)
Sets control volume.
Definition CGeometry.hpp:918
Class for defining the multigrid geometry, the main dedicated part is the agglomeration stage,...
Definition CMultiGridGeometry.hpp:40
void SetCoord(const CGeometry *fine_grid) override
Set a representative coordinates of the agglomerated control volume.
Definition CMultiGridGeometry.cpp:1339
void MatchActuator_Disk(const CConfig *config) override
Mach the near field boundary condition.
Definition CMultiGridGeometry.cpp:1224
void SetMultiGridWallHeatFlux(const CGeometry *fine_grid, unsigned short val_marker) override
Set a representative wall normal heat flux of the agglomerated control volume on a particular boundar...
Definition CMultiGridGeometry.cpp:1356
virtual void SetPoint_Connectivity()
Set connectivity between points.
Definition CGeometry.hpp:819
void SetVertex(const CGeometry *fine_grid, const CConfig *config) override
Set boundary vertex.
Definition CMultiGridGeometry.cpp:1149
void FindNormal_Neighbor(const CConfig *config) override
Find and store the closest, most normal, neighbor to a vertex.
Definition CMultiGridGeometry.cpp:1417
void SetMultiGridWallTemperature(const CGeometry *fine_grid, unsigned short val_marker) override
Set a representative wall temperature of the agglomerated control volume on a particular boundary mar...
Definition CMultiGridGeometry.cpp:1374
void SetRestricted_GridVelocity(const CGeometry *fine_grid) override
Set the grid velocity at each node in the coarse mesh level based on a restriction from a finer mesh.
Definition CMultiGridGeometry.cpp:1392
void SetControlVolume(const CGeometry *fine_grid, unsigned short action) override
Set the edge structure of the agglomerated control volume.
Definition CMultiGridGeometry.cpp:1240
void SetBoundControlVolume(const CGeometry *fine_grid, const CConfig *config, unsigned short action) override
Set boundary vertex structure of the agglomerated control volume.
Definition CMultiGridGeometry.cpp:1297
const string & GetLevelReport() const
Get the console summary for this level, held back so it does not interleave with the multigrid table.
Definition CMultiGridGeometry.hpp:156
Class for a multigrid queue system for the finite volume solver.
Definition CMultiGridQueue.hpp:42
passivedouble su2double
Definition code_config.hpp:181