Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / constraint / cyclic / cyclicFvPatchField.H
blobbafdee2dae2a4dff4c057144a05a42169532af21
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::cyclicFvPatchField
27 Description
28     Foam::cyclicFvPatchField
30 SourceFiles
31     cyclicFvPatchField.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef cyclicFvPatchField_H
36 #define cyclicFvPatchField_H
38 #include "coupledFvPatchField.H"
39 #include "cyclicLduInterfaceField.H"
40 #include "cyclicFvPatch.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class cyclicFvPatch Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class cyclicFvPatchField
54     virtual public cyclicLduInterfaceField,
55     public coupledFvPatchField<Type>
57     // Private data
59         //- Local reference cast into the cyclic patch
60         const cyclicFvPatch& cyclicPatch_;
63     // Private Member Functions
65         //- Return neighbour side field given internal fields
66         template<class Type2>
67         tmp<Field<Type2> > neighbourSideField
68         (
69             const Field<Type2>&
70         ) const;
73 public:
75     //- Runtime type information
76     TypeName(cyclicFvPatch::typeName_());
79     // Constructors
81         //- Construct from patch and internal field
82         cyclicFvPatchField
83         (
84             const fvPatch&,
85             const DimensionedField<Type, volMesh>&
86         );
88         //- Construct from patch, internal field and dictionary
89         cyclicFvPatchField
90         (
91             const fvPatch&,
92             const DimensionedField<Type, volMesh>&,
93             const dictionary&
94         );
96         //- Construct by mapping given cyclicFvPatchField onto a new patch
97         cyclicFvPatchField
98         (
99             const cyclicFvPatchField<Type>&,
100             const fvPatch&,
101             const DimensionedField<Type, volMesh>&,
102             const fvPatchFieldMapper&
103         );
105         //- Construct as copy
106         cyclicFvPatchField
107         (
108             const cyclicFvPatchField<Type>&
109         );
111         //- Construct and return a clone
112         virtual tmp<fvPatchField<Type> > clone() const
113         {
114             return tmp<fvPatchField<Type> >
115             (
116                 new cyclicFvPatchField<Type>(*this)
117             );
118         }
120         //- Construct as copy setting internal field reference
121         cyclicFvPatchField
122         (
123             const cyclicFvPatchField<Type>&,
124             const DimensionedField<Type, volMesh>&
125         );
127         //- Construct and return a clone setting internal field reference
128         virtual tmp<fvPatchField<Type> > clone
129         (
130             const DimensionedField<Type, volMesh>& iF
131         ) const
132         {
133             return tmp<fvPatchField<Type> >
134             (
135                 new cyclicFvPatchField<Type>(*this, iF)
136             );
137         }
140     // Member functions
142         // Access
144             //- Return local reference cast into the cyclic patch
145             const cyclicFvPatch& cyclicPatch() const
146             {
147                 return cyclicPatch_;
148             }
151         // Evaluation functions
153             //- Return neighbour coupled internal cell data
154             tmp<Field<Type> > patchNeighbourField() const;
156             //- Return reference to neighbour patchField
157             const cyclicFvPatchField<Type>& neighbourPatchField() const;
159             //- Update result field based on interface functionality
160             virtual void updateInterfaceMatrix
161             (
162                 const scalarField& psiInternal,
163                 scalarField& result,
164                 const lduMatrix&,
165                 const scalarField& coeffs,
166                 const direction cmpt,
167                 const Pstream::commsTypes commsType
168             ) const;
171         // Cyclic coupled interface functions
173             //- Does the patch field perform the transfromation
174             virtual bool doTransform() const
175             {
176                 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
177             }
179             //- Return face transformation tensor
180             virtual const tensorField& forwardT() const
181             {
182                 return cyclicPatch_.forwardT();
183             }
185             //- Return neighbour-cell transformation tensor
186             virtual const tensorField& reverseT() const
187             {
188                 return cyclicPatch_.reverseT();
189             }
191             //- Return rank of component for transform
192             virtual int rank() const
193             {
194                 return pTraits<Type>::rank;
195             }
198         // I-O
200             //- Write
201             virtual void write(Ostream& os) const;
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 } // End namespace Foam
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 #ifdef NoRepository
212 #   include "cyclicFvPatchField.C"
213 #endif
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #endif
219 // ************************************************************************* //