timeVaryingMappedFixedValueFvPatchField: Added the option to specify the name of...
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / timeVaryingMappedFixedValue / timeVaryingMappedFixedValueFvPatchField.H
bloba310c8f4dc721924b84233ca1bc78a6ea3b8776d
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         //- Name of the field data table, defaults to the name of the field
61         word fieldTableName_;
63         //- If true adjust the mapped field to maintain average value
64         bool setAverage_;
66         //- Coordinate system
67         autoPtr<coordinateSystem> referenceCS_;
69         //- Current interpolation addressing to face centres of underlying
70         //  patch
71         List<FixedList<label, 3> > nearestVertex_;
73         //- Current interpolation factors to face centres of underlying
74         //  patch
75         List<FixedList<scalar, 3> > nearestVertexWeight_;
77         //- List of boundaryData time directories
78         instantList sampleTimes_;
80         //- Current starting index in sampleTimes
81         label startSampleTime_;
83         //- Interpolated values from startSampleTime
84         Field<Type> startSampledValues_;
86         //- If setAverage: starting average value
87         Type startAverage_;
89         //- Current end index in sampleTimes
90         label endSampleTime_;
92         //- Interpolated values from endSampleTime
93         Field<Type> endSampledValues_;
95         //- If setAverage: end average value
96         Type endAverage_;
99     // Private Member Functions
101         //- Get names of times
102         static wordList timeNames(const instantList&);
104         //- Find times around current time
105         void findTime
106         (
107             const fileName& instance,
108             const fileName& local,
109             const scalar timeVal,
110             label& lo,
111             label& hi
112         ) const;
114         //- Read boundary points and determine interpolation weights to patch
115         //  faceCentres
116         void readSamplePoints();
118         //- Find boundary data inbetween current time and interpolate
119         void checkTable();
121         //- Do actual interpolation using current weights
122         tmp<Field<Type> > interpolate(const Field<Type>&) const;
125 public:
127     //- Runtime type information
128     TypeName("timeVaryingMappedFixedValue");
131     // Constructors
133         //- Construct from patch and internal field
134         timeVaryingMappedFixedValueFvPatchField
135         (
136             const fvPatch&,
137             const DimensionedField<Type, volMesh>&
138         );
140         //- Construct from patch, internal field and dictionary
141         timeVaryingMappedFixedValueFvPatchField
142         (
143             const fvPatch&,
144             const DimensionedField<Type, volMesh>&,
145             const dictionary&
146         );
148         //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
149         //  onto a new patch
150         timeVaryingMappedFixedValueFvPatchField
151         (
152             const timeVaryingMappedFixedValueFvPatchField<Type>&,
153             const fvPatch&,
154             const DimensionedField<Type, volMesh>&,
155             const fvPatchFieldMapper&
156         );
158         //- Construct as copy
159         timeVaryingMappedFixedValueFvPatchField
160         (
161             const timeVaryingMappedFixedValueFvPatchField<Type>&
162         );
164         //- Construct and return a clone
165         virtual tmp<fvPatchField<Type> > clone() const
166         {
167             return tmp<fvPatchField<Type> >
168             (
169                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
170             );
171         }
173         //- Construct as copy setting internal field reference
174         timeVaryingMappedFixedValueFvPatchField
175         (
176             const timeVaryingMappedFixedValueFvPatchField<Type>&,
177             const DimensionedField<Type, volMesh>&
178         );
180         //- Construct and return a clone setting internal field reference
181         virtual tmp<fvPatchField<Type> > clone
182         (
183             const DimensionedField<Type, volMesh>& iF
184         ) const
185         {
186             return tmp<fvPatchField<Type> >
187             (
188                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
189             );
190         }
193     // Member functions
195         // Access
197             //- Return the coordinateSystem
198             const coordinateSystem& referenceCS() const
199             {
200                 return referenceCS_;
201             }
204         // Mapping functions
206             //- Map (and resize as needed) from self given a mapping object
207             virtual void autoMap
208             (
209                 const fvPatchFieldMapper&
210             );
212             //- Reverse map the given fvPatchField onto this fvPatchField
213             virtual void rmap
214             (
215                 const fvPatchField<Type>&,
216                 const labelList&
217             );
220         // Evaluation functions
222             //- Update the coefficients associated with the patch field
223             virtual void updateCoeffs();
226         //- Write
227         virtual void write(Ostream&) const;
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 } // End namespace Foam
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 #ifdef NoRepository
238 #   include "timeVaryingMappedFixedValueFvPatchField.C"
239 #endif
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 #endif
245 // ************************************************************************* //