ENH: Abstracted out collisions for parcels and clouds and restructured

This commit is contained in:
andy
2011-02-25 11:23:22 +00:00
parent 4650948a68
commit 34888963d3
30 changed files with 1556 additions and 379 deletions

View File

@ -19,6 +19,10 @@ KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
KINEMATICCOLLIDINGPARCEL=$(DERIVEDPARCELS)/basicKinematicCollidingParcel
$(KINEMATICCOLLIDINGPARCEL)/defineBasicKinematicCollidingParcel.C
$(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C
/* thermo parcel sub-models */
THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel

View File

@ -0,0 +1,209 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollidingCloud.H"
#include "CollisionModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::CollidingCloud<CloudType>::setModels()
{
collisionModel_.reset
(
CollisionModel<CollidingCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
}
template<class CloudType>
template<class TrackData>
void Foam::CollidingCloud<CloudType>::moveCollide(TrackData& td)
{
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, this->solution().deltaT());
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, this->solution().deltaT());
// td.part() = TrackData::tpRotationalTrack;
// CloudType::move(td);
this->updateCellOccupancy();
this->collision().collide();
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, this->solution().deltaT());
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::cloudReset(CollidingCloud<CloudType>& c)
{
CloudType::cloudReset(c);
collisionModel_.reset(c.collisionModel_.ptr());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CollidingCloud<CloudType>::CollidingCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields
)
:
CloudType(cloudName, rho, U, mu, g, false),
collisionModel_(NULL)
{
if (this->solution().active())
{
setModels();
}
if (readFields)
{
parcelType::readFields(*this);
}
}
template<class CloudType>
Foam::CollidingCloud<CloudType>::CollidingCloud
(
CollidingCloud<CloudType>& c,
const word& name
)
:
CloudType(c, name),
collisionModel_(c.collisionModel_->clone())
{}
template<class CloudType>
Foam::CollidingCloud<CloudType>::CollidingCloud
(
const fvMesh& mesh,
const word& name,
const CollidingCloud<CloudType>& c
)
:
CloudType(mesh, name, c),
collisionModel_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CollidingCloud<CloudType>::~CollidingCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::CollidingCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<CollidingCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
);
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<CollidingCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class CloudType>
template<class TrackData>
void Foam::CollidingCloud<CloudType>::motion(TrackData& td)
{
// Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force
// + move positions with new velocity
// + calculate forces in new position
// + apply half deltaV with new force
label nSubCycles = collision().nSubCycles();
if (nSubCycles > 1)
{
Info<< " " << nSubCycles << " move-collide subCycles" << endl;
subCycleTime moveCollideSubCycle
(
const_cast<Time&>(this->db().time()),
nSubCycles
);
while(!(++moveCollideSubCycle).end())
{
moveCollide(td);
}
moveCollideSubCycle.endSubCycle();
}
else
{
moveCollide(td);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,232 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CollidingCloud
Description
Adds coolisions to kinematic clouds
SourceFiles
CollidingCloudI.H
CollidingCloud.C
\*---------------------------------------------------------------------------*/
#ifndef CollidingCloud_H
#define CollidingCloud_H
#include "particle.H"
#include "Cloud.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class CollisionModel;
/*---------------------------------------------------------------------------*\
Class CollidingCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class CollidingCloud
:
public CloudType
{
public:
// Public typedefs
//- Redefine particle type as parcel type
typedef typename CloudType::particleType parcelType;
private:
// Private data
//- Cloud copy pointer
autoPtr<CollidingCloud<CloudType> > cloudCopyPtr_;
// Private Member Functions
//- Disallow default bitwise copy construct
CollidingCloud(const CollidingCloud&);
//- Disallow default bitwise assignment
void operator=(const CollidingCloud&);
protected:
// Protected data
// References to the cloud sub-models
//- Collision model
autoPtr<CollisionModel<CollidingCloud<CloudType> > >
collisionModel_;
// Initialisation
//- Set cloud sub-models
void setModels();
// Cloud evolution functions
//- Move-collide particles
template<class TrackData>
void moveCollide(TrackData& td);
//- Reset state of cloud
void cloudReset(CollidingCloud<CloudType>& c);
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields
CollidingCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields = true
);
//- Copy constructor with new name
CollidingCloud
(
CollidingCloud<CloudType>& c,
const word& name
);
//- Copy constructor with new name - creates bare cloud
CollidingCloud
(
const fvMesh& mesh,
const word& name,
const CollidingCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new CollidingCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new CollidingCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~CollidingCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const CollidingCloud& cloudCopy() const;
//- If the collision model controls the wall interaction,
// then the wall impact distance should be zero.
// Otherwise, it should be allowed to be the value from
// the Parcel.
inline bool hasWallImpactDistance() const;
// Sub-models
//- Return const access to the collision model
inline const CollisionModel<CollidingCloud<CloudType> >&
collision() const;
//- Return reference to the collision model
inline CollisionModel<CollidingCloud<CloudType> >&
collision();
// Evolution
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Evolve the cloud
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollidingCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CollidingCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::CollidingCloud<CloudType>&
Foam::CollidingCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline bool Foam::CollidingCloud<CloudType>::hasWallImpactDistance() const
{
return !collision().controlsWallInteraction();
}
template<class CloudType>
inline const Foam::CollisionModel<Foam::CollidingCloud<CloudType> >&
Foam::CollidingCloud<CloudType>::collision() const
{
return collisionModel_();
}
template<class CloudType>
inline Foam::CollisionModel<Foam::CollidingCloud<CloudType> >&
Foam::CollidingCloud<CloudType>::collision()
{
return collisionModel_();
}
// ************************************************************************* //

View File

@ -28,7 +28,6 @@ License
#include "interpolation.H"
#include "subCycleTime.H"
#include "CollisionModel.H"
#include "DispersionModel.H"
#include "InjectionModel.H"
#include "PatchInteractionModel.H"
@ -190,15 +189,6 @@ bool Foam::KinematicCloud<CloudType>::cloudSolution::output() const
template<class CloudType>
void Foam::KinematicCloud<CloudType>::setModels()
{
collisionModel_.reset
(
CollisionModel<KinematicCloud<CloudType> >::New
(
subModelProperties_,
*this
).ptr()
);
dispersionModel_.reset
(
DispersionModel<KinematicCloud<CloudType> >::New
@ -372,7 +362,7 @@ void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td)
// Assume that motion will update the cellOccupancy as necessary
// before it is required.
motion(td);
td.cloud().motion(td);
}
else
{
@ -386,64 +376,6 @@ void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td)
}
template<class CloudType>
template<class TrackData>
void Foam::KinematicCloud<CloudType>::motion(TrackData& td)
{
// Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force
// + move positions with new velocity
// + calculate forces in new position
// + apply half deltaV with new force
label nSubCycles = collision().nSubCycles();
if (nSubCycles > 1)
{
Info<< " " << nSubCycles << " move-collide subCycles" << endl;
subCycleTime moveCollideSubCycle
(
const_cast<Time&>(this->db().time()),
nSubCycles
);
while(!(++moveCollideSubCycle).end())
{
moveCollide(td);
}
moveCollideSubCycle.endSubCycle();
}
else
{
moveCollide(td);
}
}
template<class CloudType>
template<class TrackData>
void Foam::KinematicCloud<CloudType>::moveCollide(TrackData& td)
{
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, solution_.deltaT());
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, solution_.deltaT());
// td.part() = TrackData::tpRotationalTrack;
// CloudType::move(td);
updateCellOccupancy();
this->collision().collide();
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, solution_.deltaT());
}
template<class CloudType>
void Foam::KinematicCloud<CloudType>::postEvolve()
{
@ -472,7 +404,6 @@ void Foam::KinematicCloud<CloudType>::cloudReset(KinematicCloud<CloudType>& c)
forces_.transfer(c.forces_);
collisionModel_.reset(c.collisionModel_.ptr());
dispersionModel_.reset(c.dispersionModel_.ptr());
injectionModel_.reset(c.injectionModel_.ptr());
patchInteractionModel_.reset(c.patchInteractionModel_.ptr());
@ -537,7 +468,6 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
),
solution_.active()
),
collisionModel_(NULL),
dispersionModel_(NULL),
injectionModel_(NULL),
patchInteractionModel_(NULL),
@ -616,7 +546,6 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
mu_(c.mu_),
g_(c.g_),
forces_(c.forces_),
collisionModel_(c.collisionModel_->clone()),
dispersionModel_(c.dispersionModel_->clone()),
injectionModel_(c.injectionModel_->clone()),
patchInteractionModel_(c.patchInteractionModel_->clone()),
@ -692,7 +621,6 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
mu_(c.mu_),
g_(c.g_),
forces_(*this, mesh),
collisionModel_(NULL),
dispersionModel_(NULL),
injectionModel_(NULL),
patchInteractionModel_(NULL),
@ -799,6 +727,17 @@ void Foam::KinematicCloud<CloudType>::evolve()
}
template<class CloudType>
template<class TrackData>
void Foam::KinematicCloud<CloudType>::motion(TrackData& td)
{
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, solution_.deltaT());
updateCellOccupancy();
}
template<class CloudType>
void Foam::KinematicCloud<CloudType>::info() const
{

View File

@ -35,7 +35,6 @@ Description
- pressure gradient
- sub-models:
- Collision model
- Dispersion model
- Injection model
- Patch interaction model
@ -73,9 +72,6 @@ namespace Foam
// Forward declaration of classes
template<class CloudType>
class CollisionModel;
template<class CloudType>
class DispersionModel;
@ -338,10 +334,6 @@ protected:
// References to the cloud sub-models
//- Collision model
autoPtr<CollisionModel<KinematicCloud<CloudType> > >
collisionModel_;
//- Dispersion model
autoPtr<DispersionModel<KinematicCloud<CloudType> > >
dispersionModel_;
@ -404,14 +396,6 @@ protected:
template<class TrackData>
void evolveCloud(TrackData& td);
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
//- Move-collide particles
template<class TrackData>
void moveCollide(TrackData& td);
//- Post-evolve
void postEvolve();
@ -481,12 +465,6 @@ public:
//- Return a reference to the cloud copy
inline const KinematicCloud& cloudCopy() const;
//- If the collision model controls the wall interaction,
// then the wall impact distance should be zero.
// Otherwise, it should be allowed to be the value from
// the Parcel.
inline bool hasWallImpactDistance() const;
// References to the mesh and databases
@ -547,14 +525,6 @@ public:
// Sub-models
//- Return const access to the collision model
inline const CollisionModel<KinematicCloud<CloudType> >&
collision() const;
//- Return reference to the collision model
inline CollisionModel<KinematicCloud<CloudType> >&
collision();
//- Return const-access to the dispersion model
inline const DispersionModel<KinematicCloud<CloudType> >&
dispersion() const;
@ -687,6 +657,10 @@ public:
//- Evolve the cloud
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
//- Print cloud information
void info() const;
};

View File

@ -172,13 +172,6 @@ Foam::KinematicCloud<CloudType>::cloudCopy() const
}
template<class CloudType>
inline bool Foam::KinematicCloud<CloudType>::hasWallImpactDistance() const
{
return !collision().controlsWallInteraction();
}
template<class CloudType>
inline const Foam::fvMesh& Foam::KinematicCloud<CloudType>::mesh() const
{
@ -263,22 +256,6 @@ Foam::KinematicCloud<CloudType>::forces() const
}
template<class CloudType>
inline const Foam::CollisionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::collision() const
{
return collisionModel_();
}
template<class CloudType>
inline Foam::CollisionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::collision()
{
return collisionModel_();
}
template<class CloudType>
inline const Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::dispersion() const

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicKinematicCollidingCloud
Description
Cloud class to introduce kinematic colliding parcels
\*---------------------------------------------------------------------------*/
#ifndef basicKinematicCollidingCloud_H
#define basicKinematicCollidingCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "CollidingCloud.H"
#include "basicKinematicCollidingParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef CollidingCloud
<
KinematicCloud
<
Cloud
<
basicKinematicCollidingParcel
>
>
> basicKinematicCollidingCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,171 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollidingParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const CollidingParcel<ParcelType>& p
)
:
ParcelType(p),
collisionRecords_(p.collisionRecords_)
{}
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const CollidingParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
collisionRecords_(p.collisionRecords_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
bool Foam::CollidingParcel<ParcelType>::move
(
TrackData& td,
const scalar trackTime
)
{
typename TrackData::cloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this);
td.switchProcessor = false;
td.keepParticle = true;
const polyMesh& mesh = td.cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const scalarField& V = mesh.cellVolumes();
switch (td.part())
{
case TrackData::tpVelocityHalfStep:
{
// First and last leapfrog velocity adjust part, required
// before and after tracking and force calculation
p.U() += 0.5*trackTime*p.f()/p.mass();
p.angularMomentum() += 0.5*trackTime*p.torque();
break;
}
case TrackData::tpLinearTrack:
{
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
const scalar dtMax = tEnd;
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
{
// Apply correction to position for reduced-D cases
meshTools::constrainToMeshCentre(mesh, p.position());
// Set the Lagrangian time-step
scalar dt = min(dtMax, tEnd);
// Remember which cell the parcel is in since this
// will change if a face is hit
const label cellI = p.cell();
const scalar magU = mag(p.U());
if (p.active() && magU > ROOTVSMALL)
{
const scalar d = dt*magU;
const scalar maxCo = td.cloud().solution().maxCo();
const scalar dCorr = min(d, maxCo*cbrt(V[cellI]));
dt *=
dCorr/d
*p.trackToFace(p.position() + dCorr*p.U()/magU, td);
}
tEnd -= dt;
p.stepFraction() = 1.0 - tEnd/trackTime;
// Avoid problems with extremely small timesteps
if (dt > ROOTVSMALL)
{
// Update cell based properties
p.setCellValues(td, dt, cellI);
if (td.cloud().solution().cellValueSourceCorrection())
{
p.cellValueSourceCorrection(td, dt, cellI);
}
p.calc(td, dt, cellI);
}
if (p.onBoundary() && td.keepParticle)
{
if (isA<processorPolyPatch>(pbMesh[p.patch(p.face())]))
{
td.switchProcessor = true;
}
}
p.age() += dt;
}
break;
}
case TrackData::tpRotationalTrack:
{
notImplemented("TrackData::tpRotationalTrack");
break;
}
default:
{
FatalErrorIn
(
"CollidingParcel<ParcelType>::move(TrackData&, const scalar)"
) << td.part() << " is an invalid part of the tracking method."
<< abort(FatalError);
}
}
return td.keepParticle;
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "CollidingParcelIO.C"
// ************************************************************************* //

View File

@ -0,0 +1,234 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CollidingParcel
Description
Wrapper around kinematic parcel types to add collision modelling
SourceFiles
CollidingParcelI.H
CollidingParcel.C
CollidingParcelIO.C
\*---------------------------------------------------------------------------*/
#ifndef CollidingParcel_H
#define CollidingParcel_H
#include "particle.H"
#include "CollisionRecordList.H"
#include "labelFieldIOField.H"
#include "vectorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef CollisionRecordList<vector, vector> collisionRecordList;
typedef vectorFieldCompactIOField pairDataFieldCompactIOField;
typedef vectorFieldCompactIOField wallDataFieldCompactIOField;
template<class ParcelType>
class CollidingParcel;
// Forward declaration of friend functions
template<class ParcelType>
Ostream& operator<<
(
Ostream&,
const CollidingParcel<ParcelType>&
);
/*---------------------------------------------------------------------------*\
Class CollidingParcel Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
class CollidingParcel
:
public ParcelType
{
protected:
// Protected data
//- Particle collision records
collisionRecordList collisionRecords_;
public:
// Static data members
//- String representation of properties
static string propHeader;
//- Runtime type information
TypeName("CollidingParcel");
// Constructors
//- Construct from owner, position, and cloud owner
// Other properties initialised as null
inline CollidingParcel
(
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
);
//- Construct from components
inline CollidingParcel
(
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI,
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
const vector& torque0,
const typename ParcelType::constantProperties& constProps
);
//- Construct from Istream
CollidingParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy
CollidingParcel(const CollidingParcel& p);
//- Construct as a copy
CollidingParcel(const CollidingParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new CollidingParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
{
return autoPtr<particle>(new CollidingParcel(*this, mesh));
}
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<CollidingParcel<ParcelType> > operator()(Istream& is) const
{
return autoPtr<CollidingParcel<ParcelType> >
(
new CollidingParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions
// Access
//- Return const access to the collision records
inline const collisionRecordList& collisionRecords() const;
//- Return access to collision records
inline collisionRecordList& collisionRecords();
// Tracking
//- Move the parcel
template<class TrackData>
bool move(TrackData& td, const scalar trackTime);
// I-O
//- Read
template<class CloudType>
static void readFields(CloudType& c);
//- Write
template<class CloudType>
static void writeFields(const CloudType& c);
// Ostream Operator
friend Ostream& operator<< <ParcelType>
(
Ostream&,
const CollidingParcel<ParcelType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollidingParcelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CollidingParcel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& owner,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
)
:
ParcelType(owner, position, cellI, tetFaceI, tetPtI),
collisionRecords_()
{}
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& owner,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI,
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
const vector& torque0,
const typename ParcelType::constantProperties& constProps
)
:
ParcelType
(
owner,
position,
cellI,
tetFaceI,
tetPtI,
typeId,
nParticle0,
d0,
dTarget0,
U0,
f0,
angularMomentum0,
torque0,
constProps
),
collisionRecords_()
{}
// * * * * * * * CollidingParcel Member Functions * * * * * * * //
template<class ParcelType>
inline const Foam::collisionRecordList&
Foam::CollidingParcel<ParcelType>::collisionRecords() const
{
return collisionRecords_;
}
template<class ParcelType>
inline Foam::collisionRecordList&
Foam::CollidingParcel<ParcelType>::collisionRecords()
{
return collisionRecords_;
}
// ************************************************************************* //

View File

@ -0,0 +1,261 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollidingParcel.H"
#include "IOstreams.H"
#include "IOField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParcelType>
Foam::string Foam::CollidingParcel<ParcelType>::propHeader =
ParcelType::propHeader
+ " collisionRecordsPairAccessed"
+ " collisionRecordsPairOrigProcOfOther"
+ " collisionRecordsPairOrigIdOfOther"
+ " (collisionRecordsPairData)"
+ " collisionRecordsWallAccessed"
+ " collisionRecordsWallPRel"
+ " (collisionRecordsWallData)";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
collisionRecords_()
{
if (readFields)
{
is >> collisionRecords_;
}
// Check state of Istream
is.check
(
"CollidingParcel<ParcelType>::Collisions"
"(const polyMesh&, Istream&, bool)"
);
}
template<class ParcelType>
template<class CloudType>
void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
{
if (!c.size())
{
return;
}
ParcelType::readFields(c);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed);
labelFieldCompactIOField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
labelFieldCompactIOField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigIdOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
pairDataFieldCompactIOField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairData);
labelFieldCompactIOField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed);
vectorFieldCompactIOField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallPRel);
wallDataFieldCompactIOField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallData);
label i = 0;
forAllIter(typename CloudType, c, iter)
{
CollidingParcel<ParcelType>& p = iter();
p.collisionRecords_ = collisionRecordList
(
collisionRecordsPairAccessed[i],
collisionRecordsPairOrigProcOfOther[i],
collisionRecordsPairOrigIdOfOther[i],
collisionRecordsPairData[i],
collisionRecordsWallAccessed[i],
collisionRecordsWallPRel[i],
collisionRecordsWallData[i]
);
i++;
}
}
template<class ParcelType>
template<class CloudType>
void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
{
ParcelType::writeFields(c);
label np = c.size();
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::NO_READ),
np
);
labelFieldCompactIOField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::NO_READ
),
np
);
labelFieldCompactIOField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject("collisionRecordsPairOrigIdOfOther", IOobject::NO_READ),
np
);
pairDataFieldCompactIOField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::NO_READ),
np
);
labelFieldCompactIOField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::NO_READ),
np
);
vectorFieldCompactIOField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::NO_READ),
np
);
wallDataFieldCompactIOField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::NO_READ),
np
);
label i = 0;
forAllConstIter(typename CloudType, c, iter)
{
const CollidingParcel<ParcelType>& p = iter();
collisionRecordsPairAccessed[i] = p.collisionRecords().pairAccessed();
collisionRecordsPairOrigProcOfOther[i] =
p.collisionRecords().pairOrigProcOfOther();
collisionRecordsPairOrigIdOfOther[i] =
p.collisionRecords().pairOrigIdOfOther();
collisionRecordsPairData[i] = p.collisionRecords().pairData();
collisionRecordsWallAccessed[i] = p.collisionRecords().wallAccessed();
collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel();
collisionRecordsWallData[i] = p.collisionRecords().wallData();
i++;
}
collisionRecordsPairAccessed.write();
collisionRecordsPairOrigProcOfOther.write();
collisionRecordsPairOrigIdOfOther.write();
collisionRecordsPairData.write();
collisionRecordsWallAccessed.write();
collisionRecordsWallPRel.write();
collisionRecordsWallData.write();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ParcelType>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const CollidingParcel<ParcelType>& p
)
{
if (os.format() == IOstream::ASCII)
{
os << static_cast<const ParcelType&>(p)
<< token::SPACE << p.collisionRecords();
}
else
{
os << static_cast<const ParcelType&>(p)
<< p.collisionRecords();
}
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const CollidingParcel<ParcelType>&)"
);
return os;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -24,6 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "KinematicParcel.H"
#include "forceSuSp.H"
#include "IntegrationScheme.H"
#include "meshTools.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
@ -239,7 +242,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
age_(p.age_),
tTurb_(p.tTurb_),
UTurb_(p.UTurb_),
collisionRecords_(p.collisionRecords_),
rhoc_(p.rhoc_),
Uc_(p.Uc_),
muc_(p.muc_)
@ -267,7 +269,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
age_(p.age_),
tTurb_(p.tTurb_),
UTurb_(p.UTurb_),
collisionRecords_(p.collisionRecords_),
rhoc_(p.rhoc_),
Uc_(p.Uc_),
muc_(p.muc_)
@ -294,92 +295,58 @@ bool Foam::KinematicParcel<ParcelType>::move
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const scalarField& V = mesh.cellVolumes();
switch (td.part())
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
const scalar dtMax = tEnd;
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
{
case TrackData::tpVelocityHalfStep:
// Apply correction to position for reduced-D cases
meshTools::constrainToMeshCentre(mesh, p.position());
// Set the Lagrangian time-step
scalar dt = min(dtMax, tEnd);
// Remember which cell the parcel is in since this will change if
// a face is hit
const label cellI = p.cell();
const scalar magU = mag(U_);
if (p.active() && magU > ROOTVSMALL)
{
// First and last leapfrog velocity adjust part, required
// before and after tracking and force calculation
p.U() += 0.5*trackTime*p.f()/p.mass();
angularMomentum_ += 0.5*trackTime*torque_;
break;
const scalar d = dt*magU;
const scalar maxCo = td.cloud().solution().maxCo();
const scalar dCorr = min(d, maxCo*cbrt(V[cellI]));
dt *=
dCorr/d
*p.trackToFace(p.position() + dCorr*U_/magU, td);
}
case TrackData::tpLinearTrack:
tEnd -= dt;
p.stepFraction() = 1.0 - tEnd/trackTime;
// Avoid problems with extremely small timesteps
if (dt > ROOTVSMALL)
{
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
const scalar dtMax = tEnd;
// Update cell based properties
p.setCellValues(td, dt, cellI);
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
if (td.cloud().solution().cellValueSourceCorrection())
{
// Apply correction to position for reduced-D cases
meshTools::constrainToMeshCentre(mesh, p.position());
// Set the Lagrangian time-step
scalar dt = min(dtMax, tEnd);
// Remember which cell the parcel is in since this
// will change if a face is hit
const label cellI = p.cell();
const scalar magU = mag(U_);
if (p.active() && magU > ROOTVSMALL)
{
const scalar d = dt*magU;
const scalar maxCo = td.cloud().solution().maxCo();
const scalar dCorr = min(d, maxCo*cbrt(V[cellI]));
dt *=
dCorr/d
*p.trackToFace(p.position() + dCorr*U_/magU, td);
}
tEnd -= dt;
p.stepFraction() = 1.0 - tEnd/trackTime;
// Avoid problems with extremely small timesteps
if (dt > ROOTVSMALL)
{
// Update cell based properties
p.setCellValues(td, dt, cellI);
if (td.cloud().solution().cellValueSourceCorrection())
{
p.cellValueSourceCorrection(td, dt, cellI);
}
p.calc(td, dt, cellI);
}
if (p.onBoundary() && td.keepParticle)
{
if (isA<processorPolyPatch>(pbMesh[p.patch(p.face())]))
{
td.switchProcessor = true;
}
}
p.age() += dt;
p.cellValueSourceCorrection(td, dt, cellI);
}
break;
p.calc(td, dt, cellI);
}
case TrackData::tpRotationalTrack:
if (p.onBoundary() && td.keepParticle)
{
notImplemented("TrackData::tpRotationalTrack");
break;
if (isA<processorPolyPatch>(pbMesh[p.patch(p.face())]))
{
td.switchProcessor = true;
}
}
default:
{
FatalErrorIn("KinematicParcel<ParcelType>::move(TrackData& td)")
<< td.part() << " is an invalid part of the tracking method."
<< abort(FatalError);
}
p.age() += dt;
}
return td.keepParticle;

View File

@ -33,7 +33,6 @@ Description
- drag
- turbulent dispersion
- wall interactions
- many-body collisions, including memory of data from previous collision
SourceFiles
KinematicParcelI.H
@ -50,11 +49,6 @@ SourceFiles
#include "autoPtr.H"
#include "interpolation.H"
#include "KinematicCloud.H"
#include "CollisionRecordList.H"
#include "labelFieldIOField.H"
#include "vectorFieldIOField.H"
// #include "ParticleForceList.H" // TODO
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,10 +56,6 @@ SourceFiles
namespace Foam
{
typedef CollisionRecordList<vector, vector> collisionRecordList;
typedef vectorFieldCompactIOField pairDataFieldCompactIOField;
typedef vectorFieldCompactIOField wallDataFieldCompactIOField;
template<class ParcelType>
class KinematicParcel;
@ -283,9 +273,6 @@ protected:
//- Turbulent velocity fluctuation [m/s]
vector UTurb_;
//- Particle collision records
collisionRecordList collisionRecords_;
// Cell-based quantities
@ -464,9 +451,6 @@ public:
//- Return const access to carrier viscosity [Pa.s]
inline scalar muc() const;
//- Return const access to the collision records
inline const collisionRecordList& collisionRecords() const;
// Edit
@ -509,9 +493,6 @@ public:
//- Return access to turbulent velocity fluctuation
inline vector& UTurb();
//- Return access to collision records
inline collisionRecordList& collisionRecords();
// Helper functions

View File

@ -110,7 +110,6 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
age_(0.0),
tTurb_(0.0),
UTurb_(vector::zero),
collisionRecords_(),
rhoc_(0.0),
Uc_(vector::zero),
muc_(0.0)
@ -150,7 +149,6 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
age_(0.0),
tTurb_(0.0),
UTurb_(vector::zero),
collisionRecords_(),
rhoc_(0.0),
Uc_(vector::zero),
muc_(0.0)
@ -339,14 +337,6 @@ inline bool& Foam::KinematicParcel<ParcelType>::active()
}
template<class ParcelType>
inline const Foam::collisionRecordList&
Foam::KinematicParcel<ParcelType>::collisionRecords() const
{
return collisionRecords_;
}
template<class ParcelType>
inline Foam::label& Foam::KinematicParcel<ParcelType>::typeId()
{
@ -431,14 +421,6 @@ inline Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb()
}
template<class ParcelType>
inline Foam::collisionRecordList&
Foam::KinematicParcel<ParcelType>::collisionRecords()
{
return collisionRecords_;
}
template<class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::wallImpactDistance
(

View File

@ -45,15 +45,7 @@ Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
+ " rho"
+ " age"
+ " tTurb"
+ " (UTurbx UTurby UTurbz)"
+ " collisionRecordsPairAccessed"
+ " collisionRecordsPairOrigProcOfOther"
+ " collisionRecordsPairOrigIdOfOther"
+ " (collisionRecordsPairData)"
+ " collisionRecordsWallAccessed"
+ " collisionRecordsWallPRel"
+ " (collisionRecordsWallData)";
+ " (UTurbx UTurby UTurbz)";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -79,7 +71,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
age_(0.0),
tTurb_(0.0),
UTurb_(vector::zero),
collisionRecords_(),
rhoc_(0.0),
Uc_(vector::zero),
muc_(0.0)
@ -101,7 +92,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
age_ = readScalar(is);
tTurb_ = readScalar(is);
is >> UTurb_;
is >> collisionRecords_;
}
else
{
@ -122,7 +112,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
+ sizeof(tTurb_)
+ sizeof(UTurb_)
);
is >> collisionRecords_;
}
}
@ -189,56 +178,6 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::MUST_READ));
c.checkFieldIOobject(c, UTurb);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed);
labelFieldCompactIOField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
labelFieldCompactIOField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigIdOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
pairDataFieldCompactIOField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairData);
labelFieldCompactIOField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed);
vectorFieldCompactIOField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallPRel);
wallDataFieldCompactIOField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallData);
label i = 0;
forAllIter(typename CloudType, c, iter)
@ -257,16 +196,6 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
p.age_ = age[i];
p.tTurb_ = tTurb[i];
p.UTurb_ = UTurb[i];
p.collisionRecords_ = collisionRecordList
(
collisionRecordsPairAccessed[i],
collisionRecordsPairOrigProcOfOther[i],
collisionRecordsPairOrigIdOfOther[i],
collisionRecordsPairData[i],
collisionRecordsWallAccessed[i],
collisionRecordsWallPRel[i],
collisionRecordsWallData[i]
);
i++;
}
@ -303,46 +232,6 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
IOField<scalar> tTurb(c.fieldIOobject("tTurb", IOobject::NO_READ), np);
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::NO_READ), np);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::NO_READ),
np
);
labelFieldCompactIOField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::NO_READ
),
np
);
labelFieldCompactIOField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject("collisionRecordsPairOrigIdOfOther", IOobject::NO_READ),
np
);
pairDataFieldCompactIOField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::NO_READ),
np
);
labelFieldCompactIOField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::NO_READ),
np
);
vectorFieldCompactIOField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::NO_READ),
np
);
wallDataFieldCompactIOField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::NO_READ),
np
);
label i = 0;
forAllConstIter(typename CloudType, c, iter)
@ -362,15 +251,6 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
age[i] = p.age();
tTurb[i] = p.tTurb();
UTurb[i] = p.UTurb();
collisionRecordsPairAccessed[i] = p.collisionRecords().pairAccessed();
collisionRecordsPairOrigProcOfOther[i] =
p.collisionRecords().pairOrigProcOfOther();
collisionRecordsPairOrigIdOfOther[i] =
p.collisionRecords().pairOrigIdOfOther();
collisionRecordsPairData[i] = p.collisionRecords().pairData();
collisionRecordsWallAccessed[i] = p.collisionRecords().wallAccessed();
collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel();
collisionRecordsWallData[i] = p.collisionRecords().wallData();
i++;
}
@ -388,13 +268,6 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
age.write();
tTurb.write();
UTurb.write();
collisionRecordsPairAccessed.write();
collisionRecordsPairOrigProcOfOther.write();
collisionRecordsPairOrigIdOfOther.write();
collisionRecordsPairData.write();
collisionRecordsWallAccessed.write();
collisionRecordsWallPRel.write();
collisionRecordsWallData.write();
}
@ -422,8 +295,7 @@ Foam::Ostream& Foam::operator<<
<< token::SPACE << p.rho()
<< token::SPACE << p.age()
<< token::SPACE << p.tTurb()
<< token::SPACE << p.UTurb()
<< token::SPACE << p.collisionRecords();
<< token::SPACE << p.UTurb();
}
else
{
@ -445,7 +317,6 @@ Foam::Ostream& Foam::operator<<
+ sizeof(p.tTurb())
+ sizeof(p.UTurb())
);
os << p.collisionRecords();
}
// Check state of Ostream

View File

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicKinematicCollidingParcel
Description
Definition of basic kinematic colliding parcel
SourceFiles
basicKinematicParcel.H
\*---------------------------------------------------------------------------*/
#ifndef basicKinematicCollidingParcel_H
#define basicKinematicCollidingParcel_H
#include "contiguous.H"
#include "particle.H"
#include "KinematicParcel.H"
#include "CollidingParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef CollidingParcel<KinematicParcel<particle> >
basicKinematicCollidingParcel;
template<>
inline bool contiguous<basicKinematicCollidingParcel>()
{
return true;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicKinematicCollidingParcel.H"
#include "Cloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(basicKinematicCollidingParcel, 0);
defineTemplateTypeNameAndDebug(Cloud<basicKinematicCollidingParcel>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicKinematicCollidingCloud.H"
// Kinematic
#include "makeParcelForcesNew.H"
#include "makeParcelDispersionModelsNew.H"
#include "makeParcelInjectionModelsNew.H"
#include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModelsNew.H"
#include "makeParcelPostProcessingModelsNew.H"
#include "makeParcelSurfaceFilmModelsNew.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Kinematic sub-models
typedef basicKinematicCollidingCloud::cloudType
basicKinematicCollidingCloud_1;
makeParcelForcesNew(basicKinematicCollidingCloud_1);
makeParcelDispersionModelsNew(basicKinematicCollidingCloud_1);
makeParcelInjectionModelsNew(basicKinematicCollidingCloud_1);
makeParcelCollisionModels(basicKinematicCollidingCloud);
makeParcelPatchInteractionModelsNew(basicKinematicCollidingCloud_1);
makeParcelPostProcessingModelsNew(basicKinematicCollidingCloud_1);
makeParcelSurfaceFilmModelsNew(basicKinematicCollidingCloud_1);
}
// ************************************************************************* //