fvMeshStitcherTools.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) 2023 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 "fvMeshStitcherTools.H"
27 #include "surfaceFields.H"
29 #include "nonConformalFvPatch.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
35 {
36  const fvBoundaryMesh& fvbm = mesh.boundary();
37 
38  const surfaceScalarField::Boundary& magSfb =
39  fvbm.mesh().magSf().boundaryField();
40 
42  (
44  (
45  fvbm,
46  surfaceScalarField::Internal::null(),
48  )
49  );
50 
51  surfaceScalarField::Boundary& result = tresult.ref();
52 
53  result == 0;
54 
55  forAll(fvbm, ncPatchi)
56  {
57  const fvPatch& fvp = fvbm[ncPatchi];
58 
59  if (!isA<nonConformalFvPatch>(fvp)) continue;
60 
61  const nonConformalFvPatch& ncFvp =
62  refCast<const nonConformalFvPatch>(fvp);
63 
64  const label origPatchi = ncFvp.origPatchIndex();
65  const fvPatch& origFvp = ncFvp.origPatch();
66 
67  result[origPatchi] +=
69  (
70  magSfb[ncPatchi],
71  origFvp.size(),
72  ncFvp.polyFaces(),
73  origFvp.start()
74  );
75  }
76 
77  return tresult;
78 }
79 
80 
81 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Generic GeometricBoundaryField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Foam::calculatedFvsPatchField.
Foam::fvBoundaryMesh.
const fvMesh & mesh() const
Return the mesh reference.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:857
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
virtual label size() const
Return size.
Definition: fvPatch.H:138
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:132
Non-conformal FV patch. Provides the necessary interface for a FV patch which does not conform to the...
const labelList & polyFaces() const
Return face face-poly-faces.
const fvPatch & origPatch() const
Original patch.
label origPatchIndex() const
Original patch ID.
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
tmp< SurfaceFieldBoundary< scalar > > origNcMagSfb(const fvMesh &mesh)
Return the total non-conformal area associated with each original face.
tmp< Field< Type > > fieldRMapSum(const Field< Type > &f, const label size, const labelUList &addr, const label addr0=0)
Reverse map a field with an (optional) addressing offset, initialising the.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::surfaceFields.