cyclicFvPatch.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 
47  const vectorField nbrDelta(nbrPatch.coupledFvPatch::delta());
48 
49  const scalarField nfDelta(nf() & delta);
50  const scalarField nbrNfDelta(nbrPatch.nf() & nbrDelta);
51 
52  forAll(delta, facei)
53  {
54  const scalar ndoi = nfDelta[facei];
55  const scalar ndni = nbrNfDelta[facei];
56  const scalar ndi = ndoi + ndni;
57 
58  if (ndni/vGreat < ndi)
59  {
60  w[facei] = ndni/ndi;
61  }
62  else
63  {
64  const scalar doi = mag(delta[facei]);
65  const scalar dni = mag(nbrDelta[facei]);
66  const scalar di = doi + dni;
67 
68  w[facei] = dni/di;
69  }
70  }
71 }
72 
73 
75 {
76  const vectorField patchD(coupledFvPatch::delta());
77  const vectorField nbrPatchD(neighbFvPatch().coupledFvPatch::delta());
78 
79  tmp<vectorField> tpdv(new vectorField(patchD.size()));
80  vectorField& pdv = tpdv.ref();
81 
82  // To the transformation if necessary
83  if (transform().transforms())
84  {
85  forAll(patchD, facei)
86  {
87  vector ddi = patchD[facei];
88  vector dni = nbrPatchD[facei];
89 
90  pdv[facei] = ddi - transform().transform(dni);
91  }
92  }
93  else
94  {
95  forAll(patchD, facei)
96  {
97  vector ddi = patchD[facei];
98  vector dni = nbrPatchD[facei];
99 
100  pdv[facei] = ddi - dni;
101  }
102  }
103 
104  return tpdv;
105 }
106 
107 
109 (
110  const labelUList& internalData
111 ) const
112 {
113  return patchInternalField(internalData);
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 // ************************************************************************* //
scalar delta
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
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:164
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.
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:60
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicFvPatch.C:74
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
friend dimensionSet transform(const dimensionSet &)
Return the argument; transformations do not change the dimensions.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:477