Loading...
Searching...
No Matches
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-2025 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 auto tpdv = tmp<vectorField>::New(patchD.size());
68 auto& 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
96Foam::tmp<Foam::labelField> Foam::cyclicFvPatch::interfaceInternalField
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
111 auto tpfld = tmp<labelField>::New(this->size());
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// ************************************************************************* //
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:118
commsTypes
Communications types.
Definition UPstream.H:81
virtual const labelUList & faceCells() const
Return faceCell addressing.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Cyclic-plane patch.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void makeWeights(scalarField &) const
Make patch weighting factors.
cyclicFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
const cyclicFvPatch & neighbFvPatch() const
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
virtual label size() const
Patch size is the number of faces, but can be overloaded.
Definition fvPatch.H:242
tmp< vectorField > nf() const
Return face unit normals, like the fvMesh::unitSf() method Same as unitSf().
Definition fvPatch.C:143
void patchInternalField(const UList< Type > &internalData, const labelUList &addressing, UList< Type > &pfld) const
Extract internal field next to patch using specified addressing.
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
Namespace for OpenFOAM.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Vector< scalar > vector
Definition vector.H:57
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
3D tensor transformation operations.