FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025 
00026 \*---------------------------------------------------------------------------*/
00027 
00028 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00029 
00030 namespace Foam
00031 {
00032 
00033 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00034 
00035 
00036 // Update this with w2 if w2 nearer to pt.
00037 inline bool wallPointYPlus::update
00038 (
00039     const point& pt,
00040     const wallPointYPlus& w2,
00041     const scalar tol
00042 )
00043 {
00044     scalar dist2 = magSqr(pt - w2.origin());
00045 
00046     scalar diff = distSqr() - dist2;
00047 
00048     if (diff < 0)
00049     {
00050         // already nearer to pt
00051         return false;
00052     }
00053 
00054     if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
00055     {
00056         // don't propagate small changes
00057         return false;
00058     }
00059     else
00060     {
00061         // only propagate if interesting (i.e. y+ < 100)
00062         scalar yPlus = Foam::sqrt(dist2)/w2.data();
00063 
00064 
00065         if (yPlus < yPlusCutOff)
00066         {
00067             // update with new values
00068             distSqr() = dist2;
00069             origin() = w2.origin();
00070             data() = w2.data();
00071 
00072             return true;
00073         }
00074         else
00075         {
00076             return false;
00077         }
00078     }
00079 }
00080     
00081 
00082 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00083 
00084 // Null constructor
00085 inline wallPointYPlus::wallPointYPlus()
00086 :
00087     wallPointData<scalar>()
00088 {
00089     // Important: value of yStar where meshWave does not come.
00090     data() = 1.0;
00091 }
00092 
00093 
00094 // Construct from components
00095 inline wallPointYPlus::wallPointYPlus
00096 (
00097     const point& origin,
00098     const scalar yStar,
00099     const scalar distSqr
00100 )
00101 :
00102     wallPointData<scalar>(origin, yStar, distSqr)
00103 {}
00104 
00105 
00106 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00107 
00108 // Update this with w2 if w2 nearer to pt.
00109 inline bool wallPointYPlus::updateCell
00110 (
00111     const polyMesh& mesh,
00112     const label thisCellI,
00113     const label neighbourFaceI,
00114     const wallPointYPlus& neighbourWallInfo,
00115     const scalar tol
00116 )
00117 {
00118     const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
00119 
00120     return update
00121     (
00122         cellCentres[thisCellI],
00123         neighbourWallInfo,
00124         tol
00125     );
00126 }    
00127 
00128 
00129 // Update this with w2 if w2 nearer to pt.
00130 inline bool wallPointYPlus::updateFace
00131 (
00132     const polyMesh& mesh,
00133     const label thisFaceI,
00134     const label neighbourCellI,
00135     const wallPointYPlus& neighbourWallInfo,
00136     const scalar tol
00137 )
00138 {
00139     const vectorField& faceCentres = mesh.faceCentres();
00140 
00141     return update
00142     (
00143         faceCentres[thisFaceI],
00144         neighbourWallInfo,
00145         tol
00146     );
00147 }    
00148 
00149 
00150 // Update this with w2 if w2 nearer to pt.
00151 inline bool wallPointYPlus::updateFace
00152 (
00153     const polyMesh& mesh,
00154     const label thisFaceI,
00155     const wallPointYPlus& neighbourWallInfo,
00156     const scalar tol
00157 )
00158 {
00159     const vectorField& faceCentres = mesh.faceCentres();
00160 
00161     return update
00162     (
00163         faceCentres[thisFaceI],
00164         neighbourWallInfo,
00165         tol
00166     );
00167 }    
00168 
00169 } // End namespace Foam
00170 
00171 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines