FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::cyclicFvPatchField
00026 
00027 Description
00028     Foam::cyclicFvPatchField
00029 
00030 SourceFiles
00031     cyclicFvPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef cyclicFvPatchField_H
00036 #define cyclicFvPatchField_H
00037 
00038 #include <finiteVolume/coupledFvPatchField.H>
00039 #include <OpenFOAM/cyclicLduInterfaceField.H>
00040 #include <finiteVolume/cyclicFvPatch.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     virtual public cyclicLduInterfaceField,
00055     public coupledFvPatchField<Type>
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 DimensionedField<Type, volMesh>&
00086         );
00087 
00088         //- Construct from patch, internal field and dictionary
00089         cyclicFvPatchField
00090         (
00091             const fvPatch&,
00092             const DimensionedField<Type, volMesh>&,
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 DimensionedField<Type, volMesh>&,
00102             const fvPatchFieldMapper&
00103         );
00104 
00105         //- Construct as copy
00106         cyclicFvPatchField
00107         (
00108             const cyclicFvPatchField<Type>&
00109         );
00110 
00111         //- Construct and return a clone
00112         virtual tmp<fvPatchField<Type> > clone() const
00113         {
00114             return tmp<fvPatchField<Type> >
00115             (
00116                 new cyclicFvPatchField<Type>(*this)
00117             );
00118         }
00119 
00120         //- Construct as copy setting internal field reference
00121         cyclicFvPatchField
00122         (
00123             const cyclicFvPatchField<Type>&,
00124             const DimensionedField<Type, volMesh>&
00125         );
00126 
00127         //- Construct and return a clone setting internal field reference
00128         virtual tmp<fvPatchField<Type> > clone
00129         (
00130             const DimensionedField<Type, volMesh>& iF
00131         ) const
00132         {
00133             return tmp<fvPatchField<Type> >
00134             (
00135                 new cyclicFvPatchField<Type>(*this, iF)
00136             );
00137         }
00138 
00139 
00140     // Member functions
00141 
00142         // Access
00143 
00144             //- Retirn local reference cast into the cyclic patch
00145             const cyclicFvPatch& cyclicPatch() const
00146             {
00147                 return cyclicPatch_;
00148             }
00149 
00150 
00151         // Evaluation functions
00152 
00153             //- Return neighbour coupled given internal cell data
00154             tmp<Field<Type> > patchNeighbourField() const;
00155 
00156             //- Update result field based on interface functionality
00157             virtual void updateInterfaceMatrix
00158             (
00159                 const scalarField& psiInternal,
00160                 scalarField& result,
00161                 const lduMatrix&,
00162                 const scalarField& coeffs,
00163                 const direction cmpt,
00164                 const Pstream::commsTypes commsType
00165             ) const;
00166 
00167 
00168         //- Cyclic coupled interface functions
00169 
00170             //- Does the patch field perform the transfromation
00171             virtual bool doTransform() const
00172             {
00173                 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
00174             }
00175 
00176             //- Return face transformation tensor
00177             virtual const tensorField& forwardT() const
00178             {
00179                 return cyclicPatch_.forwardT();
00180             }
00181 
00182             //- Return neighbour-cell transformation tensor
00183             virtual const tensorField& reverseT() const
00184             {
00185                 return cyclicPatch_.reverseT();
00186             }
00187 
00188             //- Return rank of component for transform
00189             virtual int rank() const
00190             {
00191                 return pTraits<Type>::rank;
00192             }
00193 };
00194 
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 } // End namespace Foam
00199 
00200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00201 
00202 #ifdef NoRepository
00203 #   include <finiteVolume/cyclicFvPatchField.C>
00204 #endif
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 #endif
00209 
00210 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines