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

turbulentInletFvPatchField.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 Class
00025     Foam::turbulentInletFvPatchField
00026 
00027 Description
00028     Generate a fluctuating inlet condition by adding a random component
00029     to a reference (mean) field.
00030     Input:
00031         referenceField
00032             Mean field.
00033         fluctuationScale
00034             RMS fluctuation, provided as the fraction of the mean field.
00035         alpha
00036             temporal correlation factor;
00037             the fraction of the new random component added to the previous
00038             time-step (defaults to 0.1).
00039 
00040 SourceFiles
00041     turbulentInletFvPatchField.C
00042 
00043 \*---------------------------------------------------------------------------*/
00044 
00045 #ifndef turbulentInletFvPatchField_H
00046 #define turbulentInletFvPatchField_H
00047 
00048 #include <OpenFOAM/Random.H>
00049 #include <finiteVolume/fixedValueFvPatchFields.H>
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 /*---------------------------------------------------------------------------*\
00057                      Class turbulentInletFvPatch Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 template<class Type>
00061 class turbulentInletFvPatchField
00062 :
00063     public fixedValueFvPatchField<Type>
00064 {
00065     // Private data
00066 
00067         Random ranGen_;
00068         Type fluctuationScale_;
00069         Field<Type> referenceField_;
00070         scalar alpha_;
00071         label curTimeIndex_;
00072 
00073 
00074 public:
00075 
00076     //- Runtime type information
00077     TypeName("turbulentInlet");
00078 
00079 
00080     // Constructors
00081 
00082         //- Construct from patch and internal field
00083         turbulentInletFvPatchField
00084         (
00085             const fvPatch&,
00086             const DimensionedField<Type, volMesh>&
00087         );
00088 
00089         //- Construct from patch, internal field and dictionary
00090         turbulentInletFvPatchField
00091         (
00092             const fvPatch&,
00093             const DimensionedField<Type, volMesh>&,
00094             const dictionary&
00095         );
00096 
00097         //- Construct by mapping given turbulentInletFvPatchField
00098         //  onto a new patch
00099         turbulentInletFvPatchField
00100         (
00101             const turbulentInletFvPatchField<Type>&,
00102             const fvPatch&,
00103             const DimensionedField<Type, volMesh>&,
00104             const fvPatchFieldMapper&
00105         );
00106 
00107         //- Construct as copy
00108         turbulentInletFvPatchField
00109         (
00110             const turbulentInletFvPatchField<Type>&
00111         );
00112 
00113         //- Construct and return a clone
00114         virtual tmp<fvPatchField<Type> > clone() const
00115         {
00116             return tmp<fvPatchField<Type> >
00117             (
00118                 new turbulentInletFvPatchField<Type>(*this)
00119             );
00120         }
00121 
00122         //- Construct as copy setting internal field reference
00123         turbulentInletFvPatchField
00124         (
00125             const turbulentInletFvPatchField<Type>&,
00126             const DimensionedField<Type, volMesh>&
00127         );
00128 
00129         //- Construct and return a clone setting internal field reference
00130         virtual tmp<fvPatchField<Type> > clone
00131         (
00132             const DimensionedField<Type, volMesh>& iF
00133         ) const
00134         {
00135             return tmp<fvPatchField<Type> >
00136             (
00137                 new turbulentInletFvPatchField<Type>(*this, iF)
00138             );
00139         }
00140 
00141 
00142     // Member functions
00143 
00144         // Access
00145 
00146             //- Return the fluctuation scale
00147             const Type& fluctuationScale() const
00148             {
00149                 return fluctuationScale_;
00150             }
00151 
00152             //- Return reference to the fluctuation scale to allow adjustment
00153             Type& fluctuationScale()
00154             {
00155                 return fluctuationScale_;
00156             }
00157 
00158             //- Return the reference field
00159             const Field<Type>& referenceField() const
00160             {
00161                 return referenceField_;
00162             }
00163 
00164             //- Return reference to the reference field to allow adjustment
00165             Field<Type>& referenceField()
00166             {
00167                 return referenceField_;
00168             }
00169 
00170 
00171         // Mapping functions
00172 
00173             //- Map (and resize as needed) from self given a mapping object
00174             virtual void autoMap
00175             (
00176                 const fvPatchFieldMapper&
00177             );
00178 
00179             //- Reverse map the given fvPatchField onto this fvPatchField
00180             virtual void rmap
00181             (
00182                 const fvPatchField<Type>&,
00183                 const labelList&
00184             );
00185 
00186 
00187         // Evaluation functions
00188 
00189             //- Update the coefficients associated with the patch field
00190             virtual void updateCoeffs();
00191 
00192 
00193         //- Write
00194         virtual void write(Ostream&) const;
00195 };
00196 
00197 
00198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00199 
00200 } // End namespace Foam
00201 
00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00203 
00204 #ifdef NoRepository
00205 #   include <finiteVolume/turbulentInletFvPatchField.C>
00206 #endif
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 #endif
00211 
00212 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines