1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 // 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
178 const scalarField& psiInternal,
181 const scalarField& coeffs,
182 const direction cmpt,
183 const Pstream::commsTypes commsType
186 //- Update result field based on interface functionality
187 virtual void updateInterfaceMatrix
189 const scalarField& psiInternal,
192 const scalarField& coeffs,
193 const direction cmpt,
194 const Pstream::commsTypes commsType
197 // Block coupled interface functionality
199 //- Initialise neighbour matrix update
200 virtual void initInterfaceMatrixUpdate
204 const BlockLduMatrix<Type>&,
205 const CoeffField<Type>&,
206 const Pstream::commsTypes commsType
210 //- Update result field based on interface functionality
211 virtual void updateInterfaceMatrix
215 const BlockLduMatrix<Type>&,
216 const CoeffField<Type>&,
217 const Pstream::commsTypes commsType
220 notImplemented("processorFvPatchField<Type>::updateInterfaceMatrix for block matrices")
223 //- Processor coupled interface functions
225 //- Return processor number
226 virtual int myProcNo() const
228 return procPatch_.myProcNo();
231 //- Return neigbour processor number
232 virtual int neighbProcNo() const
234 return procPatch_.neighbProcNo();
237 //- Does the patch field perform the transfromation
238 virtual bool doTransform() const
240 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
243 //- Return face transformation tensor
244 virtual const tensorField& forwardT() const
246 return procPatch_.forwardT();
249 //- Return rank of component for transform
250 virtual int rank() const
252 return pTraits<Type>::rank;
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 } // End namespace Foam
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 # include "processorFvPatchField.C"
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 // ************************************************************************* //