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 {
37  defineTypeNameAndDebug(processorFvPatch, 0);
38  addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
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 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
processorFvPatch.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::coupledFvPatch::delta
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Definition: coupledFvPatch.C:46
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
Foam::processorPolyPatch::neighbFaceAreas
const vectorField & neighbFaceAreas() const
Return processor-neighbour patch face areas.
Definition: processorPolyPatch.H:306
Foam::processorFvPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Definition: processorFvPatch.C:146
transformField.H
Spatial transformation functions for primitive fields.
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:144
Foam::processorFvPatch::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
Definition: processorFvPatch.C:125
Foam::processorPolyPatch::neighbFaceCellCentres
const vectorField & neighbFaceCellCentres() const
Return processor-neighbour patch neighbour cell centres.
Definition: processorPolyPatch.H:312
Foam::Field< scalar >
Foam::processorFvPatch::makeWeights
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: processorFvPatch.C:44
Foam::processorFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: processorFvPatch.C:70
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::processorPolyPatch::neighbFaceCentres
const vectorField & neighbFaceCentres() const
Return processor-neighbour patch face centres.
Definition: processorPolyPatch.H:300
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::UList< label >
Foam::processorFvPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: processorFvPatch.C:106
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56