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-------------------------------------------------------------------------------
11License
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
35namespace 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// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
commsTypes
Types of communications.
Definition: UPstream.H:67
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:144
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void makeWeights(scalarField &) const
Make patch weighting factors.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
const vectorField & neighbFaceCellCentres() const
Return processor-neighbour patch neighbour cell centres.
const vectorField & neighbFaceCentres() const
Return processor-neighbour patch face centres.
const vectorField & neighbFaceAreas() const
Return processor-neighbour patch face areas.
A class for managing temporary objects.
Definition: tmp.H:65
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Spatial transformation functions for primitive fields.