OpenFOAM logo
Open Source CFD Toolkit

cyclicFvPatchField.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-2005 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     cyclicFvPatchField
00027 
00028 Description
00029 
00030 SourceFiles
00031     cyclicFvPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef cyclicFvPatchField_H
00036 #define cyclicFvPatchField_H
00037 
00038 #include "coupledFvPatchField.H"
00039 #include "cyclicFvPatch.H"
00040 #include "cyclicLduCoupledInterface.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class cyclicFvPatch Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class Type>
00052 class cyclicFvPatchField
00053 :
00054     public coupledFvPatchField<Type>,
00055     virtual public cyclicLduCoupledInterface
00056 {
00057     // Private data
00058 
00059         //- Local reference cast into the cyclic patch
00060         const cyclicFvPatch& cyclicPatch_;
00061 
00062 
00063     // Private member functions
00064 
00065         //- Return neighbour side field given internal fields
00066         template<class Type2>
00067         tmp<Field<Type2> > neighbourSideField
00068         (
00069             const Field<Type2>&
00070         ) const;
00071 
00072 
00073 public:
00074 
00075     //- Runtime type information
00076     TypeName(cyclicFvPatch::typeName_());
00077 
00078 
00079     // Constructors
00080 
00081         //- Construct from patch and internal field
00082         cyclicFvPatchField
00083         (
00084             const fvPatch&,
00085             const Field<Type>&
00086         );
00087 
00088         //- Construct from patch, internal field and dictionary
00089         cyclicFvPatchField
00090         (
00091             const fvPatch&,
00092             const Field<Type>&,
00093             const dictionary&
00094         );
00095 
00096         //- Construct by mapping given cyclicFvPatchField onto a new patch
00097         cyclicFvPatchField
00098         (
00099             const cyclicFvPatchField<Type>&,
00100             const fvPatch&,
00101             const Field<Type>&,
00102             const fvPatchFieldMapper&
00103         );
00104 
00105         //- Construct and return a clone
00106         virtual tmp<fvPatchField<Type> > clone() const
00107         {
00108             return tmp<fvPatchField<Type> >
00109             (
00110                 new cyclicFvPatchField<Type>(*this)
00111             );
00112         }
00113 
00114         //- Construct as copy setting internal field reference
00115         cyclicFvPatchField
00116         (
00117             const cyclicFvPatchField<Type>&,
00118             const Field<Type>&
00119         );
00120 
00121         //- Construct and return a clone setting internal field reference
00122         virtual tmp<fvPatchField<Type> > clone(const Field<Type>& iF) const
00123         {
00124             return tmp<fvPatchField<Type> >
00125             (
00126                 new cyclicFvPatchField<Type>(*this, iF)
00127             );
00128         }
00129 
00130 
00131     // Member functions
00132 
00133         // Evaluation functions
00134 
00135             //- Return neighbour coupled given internal cell data
00136             tmp<Field<Type> > patchNeighbourField() const;
00137 
00138             //- Return neighbour colouring
00139             virtual tmp<labelField> nbrColour(const labelField&) const;
00140 
00141             //- Update result field based on interface functionality
00142             virtual void updateInterfaceMatrix
00143             (
00144                 const scalarField& psiInternal,
00145                 scalarField& result,
00146                 const lduMatrix&,
00147                 const scalarField& coeffs,
00148                 const direction cmpt
00149             ) const;
00150 
00151 
00152         //- Cyclic coupled interface functions
00153 
00154             //- Does the patch field perform the transfromation
00155             virtual bool doTransform() const
00156             {
00157                 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
00158             }
00159 
00160             //- Return face transformation tensor
00161             virtual const tensorField& forwardT() const
00162             {
00163                 return cyclicPatch_.forwardT();
00164             }
00165 
00166             //- Return neighbour-cell transformation tensor
00167             virtual const tensorField& reverseT() const
00168             {
00169                 return cyclicPatch_.reverseT();
00170             }
00171 
00172             //- Return rank of component for transform
00173             virtual int rank() const
00174             {
00175                 return pTraits<Type>::rank;
00176             }
00177 };
00178 
00179 
00180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00181 
00182 } // End namespace Foam
00183 
00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00185 
00186 #ifdef NoRepository
00187 #   include "cyclicFvPatchField.C"
00188 #endif
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 #endif
00193 
00194 // ************************************************************************* //
For further information go to www.openfoam.org