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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::PatchInjectionBase
28
29Description
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
37SourceFiles
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
53namespace Foam
54{
55
56// Forward declarations
57class polyMesh;
58class fvMesh;
59class Random;
60
61/*---------------------------------------------------------------------------*\
62 Class patchInjectionBase Declaration
63\*---------------------------------------------------------------------------*/
66{
67protected:
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
99public:
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
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// ************************************************************************* //
Random number generator.
Definition: Random.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const word patchName_
Patch name.
const label patchId_
Patch ID.
virtual ~patchInjectionBase()=default
Destructor.
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
scalarList triCumulativeMagSf_
Cumulative triangle area per triangle face.
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 triToFace_
Addressing from per triangle to patch face.
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.
faceList triFace_
Decomposed patch faces as a list of triangles.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Namespace for OpenFOAM.