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 stochsatic 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 cachedRandom;
57 
58 /*---------------------------------------------------------------------------*\
59  Class patchInjectionBase Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 {
64 protected:
65 
66  // Protected data
67 
68  //- Patch name
69  const word patchName_;
70 
71  //- Patch ID
72  const label patchId_;
73 
74  //- Patch area - total across all processors
75  scalar patchArea_;
76 
77  //- Patch face normal directions
79 
80  //- List of cell labels corresponding to injector positions
82 
83  //- Decomposed patch faces as a list of triangles
85 
86  //- Addressing from per triangle to patch face
88 
89  //- Cumulative triangle area per triangle face
91 
92  //- Cumulative area fractions per processor
94 
95 
96 public:
97 
98  // Constructors
99 
100  //- Construct from mesh and patch name
101  patchInjectionBase(const polyMesh& mesh, const word& patchName);
102 
103  //- Copy constructor
105 
106 
107  //- Destructor
108  virtual ~patchInjectionBase();
109 
110 
111  // Member Functions
112 
113  //- Update patch geometry and derived info for injection locations
114  virtual void updateMesh(const polyMesh& mesh);
115 
116  //- Set the injection position and owner cell, tetFace and tetPt
117  virtual void setPositionAndCell
118  (
119  const polyMesh& mesh,
120  cachedRandom& rnd,
121  vector& position,
122  label& cellOwner,
123  label& tetFacei,
124  label& tetPtI
125  );
126 };
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // end namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
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.
virtual void setPositionAndCell(const polyMesh &mesh, cachedRandom &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPtI)
Set the injection position and owner cell, tetFace and tetPt.
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.
labelList cellOwners_
List of cell labels corresponding to injector positions.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual ~patchInjectionBase()
Destructor.
Namespace for OpenFOAM.
faceList triFace_
Decomposed patch faces as a list of triangles.