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  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 "cyclicFvPatch.H"
31 #include "fvMesh.H"
32 #include "transform.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  defineTypeNameAndDebug(cyclicFvPatch, 0);
39  addToRunTimeSelectionTable(fvPatch, cyclicFvPatch, polyPatch);
40 }
41 
42 
43 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
44 
46 {
47  const cyclicFvPatch& nbrPatch = neighbFvPatch();
48 
49  const scalarField deltas(nf()&coupledFvPatch::delta());
50  const scalarField nbrDeltas(nbrPatch.nf()&nbrPatch.coupledFvPatch::delta());
51 
52  forAll(deltas, facei)
53  {
54  scalar di = deltas[facei];
55  scalar dni = nbrDeltas[facei];
56 
57  w[facei] = dni/(di + dni);
58  }
59 }
60 
61 
63 {
64  const vectorField patchD(coupledFvPatch::delta());
65  const vectorField nbrPatchD(neighbFvPatch().coupledFvPatch::delta());
66 
67  tmp<vectorField> tpdv(new vectorField(patchD.size()));
68  vectorField& pdv = tpdv.ref();
69 
70  // To the transformation if necessary
71  if (parallel())
72  {
73  forAll(patchD, facei)
74  {
75  vector ddi = patchD[facei];
76  vector dni = nbrPatchD[facei];
77 
78  pdv[facei] = ddi - dni;
79  }
80  }
81  else
82  {
83  forAll(patchD, facei)
84  {
85  vector ddi = patchD[facei];
86  vector dni = nbrPatchD[facei];
87 
88  pdv[facei] = ddi - transform(forwardT()[0], dni);
89  }
90  }
91 
92  return tpdv;
93 }
94 
95 
97 (
98  const labelUList& internalData
99 ) const
100 {
101  return patchInternalField(internalData);
102 }
103 
104 
106 (
107  const labelUList& internalData,
108  const labelUList& faceCells
109 ) const
110 {
111  return patchInternalField(internalData, faceCells);
112 }
113 
114 
116 (
117  const Pstream::commsTypes commsType,
118  const labelUList& iF
119 ) const
120 {
121  return neighbFvPatch().patchInternalField(iF);
122 }
123 
124 
125 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::cyclicFvPatch::makeWeights
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: cyclicFvPatch.C:45
Foam::cyclicFvPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: cyclicFvPatch.C:97
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:521
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:137
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:144
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::Field< scalar >
Foam::cyclicFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicFvPatch.C:62
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:54
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:116
transform.H
3D tensor transformation operations.
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56