initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / oscillatingFixedValue / oscillatingFixedValueFvPatchField.H
blob02192ea93db95c40bfbb333c5fd2c5b3e064e1fd
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::oscillatingFixedValueFvPatchField
28 Description
29     Foam::oscillatingFixedValueFvPatchField
31 SourceFiles
32     oscillatingFixedValueFvPatchField.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef oscillatingFixedValueFvPatchField_H
37 #define oscillatingFixedValueFvPatchField_H
39 #include "Random.H"
40 #include "fixedValueFvPatchFields.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                      Class oscillatingFixedValueFvPatch Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class oscillatingFixedValueFvPatchField
54     public fixedValueFvPatchField<Type>
56     // Private data
58         //- Reference value
59         Field<Type> refValue_;
61         //- Amplitude
62         scalar amplitude_;
64         //- Frequency
65         scalar frequency_;
67         //- Current time index
68         label curTimeIndex_;
71     // Private member functions
73         //- Return current scale
74         scalar currentScale() const;
77 public:
79     //- Runtime type information
80     TypeName("oscillatingFixedValue");
83     // Constructors
85         //- Construct from patch and internal field
86         oscillatingFixedValueFvPatchField
87         (
88             const fvPatch&,
89             const DimensionedField<Type, volMesh>&
90         );
92         //- Construct from patch, internal field and dictionary
93         oscillatingFixedValueFvPatchField
94         (
95             const fvPatch&,
96             const DimensionedField<Type, volMesh>&,
97             const dictionary&
98         );
100         //- Construct by mapping given oscillatingFixedValueFvPatchField
101         //  onto a new patch
102         oscillatingFixedValueFvPatchField
103         (
104             const oscillatingFixedValueFvPatchField<Type>&,
105             const fvPatch&,
106             const DimensionedField<Type, volMesh>&,
107             const fvPatchFieldMapper&
108         );
110         //- Construct as copy
111         oscillatingFixedValueFvPatchField
112         (
113             const oscillatingFixedValueFvPatchField<Type>&
114         );
116         //- Construct and return a clone
117         virtual tmp<fvPatchField<Type> > clone() const
118         {
119             return tmp<fvPatchField<Type> >
120             (
121                 new oscillatingFixedValueFvPatchField<Type>(*this)
122             );
123         }
125         //- Construct as copy setting internal field reference
126         oscillatingFixedValueFvPatchField
127         (
128             const oscillatingFixedValueFvPatchField<Type>&,
129             const DimensionedField<Type, volMesh>&
130         );
132         //- Construct and return a clone setting internal field reference
133         virtual tmp<fvPatchField<Type> > clone
134         (
135             const DimensionedField<Type, volMesh>& iF
136         ) const
137         {
138             return tmp<fvPatchField<Type> >
139             (
140                 new oscillatingFixedValueFvPatchField<Type>(*this, iF)
141             );
142         }
145     // Member functions
147         // Access
149             //- Return the ref value
150             const Field<Type>& refValue() const
151             {
152                 return refValue_;
153             }
155             //- Return reference to the ref value to allow adjustment
156             Field<Type>& refValue()
157             {
158                 return refValue_;
159             }
161             //- Return amplitude
162             scalar amplitude() const
163             {
164                 return amplitude_;
165             }
167             scalar& amplitude()
168             {
169                 return amplitude_;
170             }
172             //- Return frequency
173             scalar frequency() const
174             {
175                 return frequency_;
176             }
178             scalar& frequency()
179             {
180                 return frequency_;
181             }
184         // Mapping functions
186             //- Map (and resize as needed) from self given a mapping object
187             virtual void autoMap
188             (
189                 const fvPatchFieldMapper&
190             );
192             //- Reverse map the given fvPatchField onto this fvPatchField
193             virtual void rmap
194             (
195                 const fvPatchField<Type>&,
196                 const labelList&
197             );
200         // Evaluation functions
202             //- Update the coefficients associated with the patch field
203             virtual void updateCoeffs();
206         //- Write
207         virtual void write(Ostream&) const;
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #ifdef NoRepository
218 #   include "oscillatingFixedValueFvPatchField.C"
219 #endif
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 #endif
225 // ************************************************************************* //