1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 //- Name of the field data table, defaults to the name of the field
63 //- If true adjust the mapped field to maintain average value
67 autoPtr<coordinateSystem> referenceCS_;
69 //- Current interpolation addressing to face centres of underlying
71 List<FixedList<label, 3> > nearestVertex_;
73 //- Current interpolation factors to face centres of underlying
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
89 //- Current end index in sampleTimes
92 //- Interpolated values from endSampleTime
93 Field<Type> endSampledValues_;
95 //- If setAverage: end average value
99 // Private Member Functions
101 //- Get names of times
102 static wordList timeNames(const instantList&);
104 //- Find times around current time
107 const fileName& instance,
108 const fileName& local,
109 const scalar timeVal,
114 //- Read boundary points and determine interpolation weights to patch
116 void readSamplePoints();
118 //- Find boundary data inbetween current time and interpolate
121 //- Do actual interpolation using current weights
122 tmp<Field<Type> > interpolate(const Field<Type>&) const;
127 //- Runtime type information
128 TypeName("timeVaryingMappedFixedValue");
133 //- Construct from patch and internal field
134 timeVaryingMappedFixedValueFvPatchField
137 const DimensionedField<Type, volMesh>&
140 //- Construct from patch, internal field and dictionary
141 timeVaryingMappedFixedValueFvPatchField
144 const DimensionedField<Type, volMesh>&,
148 //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
150 timeVaryingMappedFixedValueFvPatchField
152 const timeVaryingMappedFixedValueFvPatchField<Type>&,
154 const DimensionedField<Type, volMesh>&,
155 const fvPatchFieldMapper&
158 //- Construct as copy
159 timeVaryingMappedFixedValueFvPatchField
161 const timeVaryingMappedFixedValueFvPatchField<Type>&
164 //- Construct and return a clone
165 virtual tmp<fvPatchField<Type> > clone() const
167 return tmp<fvPatchField<Type> >
169 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
173 //- Construct as copy setting internal field reference
174 timeVaryingMappedFixedValueFvPatchField
176 const timeVaryingMappedFixedValueFvPatchField<Type>&,
177 const DimensionedField<Type, volMesh>&
180 //- Construct and return a clone setting internal field reference
181 virtual tmp<fvPatchField<Type> > clone
183 const DimensionedField<Type, volMesh>& iF
186 return tmp<fvPatchField<Type> >
188 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
197 //- Return the coordinateSystem
198 const coordinateSystem& referenceCS() const
206 //- Map (and resize as needed) from self given a mapping object
209 const fvPatchFieldMapper&
212 //- Reverse map the given fvPatchField onto this fvPatchField
215 const fvPatchField<Type>&,
220 // Evaluation functions
222 //- Update the coefficients associated with the patch field
223 virtual void updateCoeffs();
227 virtual void write(Ostream&) const;
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 } // End namespace Foam
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 # include "timeVaryingMappedFixedValueFvPatchField.C"
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 // ************************************************************************* //