1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Foam::timeVaryingMappedFixedValueFvPatchField
28 Foam::timeVaryingMappedFixedValueFvPatchField
31 timeVaryingMappedFixedValueFvPatchField.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef timeVaryingMappedFixedValueFvPatchField_H
36 #define timeVaryingMappedFixedValueFvPatchField_H
38 #include "fixedValueFvPatchFields.H"
39 #include "coordinateSystem.H"
40 #include "FixedList.H"
41 #include "instantList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class timeVaryingMappedFixedValueFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
53 class timeVaryingMappedFixedValueFvPatchField
55 public fixedValueFvPatchField<Type>
59 //- Name of the field data table, defaults to the name of the field
62 //- If true adjust the mapped field to maintain average value
66 autoPtr<coordinateSystem> referenceCS_;
68 //- Current interpolation addressing to face centres of underlying
70 List<FixedList<label, 3> > nearestVertex_;
72 //- Current interpolation factors to face centres of underlying
74 List<FixedList<scalar, 3> > nearestVertexWeight_;
76 //- List of boundaryData time directories
77 instantList sampleTimes_;
79 //- Current starting index in sampleTimes
80 label startSampleTime_;
82 //- Interpolated values from startSampleTime
83 Field<Type> startSampledValues_;
85 //- If setAverage: starting average value
88 //- Current end index in sampleTimes
91 //- Interpolated values from endSampleTime
92 Field<Type> endSampledValues_;
94 //- If setAverage: end average value
98 // Private Member Functions
100 //- Get names of times
101 static wordList timeNames(const instantList&);
103 //- Find times around current time
106 const fileName& instance,
107 const fileName& local,
108 const scalar timeVal,
113 //- Read boundary points and determine interpolation weights to patch
115 void readSamplePoints();
117 //- Find boundary data inbetween current time and interpolate
120 //- Do actual interpolation using current weights
121 tmp<Field<Type> > interpolate(const Field<Type>&) const;
126 //- Runtime type information
127 TypeName("timeVaryingMappedFixedValue");
132 //- Construct from patch and internal field
133 timeVaryingMappedFixedValueFvPatchField
136 const DimensionedField<Type, volMesh>&
139 //- Construct from patch, internal field and dictionary
140 timeVaryingMappedFixedValueFvPatchField
143 const DimensionedField<Type, volMesh>&,
147 //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
149 timeVaryingMappedFixedValueFvPatchField
151 const timeVaryingMappedFixedValueFvPatchField<Type>&,
153 const DimensionedField<Type, volMesh>&,
154 const fvPatchFieldMapper&
157 //- Construct as copy
158 timeVaryingMappedFixedValueFvPatchField
160 const timeVaryingMappedFixedValueFvPatchField<Type>&
163 //- Construct and return a clone
164 virtual tmp<fvPatchField<Type> > clone() const
166 return tmp<fvPatchField<Type> >
168 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
172 //- Construct as copy setting internal field reference
173 timeVaryingMappedFixedValueFvPatchField
175 const timeVaryingMappedFixedValueFvPatchField<Type>&,
176 const DimensionedField<Type, volMesh>&
179 //- Construct and return a clone setting internal field reference
180 virtual tmp<fvPatchField<Type> > clone
182 const DimensionedField<Type, volMesh>& iF
185 return tmp<fvPatchField<Type> >
187 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
196 //- Return the coordinateSystem
197 const coordinateSystem& referenceCS() const
205 //- Map (and resize as needed) from self given a mapping object
208 const fvPatchFieldMapper&
211 //- Reverse map the given fvPatchField onto this fvPatchField
214 const fvPatchField<Type>&,
219 // Evaluation functions
221 //- Update the coefficients associated with the patch field
222 virtual void updateCoeffs();
226 virtual void write(Ostream&) const;
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 } // End namespace Foam
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 # include "timeVaryingMappedFixedValueFvPatchField.C"
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 // ************************************************************************* //