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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "processorFvPatch.H"
30 #include "transformField.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(processorFvPatch, 0);
37  addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
38 }
39 
40 
41 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
42 
44 {
45  if (Pstream::parRun())
46  {
47  // The face normals point in the opposite direction on the other side
48  scalarField neighbFaceCentresCn
49  (
50  (
51  procPolyPatch_.neighbFaceAreas()
52  /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
53  )
54  & (
55  procPolyPatch_.neighbFaceCentres()
56  - procPolyPatch_.neighbFaceCellCentres())
57  );
58 
59  w = neighbFaceCentresCn
60  /((nf()&coupledFvPatch::delta()) + neighbFaceCentresCn);
61  }
62  else
63  {
64  w = 1.0;
65  }
66 }
67 
68 
70 {
71  if (Pstream::parRun())
72  {
73  // To the transformation if necessary
74  if (parallel())
75  {
76  return
78  - (
79  procPolyPatch_.neighbFaceCentres()
80  - procPolyPatch_.neighbFaceCellCentres()
81  );
82  }
83  else
84  {
85  return
87  - transform
88  (
89  forwardT(),
90  (
91  procPolyPatch_.neighbFaceCentres()
92  - procPolyPatch_.neighbFaceCellCentres()
93  )
94  );
95  }
96  }
97  else
98  {
99  return coupledFvPatch::delta();
100  }
101 }
102 
103 
105 (
106  const labelUList& internalData
107 ) const
108 {
109  return patchInternalField(internalData);
110 }
111 
112 
114 (
115  const Pstream::commsTypes commsType,
116  const labelUList& iF
117 ) const
118 {
119  send(commsType, patchInternalField(iF)());
120 }
121 
122 
124 (
125  const Pstream::commsTypes commsType,
126  const labelUList&
127 ) const
128 {
129  return receive<label>(commsType, this->size());
130 }
131 
132 
133 // ************************************************************************* //
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::UPstream::parRun
static bool & parRun()
Test if this a parallel run, or allow modify access.
Definition: UPstream.H:434
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:519
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:124
transformField.H
Spatial transformation functions for primitive fields.
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:138
Foam::processorFvPatch::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
Definition: processorFvPatch.C:114
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:43
Foam::processorFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: processorFvPatch.C:69
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::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
Return the values of the given internal data adjacent to.
Definition: processorFvPatch.C:105
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)