OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen 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-2007 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     timeVaryingMappedFixedValueFvPatchField
00027 
00028 Description
00029 
00030 SourceFiles
00031     timeVaryingMappedFixedValueFvPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef timeVaryingMappedFixedValueFvPatchField_H
00036 #define timeVaryingMappedFixedValueFvPatchField_H
00037 
00038 #include "fixedValueFvPatchFields.H"
00039 #include "coordinateSystem.H"
00040 #include "FixedList.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048               Class timeVaryingMappedFixedValueFvPatch Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class Type>
00052 class timeVaryingMappedFixedValueFvPatchField
00053 :
00054     public fixedValueFvPatchField<Type>
00055 {
00056     // Private data
00057 
00058         //- If true adjust the mapped field to maintain average value
00059         bool setAverage_;
00060 
00061         //- Coordinate system
00062         autoPtr<coordinateSystem> referenceCS_;
00063 
00064         //- Current interpolation addressing to face centres of underlying
00065         //  patch
00066         List<FixedList<label, 3> > nearestVertex_;
00067 
00068         //- Current interpolation factors to face centres of underlying
00069         //  patch
00070         List<FixedList<scalar, 3> > nearestVertexWeight_;
00071 
00072         //- Current field name
00073         word fieldName_;
00074 
00075         //- List of boundaryData time directories
00076         instantList sampleTimes_;
00077 
00078         //- Current starting index in sampleTimes
00079         label startSampleTime_;
00080 
00081         //- Interpolated values from startSampleTime
00082         Field<Type> startSampledValues_;
00083 
00084         //- If setAverage: starting average value
00085         Type startAverage_;
00086 
00087         //- Current end index in sampleTimes
00088         label endSampleTime_;
00089 
00090         //- Interpolated values from endSampleTime
00091         Field<Type> endSampledValues_;
00092 
00093         //- If setAverage: end average value
00094         Type endAverage_;
00095 
00096 
00097     // Private Member Functions
00098 
00099         //- Get names of times
00100         static wordList timeNames(const instantList&);
00101 
00102         //- Find times around current time
00103         void findTime
00104         (
00105             const fileName& instance,
00106             const fileName& local,
00107             const scalar timeVal,
00108             label& lo,
00109             label& hi
00110         ) const;
00111         
00112         //- Read boundary points and determine interpolation weights to patch
00113         //  faceCentres
00114         void readSamplePoints();
00115 
00116         //- Find boundary data inbetween current time and interpolate
00117         void checkTable();
00118 
00119         //- Do actual interpolation using current weights
00120         tmp<Field<Type> > interpolate(const Field<Type>&) const;
00121 
00122 
00123 public:
00124 
00125     //- Runtime type information
00126     TypeName("timeVaryingMappedFixedValue");
00127 
00128 
00129     // Constructors
00130 
00131         //- Construct from patch and internal field
00132         timeVaryingMappedFixedValueFvPatchField
00133         (
00134             const fvPatch&,
00135             const DimensionedField<Type, volMesh>&
00136         );
00137 
00138         //- Construct from patch, internal field and dictionary
00139         timeVaryingMappedFixedValueFvPatchField
00140         (
00141             const fvPatch&,
00142             const DimensionedField<Type, volMesh>&,
00143             const dictionary&
00144         );
00145 
00146         //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
00147         //  onto a new patch
00148         timeVaryingMappedFixedValueFvPatchField
00149         (
00150             const timeVaryingMappedFixedValueFvPatchField<Type>&,
00151             const fvPatch&,
00152             const DimensionedField<Type, volMesh>&,
00153             const fvPatchFieldMapper&
00154         );
00155 
00156         //- Construct as copy
00157         timeVaryingMappedFixedValueFvPatchField
00158         (
00159             const timeVaryingMappedFixedValueFvPatchField<Type>&
00160         );
00161 
00162         //- Construct and return a clone
00163         virtual tmp<fvPatchField<Type> > clone() const
00164         {
00165             return tmp<fvPatchField<Type> >
00166             (
00167                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this)
00168             );
00169         }
00170 
00171         //- Construct as copy setting internal field reference
00172         timeVaryingMappedFixedValueFvPatchField
00173         (
00174             const timeVaryingMappedFixedValueFvPatchField<Type>&,
00175             const DimensionedField<Type, volMesh>&
00176         );
00177 
00178         //- Construct and return a clone setting internal field reference
00179         virtual tmp<fvPatchField<Type> > clone
00180         (
00181             const DimensionedField<Type, volMesh>& iF
00182         ) const
00183         {
00184             return tmp<fvPatchField<Type> >
00185             (
00186                 new timeVaryingMappedFixedValueFvPatchField<Type>(*this, iF)
00187             );
00188         }
00189 
00190 
00191     // Member functions
00192 
00193         // Access
00194 
00195             //- Return the coordinateSystem
00196             const coordinateSystem& referenceCS() const
00197             {
00198                 return referenceCS_;
00199             }
00200 
00201 
00202         // Evaluation functions
00203 
00204             //- Update the coefficients associated with the patch field
00205             virtual void updateCoeffs();
00206 
00207 
00208         //- Write
00209         virtual void write(Ostream&) const;
00210 };
00211 
00212 
00213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00214 
00215 } // End namespace Foam
00216 
00217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00218 
00219 #ifdef NoRepository
00220 #   include "timeVaryingMappedFixedValueFvPatchField.C"
00221 #endif
00222 
00223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00224 
00225 #endif
00226 
00227 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd