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_),
113  stepFraction_(p.stepFraction_),
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 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
p
p
Definition: pEqn.H:62
Foam::particle::origId
label origId() const
Return const access to the particle id on originating processor.
Definition: particleI.H:840
Foam::particle::minStepFractionTol
static const scalar minStepFractionTol
Minimum stepFraction tolerance.
Definition: particle.H:329
Foam::particle::wallImpactDistance
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
Definition: particle.C:131
Foam::operator==
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::particle::particleCount_
static label particleCount_
Cumulative particle counter - used to provode unique ID.
Definition: particle.H:315
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::label
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
Foam::Info
messageStream Info
Foam::operator!=
bool operator!=(const particle &, const particle &)
Definition: particle.C:147
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::particle::trackingCorrectionTol
static const scalar trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
Definition: particle.H:322
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::particle::particle
particle(const polyMesh &mesh, const vector &position, const label cellI, const label tetFaceI, const label tetPtI)
Construct from components.
Definition: particle.C:48
Foam::particle::lambdaDistanceToleranceCoeff
static const scalar lambdaDistanceToleranceCoeff
Fraction of the cell volume to use in determining tolerance values.
Definition: particle.H:326
Foam::particle::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:123
Foam::Vector< scalar >
Foam::particle::origProc
label origProc() const
Return const access to the originating processor id.
Definition: particleI.H:828
Foam::particle
Base particle class.
Definition: particle.H:78
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: doubleFloat.H:94
particle.H
transform.H
3D tensor transformation operations.
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)