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-------------------------------------------------------------------------------
11License
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
36namespace Foam
37{
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// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
commsTypes
Types of communications.
Definition: UPstream.H:67
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Cyclic-plane patch.
Definition: cyclicFvPatch.H:58
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: cyclicFvPatch.C:45
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicFvPatch.C:62
const cyclicFvPatch & neighbFvPatch() const
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: cyclicFvPatch.C:97
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:144
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
Field< vector > vectorField
Specialisation of Field<T> for vector.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
3D tensor transformation operations.