wedgeLagrangianPatch.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) 2025 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 "wedgeLagrangianPatch.H"
27 #include "LagrangianFields.H"
28 #include "tracking.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
36 
38  (
41  polyPatch
42  );
43 }
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const polyPatch& patch,
50  const LagrangianBoundaryMesh& boundaryMesh
51 )
52 :
53  LagrangianPatch(patch, boundaryMesh),
54  wedgePatch_(refCast<const wedgePolyPatch>(patch)),
55  isOppositePatchMesh_(false)
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
68 {
69  return
70  boundaryMesh()
71  [
72  isOppositePatchMesh_
73  ? wedgePatch_.oppositePatchIndex()
74  : patch().index()
75  ].LagrangianPatch::mesh();
76 }
77 
78 
80 (
84 ) const
85 {
86  const LagrangianSubMesh& patchMesh = this->mesh();
87 
88  // Sub-set the geometry and topology of the elements
89  SubField<barycentric> patchCoordinates = patchMesh.sub(mesh.coordinates());
90  SubField<label> patchCelli = patchMesh.sub(mesh.celli());
91  SubField<label> patchFacei = patchMesh.sub(mesh.facei());
92  SubField<label> patchFaceTrii = patchMesh.sub(mesh.faceTrii());
93 
94  // Cross between the wedge patches
95  forAll(patchMesh, i)
96  {
98  (
99  wedgePatch_,
100  patchCoordinates[i],
101  patchCelli[i],
102  patchFacei[i],
103  patchFaceTrii[i],
104  fraction[i + patchMesh.start()]
105  );
106  }
107 
108  // Set the elements to be in the adjacent cell
109  patchMesh.sub(mesh.states()) = LagrangianState::inCell;
110 
111  // The elements are now on the opposite patch
112  isOppositePatchMesh_ = true;
113 }
114 
115 
117 {
119 
120  // The elements are back on this patch
121  isOppositePatchMesh_ = false;
122 }
123 
124 
125 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Boundary part of a Lagrangian mesh. Just a list of Lagrangian patches with some added convenience fun...
Class containing Lagrangian geometry and topology.
Base class for Lagrangian patches.
virtual void partition() const
Update for mesh changes.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
SubList< Type > sub(const List< Type > &list) const
Return a sub-list corresponding to this sub-mesh.
label start() const
Return start.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Pre-declare related SubField type.
Definition: SubField.H:63
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Wedge Lagrangian patch. This is used for the patches that have normals that point tangentially around...
virtual ~wedgeLagrangianPatch()
Destructor.
virtual void partition() const
Update following partitioning of the mesh.
virtual void evaluate(PstreamBuffers &, LagrangianMesh &, const LagrangianScalarInternalDynamicField &fraction) const
Evaluate changes in elements that have tracked to this patch.
virtual const LagrangianSubMesh & mesh() const
Return the sub-mesh associated with this patch.
wedgeLagrangianPatch(const polyPatch &, const LagrangianBoundaryMesh &)
Construct from a patch and a boundary mesh.
Wedge front and back plane patch.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
void crossWedge(const wedgePolyPatch &inPatch, barycentric &coordinates, label &celli, label &facei, label &faceTrii, const scalar stepFraction)
Cross a wedge patch.
Definition: tracking.C:1700
Namespace for OpenFOAM.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:134
defineTypeNameAndDebug(combustionModel, 0)