processorFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::processorFvPatchField
26 
27 Group
28  grpCoupledBoundaryConditions
29 
30 Description
31  This boundary condition enables processor communication across patches.
32 
33  \heading Patch usage
34 
35  Example of the boundary condition specification:
36  \verbatim
37  myPatch
38  {
39  type processor;
40  }
41  \endverbatim
42 
43 SourceFiles
44  processorFvPatchField.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef processorFvPatchField_H
49 #define processorFvPatchField_H
50 
51 #include "coupledFvPatchField.H"
53 #include "processorFvPatch.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class processorFvPatchField Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
66 :
68  public coupledFvPatchField<Type>
69 {
70  // Private data
71 
72  //- Local reference cast into the processor patch
74 
75  // Sending and receiving
76 
77  //- Send buffer.
78  mutable Field<Type> sendBuf_;
79 
80  //- Receive buffer.
81  mutable Field<Type> receiveBuf_;
82 
83  //- Outstanding request
85 
86  //- Outstanding request
88 
89  //- Scalar send buffer
91 
92  //- Scalar receive buffer
94 
95 public:
96 
97  //- Runtime type information
98  TypeName(processorFvPatch::typeName_());
99 
100 
101  // Constructors
102 
103  //- Construct from patch and internal field
105  (
106  const fvPatch&,
108  );
109 
110  //- Construct from patch and internal field and patch field
112  (
113  const fvPatch&,
115  const Field<Type>&
116  );
117 
118  //- Construct from patch, internal field and dictionary
120  (
121  const fvPatch&,
123  const dictionary&
124  );
125 
126  //- Construct by mapping given processorFvPatchField onto a new patch
128  (
130  const fvPatch&,
132  const fvPatchFieldMapper&
133  );
134 
135  //- Construct as copy
137 
138  //- Construct and return a clone
139  virtual tmp<fvPatchField<Type> > clone() const
140  {
141  return tmp<fvPatchField<Type> >
142  (
143  new processorFvPatchField<Type>(*this)
144  );
145  }
146 
147  //- Construct as copy setting internal field reference
149  (
152  );
153 
154  //- Construct and return a clone setting internal field reference
156  (
158  ) const
159  {
160  return tmp<fvPatchField<Type> >
161  (
162  new processorFvPatchField<Type>(*this, iF)
163  );
164  }
165 
166 
167  //- Destructor
169 
170 
171  // Member functions
172 
173  // Access
174 
175  //- Return true if running parallel
176  virtual bool coupled() const
177  {
178  if (Pstream::parRun())
179  {
180  return true;
181  }
182  else
183  {
184  return false;
185  }
186  }
187 
188  //- Return neighbour field given internal field
189  virtual tmp<Field<Type> > patchNeighbourField() const;
190 
191 
192  // Evaluation functions
193 
194  //- Initialise the evaluation of the patch field
195  virtual void initEvaluate(const Pstream::commsTypes commsType);
196 
197  //- Evaluate the patch field
198  virtual void evaluate(const Pstream::commsTypes commsType);
199 
200  //- Return patch-normal gradient
201  virtual tmp<Field<Type> > snGrad
202  (
203  const scalarField& deltaCoeffs
204  ) const;
205 
206  //- Is all data available
207  virtual bool ready() const;
208 
209  //- Initialise neighbour matrix update
210  virtual void initInterfaceMatrixUpdate
211  (
212  scalarField& result,
213  const scalarField& psiInternal,
214  const scalarField& coeffs,
215  const direction cmpt,
216  const Pstream::commsTypes commsType
217  ) const;
218 
219  //- Update result field based on interface functionality
220  virtual void updateInterfaceMatrix
221  (
222  scalarField& result,
223  const scalarField& psiInternal,
224  const scalarField& coeffs,
225  const direction cmpt,
226  const Pstream::commsTypes commsType
227  ) const;
228 
229  //- Initialise neighbour matrix update
230  virtual void initInterfaceMatrixUpdate
231  (
232  Field<Type>& result,
233  const Field<Type>& psiInternal,
234  const scalarField& coeffs,
235  const Pstream::commsTypes commsType
236  ) const;
237 
238  //- Update result field based on interface functionality
239  virtual void updateInterfaceMatrix
240  (
241  Field<Type>& result,
242  const Field<Type>& psiInternal,
243  const scalarField& coeffs,
244  const Pstream::commsTypes commsType
245  ) const;
246 
247 
248  //- Processor coupled interface functions
249 
250  //- Return communicator used for comms
251  virtual label comm() const
252  {
253  return procPatch_.comm();
254  }
255 
256  //- Return processor number
257  virtual int myProcNo() const
258  {
259  return procPatch_.myProcNo();
260  }
261 
262  //- Return neigbour processor number
263  virtual int neighbProcNo() const
264  {
265  return procPatch_.neighbProcNo();
266  }
267 
268  //- Does the patch field perform the transfromation
269  virtual bool doTransform() const
270  {
271  return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
272  }
273 
274  //- Return face transformation tensor
275  virtual const tensorField& forwardT() const
276  {
277  return procPatch_.forwardT();
278  }
279 
280  //- Return rank of component for transform
281  virtual int rank() const
282  {
283  return pTraits<Type>::rank;
284  }
285 
286 };
287 
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 } // End namespace Foam
292 
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 
295 #ifdef NoRepository
296 # include "processorFvPatchField.C"
297 #endif
298 
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 
301 #endif
302 
303 // ************************************************************************* //
Foam::processorFvPatchField::outstandingSendRequest_
label outstandingSendRequest_
Outstanding request.
Definition: processorFvPatchField.H:83
Foam::processorFvPatchField::coupled
virtual bool coupled() const
Return true if running parallel.
Definition: processorFvPatchField.H:175
processorFvPatch.H
Foam::processorFvPatchField::processorFvPatchField
processorFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: processorFvPatchField.C:35
Foam::processorFvPatchField::comm
virtual label comm() const
Processor coupled interface functions.
Definition: processorFvPatchField.H:250
Foam::processorFvPatchField
This boundary condition enables processor communication across patches.
Definition: processorFvPatchField.H:64
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::processorFvPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: processorFvPatch.H:129
Foam::processorFvPatchField::myProcNo
virtual int myProcNo() const
Return processor number.
Definition: processorFvPatchField.H:256
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
processorLduInterfaceField.H
Foam::processorFvPatch
Processor patch.
Definition: processorFvPatch.H:50
Foam::processorFvPatchField::TypeName
TypeName(processorFvPatch::typeName_())
Runtime type information.
Foam::processorFvPatchField::initEvaluate
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
Definition: processorFvPatchField.C:215
Foam::processorFvPatchField::scalarSendBuf_
Field< scalar > scalarSendBuf_
Scalar send buffer.
Definition: processorFvPatchField.H:89
Foam::processorFvPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: processorFvPatch.H:135
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field< Type >
Foam::processorFvPatchField::sendBuf_
Field< Type > sendBuf_
Send buffer.
Definition: processorFvPatchField.H:77
Foam::processorFvPatch::neighbProcNo
virtual int neighbProcNo() const
Return neigbour processor number.
Definition: processorFvPatch.H:99
Foam::processorFvPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Definition: processorFvPatchField.C:259
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::processorFvPatchField::initInterfaceMatrixUpdate
virtual void initInterfaceMatrixUpdate(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
Definition: processorFvPatchField.C:306
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::processorFvPatchField::doTransform
virtual bool doTransform() const
Does the patch field perform the transfromation.
Definition: processorFvPatchField.H:268
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::processorFvPatchField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: processorFvPatchField.H:274
Foam::processorFvPatch::comm
virtual label comm() const
Return communicator used for comms.
Definition: processorFvPatch.H:87
Foam::processorFvPatchField::updateInterfaceMatrix
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Definition: processorFvPatchField.C:362
Foam::processorFvPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour field given internal field.
Definition: processorFvPatchField.C:200
Foam::processorFvPatchField::~processorFvPatchField
~processorFvPatchField()
Destructor.
Definition: processorFvPatchField.C:192
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:64
Foam::processorFvPatchField::outstandingRecvRequest_
label outstandingRecvRequest_
Outstanding request.
Definition: processorFvPatchField.H:86
processorFvPatchField.C
Foam::coupledFvPatchField
Abstract base class for coupled patches.
Definition: coupledFvPatchField.H:54
Foam::processorFvPatchField::scalarReceiveBuf_
Field< scalar > scalarReceiveBuf_
Scalar receive buffer.
Definition: processorFvPatchField.H:92
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::processorFvPatchField::ready
virtual bool ready() const
Is all data available.
Definition: processorFvPatchField.C:543
Foam::processorFvPatchField::rank
virtual int rank() const
Return rank of component for transform.
Definition: processorFvPatchField.H:280
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::processorFvPatchField::procPatch_
const processorFvPatch & procPatch_
Local reference cast into the processor patch.
Definition: processorFvPatchField.H:72
Foam::processorFvPatchField::receiveBuf_
Field< Type > receiveBuf_
Receive buffer.
Definition: processorFvPatchField.H:80
Foam::processorFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: processorFvPatchField.H:138
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
coupledFvPatchField.H
Foam::processorFvPatchField::neighbProcNo
virtual int neighbProcNo() const
Return neigbour processor number.
Definition: processorFvPatchField.H:262
Foam::coupledFvPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Definition: coupledFvPatchField.H:147
Foam::processorLduInterfaceField
Abstract base class for processor coupled interfaces.
Definition: processorLduInterfaceField.H:49
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::processorFvPatch::myProcNo
virtual int myProcNo() const
Return processor number.
Definition: processorFvPatch.H:93