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

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