initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / constraint / cyclic / cyclicFvPatchField.H
blob062ffa1d86e711d5450e1f3ed49b09516ca99144
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::cyclicFvPatchField
28 Description
29     Foam::cyclicFvPatchField
31 SourceFiles
32     cyclicFvPatchField.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef cyclicFvPatchField_H
37 #define cyclicFvPatchField_H
39 #include "coupledFvPatchField.H"
40 #include "cyclicLduInterfaceField.H"
41 #include "cyclicFvPatch.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                            Class cyclicFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Type>
53 class cyclicFvPatchField
55     virtual public cyclicLduInterfaceField,
56     public coupledFvPatchField<Type>
58     // Private data
60         //- Local reference cast into the cyclic patch
61         const cyclicFvPatch& cyclicPatch_;
64     // Private member functions
66         //- Return neighbour side field given internal fields
67         template<class Type2>
68         tmp<Field<Type2> > neighbourSideField
69         (
70             const Field<Type2>&
71         ) const;
74 public:
76     //- Runtime type information
77     TypeName(cyclicFvPatch::typeName_());
80     // Constructors
82         //- Construct from patch and internal field
83         cyclicFvPatchField
84         (
85             const fvPatch&,
86             const DimensionedField<Type, volMesh>&
87         );
89         //- Construct from patch, internal field and dictionary
90         cyclicFvPatchField
91         (
92             const fvPatch&,
93             const DimensionedField<Type, volMesh>&,
94             const dictionary&
95         );
97         //- Construct by mapping given cyclicFvPatchField onto a new patch
98         cyclicFvPatchField
99         (
100             const cyclicFvPatchField<Type>&,
101             const fvPatch&,
102             const DimensionedField<Type, volMesh>&,
103             const fvPatchFieldMapper&
104         );
106         //- Construct as copy
107         cyclicFvPatchField
108         (
109             const cyclicFvPatchField<Type>&
110         );
112         //- Construct and return a clone
113         virtual tmp<fvPatchField<Type> > clone() const
114         {
115             return tmp<fvPatchField<Type> >
116             (
117                 new cyclicFvPatchField<Type>(*this)
118             );
119         }
121         //- Construct as copy setting internal field reference
122         cyclicFvPatchField
123         (
124             const cyclicFvPatchField<Type>&,
125             const DimensionedField<Type, volMesh>&
126         );
128         //- Construct and return a clone setting internal field reference
129         virtual tmp<fvPatchField<Type> > clone
130         (
131             const DimensionedField<Type, volMesh>& iF
132         ) const
133         {
134             return tmp<fvPatchField<Type> >
135             (
136                 new cyclicFvPatchField<Type>(*this, iF)
137             );
138         }
141     // Member functions
143         // Access
145             //- Retirn local reference cast into the cyclic patch
146             const cyclicFvPatch& cyclicPatch() const
147             {
148                 return cyclicPatch_;
149             }
152         // Evaluation functions
154             //- Return neighbour coupled given internal cell data
155             tmp<Field<Type> > patchNeighbourField() const;
157             //- Update result field based on interface functionality
158             virtual void updateInterfaceMatrix
159             (
160                 const scalarField& psiInternal,
161                 scalarField& result,
162                 const lduMatrix&,
163                 const scalarField& coeffs,
164                 const direction cmpt,
165                 const Pstream::commsTypes commsType
166             ) const;
169         //- Cyclic coupled interface functions
171             //- Does the patch field perform the transfromation
172             virtual bool doTransform() const
173             {
174                 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
175             }
177             //- Return face transformation tensor
178             virtual const tensorField& forwardT() const
179             {
180                 return cyclicPatch_.forwardT();
181             }
183             //- Return neighbour-cell transformation tensor
184             virtual const tensorField& reverseT() const
185             {
186                 return cyclicPatch_.reverseT();
187             }
189             //- Return rank of component for transform
190             virtual int rank() const
191             {
192                 return pTraits<Type>::rank;
193             }
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 } // End namespace Foam
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 #ifdef NoRepository
204 #   include "cyclicFvPatchField.C"
205 #endif
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 #endif
211 // ************************************************************************* //