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

cellMotionFvPatchField.C

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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "cellMotionFvPatchField.H"
00028 #include "fvMesh.H"
00029 #include "volMesh.H"
00030 #include "pointFields.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00038 
00039 template<class Type>
00040 cellMotionFvPatchField<Type>::cellMotionFvPatchField
00041 (
00042     const fvPatch& p,
00043     const DimensionedField<Type, volMesh>& iF
00044 )
00045 :
00046     fixedValueFvPatchField<Type>(p, iF)
00047 {}
00048 
00049 
00050 template<class Type>
00051 cellMotionFvPatchField<Type>::cellMotionFvPatchField
00052 (
00053     const cellMotionFvPatchField<Type>& ptf,
00054     const fvPatch& p,
00055     const DimensionedField<Type, volMesh>& iF,
00056     const fvPatchFieldMapper& mapper
00057 )
00058 :
00059     fixedValueFvPatchField<Type>(ptf, p, iF, mapper)
00060 {}
00061 
00062 
00063 template<class Type>
00064 cellMotionFvPatchField<Type>::cellMotionFvPatchField
00065 (
00066     const fvPatch& p,
00067     const DimensionedField<Type, volMesh>& iF,
00068     const dictionary& dict
00069 )
00070 :
00071     fixedValueFvPatchField<Type>(p, iF)
00072 {
00073     fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
00074 }
00075 
00076 
00077 template<class Type>
00078 cellMotionFvPatchField<Type>::cellMotionFvPatchField
00079 (
00080     const cellMotionFvPatchField<Type>& ptf
00081 )
00082 :
00083     fixedValueFvPatchField<Type>(ptf)
00084 {}
00085 
00086 
00087 template<class Type>
00088 cellMotionFvPatchField<Type>::cellMotionFvPatchField
00089 (
00090     const cellMotionFvPatchField<Type>& ptf,
00091     const DimensionedField<Type, volMesh>& iF
00092 )
00093 :
00094     fixedValueFvPatchField<Type>(ptf, iF)
00095 {}
00096 
00097 
00098 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00099 
00100 template<class Type>
00101 void cellMotionFvPatchField<Type>::updateCoeffs()
00102 {
00103     if (this->updated())
00104     {
00105         return;
00106     }
00107 
00108     const fvPatch& p = this->patch();
00109     const polyPatch& pp = p.patch();
00110     const fvMesh& mesh = this->dimensionedInternalField().mesh();
00111     const pointField& points = mesh.points();
00112 
00113     word pfName = this->dimensionedInternalField().name();
00114     pfName.replace("cell", "point");
00115 
00116     const GeometricField<Type, pointPatchField, pointMesh>& pointMotion = 
00117         this->db().objectRegistry::
        lookupObject<GeometricField<Type, pointPatchField, pointMesh> >
00118         (
00119             pfName
00120         );
00121 
00122     forAll(p, i)
00123     {
00124         this->operator[](i) = pp[i].average(points, pointMotion);
00125     }
00126 
00127     fixedValueFvPatchField<Type>::updateCoeffs();
00128 }
00129 
00130 
00131 template<class Type>
00132 void cellMotionFvPatchField<Type>::write(Ostream& os) const
00133 {
00134     fvPatchField<Type>::write(os);
00135     this->writeEntry("value", os);
00136 }
00137 
00138 
00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00140 
00141 } // End namespace Foam
00142 
00143 // ************************************************************************* //
00144 
Copyright © 2000-2009 OpenCFD Ltd