initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fvMesh / wallDist / wallPointYPlus / wallPointYPlusI.H
blob0f41fae9a90be8f987ec645e1121d1c2ae486eb1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Description
27 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
34 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
37 // Update this with w2 if w2 nearer to pt.
38 inline bool wallPointYPlus::update
40     const point& pt,
41     const wallPointYPlus& w2,
42     const scalar tol
45     scalar dist2 = magSqr(pt - w2.origin());
47     scalar diff = distSqr() - dist2;
49     if (diff < 0)
50     {
51         // already nearer to pt
52         return false;
53     }
55     if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
56     {
57         // don't propagate small changes
58         return false;
59     }
60     else
61     {
62         // only propagate if interesting (i.e. y+ < 100)
63         scalar yPlus = Foam::sqrt(dist2)/w2.data();
66         if (yPlus < yPlusCutOff)
67         {
68             // update with new values
69             distSqr() = dist2;
70             origin() = w2.origin();
71             data() = w2.data();
73             return true;
74         }
75         else
76         {
77             return false;
78         }
79     }
81     
83 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
85 // Null constructor
86 inline wallPointYPlus::wallPointYPlus()
88     wallPointData<scalar>()
90     // Important: value of yStar where meshWave does not come.
91     data() = 1.0;
95 // Construct from components
96 inline wallPointYPlus::wallPointYPlus
98     const point& origin,
99     const scalar yStar,
100     const scalar distSqr
103     wallPointData<scalar>(origin, yStar, distSqr)
107 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
109 // Update this with w2 if w2 nearer to pt.
110 inline bool wallPointYPlus::updateCell
112     const polyMesh& mesh,
113     const label thisCellI,
114     const label neighbourFaceI,
115     const wallPointYPlus& neighbourWallInfo,
116     const scalar tol
119     const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
121     return update
122     (
123         cellCentres[thisCellI],
124         neighbourWallInfo,
125         tol
126     );
127 }    
130 // Update this with w2 if w2 nearer to pt.
131 inline bool wallPointYPlus::updateFace
133     const polyMesh& mesh,
134     const label thisFaceI,
135     const label neighbourCellI,
136     const wallPointYPlus& neighbourWallInfo,
137     const scalar tol
140     const vectorField& faceCentres = mesh.faceCentres();
142     return update
143     (
144         faceCentres[thisFaceI],
145         neighbourWallInfo,
146         tol
147     );
148 }    
151 // Update this with w2 if w2 nearer to pt.
152 inline bool wallPointYPlus::updateFace
154     const polyMesh& mesh,
155     const label thisFaceI,
156     const wallPointYPlus& neighbourWallInfo,
157     const scalar tol
160     const vectorField& faceCentres = mesh.faceCentres();
162     return update
163     (
164         faceCentres[thisFaceI],
165         neighbourWallInfo,
166         tol
167     );
168 }    
171 // ************************************************************************* //
173 } // End namespace Foam
175 // ************************************************************************* //