OpenFOAM logo
Open Source CFD Toolkit

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