1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
26 Foam::timeVaryingMappedFixedValueFvPatchField
29 Foam::timeVaryingMappedFixedValueFvPatchField
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class timeVaryingMappedFixedValueFvPatch Declaration
51 \*---------------------------------------------------------------------------*/
54 class timeVaryingMappedFixedValueFvPatchField
56 public fixedValueFvPatchField<Type>
60 //- If true adjust the mapped field to maintain average value
64 autoPtr<coordinateSystem> referenceCS_;
66 //- Current interpolation addressing to face centres of underlying
68 List<FixedList<label, 3> > nearestVertex_;
70 //- Current interpolation factors to face centres of underlying
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
86 //- Current end index in sampleTimes
89 //- Interpolated values from endSampleTime
90 Field<Type> endSampledValues_;
92 //- If setAverage: end average value
96 // Private Member Functions
98 //- Get names of times
99 static wordList timeNames(const instantList&);
101 //- Find times around current time
104 const fileName& instance,
105 const fileName& local,
106 const scalar timeVal,
111 //- Read boundary points and determine interpolation weights to patch
113 void readSamplePoints();
115 //- Find boundary data inbetween current time and interpolate
118 //- Do actual interpolation using current weights
119 tmp<Field<Type> > interpolate(const Field<Type>&) const;
124 //- Runtime type information
125 TypeName("timeVaryingMappedFixedValue");
130 //- Construct from patch and internal field
131 timeVaryingMappedFixedValueFvPatchField
134 const DimensionedField<Type, volMesh>&
137 //- Construct from patch, internal field and dictionary
138 timeVaryingMappedFixedValueFvPatchField
141 const DimensionedField<Type, volMesh>&,
145 //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
147 timeVaryingMappedFixedValueFvPatchField
149 const timeVaryingMappedFixedValueFvPatchField<Type>&,
151 const DimensionedField<Type, volMesh>&,
152 const fvPatchFieldMapper&
155 //- Construct as copy
156 timeVaryingMappedFixedValueFvPatchField
158 const timeVaryingMappedFixedValueFvPatchField<Type>&
161 //- Construct and return a clone
162 virtual tmp<fvPatchField<Type> > clone() const
164 return tmp<fvPatchField<Type> >
166 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
170 //- Construct as copy setting internal field reference
171 timeVaryingMappedFixedValueFvPatchField
173 const timeVaryingMappedFixedValueFvPatchField<Type>&,
174 const DimensionedField<Type, volMesh>&
177 //- Construct and return a clone setting internal field reference
178 virtual tmp<fvPatchField<Type> > clone
180 const DimensionedField<Type, volMesh>& iF
183 return tmp<fvPatchField<Type> >
185 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
194 //- Return the coordinateSystem
195 const coordinateSystem& referenceCS() const
203 //- Map (and resize as needed) from self given a mapping object
206 const fvPatchFieldMapper&
209 //- Reverse map the given fvPatchField onto this fvPatchField
212 const fvPatchField<Type>&,
217 // Evaluation functions
219 //- Update the coefficients associated with the patch field
220 virtual void updateCoeffs();
224 virtual void write(Ostream&) const;
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 } // End namespace Foam
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 # include "timeVaryingMappedFixedValueFvPatchField.C"
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 // ************************************************************************* //