initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / timeVaryingMappedFixedValue / timeVaryingMappedFixedValueFvPatchField.H
blob31b88ae03aa11537c31f93f2d78451d0549f3593
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::timeVaryingMappedFixedValueFvPatchField
28 Description
29     Foam::timeVaryingMappedFixedValueFvPatchField
31 SourceFiles
32     timeVaryingMappedFixedValueFvPatchField.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef timeVaryingMappedFixedValueFvPatchField_H
37 #define timeVaryingMappedFixedValueFvPatchField_H
39 #include "fixedValueFvPatchFields.H"
40 #include "coordinateSystem.H"
41 #include "FixedList.H"
42 #include "instantList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50               Class timeVaryingMappedFixedValueFvPatch Declaration
51 \*---------------------------------------------------------------------------*/
53 template<class Type>
54 class timeVaryingMappedFixedValueFvPatchField
56     public fixedValueFvPatchField<Type>
58     // Private data
60         //- If true adjust the mapped field to maintain average value
61         bool setAverage_;
63         //- Coordinate system
64         autoPtr<coordinateSystem> referenceCS_;
66         //- Current interpolation addressing to face centres of underlying
67         //  patch
68         List<FixedList<label, 3> > nearestVertex_;
70         //- Current interpolation factors to face centres of underlying
71         //  patch
72         List<FixedList<scalar, 3> > nearestVertexWeight_;
74         //- List of boundaryData time directories
75         instantList sampleTimes_;
77         //- Current starting index in sampleTimes
78         label startSampleTime_;
80         //- Interpolated values from startSampleTime
81         Field<Type> startSampledValues_;
83         //- If setAverage: starting average value
84         Type startAverage_;
86         //- Current end index in sampleTimes
87         label endSampleTime_;
89         //- Interpolated values from endSampleTime
90         Field<Type> endSampledValues_;
92         //- If setAverage: end average value
93         Type endAverage_;
96     // Private Member Functions
98         //- Get names of times
99         static wordList timeNames(const instantList&);
101         //- Find times around current time
102         void findTime
103         (
104             const fileName& instance,
105             const fileName& local,
106             const scalar timeVal,
107             label& lo,
108             label& hi
109         ) const;
111         //- Read boundary points and determine interpolation weights to patch
112         //  faceCentres
113         void readSamplePoints();
115         //- Find boundary data inbetween current time and interpolate
116         void checkTable();
118         //- Do actual interpolation using current weights
119         tmp<Field<Type> > interpolate(const Field<Type>&) const;
122 public:
124     //- Runtime type information
125     TypeName("timeVaryingMappedFixedValue");
128     // Constructors
130         //- Construct from patch and internal field
131         timeVaryingMappedFixedValueFvPatchField
132         (
133             const fvPatch&,
134             const DimensionedField<Type, volMesh>&
135         );
137         //- Construct from patch, internal field and dictionary
138         timeVaryingMappedFixedValueFvPatchField
139         (
140             const fvPatch&,
141             const DimensionedField<Type, volMesh>&,
142             const dictionary&
143         );
145         //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
146         //  onto a new patch
147         timeVaryingMappedFixedValueFvPatchField
148         (
149             const timeVaryingMappedFixedValueFvPatchField<Type>&,
150             const fvPatch&,
151             const DimensionedField<Type, volMesh>&,
152             const fvPatchFieldMapper&
153         );
155         //- Construct as copy
156         timeVaryingMappedFixedValueFvPatchField
157         (
158             const timeVaryingMappedFixedValueFvPatchField<Type>&
159         );
161         //- Construct and return a clone
162         virtual tmp<fvPatchField<Type> > clone() const
163         {
164             return tmp<fvPatchField<Type> >
165             (
166                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
167             );
168         }
170         //- Construct as copy setting internal field reference
171         timeVaryingMappedFixedValueFvPatchField
172         (
173             const timeVaryingMappedFixedValueFvPatchField<Type>&,
174             const DimensionedField<Type, volMesh>&
175         );
177         //- Construct and return a clone setting internal field reference
178         virtual tmp<fvPatchField<Type> > clone
179         (
180             const DimensionedField<Type, volMesh>& iF
181         ) const
182         {
183             return tmp<fvPatchField<Type> >
184             (
185                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
186             );
187         }
190     // Member functions
192         // Access
194             //- Return the coordinateSystem
195             const coordinateSystem& referenceCS() const
196             {
197                 return referenceCS_;
198             }
201         // Mapping functions
203             //- Map (and resize as needed) from self given a mapping object
204             virtual void autoMap
205             (
206                 const fvPatchFieldMapper&
207             );
209             //- Reverse map the given fvPatchField onto this fvPatchField
210             virtual void rmap
211             (
212                 const fvPatchField<Type>&,
213                 const labelList&
214             );
217         // Evaluation functions
219             //- Update the coefficients associated with the patch field
220             virtual void updateCoeffs();
223         //- Write
224         virtual void write(Ostream&) const;
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 } // End namespace Foam
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 #ifdef NoRepository
235 #   include "timeVaryingMappedFixedValueFvPatchField.C"
236 #endif
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 #endif
242 // ************************************************************************* //