1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
26 Foam::processorFvPatchField
29 Foam::processorFvPatchField
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class processorFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
53 class processorFvPatchField
55 public processorLduInterfaceField,
56 public coupledFvPatchField<Type>
60 //- Local reference cast into the processor patch
61 const processorFvPatch& procPatch_;
66 //- Runtime type information
67 TypeName(processorFvPatch::typeName_());
72 //- Construct from patch and internal field
76 const DimensionedField<Type, volMesh>&
79 //- Construct from patch and internal field and patch field
83 const DimensionedField<Type, volMesh>&,
87 //- Construct from patch, internal field and dictionary
91 const DimensionedField<Type, volMesh>&,
95 //- Construct by mapping given processorFvPatchField onto a new patch
98 const processorFvPatchField<Type>&,
100 const DimensionedField<Type, volMesh>&,
101 const fvPatchFieldMapper&
104 //- Construct as copy
105 processorFvPatchField(const processorFvPatchField<Type>&);
107 //- Construct and return a clone
108 virtual tmp<fvPatchField<Type> > clone() const
110 return tmp<fvPatchField<Type> >
112 new processorFvPatchField<Type>(*this)
116 //- Construct as copy setting internal field reference
117 processorFvPatchField
119 const processorFvPatchField<Type>&,
120 const DimensionedField<Type, volMesh>&
123 //- Construct and return a clone setting internal field reference
124 virtual tmp<fvPatchField<Type> > clone
126 const DimensionedField<Type, volMesh>& iF
129 return tmp<fvPatchField<Type> >
131 new processorFvPatchField<Type>(*this, iF)
138 ~processorFvPatchField();
145 //- Return true if running parallel
146 virtual bool coupled() const
148 if (Pstream::parRun())
158 //- Return neighbour field given internal field
159 tmp<Field<Type> > patchNeighbourField() const;
162 // Evaluation functions
164 //- Initialise the evaluation of the patch field
165 virtual void initEvaluate(const Pstream::commsTypes commsType);
167 //- Evaluate the patch field
168 virtual void evaluate(const Pstream::commsTypes commsType);
170 //- Return patch-normal gradient
171 virtual tmp<Field<Type> > snGrad() const;
173 //- Initialise neighbour matrix update
174 virtual void initInterfaceMatrixUpdate
176 const scalarField& psiInternal,
179 const scalarField& coeffs,
180 const direction cmpt,
181 const Pstream::commsTypes commsType
184 //- Update result field based on interface functionality
185 virtual void updateInterfaceMatrix
187 const scalarField& psiInternal,
190 const scalarField& coeffs,
191 const direction cmpt,
192 const Pstream::commsTypes commsType
195 //- Processor coupled interface functions
197 //- Return processor number
198 virtual int myProcNo() const
200 return procPatch_.myProcNo();
203 //- Return neigbour processor number
204 virtual int neighbProcNo() const
206 return procPatch_.neighbProcNo();
209 //- Does the patch field perform the transfromation
210 virtual bool doTransform() const
212 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
215 //- Return face transformation tensor
216 virtual const tensorField& forwardT() const
218 return procPatch_.forwardT();
221 //- Return rank of component for transform
222 virtual int rank() const
224 return pTraits<Type>::rank;
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 } // End namespace Foam
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 # include "processorFvPatchField.C"
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 // ************************************************************************* //