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-2023 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 {
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  auto tpfld = tmp<labelField>::New();
112  patchInternalField(internalData, faceCells, tpfld.ref());
113  return tpfld;
114 }
115 
116 
118 (
119  const Pstream::commsTypes commsType,
120  const labelUList& iF
121 ) const
122 {
123  return neighbFvPatch().patchInternalField(iF);
124 }
125 
126 
127 // ************************************************************************* //
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
commsTypes
Communications types.
Definition: UPstream.H:72
const cyclicFvPatch & neighbFvPatch() const
tmp< vectorField > nf() const
Return face unit normals, like the fvMesh::unitSf() method Same as unitSf().
Definition: fvPatch.C:143
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: cyclicFvPatch.C:38
3D tensor transformation operations.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
Definition: cyclicFvPatch.C:90
Vector< scalar > vector
Definition: vector.H:57
Cyclic-plane patch.
Definition: cyclicFvPatch.H:50
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicFvPatch.C:55
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: HashPtrTable.H:50
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
Namespace for OpenFOAM.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)