processorFvPatch.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 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 "volFields.H"
29 #include "surfaceFields.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
37 }
38 
39 
40 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
41 
43 {
44  if (Pstream::parRun())
45  {
46  if (!boundaryMesh().mesh().conformal())
47  {
49  (
50  w,
51  - boundaryMesh().mesh().Sf().boundaryField()[index()],
52  boundaryMesh().mesh().Cf().boundaryField()[index()]
53  - boundaryMesh().mesh().C().boundaryField()[index()]
54  );
55  }
56  else
57  {
59  (
60  w,
61  procPolyPatch_.neighbFaceAreas(),
62  procPolyPatch_.neighbFaceCentres()
63  - procPolyPatch_.neighbFaceCellCentres()
64  );
65  }
66  }
67  else
68  {
69  w = 1;
70  }
71 }
72 
73 
75 {
76  if (Pstream::parRun())
77  {
78  if (!boundaryMesh().mesh().conformal())
79  {
80  return
82  - (
83  boundaryMesh().mesh().Cf().boundaryField()[index()]
84  - boundaryMesh().mesh().C().boundaryField()[index()]
85  );
86  }
87  else
88  {
89  return
92  (
93  procPolyPatch_.neighbFaceCentres()
94  - procPolyPatch_.neighbFaceCellCentres()
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 Pstream::commsTypes commsType,
117  const labelUList& iF
118 ) const
119 {
120  send(commsType, patchInternalField(iF)());
121 }
122 
123 
125 (
126  const Pstream::commsTypes commsType,
127  const labelUList&
128 ) const
129 {
130  return receive<label>(commsType, this->size());
131 }
132 
133 
134 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
commsTypes
Types of communications.
Definition: UPstream.H:65
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:399
void makeWeights(scalarField &w, const vectorField &nbrSf, const vectorField &nbrDelta) const
Make patch weighting factors.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
friend dimensionSet transform(const dimensionSet &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:156
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:105
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:162
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:136
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
virtual void makeWeights(scalarField &w) const
Make patch weighting factors.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, labelUList &iF) const
Inherit initInternalFieldTransfer from coupledFvPatch.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
const vectorField & neighbFaceCentres() const
Return processor-neighbour patch face centres.
const vectorField & neighbFaceAreas() const
Return processor-neighbour patch face areas.
const vectorField & neighbFaceCellCentres() const
Return processor-neighbour patch neighbour cell centres.
A class for managing temporary objects.
Definition: tmp.H:55
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
static const coefficient C("C", dimTemperature, 234.5)
Namespace for OpenFOAM.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:501
defineTypeNameAndDebug(combustionModel, 0)
Foam::surfaceFields.