processorFvPatch.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "processorFvPatch.H"
28 #include "transformField.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(processorFvPatch, 0);
35  addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
36 }
37 
38 
39 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
40 
42 {
43  if (Pstream::parRun())
44  {
45  // The face normals point in the opposite direction on the other side
46  scalarField neighbFaceCentresCn
47  (
48  (
49  procPolyPatch_.neighbFaceAreas()
50  /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
51  )
52  & (
53  procPolyPatch_.neighbFaceCentres()
54  - procPolyPatch_.neighbFaceCellCentres())
55  );
56 
57  w = neighbFaceCentresCn
58  /((nf()&coupledFvPatch::delta()) + neighbFaceCentresCn);
59  }
60  else
61  {
62  w = 1.0;
63  }
64 }
65 
66 
68 {
69  if (Pstream::parRun())
70  {
71  // To the transformation if necessary
72  if (parallel())
73  {
74  return
76  - (
77  procPolyPatch_.neighbFaceCentres()
78  - procPolyPatch_.neighbFaceCellCentres()
79  );
80  }
81  else
82  {
83  return
85  - transform
86  (
87  forwardT(),
88  (
89  procPolyPatch_.neighbFaceCentres()
90  - procPolyPatch_.neighbFaceCellCentres()
91  )
92  );
93  }
94  }
95  else
96  {
97  return coupledFvPatch::delta();
98  }
99 }
100 
101 
103 (
104  const labelUList& internalData
105 ) const
106 {
107  return patchInternalField(internalData);
108 }
109 
110 
112 (
113  const Pstream::commsTypes commsType,
114  const labelUList& iF
115 ) const
116 {
117  send(commsType, patchInternalField(iF)());
118 }
119 
120 
122 (
123  const Pstream::commsTypes commsType,
124  const labelUList&
125 ) const
126 {
127  return receive<label>(commsType, this->size());
128 }
129 
130 
131 // ************************************************************************* //
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
commsTypes
Types of communications.
Definition: UPstream.H:64
Macros for easy insertion into run-time selection tables.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Spatial transformation functions for primitive fields.
void makeWeights(scalarField &) const
Make patch weighting factors.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:394
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:477