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

atmBoundaryLayerInletVelocityFvPatchVectorField.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) 2010-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 the
00013     Free Software Foundation; either version 3 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     atmBoundaryLayerInletVelocityFvPatchVectorField
00027 
00028 Description
00029     Boundary condition specifies a atmospheric boundary layer (ABL)
00030     velocity inlet profile given the friction velocity value,
00031     flow direction n and direction of the parabolic coordinate z.
00032 
00033     @verbatim
00034         U = (Ustar/K) ln((z - zGround + z0)/z0)
00035 
00036     where:
00037 
00038         Ustar is the frictional velocity
00039         K is karman's constant
00040         z0 is the surface roughness lenght
00041         z is the verical coordinate
00042         zGround is the minumum coordinate value in z direction.
00043 
00044     and:
00045 
00046         Ustar = K Uref/ln((Zref + z0)/z0)
00047 
00048     where:
00049 
00050         Uref is the reference velocity at Zref
00051         Zref is the reference height.
00052 
00053     @endverbatim
00054 
00055     Reference:
00056     D.M. Hargreaves and N.G. Wright
00057     "On the use of the k-epsilon model in commercial CFD software to model the
00058      neutral atmospheric boundary layer"
00059     Journal of Wind Engineering and Industrial Aerodynamics 95(2007) 355-369.
00060 
00061 NOTE: D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the k-epsilon
00062       model should be changed from 1.3 to 1.11 for consistency.
00063       The roughness height (Er) is given by Er = 20 z0 following the same
00064       reference
00065 
00066 SourceFiles
00067     atmBoundaryLayerInletVelocityFvPatchVectorField.C
00068 
00069 \*---------------------------------------------------------------------------*/
00070 
00071 #ifndef atmBoundaryLayerInletVelocityFvPatchVectorField_H
00072 #define atmBoundaryLayerInletVelocityFvPatchVectorField_H
00073 
00074 #include <finiteVolume/fvPatchFields.H>
00075 #include <finiteVolume/fixedValueFvPatchFields.H>
00076 
00077 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00078 
00079 namespace Foam
00080 {
00081 namespace incompressible
00082 {
00083 
00084 /*---------------------------------------------------------------------------*\
00085        Class atmBoundaryLayerInletVelocityFvPatchVectorField Declaration
00086 \*---------------------------------------------------------------------------*/
00087 
00088 class atmBoundaryLayerInletVelocityFvPatchVectorField
00089 :
00090     public fixedValueFvPatchVectorField
00091 {
00092     // Private data
00093 
00094         //- Frictional velocity
00095         scalar Ustar_;
00096 
00097         //- Flow direction
00098         vector n_;
00099 
00100         //- Direction of the z-coordinate
00101         vector z_;
00102 
00103         //- Surface roughness lenght
00104         const scalar z0_;
00105 
00106         //- Von Karman constant
00107         const scalar kappa_;
00108 
00109         //- Reference velocity
00110         const scalar Uref_;
00111 
00112         //- Reference hight
00113         const scalar Href_;
00114 
00115         //- Minimum corrdinate value in z direction
00116         const scalar zGround_;
00117 
00118 
00119 public:
00120 
00121     //- Runtime type information
00122     TypeName("atmBoundaryLayerInletVelocity");
00123 
00124 
00125     // Constructors
00126 
00127         //- Construct from patch and internal field
00128         atmBoundaryLayerInletVelocityFvPatchVectorField
00129         (
00130             const fvPatch&,
00131             const DimensionedField<vector, volMesh>&
00132         );
00133 
00134         //- Construct from patch, internal field and dictionary
00135         atmBoundaryLayerInletVelocityFvPatchVectorField
00136         (
00137             const fvPatch&,
00138             const DimensionedField<vector, volMesh>&,
00139             const dictionary&
00140         );
00141 
00142         //- Construct by mapping given
00143         // atmBoundaryLayerInletVelocityFvPatchVectorField onto a new patch
00144         atmBoundaryLayerInletVelocityFvPatchVectorField
00145         (
00146             const atmBoundaryLayerInletVelocityFvPatchVectorField&,
00147             const fvPatch&,
00148             const DimensionedField<vector, volMesh>&,
00149             const fvPatchFieldMapper&
00150         );
00151 
00152         //- Construct and return a clone
00153         virtual tmp<fvPatchVectorField> clone() const
00154         {
00155             return tmp<fvPatchVectorField>
00156             (
00157                 new atmBoundaryLayerInletVelocityFvPatchVectorField(*this)
00158             );
00159         }
00160 
00161         //- Construct as copy setting internal field reference
00162         atmBoundaryLayerInletVelocityFvPatchVectorField
00163         (
00164             const atmBoundaryLayerInletVelocityFvPatchVectorField&,
00165             const DimensionedField<vector, volMesh>&
00166         );
00167 
00168         //- Construct and return a clone setting internal field reference
00169         virtual tmp<fvPatchVectorField> clone
00170         (
00171             const DimensionedField<vector, volMesh>& iF
00172         ) const
00173         {
00174             return tmp<fvPatchVectorField>
00175             (
00176                 new atmBoundaryLayerInletVelocityFvPatchVectorField(*this, iF)
00177             );
00178         }
00179 
00180 
00181     // Member functions
00182 
00183         //- Return Ustar
00184         scalar& Ustar()
00185         {
00186             return Ustar_;
00187         }
00188 
00189         //- Return flow direction
00190         vector& n()
00191         {
00192             return n_;
00193         }
00194 
00195         //- Return z direction
00196         vector& z()
00197         {
00198             return z_;
00199         }
00200 
00201         //- Update coefficients
00202         virtual void updateCoeffs();
00203 
00204         //- Write
00205         virtual void write(Ostream&) const;
00206 };
00207 
00208 
00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00210 
00211 } // End namespace incompressible
00212 } // End namespace Foam
00213 
00214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00215 
00216 #endif
00217 
00218 // ************************************************************************* //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines