Loading...
Searching...
No Matches
processorFvPatch.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-2014 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 "processorFvPatch.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
39}
40
41
42// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
43
45{
46 if (Pstream::parRun())
47 {
48 // The face normals point in the opposite direction on the other side
49 scalarField neighbFaceCentresCn
50 (
51 (
52 procPolyPatch_.neighbFaceAreas()
53 /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
54 )
55 & (
56 procPolyPatch_.neighbFaceCentres()
57 - procPolyPatch_.neighbFaceCellCentres())
58 );
59
60 w = neighbFaceCentresCn
61 /((nf()&coupledFvPatch::delta()) + neighbFaceCentresCn);
62 }
63 else
64 {
65 w = 1.0;
66 }
67}
68
69
71{
72 if (Pstream::parRun())
73 {
74 // To the transformation if necessary
75 if (parallel())
76 {
77 return
79 - (
80 procPolyPatch_.neighbFaceCentres()
81 - procPolyPatch_.neighbFaceCellCentres()
82 );
83 }
84 else
85 {
86 return
88 - transform
89 (
90 forwardT(),
91 (
92 procPolyPatch_.neighbFaceCentres()
93 - procPolyPatch_.neighbFaceCellCentres()
94 )
95 );
96 }
97 }
98 else
99 {
100 return coupledFvPatch::delta();
101 }
102}
103
104
106(
107 const labelUList& internalData
108) const
109{
110 return patchInternalField(internalData);
111}
112
113
115(
116 const labelUList& internalData,
117 const labelUList& faceCells
118) const
120 auto tpfld = tmp<labelField>::New(this->size());
121 patchInternalField(internalData, faceCells, tpfld.ref());
122 return tpfld;
123}
124
125
127(
128 const Pstream::commsTypes commsType,
129 const labelUList& iF
130) const
131{
132 send(commsType, patchInternalField(iF)());
133}
134
135
137(
138 const Pstream::commsTypes commsType,
139 const labelUList& iF,
148(
149 const Pstream::commsTypes commsType,
150 const labelUList&
151) const
152{
153 return receive<label>(commsType, this->size());
154}
155
156
157// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
commsTypes
Communications types.
Definition UPstream.H:81
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
Definition UPstream.H:1669
static bool & parRun() noexcept
Test if this a parallel run.
Definition UPstream.H:1681
virtual const labelUList & faceCells() const
Return faceCell addressing.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
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
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void makeWeights(scalarField &) const
Make patch weighting factors.
processorFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from components.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
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.
void receive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
const vectorField & neighbFaceAreas() const noexcept
Return processor-neighbour patch face areas.
const vectorField & neighbFaceCellCentres() const noexcept
Return processor-neighbour patch neighbour cell centres.
const vectorField & neighbFaceCentres() const noexcept
Return processor-neighbour patch face centres.
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
#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.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
UList< label > labelUList
A UList of labels.
Definition UList.H:75
Spatial transformation functions for primitive fields.