FreeFOAM The Cross-Platform CFD Toolkit
Particle< ParticleType > Class Template Reference

#include <lagrangian/Particle.H>


Detailed Description

template<class ParticleType>
class Foam::Particle< ParticleType >

Definition at line 75 of file Particle.H.

+ Inheritance diagram for Particle< ParticleType >:
+ Collaboration diagram for Particle< ParticleType >:

List of all members.

Classes

class  iNew
 Factory class to read-construct particles used for. More...
class  trackData
 Class used to pass tracking data to the trackToFace function. More...

Public Member Functions

 TypeName ("Particle")
 Runtime type information.
 Particle (const Cloud< ParticleType > &, const vector &position, const label celli)
 Construct from components.
 Particle (const Cloud< ParticleType > &, Istream &, bool readFields=true)
 Construct from Istream.
 Particle (const Particle &p)
 Construct as a copy.
autoPtr< ParticleType > clone () const
 Construct a clone.
virtual ~Particle ()
 Destructor.
bool inCell () const
 Return true if particle is in cell.
bool inCell (const vector &position, const label celli, const scalar stepFraction) const
 Return true if position is in cell i.
const vectorposition () const
 Return current particle position.
vectorposition ()
 Return current particle position.
label & cell ()
 Return current cell particle is in.
label cell () const
 Return current cell particle is in.
label face () const
 Return current face particle is on otherwise -1.
const Cloud< ParticleType > & cloud () const
 Return reference to the particle cloud.
bool softImpact () const
 Return the impact model to be used, soft or hard (default).
scalar currentTime () const
 Return the particle current time.
bool onBoundary () const
 Is the particle on the boundary/(or outside the domain)?
label patch (const label facei) const
 Which patch is particle on.
label patchFace (const label patchi, const label facei) const
 Which face of this patch is this particle on.
scalar wallImpactDistance (const vector &n) const
 The nearest distance to a wall that.
scalar & stepFraction ()
 Return the fraction of time-step completed.
scalar stepFraction () const
 Return the fraction of time-step completed.
label origProc () const
 Return the originating processor id.
label origId () const
 Return the particle id on originating processor.
template<class TrackData >
label track (const vector &endPosition, TrackData &td)
 Track particle to end of trajectory.
label track (const vector &endPosition)
 Calls the templated track with dummy TrackData.
template<class TrackData >
scalar trackToFace (const vector &endPosition, TrackData &td)
 Track particle to a given position and returns 1.0 if the.
scalar trackToFace (const vector &endPosition)
 Calls the templated trackToFace with dummy TrackData.
label faceInterpolation () const
 Return the index of the face to be used in the interpolation.
void write (Ostream &os, bool writeFields) const
 Write the particle data.

Static Public Member Functions

static void readFields (Cloud< ParticleType > &c)
 Read the fields associated with the owner cloud.
static void writeFields (const Cloud< ParticleType > &c)
 Write the fields associated with the owner cloud.

Static Public Attributes

static string propHeader = "(Px Py Pz) cellI origProc origId"
 String representation of properties.

Protected Member Functions

scalar lambda (const vector &from, const vector &to, const label facei, const scalar stepFraction) const
 Return the 'lambda' value for the position, p, on the face,.
scalar lambda (const vector &from, const vector &to, const label facei) const
 Return the 'lambda' value for the position, p, on the face,.
void findFaces (const vector &position, DynamicList< label > &faceList) const
 Find the faces between position and cell centre.
void findFaces (const vector &position, const label celli, const scalar stepFraction, DynamicList< label > &faceList) const
 Find the faces between position and cell centre.
template<class TrackData >
bool hitPatch (const polyPatch &, TrackData &td, const label patchI)
 Overridable function to handle the particle hitting a patch.
template<class TrackData >
void hitWedgePatch (const wedgePolyPatch &, TrackData &td)
 Overridable function to handle the particle hitting a wedgePatch.
template<class TrackData >
void hitSymmetryPatch (const symmetryPolyPatch &, TrackData &td)
 Overridable function to handle the particle hitting a.
template<class TrackData >
void hitCyclicPatch (const cyclicPolyPatch &, TrackData &td)
 Overridable function to handle the particle hitting a cyclicPatch.
template<class TrackData >
void hitProcessorPatch (const processorPolyPatch &, TrackData &td)
 Overridable function to handle the particle hitting a.
template<class TrackData >
void hitWallPatch (const wallPolyPatch &, TrackData &td)
 Overridable function to handle the particle hitting a wallPatch.
template<class TrackData >
void hitPatch (const polyPatch &, TrackData &td)
 Overridable function to handle the particle hitting a.
virtual void transformPosition (const tensor &T)
 Transform the position the particle.
virtual void transformProperties (const tensor &T)
 Transform the physical properties of the particle.
virtual void transformProperties (const vector &separation)
 Transform the physical properties of the particle.
template<class TrackData >
void prepareForParallelTransfer (const label patchi, TrackData &td)
 Convert global addressing to the processor patch.
template<class TrackData >
void correctAfterParallelTransfer (const label patchi, TrackData &td)
 Convert processor patch addressing to the global equivalents.

Protected Attributes

const Cloud< ParticleType > & cloud_
 Reference to the particle cloud.
vector position_
 Position of particle.
label celli_
 Index of the cell it is in.
label facei_
 Face index if the particle is on a face otherwise -1.
scalar stepFraction_
 Fraction of time-step completed.
label origProc_
 Originating processor id.
label origId_
 Local particle id on originating processor.

Friends

class Cloud< ParticleType >
Ostreamoperator (Ostream &, const Particle< ParticleType > &)

Constructor & Destructor Documentation

Particle ( const Cloud< ParticleType > &  cloud,
const vector position,
const label  celli 
)

Construct from components.

Definition at line 168 of file Particle.C.

Referenced by Particle< BasicReactingParcel< ThermoType > >::clone().

Particle ( const Cloud< ParticleType > &  cloud,
Istream is,
bool  readFields = true 
)

Construct from Istream.

Definition at line 40 of file ParticleIO.C.

References IOstream::check(), IOstream::format(), and Istream::read().

Particle ( const Particle< ParticleType > &  p)

Construct as a copy.

virtual ~Particle ( )
inlinevirtual

Destructor.

Definition at line 343 of file Particle.H.


Member Function Documentation

Foam::scalar lambda ( const vector from,
const vector to,
const label  facei,
const scalar  stepFraction 
) const
inlineprotected

Return the 'lambda' value for the position, p, on the face,.

where, p = from + lamda*(to - from) for non-static meshes

Definition at line 32 of file ParticleI.H.

References b, beta(), polyMesh::boundaryMesh(), primitiveMesh::cellCentres(), cp, primitiveMesh::faceAreas(), primitiveMesh::faceCentres(), polyMesh::faces(), Foam::mag(), mesh, polyMesh::moving(), polyMesh::oldPoints(), p, patchi, and Foam::sqrt().

Foam::scalar lambda ( const vector from,
const vector to,
const label  facei 
) const
inlineprotected

Return the 'lambda' value for the position, p, on the face,.

where, p = from + lamda*(to - from) for static meshes

Definition at line 184 of file ParticleI.H.

References polyMesh::boundaryMesh(), primitiveMesh::cellCentres(), primitiveMesh::faceAreas(), primitiveMesh::faceCentres(), Foam::mag(), mesh, p, and patchi.

void findFaces ( const vector position,
DynamicList< label > &  faceList 
) const
protected
void findFaces ( const vector position,
const label  celli,
const scalar  stepFraction,
DynamicList< label > &  faceList 
) const
protected
bool hitPatch ( const polyPatch ,
TrackData &  td,
const label  patchI 
)
protected
void hitWedgePatch ( const wedgePolyPatch wpp,
TrackData &  td 
)
protected

Overridable function to handle the particle hitting a wedgePatch.

Definition at line 442 of file Particle.C.

References polyPatch::faceAreas(), Foam::I, Foam::mag(), and polyPatch::whichFace().

void hitSymmetryPatch ( const symmetryPolyPatch spp,
TrackData &  td 
)
protected

Overridable function to handle the particle hitting a.

symmetryPatch

Definition at line 457 of file Particle.C.

References polyPatch::faceAreas(), Foam::I, Foam::mag(), and polyPatch::whichFace().

void hitCyclicPatch ( const cyclicPolyPatch cpp,
TrackData &  td 
)
protected
void transformPosition ( const tensor T)
protectedvirtual

Transform the position the particle.

according to the given transformation tensor

Definition at line 410 of file Particle.C.

References Foam::transform().

void prepareForParallelTransfer ( const label  patchi,
TrackData &  td 
)
protected

Convert global addressing to the processor patch.

local equivalents

Definition at line 92 of file Particle.C.

void correctAfterParallelTransfer ( const label  patchi,
TrackData &  td 
)
protected

Convert processor patch addressing to the global equivalents.

and set the celli to the face-neighbour

Definition at line 105 of file Particle.C.

References polyPatch::faceCells(), coupledPolyPatch::forwardT(), coupledPolyPatch::parallel(), patchi, coupledPolyPatch::separated(), coupledPolyPatch::separation(), List< T >::size(), polyPatch::start(), and T.

TypeName ( "Particle< ParticleType >"  )

Runtime type information.

bool inCell ( ) const
inline

Return true if particle is in cell.

Definition at line 238 of file ParticleI.H.

References List< T >::size().

bool inCell ( const vector position,
const label  celli,
const scalar  stepFraction 
) const
inline

Return true if position is in cell i.

Definition at line 249 of file ParticleI.H.

References List< T >::size().

Foam::vector & position ( )
inline

Return current particle position.

Definition at line 300 of file ParticleI.H.

References Particle< ParticleType >::position_.

Foam::label cell ( ) const
inline

Return current cell particle is in.

Definition at line 307 of file ParticleI.H.

References Particle< ParticleType >::celli_.

Foam::label face ( ) const
inline

Return current face particle is on otherwise -1.

Definition at line 321 of file ParticleI.H.

References Particle< ParticleType >::facei_.

Referenced by meshSearch::findCell().

const Foam::Cloud< ParticleType > & cloud ( ) const
inline

Return reference to the particle cloud.

Definition at line 286 of file ParticleI.H.

References Particle< ParticleType >::cloud_.

bool softImpact ( ) const
inline

Return the impact model to be used, soft or hard (default).

Definition at line 363 of file ParticleI.H.

Foam::scalar currentTime ( ) const
inline

Return the particle current time.

Definition at line 370 of file ParticleI.H.

References Particle< ParticleType >::cloud_, and Particle< ParticleType >::stepFraction_.

bool onBoundary ( ) const
inline

Is the particle on the boundary/(or outside the domain)?

Definition at line 328 of file ParticleI.H.

References Particle< ParticleType >::cloud_, and Particle< ParticleType >::facei_.

Referenced by meshSearch::findCell().

Foam::label patch ( const label  facei) const
inline

Which patch is particle on.

Definition at line 379 of file ParticleI.H.

References Particle< ParticleType >::cloud_.

Referenced by reflectParcel::wallTreatment().

Foam::label patchFace ( const label  patchi,
const label  facei 
) const
inline

Which face of this patch is this particle on.

Definition at line 387 of file ParticleI.H.

References Particle< ParticleType >::cloud_.

Referenced by reflectParcel::wallTreatment().

Foam::scalar wallImpactDistance ( const vector n) const
inline
Foam::scalar & stepFraction ( )
inline

Return the fraction of time-step completed.

Definition at line 335 of file ParticleI.H.

References Particle< ParticleType >::stepFraction_.

Referenced by spray::inject(), and reflectParcel::wallTreatment().

Foam::scalar stepFraction ( ) const
inline

Return the fraction of time-step completed.

Definition at line 342 of file ParticleI.H.

References Particle< ParticleType >::stepFraction_.

Foam::label origProc ( ) const
inline

Return the originating processor id.

Definition at line 349 of file ParticleI.H.

References Particle< ParticleType >::origProc_.

Foam::label origId ( ) const
inline

Return the particle id on originating processor.

Definition at line 356 of file ParticleI.H.

References Particle< ParticleType >::origId_.

Foam::label track ( const vector endPosition,
TrackData &  td 
)

Track particle to end of trajectory.

or until it hits the boundary. On entry 'stepFraction()' should be set to the fraction of the time-step at which the tracking starts and on exit it contains the fraction of the time-step completed. Returns the boundary face index if the track stops at the boundary, -1 otherwise.

Definition at line 202 of file Particle.C.

Referenced by meshSearch::findCell().

Foam::label track ( const vector endPosition)

Calls the templated track with dummy TrackData.

Reimplemented in ExactParticle< ParticleType >, and ExactParticle< trackedParticle >.

Definition at line 221 of file Particle.C.

Foam::scalar trackToFace ( const vector endPosition,
TrackData &  td 
)

Track particle to a given position and returns 1.0 if the.

trajectory is completed without hitting a face otherwise stops at the face and returns the fraction of the trajectory completed. on entry 'stepFraction()' should be set to the fraction of the time-step at which the tracking starts.

Definition at line 230 of file Particle.C.

References Foam::abort(), polyMesh::boundaryMesh(), primitiveMesh::cellCentres(), UList< T >::empty(), polyMesh::faceNeighbour(), polyMesh::faceOwner(), Foam::FatalError, FatalErrorIn, forAll, mesh, Foam::nl, p, patchi, and List< T >::size().

Foam::scalar trackToFace ( const vector endPosition)

Calls the templated trackToFace with dummy TrackData.

Reimplemented in ExactParticle< ParticleType >, and ExactParticle< trackedParticle >.

Definition at line 401 of file Particle.C.

void write ( Ostream os,
bool  writeFields 
) const

Write the particle data.

Definition at line 172 of file ParticleIO.C.

References IOstream::check(), IOstream::format(), and Ostream::write().


Friends And Related Function Documentation

friend class Cloud< ParticleType >
friend

Reimplemented in ExactParticle< ParticleType >, and ExactParticle< trackedParticle >.

Definition at line 270 of file Particle.H.

Ostream& operator ( Ostream ,
const Particle< ParticleType > &   
)
friend

Member Data Documentation

vector position_
protected

Position of particle.

Definition at line 118 of file Particle.H.

Referenced by Particle< ParticleType >::position().

label celli_
protected

Index of the cell it is in.

Definition at line 121 of file Particle.H.

Referenced by Particle< ParticleType >::cell().

label facei_
protected

Face index if the particle is on a face otherwise -1.

Definition at line 124 of file Particle.H.

Referenced by Particle< ParticleType >::face(), Particle< ParticleType >::faceInterpolation(), and Particle< ParticleType >::onBoundary().

scalar stepFraction_
protected

Fraction of time-step completed.

Definition at line 127 of file Particle.H.

Referenced by Particle< ParticleType >::currentTime(), and Particle< ParticleType >::stepFraction().

label origProc_
protected

Originating processor id.

Definition at line 130 of file Particle.H.

Referenced by Particle< ParticleType >::origProc().

label origId_
protected

Local particle id on originating processor.

Definition at line 133 of file Particle.H.

Referenced by Particle< ParticleType >::origId().


The documentation for this class was generated from the following files: