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