fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / finiteVolume / fields / fvPatchFields / constraint / cyclic / cyclicFvPatchField.H
blob1d651bf8e620b0eaec0fd79130d34e6f02b08366
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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             virtual 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;
168         // Block coupled interface functionality
170             //- Update result field based on interface functionality
171             virtual void updateInterfaceMatrix
172             (
173                 const Field<Type>&,
174                 Field<Type>&,
175                 const BlockLduMatrix<Type>&,
176                 const CoeffField<Type>&,
177                 const Pstream::commsTypes commsType
178             ) const
179             {
180                 notImplemented("cyclicFvPatchField<Type>::updateInterfaceMatrix for block matrices")
181             }
183         //- Cyclic coupled interface functions
185             //- Does the patch field perform the transfromation
186             virtual bool doTransform() const
187             {
188                 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
189             }
191             //- Return face transformation tensor
192             virtual const tensorField& forwardT() const
193             {
194                 return cyclicPatch_.forwardT();
195             }
197             //- Return neighbour-cell transformation tensor
198             virtual const tensorField& reverseT() const
199             {
200                 return cyclicPatch_.reverseT();
201             }
203             //- Return rank of component for transform
204             virtual int rank() const
205             {
206                 return pTraits<Type>::rank;
207             }
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #ifdef NoRepository
218 #   include "cyclicFvPatchField.C"
219 #endif
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 #endif
225 // ************************************************************************* //