Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
ParticleCollector< CloudType > Class Template Reference

Function object to collect the parcel mass- and mass flow rate over a set of polygons. The polygons can either be specified by sets of user- supplied points, or in a concentric circles arrangement. If a parcel is 'collected', it can be flagged to be removed from the domain using the removeCollected entry. More...

Inheritance diagram for ParticleCollector< CloudType >:
Inheritance graph
[legend]
Collaboration diagram for ParticleCollector< CloudType >:
Collaboration graph
[legend]

Public Types

enum  modeType { mtPolygon, mtConcentricCircle, mtUnknown }
 
- Public Types inherited from CloudSubModelBase< CloudType >
typedef CloudType cloudType
 Type of cloud this model was instantiated for. More...
 

Public Member Functions

 TypeName ("particleCollector")
 Runtime type information. More...
 
 ParticleCollector (const dictionary &dict, CloudType &owner, const word &modelName)
 Construct from dictionary. More...
 
 ParticleCollector (const ParticleCollector< CloudType > &pc)
 Construct copy. More...
 
virtual autoPtr< CloudFunctionObject< CloudType > > clone () const
 Construct and return a clone. More...
 
virtual ~ParticleCollector ()
 Destructor. More...
 
const SwitchresetOnWrite () const
 Return const access to the reset on write flag. More...
 
virtual void postMove (parcelType &p, const label cellI, const scalar dt, const point &position0, bool &keepParticle)
 Post-move hook. More...
 
- Public Member Functions inherited from CloudFunctionObject< CloudType >
 TypeName ("cloudFunctionObject")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, CloudFunctionObject, dictionary,(const dictionary &dict, CloudType &owner, const word &modelName),(dict, owner, modelName))
 Declare runtime constructor selection table. More...
 
 CloudFunctionObject (CloudType &owner)
 Construct null from owner. More...
 
 CloudFunctionObject (const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
 Construct from dictionary. More...
 
 CloudFunctionObject (const CloudFunctionObject< CloudType > &ppm)
 Construct copy. More...
 
virtual ~CloudFunctionObject ()
 Destructor. More...
 
virtual void preEvolve ()
 Pre-evolve hook. More...
 
virtual void postEvolve ()
 Post-evolve hook. More...
 
virtual void postPatch (const typename CloudType::parcelType &p, const polyPatch &pp, const scalar trackFraction, const tetIndices &testIs, bool &keepParticle)
 Post-patch hook. More...
 
virtual void postFace (const typename CloudType::parcelType &p, const label faceI, bool &keepParticle)
 Post-face hook. More...
 
const fileNameoutputDir () const
 Return the output path. More...
 
fileName outputTimeDir () const
 Return the output time path. More...
 
- Public Member Functions inherited from CloudSubModelBase< CloudType >
 CloudSubModelBase (CloudType &owner)
 Construct null from owner cloud. More...
 
 CloudSubModelBase (CloudType &owner, const dictionary &dict, const word &baseName, const word &modelType, const word &dictExt="Coeffs")
 Construct from owner cloud without name. More...
 
 CloudSubModelBase (const word &modelName, CloudType &owner, const dictionary &dict, const word &baseName, const word &modelType)
 Construct from owner cloud with name. More...
 
 CloudSubModelBase (const CloudSubModelBase< CloudType > &smb)
 Construct as copy. More...
 
virtual ~CloudSubModelBase ()
 Destructor. More...
 
const CloudTypeowner () const
 Return const access to the owner cloud. More...
 
virtual bool outputTime () const
 Flag to indicate when to write a property. More...
 
CloudTypeowner ()
 Return non-const access to the owner cloud for manipulation. More...
 
virtual void write (Ostream &os) const
 Write. More...
 
- Public Member Functions inherited from subModelBase
 subModelBase (dictionary &properties)
 Construct null. More...
 
 subModelBase (dictionary &properties, const dictionary &dict, const word &baseName, const word &modelType, const word &dictExt="Coeffs")
 Construct from components without name. More...
 
 subModelBase (const word &modelName, dictionary &properties, const dictionary &dict, const word &baseName, const word &modelType)
 Construct from components with name. More...
 
 subModelBase (const subModelBase &smb)
 Construct as copy. More...
 
virtual ~subModelBase ()
 Destructor. More...
 
const wordmodelName () const
 Return const access to the name of the sub-model. More...
 
const dictionarydict () const
 Return const access to the cloud dictionary. More...
 
const wordbaseName () const
 Return const access to the base name of the sub-model. More...
 
const wordmodelType () const
 Return const access to the sub-model type. More...
 
const dictionarycoeffDict () const
 Return const access to the coefficients dictionary. More...
 
const dictionaryproperties () const
 Return const access to the properties dictionary. More...
 
virtual bool defaultCoeffs (const bool printMsg) const
 Returns true if defaultCoeffs is true and outputs on printMsg. More...
 
virtual bool active () const
 Return the model 'active' status - default active = true. More...
 
virtual void cacheFields (const bool store)
 Cache dependant sub-model fields. More...
 
template<class Type >
Type getBaseProperty (const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const
 Retrieve generic property from the base model. More...
 
template<class Type >
void getBaseProperty (const word &entryName, Type &value) const
 Retrieve generic property from the base model. More...
 
template<class Type >
void setBaseProperty (const word &entryName, const Type &value)
 Add generic property to the base model. More...
 
template<class Type >
void getModelProperty (const word &entryName, Type &value) const
 Retrieve generic property from the sub-model. More...
 
template<class Type >
Type getModelProperty (const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const
 Retrieve generic property from the sub-model. More...
 
template<class Type >
void setModelProperty (const word &entryName, const Type &value)
 Add generic property to the sub-model. More...
 

Protected Member Functions

void write ()
 Write post-processing info. More...
 
- Protected Member Functions inherited from subModelBase
bool inLine () const
 Flag to indicate whether data is/was read in-line. More...
 

Private Types

typedef CloudType::parcelType parcelType
 Convenience typedef for parcel type. More...
 

Private Member Functions

void makeLogFile (const faceList &faces, const Field< point > &points, const Field< scalar > &area)
 Helper function to create log files. More...
 
void initPolygons (const List< Field< point > > &polygons)
 Initialise polygon collectors. More...
 
void initConcentricCircles ()
 Initialise concentric circle collectors. More...
 
void collectParcelPolygon (const point &p1, const point &p2) const
 Collect parcels in polygon collectors. More...
 
void collectParcelConcentricCircles (const point &p1, const point &p2) const
 Collect parcels in concentric circle collectors. More...
 

Private Attributes

modeType mode_
 Collector mode type. More...
 
const label parcelType_
 Index of parcel types to collect (-1 by default = all particles) More...
 
Switch removeCollected_
 Flag to remove collected particles. More...
 
Field< pointpoints_
 List of points. More...
 
List< facefaces_
 List of faces. More...
 
List< List< face > > faceTris_
 Triangulation of faces. More...
 
label nSector_
 Number of sectors per circle. More...
 
List< scalar > radius_
 List of radii. More...
 
cylindricalCS coordSys_
 Cylindrical co-ordinate system. More...
 
Field< scalar > area_
 Face areas. More...
 
Field< vectornormal_
 Polygon normal vector per face. More...
 
bool negateParcelsOppositeNormal_
 Remove mass of parcel travelling in opposite direction to normal_. More...
 
const word surfaceFormat_
 Surface output format. More...
 
Switch resetOnWrite_
 Flag to indicate whether data should be reset/cleared on writing. More...
 
scalar totalTime_
 Total time. More...
 
List< scalar > mass_
 Mass storage. More...
 
List< scalar > massTotal_
 Mass total storage. More...
 
List< scalar > massFlowRate_
 Mass flow rate storage. More...
 
Switch log_
 Flag to indicate whether data should be written to file. More...
 
autoPtr< OFstreamoutputFilePtr_
 Output file pointer. More...
 
scalar timeOld_
 Last calculation time. More...
 
DynamicList< labelhitFaceIDs_
 Work list to store which faces are hit. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CloudFunctionObject< CloudType >
static autoPtr< CloudFunctionObject< CloudType > > New (const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
 Selector. More...
 
- Protected Attributes inherited from CloudSubModelBase< CloudType >
CloudTypeowner_
 Reference to the cloud. More...
 
- Protected Attributes inherited from subModelBase
const word modelName_
 Name of the sub-model. More...
 
dictionaryproperties_
 Reference to properties dictionary e.g. for restart. More...
 
const dictionary dict_
 Copy of dictionary used during construction. More...
 
const word baseName_
 Name of the sub-model base class. More...
 
const word modelType_
 Type of the sub-model. More...
 
const dictionary coeffDict_
 Coefficients dictionary. More...
 

Detailed Description

template<class CloudType>
class Foam::ParticleCollector< CloudType >

Function object to collect the parcel mass- and mass flow rate over a set of polygons. The polygons can either be specified by sets of user- supplied points, or in a concentric circles arrangement. If a parcel is 'collected', it can be flagged to be removed from the domain using the removeCollected entry.

Example usage:

particleCollector1
{
    type            particleCollector;

    mode            concentricCircle;
    origin          (0.05 0.025 0.005);
    radius          (0.01 0.025 0.05);
    nSector         10;
    refDir          (1 0 0);
    normal          (0 0 1);

    negateParcelsOppositeNormal no;
    removeCollected no;
    surfaceFormat   vtk;
    resetOnWrite    no;
    log             yes;
}

particleCollector2
{
    type            particleCollector;

    mode            polygon;
    polygons
    (
        (
            (0 0 0)
            (1 0 0)
            (1 1 0)
            (0 1 0)
        )
        (
            (0 0 1)
            (1 0 1)
            (1 1 1)
            (0 1 1)
        )
    );
    normal          (0 0 1);

    negateParcelsOppositeNormal no;
    removeCollected no;
    surfaceFormat   vtk;
    resetOnWrite    no;
    log             yes;
}
Source files

Definition at line 107 of file ParticleCollector.H.

Member Typedef Documentation

◆ parcelType

Convenience typedef for parcel type.

Definition at line 128 of file ParticleCollector.H.

Member Enumeration Documentation

◆ modeType

enum modeType
Enumerator
mtPolygon 
mtConcentricCircle 
mtUnknown 

Definition at line 113 of file ParticleCollector.H.

Constructor & Destructor Documentation

◆ ParticleCollector() [1/2]

ParticleCollector ( const dictionary dict,
CloudType owner,
const word modelName 
)

Construct from dictionary.

Definition at line 519 of file ParticleCollector.C.

References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, forAll, lookup(), Foam::mag(), Foam::mode(), List::size(), and vectorField().

Here is the call graph for this function:

◆ ParticleCollector() [2/2]

Construct copy.

Definition at line 607 of file ParticleCollector.C.

◆ ~ParticleCollector()

Destructor.

Definition at line 639 of file ParticleCollector.C.

Member Function Documentation

◆ makeLogFile()

void makeLogFile ( const faceList faces,
const Field< point > &  points,
const Field< scalar > &  area 
)
private

Helper function to create log files.

Definition at line 38 of file ParticleCollector.C.

References Foam::endl(), forAll, Foam::Info, Foam::mkDir(), Foam::name(), Foam::nl, points, List::size(), Foam::sum(), Foam::tab, and Foam::type().

Here is the call graph for this function:

◆ initPolygons()

void initPolygons ( const List< Field< point > > &  polygons)
private

Initialise polygon collectors.

Definition at line 110 of file ParticleCollector.C.

References Foam::exit(), f(), Foam::FatalIOError, FatalIOErrorInFunction, forAll, Foam::identity(), and nPoints.

Here is the call graph for this function:

◆ initConcentricCircles()

void initConcentricCircles
private

Initialise concentric circle collectors.

Definition at line 154 of file ParticleCollector.C.

References DynamicList::append(), DynamicList::clear(), Foam::degToRad(), forAll, Foam::identity(), lookup(), Foam::mag(), Foam::max(), Foam::readLabel(), and Random::vector01().

Here is the call graph for this function:

◆ collectParcelPolygon()

void collectParcelPolygon ( const point p1,
const point p2 
) const
private

Collect parcels in polygon collectors.

Definition at line 288 of file ParticleCollector.C.

References triangle::classify(), forAll, and Foam::sign().

Here is the call graph for this function:

◆ collectParcelConcentricCircles()

void collectParcelConcentricCircles ( const point p1,
const point p2 
) const
private

Collect parcels in concentric circle collectors.

Definition at line 338 of file ParticleCollector.C.

References Foam::constant::mathematical::pi(), Foam::sign(), and Foam::constant::mathematical::twoPi().

Here is the call graph for this function:

◆ write()

void write
protectedvirtual

Write post-processing info.

Reimplemented from CloudFunctionObject< CloudType >.

Definition at line 389 of file ParticleCollector.C.

References Foam::constant::atomic::alpha, beta(), Foam::endl(), forAll, Foam::Info, mesh, Foam::compressible::New(), Foam::nl, Foam::sum(), Foam::tab, Time::timeName(), Foam::type(), dimensioned::value(), and writer< Type >::write().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "particleCollector"  )

Runtime type information.

◆ clone()

virtual autoPtr<CloudFunctionObject<CloudType> > clone ( ) const
inlinevirtual

Construct and return a clone.

Reimplemented from CloudFunctionObject< CloudType >.

Definition at line 262 of file ParticleCollector.H.

◆ resetOnWrite()

const Foam::Switch & resetOnWrite
inline

Return const access to the reset on write flag.

Definition at line 28 of file ParticleCollectorI.H.

◆ postMove()

void postMove ( parcelType p,
const label  cellI,
const scalar  dt,
const point position0,
bool &  keepParticle 
)
virtual

Post-move hook.

Reimplemented from CloudFunctionObject< CloudType >.

Definition at line 647 of file ParticleCollector.C.

References forAll, Foam::mag(), and p.

Here is the call graph for this function:

Field Documentation

◆ mode_

modeType mode_
private

Collector mode type.

Definition at line 131 of file ParticleCollector.H.

◆ parcelType_

const label parcelType_
private

Index of parcel types to collect (-1 by default = all particles)

Definition at line 134 of file ParticleCollector.H.

◆ removeCollected_

Switch removeCollected_
private

Flag to remove collected particles.

Definition at line 137 of file ParticleCollector.H.

◆ points_

Field<point> points_
private

List of points.

Definition at line 140 of file ParticleCollector.H.

◆ faces_

List<face> faces_
private

List of faces.

Definition at line 143 of file ParticleCollector.H.

◆ faceTris_

List<List<face> > faceTris_
private

Triangulation of faces.

Definition at line 149 of file ParticleCollector.H.

◆ nSector_

label nSector_
private

Number of sectors per circle.

Definition at line 154 of file ParticleCollector.H.

◆ radius_

List<scalar> radius_
private

List of radii.

Definition at line 157 of file ParticleCollector.H.

◆ coordSys_

cylindricalCS coordSys_
private

Cylindrical co-ordinate system.

Definition at line 160 of file ParticleCollector.H.

◆ area_

Field<scalar> area_
private

Face areas.

Definition at line 164 of file ParticleCollector.H.

◆ normal_

Field<vector> normal_
private

Polygon normal vector per face.

Definition at line 167 of file ParticleCollector.H.

◆ negateParcelsOppositeNormal_

bool negateParcelsOppositeNormal_
private

Remove mass of parcel travelling in opposite direction to normal_.

Definition at line 170 of file ParticleCollector.H.

◆ surfaceFormat_

const word surfaceFormat_
private

Surface output format.

Definition at line 173 of file ParticleCollector.H.

◆ resetOnWrite_

Switch resetOnWrite_
private

Flag to indicate whether data should be reset/cleared on writing.

Definition at line 176 of file ParticleCollector.H.

◆ totalTime_

scalar totalTime_
private

Total time.

Definition at line 179 of file ParticleCollector.H.

◆ mass_

List<scalar> mass_
private

Mass storage.

Definition at line 182 of file ParticleCollector.H.

◆ massTotal_

List<scalar> massTotal_
private

Mass total storage.

Definition at line 185 of file ParticleCollector.H.

◆ massFlowRate_

List<scalar> massFlowRate_
private

Mass flow rate storage.

Definition at line 188 of file ParticleCollector.H.

◆ log_

Switch log_
private

Flag to indicate whether data should be written to file.

Definition at line 191 of file ParticleCollector.H.

◆ outputFilePtr_

autoPtr<OFstream> outputFilePtr_
private

Output file pointer.

Definition at line 194 of file ParticleCollector.H.

◆ timeOld_

scalar timeOld_
private

Last calculation time.

Definition at line 197 of file ParticleCollector.H.

◆ hitFaceIDs_

DynamicList<label> hitFaceIDs_
mutableprivate

Work list to store which faces are hit.

Definition at line 200 of file ParticleCollector.H.


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