OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

smoothDelta.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-2009 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 Class
00026     Foam::smoothDelta
00027 
00028 Description
00029     Smoothed delta which takes a given simple geometric delta and applies
00030     smoothing to it such that the ratio of deltas between two cells is no
00031     larger than a specified amount, typically 1.15.
00032 
00033 SourceFiles
00034     smoothDelta.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef smoothDelta_H
00039 #define smoothDelta_H
00040 
00041 #include "LESdelta.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class smoothDelta Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class smoothDelta
00053 :
00054     public LESdelta
00055 {
00056     // Private data
00057 
00058         autoPtr<LESdelta> geometricDelta_;
00059         scalar maxDeltaRatio_;
00060 
00061 
00062     // Private Member Functions
00063 
00064         //- Disallow default bitwise copy construct and assignment
00065         smoothDelta(const smoothDelta&);
00066         void operator=(const smoothDelta&);
00067 
00068         // Calculate the delta values
00069         void calcDelta();
00070 
00071         //- Private member class used by mesh-wave to propagate the delta-ratio
00072         class deltaData
00073         {
00074             scalar delta_;
00075 
00076             // Private Member Functions
00077 
00078                 //- Update. Gets information from neighbouring face/cell and
00079                 //  uses this to update itself (if nessecary) and return true.
00080                 inline bool update
00081                 (
00082                     const deltaData& w2,
00083                     const scalar scale,
00084                     const scalar tol
00085                 );
00086 
00087 
00088         public:
00089 
00090             // Static data members
00091 
00092                 //- delta fraction
00093                 static scalar maxDeltaRatio;
00094 
00095 
00096                 // Constructors
00097 
00098                 //- Construct null
00099                 inline deltaData();
00100 
00101                 //- Construct from origin, yStar, distance
00102                 inline deltaData(const scalar delta);
00103 
00104 
00105             // Member Functions
00106 
00107                 // Access
00108 
00109                 scalar delta() const
00110                 {
00111                     return delta_;
00112                 }
00113 
00114 
00115                 // Needed by FaceCellWave
00116 
00117                     //- Check whether origin has been changed at all or
00118                     //  still contains original (invalid) value.
00119                     inline bool valid() const;
00120 
00121                     //- Check for identical geometrical data.
00122                     //  Used for cyclics checking.
00123                     inline bool sameGeometry
00124                     (
00125                         const polyMesh&,
00126                         const deltaData&,
00127                         const scalar
00128                     ) const;
00129 
00130                     //- Convert any absolute coordinates into relative to
00131                     //  (patch)face centre
00132                     inline void leaveDomain
00133                     (
00134                         const polyMesh&,
00135                         const polyPatch&,
00136                         const label patchFaceI,
00137                         const point& faceCentre
00138                     );
00139 
00140                     //- Reverse of leaveDomain
00141                     inline void enterDomain
00142                     (
00143                         const polyMesh&,
00144                         const polyPatch&,
00145                         const label patchFaceI,
00146                         const point& faceCentre
00147                     );
00148 
00149                     //- Apply rotation matrix to any coordinates
00150                     inline void transform
00151                     (
00152                         const polyMesh&,
00153                         const tensor&
00154                     );
00155 
00156                     //- Influence of neighbouring face.
00157                     inline bool updateCell
00158                     (
00159                         const polyMesh&,
00160                         const label thisCellI,
00161                         const label neighbourFaceI,
00162                         const deltaData& neighbourInfo,
00163                         const scalar tol
00164                     );
00165 
00166                     //- Influence of neighbouring cell.
00167                     inline bool updateFace
00168                     (
00169                         const polyMesh&,
00170                         const label thisFaceI,
00171                         const label neighbourCellI,
00172                         const deltaData& neighbourInfo,
00173                         const scalar tol
00174                     );
00175 
00176                     //- Influence of different value on same face.
00177                     inline bool updateFace
00178                     (
00179                         const polyMesh&,
00180                         const label thisFaceI,
00181                         const deltaData& neighbourInfo,
00182                         const scalar tol
00183                     );
00184 
00185                 // Member Operators
00186 
00187                     // Needed for List IO
00188                     inline bool operator==(const deltaData&) const;
00189 
00190                     inline bool operator!=(const deltaData&) const;
00191 
00192                 // IOstream Operators
00193 
00194                     friend Ostream& operator<<
00195                     (
00196                         Ostream& os,
00197                         const deltaData& wDist
00198                     )
00199                     {
00200                         return os << wDist.delta_;
00201                     }
00202 
00203                     friend Istream& operator>>(Istream& is, deltaData& wDist)
00204                     {
00205                         return is >> wDist.delta_;
00206                     }
00207         };
00208 
00209 
00210         void setChangedFaces
00211         (
00212             const polyMesh& mesh,
00213             const volScalarField& delta,
00214             DynamicList<label>& changedFaces,
00215             DynamicList<deltaData>& changedFacesInfo
00216         );
00217 
00218 
00219 public:
00220 
00221     //- Runtime type information
00222     TypeName("smooth");
00223 
00224 
00225     // Constructors
00226 
00227         //- Construct from name, mesh and IOdictionary
00228         smoothDelta
00229         (
00230             const word& name,
00231             const fvMesh& mesh,
00232             const dictionary&
00233         );
00234 
00235 
00236     //- Destructor
00237     virtual ~smoothDelta()
00238     {}
00239 
00240 
00241     // Member Functions
00242 
00243         //- Read the LESdelta dictionary
00244         virtual void read(const dictionary&);
00245 
00246         // Correct values
00247         virtual void correct();
00248 };
00249 
00250 
00251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00252 
00253 } // End namespace Foam
00254 
00255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00256 
00257 #include "smoothDeltaDeltaDataI.H"
00258 
00259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00260 
00261 #endif
00262 
00263 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd