1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::layerAdditionRemoval
28 Cell layer addition mesh modifier
31 layerAdditionRemoval.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef layerAdditionRemoval_H
38 #define layerAdditionRemoval_H
40 #include "polyMeshModifier.H"
41 #include "primitiveFacePatch.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class layerAdditionRemoval Declaration
51 \*---------------------------------------------------------------------------*/
53 class layerAdditionRemoval
55 public polyMeshModifier
59 //- Master face zone ID
60 faceZoneID faceZoneID_;
62 //- Min thickness of extrusion layer. Triggers layer removal
63 mutable scalar minLayerThickness_;
65 //- Max thickness of extrusion layer. Triggers layer addition
66 mutable scalar maxLayerThickness_;
68 //- Layer thickness from previous step
69 // Used to decide whether to add or remove layers
70 mutable scalar oldLayerThickness_;
73 mutable labelList* pointsPairingPtr_;
76 mutable labelList* facesPairingPtr_;
78 //- Layer removal trigger time index
79 mutable label triggerRemoval_;
81 //- Layer addition trigger time index
82 mutable label triggerAddition_;
85 // Private Member Functions
87 //- Disallow default bitwise copy construct
88 layerAdditionRemoval(const layerAdditionRemoval&);
90 //- Disallow default bitwise assignment
91 void operator=(const layerAdditionRemoval&);
93 //- Check validity of construction data
94 void checkDefinition();
97 // Topological changes
99 //- Check for valid layer
100 bool validCollapse() const;
102 //- Set layer pairing. Return true if a valid layer exists
103 bool setLayerPairing() const;
105 //- Return points pairing in a layer (not automatic!)
106 const labelList& pointsPairing() const;
108 //- Return faces pairing in a layer (not automatic!)
109 const labelList& facesPairing() const;
111 //- Calculate the offset to the next layer
112 tmp<vectorField> extrusionDir() const;
114 //- Add a layer of cells
115 void addCellLayer(polyTopoChange&) const;
117 //- Remove a layer of cells
118 void removeCellLayer(polyTopoChange&) const;
121 void clearAddressing() const;
125 //- Optionally read old thickness
126 static scalar readOldThickness(const dictionary&);
129 // Static data members
131 //- Thickness insertion fraction for the pre-motion
132 static const scalar addDelta_;
134 //- Thickness removal fraction for the cell collapse
135 // Note: the cell will be collapsed to this relative
136 // thickness before the layer is removed.
137 static const scalar removeDelta_;
141 //- Runtime type information
142 TypeName("layerAdditionRemoval");
147 //- Construct from components
152 const polyTopoChanger& mme,
153 const word& zoneName,
154 const scalar minThickness,
155 const scalar maxThickness
158 //- Construct from dictionary
162 const dictionary& dict,
164 const polyTopoChanger& mme
169 virtual ~layerAdditionRemoval();
174 //- Check for topology change
175 virtual bool changeTopology() const;
177 //- Insert the layer addition/removal instructions
178 // into the topological change
179 virtual void setRefinement(polyTopoChange&) const;
181 //- Modify motion points to comply with the topological change
182 virtual void modifyMotionPoints(pointField& motionPoints) const;
184 //- Force recalculation of locally stored data on topological change
185 virtual void updateMesh(const mapPolyMesh&);
190 //- Return min layer thickness which triggers removal
191 scalar minLayerThickness() const
193 return minLayerThickness_;
196 //- Set min layer thickness which triggers removal
197 void setMinLayerThickness(const scalar t) const;
199 //- Return max layer thickness which triggers removal
200 scalar maxLayerThickness() const
202 return maxLayerThickness_;
205 //- Set max layer thickness which triggers removal
206 void setMaxLayerThickness(const scalar t) const;
210 virtual void write(Ostream&) const;
213 virtual void writeDict(Ostream&) const;
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 } // End namespace Foam
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 // ************************************************************************* //