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

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