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-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 \*---------------------------------------------------------------------------*/
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  return 0.0;
134 }
135 
136 
137 // * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
138 
139 bool Foam::operator==(const particle& pA, const particle& pB)
140 {
141  return (pA.origProc() == pB.origProc() && pA.origId() == pB.origId());
142 }
143 
144 
145 bool Foam::operator!=(const particle& pA, const particle& pB)
146 {
147  return !(pA == pB);
148 }
149 
150 
151 // ************************************************************************* //
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 trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
Definition: particle.H:326
label tetPtI_
Index of the point on the face that defines the decomposed.
Definition: particle.H:158
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:417
static const scalar lambdaDistanceToleranceCoeff
Fraction of the cell volume to use in determining tolerance values.
Definition: particle.H:330
particle(const polyMesh &mesh, const vector &position, const label celli, const label tetFacei, const label tetPtI)
Construct from components.
Definition: particle.C:48
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:123
vector position_
Position of particle.
Definition: particle.H:140
label origId() const
Return const access to the particle id on originating processor.
Definition: particleI.H:840
label origId_
Local particle id on originating processor.
Definition: particle.H:164
Base particle class.
Definition: particle.H:78
label origProc_
Originating processor id.
Definition: particle.H:161
const dimensionedScalar e
Elementary charge.
Definition: doubleFloat.H:78
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
3D tensor transformation operations.
const polyMesh & mesh_
Reference to the polyMesh database.
Definition: particle.H:137
scalar stepFraction_
Fraction of time-step completed.
Definition: particle.H:149
static const scalar minStepFractionTol
Minimum stepFraction tolerance.
Definition: particle.H:333
label celli_
Index of the cell it is in.
Definition: particle.H:143
label tetFacei_
Index of the face that owns the decomposed tet that the.
Definition: particle.H:153
label origProc() const
Return const access to the originating processor id.
Definition: particleI.H:828
defineTypeNameAndDebug(combustionModel, 0)
static label particleCount_
Cumulative particle counter - used to provode unique ID.
Definition: particle.H:319
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
Definition: particle.C:131
volScalarField & p
bool operator!=(const particle &, const particle &)
Definition: particle.C:145
Namespace for OpenFOAM.
label facei_
Face index if the particle is on a face otherwise -1.
Definition: particle.H:146