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 | Copyright (C) 2013-2016 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 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward class declarations
55 class polyMesh;
56 class fvMesh;
57 class cachedRandom;
58 
59 /*---------------------------------------------------------------------------*\
60  Class patchInjectionBase Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 {
65 protected:
66 
67  // Protected data
68 
69  //- Patch name
70  const word patchName_;
71 
72  //- Patch ID
73  const label patchId_;
74 
75  //- Patch area - total across all processors
76  scalar patchArea_;
77 
78  //- Patch face normal directions
80 
81  //- List of cell labels corresponding to injector positions
83 
84  //- Decomposed patch faces as a list of triangles
86 
87  //- Addressing from per triangle to patch face
89 
90  //- Cumulative triangle area per triangle face
92 
93  //- Cumulative area fractions per processor
95 
96 
97 public:
98 
99  // Constructors
100 
101  //- Construct from mesh and patch name
102  patchInjectionBase(const polyMesh& mesh, const word& patchName);
103 
104  //- Copy constructor
106 
107 
108  //- Destructor
109  virtual ~patchInjectionBase();
110 
111 
112  // Member Functions
113 
114  //- Update patch geometry and derived info for injection locations
115  virtual void updateMesh(const polyMesh& mesh);
116 
117  //- Set the injection position and owner cell, tetFace and tetPt
118  virtual void setPositionAndCell
119  (
120  const fvMesh& mesh,
121  cachedRandom& rnd,
122  vector& position,
123  label& cellOwner,
124  label& tetFacei,
125  label& tetPti
126  );
127 };
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // end namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************************************************************* //
labelList triToFace_
Addressing from per triangle to patch face.
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
const word patchName_
Patch name.
Random number generator.
Definition: cachedRandom.H:63
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.
vectorList patchNormal_
Patch face normal directions.
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
scalarList sumTriMagSf_
Cumulative area fractions per processor.
const label patchId_
Patch ID.
scalarList triCumulativeMagSf_
Cumulative triangle area per triangle face.
scalar patchArea_
Patch area - total across all processors.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
labelList cellOwners_
List of cell labels corresponding to injector positions.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual ~patchInjectionBase()
Destructor.
virtual void setPositionAndCell(const fvMesh &mesh, cachedRandom &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
Namespace for OpenFOAM.
faceList triFace_
Decomposed patch faces as a list of triangles.