OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

timeVaryingMappedFixedValueFvPatchField.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::timeVaryingMappedFixedValueFvPatchField
00027 
00028 Description
00029     Foam::timeVaryingMappedFixedValueFvPatchField
00030 
00031 SourceFiles
00032     timeVaryingMappedFixedValueFvPatchField.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef timeVaryingMappedFixedValueFvPatchField_H
00037 #define timeVaryingMappedFixedValueFvPatchField_H
00038 
00039 #include "fixedValueFvPatchFields.H"
00040 #include "coordinateSystem.H"
00041 #include "FixedList.H"
00042 #include "instantList.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050               Class timeVaryingMappedFixedValueFvPatch Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 template<class Type>
00054 class timeVaryingMappedFixedValueFvPatchField
00055 :
00056     public fixedValueFvPatchField<Type>
00057 {
00058     // Private data
00059 
00060         //- If true adjust the mapped field to maintain average value
00061         bool setAverage_;
00062 
00063         //- Coordinate system
00064         autoPtr<coordinateSystem> referenceCS_;
00065 
00066         //- Current interpolation addressing to face centres of underlying
00067         //  patch
00068         List<FixedList<label, 3> > nearestVertex_;
00069 
00070         //- Current interpolation factors to face centres of underlying
00071         //  patch
00072         List<FixedList<scalar, 3> > nearestVertexWeight_;
00073 
00074         //- List of boundaryData time directories
00075         instantList sampleTimes_;
00076 
00077         //- Current starting index in sampleTimes
00078         label startSampleTime_;
00079 
00080         //- Interpolated values from startSampleTime
00081         Field<Type> startSampledValues_;
00082 
00083         //- If setAverage: starting average value
00084         Type startAverage_;
00085 
00086         //- Current end index in sampleTimes
00087         label endSampleTime_;
00088 
00089         //- Interpolated values from endSampleTime
00090         Field<Type> endSampledValues_;
00091 
00092         //- If setAverage: end average value
00093         Type endAverage_;
00094 
00095 
00096     // Private Member Functions
00097 
00098         //- Get names of times
00099         static wordList timeNames(const instantList&);
00100 
00101         //- Find times around current time
00102         void findTime
00103         (
00104             const fileName& instance,
00105             const fileName& local,
00106             const scalar timeVal,
00107             label& lo,
00108             label& hi
00109         ) const;
00110 
00111         //- Read boundary points and determine interpolation weights to patch
00112         //  faceCentres
00113         void readSamplePoints();
00114 
00115         //- Find boundary data inbetween current time and interpolate
00116         void checkTable();
00117 
00118         //- Do actual interpolation using current weights
00119         tmp<Field<Type> > interpolate(const Field<Type>&) const;
00120 
00121 
00122 public:
00123 
00124     //- Runtime type information
00125     TypeName("timeVaryingMappedFixedValue");
00126 
00127 
00128     // Constructors
00129 
00130         //- Construct from patch and internal field
00131         timeVaryingMappedFixedValueFvPatchField
00132         (
00133             const fvPatch&,
00134             const DimensionedField<Type, volMesh>&
00135         );
00136 
00137         //- Construct from patch, internal field and dictionary
00138         timeVaryingMappedFixedValueFvPatchField
00139         (
00140             const fvPatch&,
00141             const DimensionedField<Type, volMesh>&,
00142             const dictionary&
00143         );
00144 
00145         //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
00146         //  onto a new patch
00147         timeVaryingMappedFixedValueFvPatchField
00148         (
00149             const timeVaryingMappedFixedValueFvPatchField<Type>&,
00150             const fvPatch&,
00151             const DimensionedField<Type, volMesh>&,
00152             const fvPatchFieldMapper&
00153         );
00154 
00155         //- Construct as copy
00156         timeVaryingMappedFixedValueFvPatchField
00157         (
00158             const timeVaryingMappedFixedValueFvPatchField<Type>&
00159         );
00160 
00161         //- Construct and return a clone
00162         virtual tmp<fvPatchField<Type> > clone() const
00163         {
00164             return tmp<fvPatchField<Type> >
00165             (
00166                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
00167             );
00168         }
00169 
00170         //- Construct as copy setting internal field reference
00171         timeVaryingMappedFixedValueFvPatchField
00172         (
00173             const timeVaryingMappedFixedValueFvPatchField<Type>&,
00174             const DimensionedField<Type, volMesh>&
00175         );
00176 
00177         //- Construct and return a clone setting internal field reference
00178         virtual tmp<fvPatchField<Type> > clone
00179         (
00180             const DimensionedField<Type, volMesh>& iF
00181         ) const
00182         {
00183             return tmp<fvPatchField<Type> >
00184             (
00185                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
00186             );
00187         }
00188 
00189 
00190     // Member functions
00191 
00192         // Access
00193 
00194             //- Return the coordinateSystem
00195             const coordinateSystem& referenceCS() const
00196             {
00197                 return referenceCS_;
00198             }
00199 
00200 
00201         // Mapping functions
00202 
00203             //- Map (and resize as needed) from self given a mapping object
00204             virtual void autoMap
00205             (
00206                 const fvPatchFieldMapper&
00207             );
00208 
00209             //- Reverse map the given fvPatchField onto this fvPatchField
00210             virtual void rmap
00211             (
00212                 const fvPatchField<Type>&,
00213                 const labelList&
00214             );
00215 
00216 
00217         // Evaluation functions
00218 
00219             //- Update the coefficients associated with the patch field
00220             virtual void updateCoeffs();
00221 
00222 
00223         //- Write
00224         virtual void write(Ostream&) const;
00225 };
00226 
00227 
00228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00229 
00230 } // End namespace Foam
00231 
00232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00233 
00234 #ifdef NoRepository
00235 #   include "timeVaryingMappedFixedValueFvPatchField.C"
00236 #endif
00237 
00238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00239 
00240 #endif
00241 
00242 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd