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

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