Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / turbulenceModels / LES / LESdeltas / smoothDelta / smoothDelta.H
blobf538e4ceaba6406917258d06f5192b7c795e28fc
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::smoothDelta
27 Description
28     Smoothed delta which takes a given simple geometric delta and applies
29     smoothing to it such that the ratio of deltas between two cells is no
30     larger than a specified amount, typically 1.15.
32 SourceFiles
33     smoothDelta.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef smoothDelta_H
38 #define smoothDelta_H
40 #include "LESdelta.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class smoothDelta Declaration
49 \*---------------------------------------------------------------------------*/
51 class smoothDelta
53     public LESdelta
55     // Private data
57         //- Raw geometric delta, to be used in smoothing
58         autoPtr<LESdelta> geometricDelta_;
60         //- Smoothing ratio
61         scalar maxDeltaRatio_;
64     // Private Member Functions
66         //- Disallow default bitwise copy construct and assignment
67         smoothDelta(const smoothDelta&);
68         void operator=(const smoothDelta&);
70         // Calculate the delta values
71         void calcDelta();
73         //- Private member class used by mesh-wave to propagate the delta-ratio
74         class deltaData
75         {
76             scalar delta_;
78             // Private Member Functions
80                 //- Update. Gets information from neighbouring face/cell and
81                 //  uses this to update itself (if nessecary) and return true.
82                 inline bool update
83                 (
84                     const deltaData& w2,
85                     const scalar scale,
86                     const scalar tol
87                 );
90         public:
92             // Static data members
94                 //- delta fraction
95                 static scalar maxDeltaRatio;
98                 // Constructors
100                 //- Construct null
101                 inline deltaData();
103                 //- Construct from origin, yStar, distance
104                 inline deltaData(const scalar delta);
107             // Member Functions
109                 // Access
111                 scalar delta() const
112                 {
113                     return delta_;
114                 }
117                 // Needed by FaceCellWave
119                     //- Check whether origin has been changed at all or
120                     //  still contains original (invalid) value.
121                     inline bool valid() const;
123                     //- Check for identical geometrical data.
124                     //  Used for cyclics checking.
125                     inline bool sameGeometry
126                     (
127                         const polyMesh&,
128                         const deltaData&,
129                         const scalar
130                     ) const;
132                     //- Convert any absolute coordinates into relative to
133                     //  (patch)face centre
134                     inline void leaveDomain
135                     (
136                         const polyMesh&,
137                         const polyPatch&,
138                         const label patchFaceI,
139                         const point& faceCentre
140                     );
142                     //- Reverse of leaveDomain
143                     inline void enterDomain
144                     (
145                         const polyMesh&,
146                         const polyPatch&,
147                         const label patchFaceI,
148                         const point& faceCentre
149                     );
151                     //- Apply rotation matrix to any coordinates
152                     inline void transform
153                     (
154                         const polyMesh&,
155                         const tensor&
156                     );
158                     //- Influence of neighbouring face.
159                     inline bool updateCell
160                     (
161                         const polyMesh&,
162                         const label thisCellI,
163                         const label neighbourFaceI,
164                         const deltaData& neighbourInfo,
165                         const scalar tol
166                     );
168                     //- Influence of neighbouring cell.
169                     inline bool updateFace
170                     (
171                         const polyMesh&,
172                         const label thisFaceI,
173                         const label neighbourCellI,
174                         const deltaData& neighbourInfo,
175                         const scalar tol
176                     );
178                     //- Influence of different value on same face.
179                     inline bool updateFace
180                     (
181                         const polyMesh&,
182                         const label thisFaceI,
183                         const deltaData& neighbourInfo,
184                         const scalar tol
185                     );
187                 // Member Operators
189                     // Needed for List IO
190                     inline bool operator==(const deltaData&) const;
192                     inline bool operator!=(const deltaData&) const;
194                 // IOstream Operators
196                     friend Ostream& operator<<
197                     (
198                         Ostream& os,
199                         const deltaData& wDist
200                     )
201                     {
202                         return os << wDist.delta_;
203                     }
205                     friend Istream& operator>>(Istream& is, deltaData& wDist)
206                     {
207                         return is >> wDist.delta_;
208                     }
209         };
212         void setChangedFaces
213         (
214             const polyMesh& mesh,
215             const volScalarField& delta,
216             dynamicLabelList& changedFaces,
217             DynamicList<deltaData>& changedFacesInfo
218         );
221 public:
223     //- Runtime type information
224     TypeName("smooth");
227     // Constructors
229         //- Construct from name, mesh and IOdictionary
230         smoothDelta
231         (
232             const word& name,
233             const fvMesh& mesh,
234             const dictionary&
235         );
238     //- Destructor
239     virtual ~smoothDelta()
240     {}
243     // Member Functions
245         //- Read the LESdelta dictionary
246         virtual void read(const dictionary&);
248         // Correct values
249         virtual void correct();
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 } // End namespace Foam
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 #include "smoothDeltaDeltaDataI.H"
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 #endif
265 // ************************************************************************* //