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 | Copyright (C) 2011-2014 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 "transformField.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(processorFvPatch, 0);
35  addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
36 }
37 
38 
39 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
40 
42 {
43  if (Pstream::parRun())
44  {
45  // The face normals point in the opposite direction on the other side
46  scalarField neighbFaceCentresCn
47  (
48  (
50  /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
51  )
52  & (
55  );
56 
57  w = neighbFaceCentresCn
58  /((nf()&coupledFvPatch::delta()) + neighbFaceCentresCn);
59  }
60  else
61  {
62  w = 1.0;
63  }
64 }
65 
66 
68 {
69  if (Pstream::parRun())
70  {
71  // To the transformation if necessary
72  if (parallel())
73  {
74  return
76  - (
77  procPolyPatch_.neighbFaceCentres()
78  - procPolyPatch_.neighbFaceCellCentres()
79  );
80  }
81  else
82  {
83  return
85  - transform
86  (
87  forwardT(),
88  (
89  procPolyPatch_.neighbFaceCentres()
90  - procPolyPatch_.neighbFaceCellCentres()
91  )
92  );
93  }
94  }
95  else
96  {
97  return coupledFvPatch::delta();
98  }
99 }
100 
101 
103 (
104  const labelUList& internalData
105 ) const
106 {
107  return patchInternalField(internalData);
108 }
109 
110 
112 (
113  const Pstream::commsTypes commsType,
114  const labelUList& iF
115 ) const
116 {
117  send(commsType, patchInternalField(iF)());
118 }
119 
120 
122 (
123  const Pstream::commsTypes commsType,
124  const labelUList&
125 ) const
126 {
127  return receive<label>(commsType, this->size());
128 }
129 
130 
131 // ************************************************************************* //
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
processorFvPatch.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::coupledFvPatch::delta
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Definition: coupledFvPatch.C:44
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::processorPolyPatch::neighbFaceAreas
const vectorField & neighbFaceAreas() const
Return processor-neighbour patch face areas.
Definition: processorPolyPatch.H:279
Foam::processorFvPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Definition: processorFvPatch.C:122
transformField.H
Spatial transformation functions for primitive fields.
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:124
Foam::processorFvPatch::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
Definition: processorFvPatch.C:112
Foam::processorPolyPatch::neighbFaceCellCentres
const vectorField & neighbFaceCellCentres() const
Return processor-neighbour patch neighbour cell centres.
Definition: processorPolyPatch.H:285
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::processorFvPatch::makeWeights
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: processorFvPatch.C:41
Foam::processorFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: processorFvPatch.C:67
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:273
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:64
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
Foam::processorFvPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
Definition: processorFvPatch.C:103
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::processorFvPatch::procPolyPatch_
const processorPolyPatch & procPolyPatch_
Definition: processorFvPatch.H:57