layerAdditionRemoval.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2013 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::layerAdditionRemoval
29
30Description
31 Cell layer addition mesh modifier
32
33SourceFiles
34 layerAdditionRemoval.C
35 addCellLayer.C
36 removeCellLayer.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef Foam_layerAdditionRemoval_H
41#define Foam_layerAdditionRemoval_H
42
43#include "polyMeshModifier.H"
44#include "primitivePatch.H"
45#include "ZoneIDs.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class layerAdditionRemoval Declaration
54\*---------------------------------------------------------------------------*/
57:
58 public polyMeshModifier
59{
60 // Private Data
61
62 //- Master face zone ID
63 faceZoneID faceZoneID_;
64
65 //- Min thickness of extrusion layer. Triggers layer removal
66 mutable scalar minLayerThickness_;
67
68 //- Max thickness of extrusion layer. Triggers layer addition
69 mutable scalar maxLayerThickness_;
70
71 //- Switch to calculate thickness as volume/area
72 // If false, thickness calculated from edges
73 const bool thicknessFromVolume_;
74
75 //- Layer thickness from previous step
76 // Used to decide whether to add or remove layers
77 mutable scalar oldLayerThickness_;
78
79 //- Point pairing
80 mutable unique_ptr<labelList> pointsPairingPtr_;
81
82 //- Face pairing
83 mutable unique_ptr<labelList> facesPairingPtr_;
84
85 //- Layer removal trigger time index
86 mutable label triggerRemoval_;
87
88 //- Layer addition trigger time index
89 mutable label triggerAddition_;
90
91
92 // Private Member Functions
93
94 //- No copy construct
96
97 //- No copy assignment
98 void operator=(const layerAdditionRemoval&) = delete;
99
100 //- Check validity of construction data
101 void checkDefinition();
102
103
104 // Topological Changes
105
106 //- Check for valid layer
107 bool validCollapse() const;
108
109 //- Set layer pairing. Return true if a valid layer exists
110 bool setLayerPairing() const;
111
112 //- Return points pairing in a layer (not automatic!)
113 const labelList& pointsPairing() const;
114
115 //- Return faces pairing in a layer (not automatic!)
116 const labelList& facesPairing() const;
117
118 //- Calculate the offset to the next layer
119 tmp<vectorField> extrusionDir() const;
120
121 //- Add a layer of cells
122 void addCellLayer(polyTopoChange&) const;
123
124 //- Remove a layer of cells
125 void removeCellLayer(polyTopoChange&) const;
126
127 //- Clear addressing
128 void clearAddressing() const;
129
130
131 // Static Data Members
132
133 //- Thickness insertion fraction for the pre-motion
134 static const scalar addDelta_;
135
136 //- Thickness removal fraction for the cell collapse
137 // Note: the cell will be collapsed to this relative
138 // thickness before the layer is removed.
139 static const scalar removeDelta_;
140
141public:
142
143 //- Runtime type information
144 TypeName("layerAdditionRemoval");
145
146
147 // Constructors
148
149 //- Construct from components
151 (
152 const word& name,
153 const label index,
154 const polyTopoChanger& ptc,
155 const word& zoneName,
156 const scalar minThickness,
157 const scalar maxThickness,
158 const bool thicknessFromVolume = true
159 );
160
161 //- Construct from dictionary
163 (
164 const word& name,
165 const dictionary& dict,
166 const label index,
167 const polyTopoChanger& ptc
168 );
169
170
171 //- Destructor
172 virtual ~layerAdditionRemoval() = default;
173
174
175 // Member Functions
176
177 //- Check for topology change
178 virtual bool changeTopology() const;
179
180 //- Insert the layer addition/removal instructions
181 // into the topological change
182 virtual void setRefinement(polyTopoChange&) const;
183
184 //- Modify motion points to comply with the topological change
185 virtual void modifyMotionPoints(pointField& motionPoints) const;
186
187 //- Force recalculation of locally stored data on topological change
188 virtual void updateMesh(const mapPolyMesh&);
189
190
191 // Edit
192
193 //- Return min layer thickness which triggers removal
194 scalar minLayerThickness() const
195 {
196 return minLayerThickness_;
197 }
198
199 //- Set min layer thickness which triggers removal
200 void setMinLayerThickness(const scalar t) const;
201
202 //- Return max layer thickness which triggers removal
203 scalar maxLayerThickness() const
204 {
205 return maxLayerThickness_;
206 }
207
208 //- Set max layer thickness which triggers removal
209 void setMaxLayerThickness(const scalar t) const;
210
211
212 //- Write
213 virtual void write(Ostream&) const;
214
215 //- Write dictionary
216 virtual void writeDict(Ostream&) const;
217};
218
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222} // End namespace Foam
223
224// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225
226#endif
227
228// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Cell layer addition mesh modifier.
scalar maxLayerThickness() const
Return max layer thickness which triggers removal.
void setMaxLayerThickness(const scalar t) const
Set max layer thickness which triggers removal.
TypeName("layerAdditionRemoval")
Runtime type information.
virtual bool changeTopology() const
Check for topology change.
virtual void writeDict(Ostream &) const
Write dictionary.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
void setMinLayerThickness(const scalar t) const
Set min layer thickness which triggers removal.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
scalar minLayerThickness() const
Return min layer thickness which triggers removal.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
virtual ~layerAdditionRemoval()=default
Destructor.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Virtual base class for mesh modifiers.
label index() const
Return the index of this modifier.
const word & name() const
Return name of this modifier.
Direct mesh changes based on v1.3 polyTopoChange syntax.
List of mesh modifiers defining the mesh dynamics.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73