Loading...
Searching...
No Matches
patchInjectionBase.H
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) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2024 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
27Class
28 Foam::PatchInjectionBase
29
30Description
31 Base class for patch-based injection models.
32
33 Class handles injecting at a random point adjacent to the patch faces to
34 provide a more stochastic view of the injection process. Patch faces are
35 triangulated, and area fractions accumulated. The fractional areas are
36 then applied to determine across which face a parcel is to be injected.
37
38SourceFiles
39 PatchInjectionBase.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef Foam_patchInjectionBase_H
44#define Foam_patchInjectionBase_H
45
46#include "word.H"
47#include "labelList.H"
48#include "scalarList.H"
49#include "vectorList.H"
50#include "faceList.H"
51#include "labelledTri.H"
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace Foam
56{
57
58// Forward Declarations
59class polyMesh;
60class fvMesh;
61class Random;
63/*---------------------------------------------------------------------------*\
64 Class patchInjectionBase Declaration
65\*---------------------------------------------------------------------------*/
66
68{
69protected:
70
71 // Protected Data
72
73 //- Patch name
74 const word patchName_;
75
76 //- Patch ID
77 const label patchId_;
78
79 //- Patch area - total across all processors
80 scalar patchArea_;
82 //- Patch face normal directions
84
85 //- List of cell labels corresponding to injector positions
87
88 //- The polyPatch faces as triangles, the index of each corresponds
89 //- to the undecomposed patch face index.
92 //- Cumulative triangle area per triangle face (processor-local)
94
95 //- Cumulative area fractions per processor
98
99public:
100
101 // Constructors
103 //- Construct from mesh and patch name
104 patchInjectionBase(const polyMesh& mesh, const word& patchName);
105
106 //- Copy constructor
108
109
110 //- Destructor
111 virtual ~patchInjectionBase() = default;
112
113
114 // Member Functions
115
116 //- Update patch geometry and derived info for injection locations
117 virtual void updateMesh(const polyMesh& mesh);
118
119 //- Set the injection position and owner cell, tetFace and tetPt
120 // Supply the fraction used to determine the location on the patch
121 // Returns the seed patch face index
123 (
124 const fvMesh& mesh,
125 const scalar fraction01,
126 Random& rnd,
127 vector& position,
128 label& cellOwner,
129 label& tetFacei,
130 label& tetPti
131 );
132
133 //- Set the injection position and owner cell, tetFace and tetPt
134 // Returns the seed patch face index
135 virtual label setPositionAndCell
136 (
137 const fvMesh& mesh,
138 Random& rnd,
139 vector& position,
140 label& cellOwner,
141 label& tetFacei,
142 label& tetPti
143 );
144
145 //- Return the processor that has the location specified by the fraction
146 label whichProc(const scalar fraction01) const;
147};
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151} // End namespace Foam
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155#endif
156
157// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
Random number generator.
Definition Random.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const word patchName_
Patch name.
const label patchId_
Patch ID.
virtual ~patchInjectionBase()=default
Destructor.
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
scalarList triCumulativeMagSf_
Cumulative triangle area per triangle face (processor-local).
label whichProc(const scalar fraction01) const
Return the processor that has the location specified by the fraction.
scalar patchArea_
Patch area - total across all processors.
vectorList patchNormal_
Patch face normal directions.
scalarList sumTriMagSf_
Cumulative area fractions per processor.
labelList cellOwners_
List of cell labels corresponding to injector positions.
label setPositionAndCell(const fvMesh &mesh, const scalar fraction01, Random &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
List< labelledTri > triFace_
The polyPatch faces as triangles, the index of each corresponds to the undecomposed patch face index.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
List< vector > vectorList
List of vector.
Definition vectorList.H:32
Vector< scalar > vector
Definition vector.H:57
List< scalar > scalarList
List of scalar.
Definition scalarList.H:32