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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::PatchInjectionBase
28 
29 Description
30  Base class for patch-based injection models.
31 
32  Class handles injecting at a random point adjacent to the patch faces to
33  provide a more stochastic view of the injection process. Patch faces are
34  triangulated, and area fractions accumulated. The fractional areas are
35  then applied to determine across which face a parcel is to be injected.
36 
37 SourceFiles
38  PatchInjectionBase.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef patchInjectionBase_H
43 #define patchInjectionBase_H
44 
45 #include "word.H"
46 #include "labelList.H"
47 #include "scalarList.H"
48 #include "vectorList.H"
49 #include "faceList.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declarations
57 class polyMesh;
58 class fvMesh;
59 class Random;
60 
61 /*---------------------------------------------------------------------------*\
62  Class patchInjectionBase Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67 protected:
68 
69  // Protected data
70 
71  //- Patch name
72  const word patchName_;
73 
74  //- Patch ID
75  const label patchId_;
76 
77  //- Patch area - total across all processors
78  scalar patchArea_;
79 
80  //- Patch face normal directions
82 
83  //- List of cell labels corresponding to injector positions
85 
86  //- Decomposed patch faces as a list of triangles
88 
89  //- Addressing from per triangle to patch face
91 
92  //- Cumulative triangle area per triangle face
94 
95  //- Cumulative area fractions per processor
97 
98 
99 public:
100 
101  // Constructors
102 
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
122  label setPositionAndCell
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 // ************************************************************************* //
Foam::patchInjectionBase::cellOwners_
labelList cellOwners_
List of cell labels corresponding to injector positions.
Definition: patchInjectionBase.H:83
Foam::Random
Random number generator.
Definition: Random.H:59
vectorList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::patchInjectionBase::patchArea_
scalar patchArea_
Patch area - total across all processors.
Definition: patchInjectionBase.H:77
Foam::patchInjectionBase::triToFace_
labelList triToFace_
Addressing from per triangle to patch face.
Definition: patchInjectionBase.H:89
Foam::patchInjectionBase::sumTriMagSf_
scalarList sumTriMagSf_
Cumulative area fractions per processor.
Definition: patchInjectionBase.H:95
Foam::patchInjectionBase::~patchInjectionBase
virtual ~patchInjectionBase()=default
Destructor.
faceList.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
scalarList.H
Foam::patchInjectionBase::triCumulativeMagSf_
scalarList triCumulativeMagSf_
Cumulative triangle area per triangle face.
Definition: patchInjectionBase.H:92
Foam::patchInjectionBase::patchInjectionBase
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
Definition: patchInjectionBase.C:39
Foam::patchInjectionBase::patchName_
const word patchName_
Patch name.
Definition: patchInjectionBase.H:71
labelList.H
Foam::patchInjectionBase::updateMesh
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
Definition: patchInjectionBase.C:82
Foam::patchInjectionBase::setPositionAndCell
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.
Definition: patchInjectionBase.C:148
Foam::patchInjectionBase::whichProc
label whichProc(const scalar fraction01) const
Return the processor that has the location specified by the fraction.
Definition: patchInjectionBase.C:296
Foam::patchInjectionBase::patchNormal_
vectorList patchNormal_
Patch face normal directions.
Definition: patchInjectionBase.H:80
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Vector< scalar >
Foam::patchInjectionBase
Definition: patchInjectionBase.H:64
Foam::patchInjectionBase::patchId_
const label patchId_
Patch ID.
Definition: patchInjectionBase.H:74
Foam::List< vector >
Foam::patchInjectionBase::triFace_
faceList triFace_
Decomposed patch faces as a list of triangles.
Definition: patchInjectionBase.H:86
word.H