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  return patchInternalField(internalData, faceCells);
121 }
122 
123 
125 (
126  const Pstream::commsTypes commsType,
127  const labelUList& iF
128 ) const
129 {
130  send(commsType, patchInternalField(iF)());
131 }
132 
133 
135 (
136  const Pstream::commsTypes commsType,
137  const labelUList& iF,
138  const labelUList& faceCells
139 ) const
140 {
141  send(commsType, interfaceInternalField(iF, faceCells)());
142 }
143 
144 
146 (
147  const Pstream::commsTypes commsType,
148  const labelUList&
149 ) const
150 {
151  return receive<label>(commsType, this->size());
152 }
153 
154 
155 // ************************************************************************* //
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
Types of communications.
Definition: UPstream.H:66
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:125
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:68
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:639
const vectorField & neighbFaceCentres() const
Return processor-neighbour patch face centres.
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Definition: UList.H:80
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Spatial transformation functions for primitive fields.
const vectorField & neighbFaceAreas() const
Return processor-neighbour patch face areas.
void makeWeights(scalarField &) const
Make patch weighting factors.
Processor patch.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
const vectorField & neighbFaceCellCentres() const
Return processor-neighbour patch neighbour cell centres.
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:529
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
Namespace for OpenFOAM.