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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2014 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "processorFvPatch.H"
31 #include "transformField.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
39 }
40 
41 
42 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
43 
45 {
46  if (Pstream::parRun())
47  {
48  // The face normals point in the opposite direction on the other side
49  scalarField neighbFaceCentresCn
50  (
51  (
52  procPolyPatch_.neighbFaceAreas()
53  /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
54  )
55  & (
56  procPolyPatch_.neighbFaceCentres()
57  - procPolyPatch_.neighbFaceCellCentres())
58  );
59 
60  w = neighbFaceCentresCn
61  /((nf()&coupledFvPatch::delta()) + neighbFaceCentresCn);
62  }
63  else
64  {
65  w = 1.0;
66  }
67 }
68 
69 
71 {
72  if (Pstream::parRun())
73  {
74  // To the transformation if necessary
75  if (parallel())
76  {
77  return
79  - (
80  procPolyPatch_.neighbFaceCentres()
81  - procPolyPatch_.neighbFaceCellCentres()
82  );
83  }
84  else
85  {
86  return
88  - transform
89  (
90  forwardT(),
91  (
92  procPolyPatch_.neighbFaceCentres()
93  - procPolyPatch_.neighbFaceCellCentres()
94  )
95  );
96  }
97  }
98  else
99  {
100  return coupledFvPatch::delta();
101  }
102 }
103 
104 
106 (
107  const labelUList& internalData
108 ) const
109 {
110  return patchInternalField(internalData);
111 }
112 
113 
115 (
116  const labelUList& internalData,
117  const labelUList& faceCells
118 ) const
119 {
120  auto tpfld = tmp<labelField>::New();
121  patchInternalField(internalData, faceCells, tpfld.ref());
122  return tpfld;
123 }
124 
125 
127 (
128  const Pstream::commsTypes commsType,
129  const labelUList& iF
130 ) const
131 {
132  send(commsType, patchInternalField(iF)());
133 }
134 
135 
137 (
138  const Pstream::commsTypes commsType,
139  const labelUList& iF,
140  const labelUList& faceCells
141 ) const
142 {
143  send(commsType, interfaceInternalField(iF, faceCells)());
144 }
145 
146 
148 (
149  const Pstream::commsTypes commsType,
150  const labelUList&
151 ) const
152 {
153  return receive<label>(commsType, this->size());
154 }
155 
156 
157 // ************************************************************************* //
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
commsTypes
Communications types.
Definition: UPstream.H:72
tmp< vectorField > nf() const
Return face unit normals, like the fvMesh::unitSf() method Same as unitSf().
Definition: fvPatch.C:143
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:1049
const vectorField & neighbFaceCellCentres() const noexcept
Return processor-neighbour patch neighbour cell centres.
const vectorField & neighbFaceAreas() const noexcept
Return processor-neighbour patch face areas.
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
const vectorField & neighbFaceCentres() const noexcept
Return processor-neighbour patch face centres.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
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.
Processor patch.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
Namespace for OpenFOAM.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)