patchInjectionBase.H
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) 2013-2022 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 Class
25  Foam::patchInjectionBase
26 
27 Description
28  Base class for patch-based injection models.
29 
30  Class handles injecting at a random point adjacent to the patch faces to
31  provide a more stochastic view of the injection process. Patch faces are
32  triangulated, and area fractions accumulated. The fractional areas are
33  then applied to determine across which face a parcel is to be injected.
34 
35 SourceFiles
36  PatchInjectionBase.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef patchInjectionBase_H
41 #define patchInjectionBase_H
42 
43 #include "word.H"
44 #include "labelList.H"
45 #include "scalarList.H"
46 #include "vectorList.H"
47 #include "faceList.H"
48 #include "triFaceList.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward class declarations
56 class polyMesh;
57 class fvMesh;
58 class Random;
59 
60 /*---------------------------------------------------------------------------*\
61  Class patchInjectionBase Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 {
66 protected:
67 
68  // Protected data
69 
70  //- Patch name
71  const word patchName_;
72 
73  //- Patch ID
74  const label patchId_;
75 
76  //- Patch area - total across all processors
77  scalar patchArea_;
78 
79  //- Patch face normal directions
81 
82  //- List of cell labels corresponding to injector positions
84 
85  //- Decomposed patch faces as a list of triangles
87 
88  //- Addressing from per triangle to patch face
90 
91  //- Cumulative triangle area per triangle face
93 
94  //- Cumulative area fractions per processor
96 
97 
98 public:
99 
100  // Constructors
101 
102  //- Construct from mesh and patch name
103  patchInjectionBase(const polyMesh& mesh, const word& patchName);
104 
105  //- Copy constructor
107 
108 
109  //- Destructor
110  virtual ~patchInjectionBase();
111 
112 
113  // Member Functions
114 
115  //- Update patch geometry and derived info for injection locations
116  virtual void topoChange(const polyMesh& mesh);
117 
118  //- Set the injection position and owner cell, tetFace and tetPt
119  virtual void setPositionAndCell
120  (
121  const fvMesh& mesh,
122  Random& rnd,
123  vector& position,
124  label& cellOwner,
125  label& tetFacei,
126  label& tetPti
127  );
128 };
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // end namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
labelList triToFace_
Addressing from per triangle to patch face.
const word patchName_
Patch name.
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
fvMesh & mesh
vectorList patchNormal_
Patch face normal directions.
A class for handling words, derived from string.
Definition: word.H:59
triFaceList triFace_
Decomposed patch faces as a list of triangles.
scalarList sumTriMagSf_
Cumulative area fractions per processor.
Base class for patch-based injection models.
const label patchId_
Patch ID.
scalarList triCumulativeMagSf_
Cumulative triangle area per triangle face.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
Random number generator.
Definition: Random.H:57
scalar patchArea_
Patch area - total across all processors.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
labelList cellOwners_
List of cell labels corresponding to injector positions.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
virtual ~patchInjectionBase()
Destructor.
Namespace for OpenFOAM.