OpenFOAM logo
Open Source CFD Toolkit

wallPointYPlusI.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00035 
00036 
00037 // Update this with w2 if w2 nearer to pt.
00038 inline bool wallPointYPlus::update
00039 (
00040     const point& pt,
00041     const wallPointYPlus& w2,
00042     const scalar tol
00043 )
00044 {
00045     scalar dist2 = magSqr(pt - w2.origin());
00046 
00047     scalar diff = distSqr() - dist2;
00048 
00049     if (diff < 0)
00050     {
00051         // already nearer to pt
00052         return false;
00053     }
00054 
00055     if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
00056     {
00057         // don't propagate small changes
00058         return false;
00059     }
00060     else
00061     {
00062         // only propagate if interesting (i.e. y+ < 100)
00063         scalar yPlus = Foam::sqrt(dist2)/w2.data();
00064 
00065 
00066         if (yPlus < yPlusCutOff)
00067         {
00068             // update with new values
00069             distSqr() = dist2;
00070             origin() = w2.origin();
00071             data() = w2.data();
00072 
00073             return true;
00074         }
00075         else
00076         {
00077             return false;
00078         }
00079     }
00080 }
00081     
00082 
00083 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00084 
00085 // Null constructor
00086 inline wallPointYPlus::wallPointYPlus()
00087 :
00088     wallPointData<scalar>()
00089 {
00090     // Important: value of yStar where meshWave does not come.
00091     data() = 1.0;
00092 }
00093 
00094 
00095 // Construct from components
00096 inline wallPointYPlus::wallPointYPlus
00097 (
00098     const point& origin,
00099     const scalar yStar,
00100     const scalar distSqr
00101 )
00102 :
00103     wallPointData<scalar>(origin, yStar, distSqr)
00104 {}
00105 
00106 
00107 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00108 
00109 // Update this with w2 if w2 nearer to pt.
00110 inline bool wallPointYPlus::updateCell
00111 (
00112     const polyMesh& mesh,
00113     const label thisCellI,
00114     const label neighbourFaceI,
00115     const wallPointYPlus& neighbourWallInfo,
00116     const scalar tol
00117 )
00118 {
00119     const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
00120 
00121     return update
00122     (
00123         cellCentres[thisCellI],
00124         neighbourWallInfo,
00125         tol
00126     );
00127 }    
00128 
00129 
00130 // Update this with w2 if w2 nearer to pt.
00131 inline bool wallPointYPlus::updateFace
00132 (
00133     const polyMesh& mesh,
00134     const label thisFaceI,
00135     const label neighbourCellI,
00136     const wallPointYPlus& neighbourWallInfo,
00137     const scalar tol
00138 )
00139 {
00140     const vectorField& faceCentres = mesh.faceCentres();
00141 
00142     return update
00143     (
00144         faceCentres[thisFaceI],
00145         neighbourWallInfo,
00146         tol
00147     );
00148 }    
00149 
00150 
00151 // Update this with w2 if w2 nearer to pt.
00152 inline bool wallPointYPlus::updateFace
00153 (
00154     const polyMesh& mesh,
00155     const label thisFaceI,
00156     const wallPointYPlus& neighbourWallInfo,
00157     const scalar tol
00158 )
00159 {
00160     const vectorField& faceCentres = mesh.faceCentres();
00161 
00162     return update
00163     (
00164         faceCentres[thisFaceI],
00165         neighbourWallInfo,
00166         tol
00167     );
00168 }    
00169 
00170 
00171 // ************************************************************************* //
00172 
00173 } // End namespace Foam
00174 
00175 // ************************************************************************* //
For further information go to www.openfoam.org