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

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-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::oscillatingFixedValueFvPatchField
00026 
00027 Description
00028     Foam::oscillatingFixedValueFvPatchField
00029 
00030 SourceFiles
00031     oscillatingFixedValueFvPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef oscillatingFixedValueFvPatchField_H
00036 #define oscillatingFixedValueFvPatchField_H
00037 
00038 #include <OpenFOAM/Random.H>
00039 #include <finiteVolume/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 DimensionedField<Type, volMesh>&
00089         );
00090 
00091         //- Construct from patch, internal field and dictionary
00092         oscillatingFixedValueFvPatchField
00093         (
00094             const fvPatch&,
00095             const DimensionedField<Type, volMesh>&,
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 DimensionedField<Type, volMesh>&,
00106             const fvPatchFieldMapper&
00107         );
00108 
00109         //- Construct as copy
00110         oscillatingFixedValueFvPatchField
00111         (
00112             const oscillatingFixedValueFvPatchField<Type>&
00113         );
00114 
00115         //- Construct and return a clone
00116         virtual tmp<fvPatchField<Type> > clone() const
00117         {
00118             return tmp<fvPatchField<Type> >
00119             (
00120                 new oscillatingFixedValueFvPatchField<Type>(*this)
00121             );
00122         }
00123 
00124         //- Construct as copy setting internal field reference
00125         oscillatingFixedValueFvPatchField
00126         (
00127             const oscillatingFixedValueFvPatchField<Type>&,
00128             const DimensionedField<Type, volMesh>&
00129         );
00130 
00131         //- Construct and return a clone setting internal field reference
00132         virtual tmp<fvPatchField<Type> > clone
00133         (
00134             const DimensionedField<Type, volMesh>& iF
00135         ) const
00136         {
00137             return tmp<fvPatchField<Type> >
00138             (
00139                 new oscillatingFixedValueFvPatchField<Type>(*this, iF)
00140             );
00141         }
00142 
00143 
00144     // Member functions
00145 
00146         // Access
00147 
00148             //- Return the ref value
00149             const Field<Type>& refValue() const
00150             {
00151                 return refValue_;
00152             }
00153 
00154             //- Return reference to the ref value to allow adjustment
00155             Field<Type>& refValue()
00156             {
00157                 return refValue_;
00158             }
00159 
00160             //- Return amplitude
00161             scalar amplitude() const
00162             {
00163                 return amplitude_;
00164             }
00165 
00166             scalar& amplitude()
00167             {
00168                 return amplitude_;
00169             }
00170 
00171             //- Return frequency
00172             scalar frequency() const
00173             {
00174                 return frequency_;
00175             }
00176 
00177             scalar& frequency()
00178             {
00179                 return frequency_;
00180             }
00181 
00182 
00183         // Mapping functions
00184 
00185             //- Map (and resize as needed) from self given a mapping object
00186             virtual void autoMap
00187             (
00188                 const fvPatchFieldMapper&
00189             );
00190 
00191             //- Reverse map the given fvPatchField onto this fvPatchField
00192             virtual void rmap
00193             (
00194                 const fvPatchField<Type>&,
00195                 const labelList&
00196             );
00197 
00198 
00199         // Evaluation functions
00200 
00201             //- Update the coefficients associated with the patch field
00202             virtual void updateCoeffs();
00203 
00204 
00205         //- Write
00206         virtual void write(Ostream&) const;
00207 };
00208 
00209 
00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00211 
00212 } // End namespace Foam
00213 
00214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00215 
00216 #ifdef NoRepository
00217 #   include <finiteVolume/oscillatingFixedValueFvPatchField.C>
00218 #endif
00219 
00220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00221 
00222 #endif
00223 
00224 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines