cyclicFvPatch.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-2016 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 "cyclicFvPatch.H"
30 #include "fvMesh.H"
31 #include "transform.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(cyclicFvPatch, 0);
38  addToRunTimeSelectionTable(fvPatch, cyclicFvPatch, polyPatch);
39 }
40 
41 
42 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 
45 {
46  const cyclicFvPatch& nbrPatch = neighbFvPatch();
47 
48  const scalarField deltas(nf()&coupledFvPatch::delta());
49  const scalarField nbrDeltas(nbrPatch.nf()&nbrPatch.coupledFvPatch::delta());
50 
51  forAll(deltas, facei)
52  {
53  scalar di = deltas[facei];
54  scalar dni = nbrDeltas[facei];
55 
56  w[facei] = dni/(di + dni);
57  }
58 }
59 
60 
62 {
63  const vectorField patchD(coupledFvPatch::delta());
64  const vectorField nbrPatchD(neighbFvPatch().coupledFvPatch::delta());
65 
66  tmp<vectorField> tpdv(new vectorField(patchD.size()));
67  vectorField& pdv = tpdv.ref();
68 
69  // To the transformation if necessary
70  if (parallel())
71  {
72  forAll(patchD, facei)
73  {
74  vector ddi = patchD[facei];
75  vector dni = nbrPatchD[facei];
76 
77  pdv[facei] = ddi - dni;
78  }
79  }
80  else
81  {
82  forAll(patchD, facei)
83  {
84  vector ddi = patchD[facei];
85  vector dni = nbrPatchD[facei];
86 
87  pdv[facei] = ddi - transform(forwardT()[0], dni);
88  }
89  }
90 
91  return tpdv;
92 }
93 
94 
96 (
97  const labelUList& internalData
98 ) const
99 {
100  return patchInternalField(internalData);
101 }
102 
103 
105 (
106  const Pstream::commsTypes commsType,
107  const labelUList& iF
108 ) const
109 {
110  return neighbFvPatch().patchInternalField(iF);
111 }
112 
113 
114 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::cyclicFvPatch::makeWeights
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: cyclicFvPatch.C:44
Foam::cyclicFvPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
Definition: cyclicFvPatch.C:96
cyclicFvPatch.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:519
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::cyclicFvPatch::neighbFvPatch
const cyclicFvPatch & neighbFvPatch() const
Definition: cyclicFvPatch.H:135
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:138
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:228
Foam::Field< scalar >
Foam::cyclicFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicFvPatch.C:61
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::cyclicFvPatch
Cyclic-plane patch.
Definition: cyclicFvPatch.H:53
Foam::Vector< scalar >
Foam::UList< label >
Foam::cyclicFvPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Definition: cyclicFvPatch.C:105
transform.H
3D tensor transformation operations.
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)