snappyRefineDriver.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::snappyRefineDriver
26 
27 Description
28 
29 SourceFiles
30  snappyRefineDriver.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef snappyRefineDriver_H
35 #define snappyRefineDriver_H
36 
37 #include "treeBoundBox.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 // Forward declaration of classes
45 class refinementParameters;
46 class snapParameters;
47 
48 class meshRefinement;
49 class decompositionMethod;
50 class fvMeshDistribute;
51 
52 /*---------------------------------------------------------------------------*\
53  Class snappyRefineDriver Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58  // Private Data
59 
60  //- Mesh+surface
61  meshRefinement& meshRefiner_;
62 
63  //- Reference to decomposition method
64  decompositionMethod& decomposer_;
65 
66  //- Reference to mesh distribution engine
67  fvMeshDistribute& distributor_;
68 
69  //- From surface region to patch
70  const labelList globalToMasterPatch_;
71 
72  //- From surface region to patch
73  const labelList globalToSlavePatch_;
74 
75 
76  // Private Member Functions
77 
78  //- Refine all cells pierced by explicit feature edges
79  label featureEdgeRefine
80  (
81  const refinementParameters& refineParams,
82  const label maxIter,
83  const label minRefine
84  );
85 
86  //- Refine all cells interacting with the surface
87  label surfaceOnlyRefine
88  (
89  const refinementParameters& refineParams,
90  const label maxIter
91  );
92 
93  //- Refine all cells in small gaps
94  label gapOnlyRefine
95  (
96  const refinementParameters& refineParams,
97  const label maxIter
98  );
99 
100  //- Refine cells with almost all sides refined
101  label danglingCellRefine
102  (
103  const refinementParameters& refineParams,
104  const label nFaces,
105  const label maxIter
106  );
107 
108  //- Remove all cells within intersected region
109  void removeInsideCells
110  (
111  const refinementParameters& refineParams,
112  const label nBufferLayers
113  );
114 
115  //- Remove all cells inside/outside shell
116  label shellRefine
117  (
118  const refinementParameters& refineParams,
119  const label maxIter
120  );
121 
122  //- Add baffles and remove unreachable cells
123  void baffleAndSplitMesh
124  (
125  const refinementParameters& refineParams,
126  const snapParameters& snapParams,
127  const bool handleSnapProblems,
128  const dictionary& motionDict
129  );
130 
131  //- Add zones
132  void zonify(const refinementParameters& refineParams);
133 
134  void splitAndMergeBaffles
135  (
136  const refinementParameters& refineParams,
137  const snapParameters& snapParams,
138  const bool handleSnapProblems,
139  const dictionary& motionDict
140  );
141 
142  //- Merge refined boundary faces (from exposing coarser cell)
143  void mergePatchFaces
144  (
145  const refinementParameters& refineParams,
146  const dictionary& motionDict
147  );
148 
149 
150 public:
151 
152  //- Runtime type information
153  ClassName("snappyRefineDriver");
154 
155 
156  // Constructors
157 
158  //- Construct from components
160  (
161  meshRefinement& meshRefiner,
162  decompositionMethod& decomposer,
163  fvMeshDistribute& distributor,
164  const labelList& globalToMasterPatch,
165  const labelList& globalToSlavePatch
166  );
167 
168  //- Disallow default bitwise copy construction
169  snappyRefineDriver(const snappyRefineDriver&) = delete;
170 
171 
172  // Member Functions
173 
174  //- Do all the refinement
175  void doRefine
176  (
177  const dictionary& refineDict,
178  const refinementParameters& refineParams,
179  const snapParameters& snapParams,
180  const bool prepareForSnapping,
181  const dictionary& motionDict
182  );
183 
184 
185  // Member Operators
186 
187  //- Disallow default bitwise assignment
188  void operator=(const snappyRefineDriver&) = delete;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
Abstract base class for decomposition.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Simple container to keep together refinement specific information.
Simple container to keep together snap specific information.
void doRefine(const dictionary &refineDict, const refinementParameters &refineParams, const snapParameters &snapParams, const bool prepareForSnapping, const dictionary &motionDict)
Do all the refinement.
ClassName("snappyRefineDriver")
Runtime type information.
snappyRefineDriver(meshRefinement &meshRefiner, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch)
Construct from components.
void operator=(const snappyRefineDriver &)=delete
Disallow default bitwise assignment.
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59