particle.C
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) 2011-2013 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 \*---------------------------------------------------------------------------*/
25 
26 #include "particle.H"
27 #include "transform.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
32 
33 const Foam::scalar Foam::particle::trackingCorrectionTol = 1e-5;
34 
35 const Foam::scalar Foam::particle::lambdaDistanceToleranceCoeff = 1e3*SMALL;
36 
37 const Foam::scalar Foam::particle::minStepFractionTol = 1e5*SMALL;
38 
39 namespace Foam
40 {
41  defineTypeNameAndDebug(particle, 0);
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const polyMesh& mesh,
50  const vector& position,
51  const label cellI,
52  const label tetFaceI,
53  const label tetPtI
54 )
55 :
56  mesh_(mesh),
57  position_(position),
58  cellI_(cellI),
59  faceI_(-1),
60  stepFraction_(0.0),
61  tetFaceI_(tetFaceI),
62  tetPtI_(tetPtI),
63  origProc_(Pstream::myProcNo()),
64  origId_(getNewParticleID())
65 {}
66 
67 
69 (
70  const polyMesh& mesh,
71  const vector& position,
72  const label cellI,
73  bool doCellFacePt
74 )
75 :
76  mesh_(mesh),
77  position_(position),
78  cellI_(cellI),
79  faceI_(-1),
80  stepFraction_(0.0),
81  tetFaceI_(-1),
82  tetPtI_(-1),
83  origProc_(Pstream::myProcNo()),
84  origId_(getNewParticleID())
85 {
86  if (doCellFacePt)
87  {
88  initCellFacePt();
89  }
90 }
91 
92 
94 :
95  mesh_(p.mesh_),
96  position_(p.position_),
97  cellI_(p.cellI_),
98  faceI_(p.faceI_),
99  stepFraction_(p.stepFraction_),
100  tetFaceI_(p.tetFaceI_),
101  tetPtI_(p.tetPtI_),
102  origProc_(p.origProc_),
103  origId_(p.origId_)
104 {}
105 
106 
108 :
109  mesh_(mesh),
110  position_(p.position_),
111  cellI_(p.cellI_),
112  faceI_(p.faceI_),
114  tetFaceI_(p.tetFaceI_),
115  tetPtI_(p.tetPtI_),
116  origProc_(p.origProc_),
117  origId_(p.origId_)
118 {}
119 
120 
121 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 
124 {}
125 
126 
128 {}
129 
130 
131 Foam::scalar Foam::particle::wallImpactDistance(const vector&) const
132 {
133  Info<< "particle::wallImpactDistance" << endl;
134 
135  return 0.0;
136 }
137 
138 
139 // * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
140 
141 bool Foam::operator==(const particle& pA, const particle& pB)
142 {
143  return (pA.origProc() == pB.origProc() && pA.origId() == pB.origId());
144 }
145 
146 
147 bool Foam::operator!=(const particle& pA, const particle& pB)
148 {
149  return !(pA == pB);
150 }
151 
152 
153 // ************************************************************************* //
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
Definition: particle.C:131
static const scalar lambdaDistanceToleranceCoeff
Fraction of the cell volume to use in determining tolerance values.
Definition: particle.H:326
label origId() const
Return const access to the particle id on originating processor.
Definition: particleI.H:858
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
static const scalar minStepFractionTol
Minimum stepFraction tolerance.
Definition: particle.H:329
static label particleCount_
Cumulative particle counter - used to provode unique ID.
Definition: particle.H:315
messageStream Info
Namespace for OpenFOAM.
label origId_
Local particle id on originating processor.
Definition: particle.H:164
label tetFaceI_
Index of the face that owns the decomposed tet that the.
Definition: particle.H:153
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
static const scalar trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
Definition: particle.H:322
volScalarField & p
Definition: createFields.H:51
const dimensionedScalar e
Elementary charge.
Definition: doubleFloat.H:78
label cellI_
Index of the cell it is in.
Definition: particle.H:143
bool operator!=(const particle &, const particle &)
Definition: particle.C:147
Base particle class.
Definition: particle.H:78
const polyMesh & mesh_
Reference to the polyMesh database.
Definition: particle.H:137
scalar stepFraction_
Fraction of time-step completed.
Definition: particle.H:149
label origProc() const
Return const access to the originating processor id.
Definition: particleI.H:846
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:404
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
particle(const polyMesh &mesh, const vector &position, const label cellI, const label tetFaceI, const label tetPtI)
Construct from components.
Definition: particle.C:48
3D tensor transformation operations.
label tetPtI_
Index of the point on the face that defines the decomposed.
Definition: particle.H:158
label origProc_
Originating processor id.
Definition: particle.H:161
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:123
label faceI_
Face index if the particle is on a face otherwise -1.
Definition: particle.H:146
vector position_
Position of particle.
Definition: particle.H:140
defineTypeNameAndDebug(combustionModel, 0)