fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / finiteVolume / fields / fvPatchFields / constraint / processor / processorFvPatchField.H
blobc98ba6359b4de661fa479b4f882cc1fa0a5fdfb7
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::processorFvPatchField
28 Description
29     Foam::processorFvPatchField
31 SourceFiles
32     processorFvPatchField.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef processorFvPatchField_H
37 #define processorFvPatchField_H
39 #include "coupledFvPatchField.H"
40 #include "processorLduInterfaceField.H"
41 #include "processorFvPatch.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                       Class processorFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Type>
53 class processorFvPatchField
55     public processorLduInterfaceField,
56     public coupledFvPatchField<Type>
58     // Private data
60         //- Local reference cast into the processor patch
61         const processorFvPatch& procPatch_;
64 public:
66     //- Runtime type information
67     TypeName(processorFvPatch::typeName_());
70     // Constructors
72         //- Construct from patch and internal field
73         processorFvPatchField
74         (
75             const fvPatch&,
76             const DimensionedField<Type, volMesh>&
77         );
79         //- Construct from patch and internal field and patch field
80         processorFvPatchField
81         (
82             const fvPatch&,
83             const DimensionedField<Type, volMesh>&,
84             const Field<Type>&
85         );
87         //- Construct from patch, internal field and dictionary
88         processorFvPatchField
89         (
90             const fvPatch&,
91             const DimensionedField<Type, volMesh>&,
92             const dictionary&
93         );
95         //- Construct by mapping given processorFvPatchField onto a new patch
96         processorFvPatchField
97         (
98             const processorFvPatchField<Type>&,
99             const fvPatch&,
100             const DimensionedField<Type, volMesh>&,
101             const fvPatchFieldMapper&
102         );
104         //- Construct as copy
105         processorFvPatchField(const processorFvPatchField<Type>&);
107         //- Construct and return a clone
108         virtual tmp<fvPatchField<Type> > clone() const
109         {
110             return tmp<fvPatchField<Type> >
111             (
112                 new processorFvPatchField<Type>(*this)
113             );
114         }
116         //- Construct as copy setting internal field reference
117         processorFvPatchField
118         (
119             const processorFvPatchField<Type>&,
120             const DimensionedField<Type, volMesh>&
121         );
123         //- Construct and return a clone setting internal field reference
124         virtual tmp<fvPatchField<Type> > clone
125         (
126             const DimensionedField<Type, volMesh>& iF
127         ) const
128         {
129             return tmp<fvPatchField<Type> >
130             (
131                 new processorFvPatchField<Type>(*this, iF)
132             );
133         }
136     // Destructor
138         ~processorFvPatchField();
141     // Member functions
143         // Access
145             //- Return true if running parallel
146             virtual bool coupled() const
147             {
148                 if (Pstream::parRun())
149                 {
150                     return true;
151                 }
152                 else
153                 {
154                     return false;
155                 }
156             }
158             //- Return neighbour field given internal field
159             // Returning patch values, which stores neighbour
160             // data after update due to scheduling issues.  HJ, 11/May/2009
161             virtual tmp<Field<Type> > patchNeighbourField() const;
164         // Evaluation functions
166             //- Initialise the evaluation of the patch field
167             virtual void initEvaluate(const Pstream::commsTypes commsType);
169             //- Evaluate the patch field
170             virtual void evaluate(const Pstream::commsTypes commsType);
172             //- Return patch-normal gradient
173             virtual tmp<Field<Type> > snGrad() const;
175             //- Initialise neighbour matrix update
176             virtual void initInterfaceMatrixUpdate
177             (
178                 const scalarField& psiInternal,
179                 scalarField& result,
180                 const lduMatrix& m,
181                 const scalarField& coeffs,
182                 const direction cmpt,
183                 const Pstream::commsTypes commsType
184             ) const;
186             //- Update result field based on interface functionality
187             virtual void updateInterfaceMatrix
188             (
189                 const scalarField& psiInternal,
190                 scalarField& result,
191                 const lduMatrix& m,
192                 const scalarField& coeffs,
193                 const direction cmpt,
194                 const Pstream::commsTypes commsType
195             ) const;
197         // Block coupled interface functionality
199             //- Initialise neighbour matrix update
200             virtual void initInterfaceMatrixUpdate
201             (
202                 const Field<Type>&,
203                 Field<Type>&,
204                 const BlockLduMatrix<Type>&,
205                 const CoeffField<Type>&,
206                 const Pstream::commsTypes commsType
207             ) const
208             {}
210             //- Update result field based on interface functionality
211             virtual void updateInterfaceMatrix
212             (
213                 const Field<Type>&,
214                 Field<Type>&,
215                 const BlockLduMatrix<Type>&,
216                 const CoeffField<Type>&,
217                 const Pstream::commsTypes commsType
218             ) const
219             {
220                 notImplemented("processorFvPatchField<Type>::updateInterfaceMatrix for block matrices")
221             }
222             
223         //- Processor coupled interface functions
225             //- Return processor number
226             virtual int myProcNo() const
227             {
228                 return procPatch_.myProcNo();
229             }
231             //- Return neigbour processor number
232             virtual int neighbProcNo() const
233             {
234                 return procPatch_.neighbProcNo();
235             }
237             //- Does the patch field perform the transfromation
238             virtual bool doTransform() const
239             {
240                 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
241             }
243             //- Return face transformation tensor
244             virtual const tensorField& forwardT() const
245             {
246                 return procPatch_.forwardT();
247             }
249             //- Return rank of component for transform
250             virtual int rank() const
251             {
252                 return pTraits<Type>::rank;
253             }
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 } // End namespace Foam
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 #ifdef NoRepository
264 #   include "processorFvPatchField.C"
265 #endif
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 #endif
271 // ************************************************************************* //