Skip to content
Snippets Groups Projects
Commit d3b48fea authored by andy's avatar andy
Browse files

ENH: Re-worked lagrangian/solidParticle

parent 84314bfd
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -29,15 +29,14 @@ License
bool Foam::solidParticle::move
(
solidParticle::trackData& td,
trackingData& td,
const scalar trackTime
)
{
td.switchProcessor = false;
td.keepParticle = true;
const polyMesh& mesh = cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
scalar tEnd = (1.0 - stepFraction())*trackTime;
scalar dtMax = tEnd;
......@@ -46,7 +45,7 @@ bool Foam::solidParticle::move
{
if (debug)
{
Info<< "Time = " << mesh.time().timeName()
Info<< "Time = " << mesh_.time().timeName()
<< " trackTime = " << trackTime
<< " tEnd = " << tEnd
<< " steptFraction() = " << stepFraction() << endl;
......@@ -64,12 +63,12 @@ bool Foam::solidParticle::move
tEnd -= dt;
stepFraction() = 1.0 - tEnd/trackTime;
cellPointWeight cpw(mesh, position(), cellI, face());
cellPointWeight cpw(mesh_, position(), cellI, face());
scalar rhoc = td.rhoInterp().interpolate(cpw);
vector Uc = td.UInterp().interpolate(cpw);
scalar nuc = td.nuInterp().interpolate(cpw);
scalar rhop = td.spc().rhop();
scalar rhop = td.cloud().rhop();
scalar magUr = mag(Uc - U_);
scalar ReFunc = 1.0;
......@@ -100,20 +99,7 @@ bool Foam::solidParticle::move
bool Foam::solidParticle::hitPatch
(
const polyPatch&,
solidParticle::trackData&,
const label,
const scalar,
const tetIndices&
)
{
return false;
}
bool Foam::solidParticle::hitPatch
(
const polyPatch&,
int&,
trackingData&,
const label,
const scalar,
const tetIndices&
......@@ -126,29 +112,21 @@ bool Foam::solidParticle::hitPatch
void Foam::solidParticle::hitProcessorPatch
(
const processorPolyPatch&,
solidParticle::trackData& td
trackingData& td
)
{
td.switchProcessor = true;
}
void Foam::solidParticle::hitProcessorPatch
(
const processorPolyPatch&,
int&
)
{}
void Foam::solidParticle::hitWallPatch
(
const wallPolyPatch& wpp,
solidParticle::trackData& td,
trackingData& td,
const tetIndices& tetIs
)
{
vector nw = tetIs.faceTri(cloud().pMesh()).normal();
vector nw = tetIs.faceTri(mesh_).normal();
nw /= mag(nw);
scalar Un = U_ & nw;
......@@ -156,50 +134,33 @@ void Foam::solidParticle::hitWallPatch
if (Un > 0)
{
U_ -= (1.0 + td.spc().e())*Un*nw;
U_ -= (1.0 + td.cloud().e())*Un*nw;
}
U_ -= td.spc().mu()*Ut;
U_ -= td.cloud().mu()*Ut;
}
void Foam::solidParticle::hitWallPatch
(
const wallPolyPatch&,
int&,
const tetIndices&
)
{}
void Foam::solidParticle::hitPatch
(
const polyPatch&,
solidParticle::trackData& td
trackingData& td
)
{
td.keepParticle = false;
}
void Foam::solidParticle::hitPatch
(
const polyPatch&,
int&
)
{}
void Foam::solidParticle::transformProperties (const tensor& T)
{
Particle<solidParticle>::transformProperties(T);
particle::transformProperties(T);
U_ = transform(T, U_);
}
void Foam::solidParticle::transformProperties(const vector& separation)
{
Particle<solidParticle>::transformProperties(separation);
particle::transformProperties(separation);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -38,7 +38,7 @@ SourceFiles
#ifndef solidParticle_H
#define solidParticle_H
#include "Particle.H"
#include "particle.H"
#include "IOstream.H"
#include "autoPtr.H"
#include "interpolationCellPoint.H"
......@@ -57,7 +57,7 @@ class solidParticleCloud;
class solidParticle
:
public Particle<solidParticle>
public particle
{
// Private member data
......@@ -73,11 +73,10 @@ public:
friend class Cloud<solidParticle>;
//- Class used to pass tracking data to the trackToFace function
class trackData
class trackingData
:
public particle::TrackingData<solidParticleCloud>
{
//- Reference to the cloud containing this particle
solidParticleCloud& spc_;
// Interpolators for continuous phase fields
const interpolationCellPoint<scalar>& rhoInterp_;
......@@ -90,13 +89,9 @@ public:
public:
bool switchProcessor;
bool keepParticle;
// Constructors
inline trackData
inline trackingData
(
solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp,
......@@ -108,8 +103,6 @@ public:
// Member functions
inline solidParticleCloud& spc();
inline const interpolationCellPoint<scalar>& rhoInterp() const;
inline const interpolationCellPoint<vector>& UInterp() const;
......@@ -125,7 +118,7 @@ public:
//- Construct from components
inline solidParticle
(
const Cloud<solidParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
......@@ -137,17 +130,39 @@ public:
//- Construct from Istream
solidParticle
(
const Cloud<solidParticle>& c,
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone
virtual autoPtr<Particle<solidParticle> > clone() const
virtual autoPtr<particle> clone() const
{
return autoPtr<Particle<solidParticle> >(new solidParticle(*this));
return autoPtr<particle>(new solidParticle(*this));
}
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<solidParticle> operator()(Istream& is) const
{
return autoPtr<solidParticle>
(
new solidParticle(mesh_, is, true)
);
}
};
// Member Functions
......@@ -167,7 +182,7 @@ public:
// Tracking
//- Move
bool move(trackData&, const scalar);
bool move(trackingData&, const scalar);
// Patch interactions
......@@ -177,18 +192,7 @@ public:
bool hitPatch
(
const polyPatch&,
solidParticle::trackData& td,
const label patchI,
const scalar trackFraction,
const tetIndices& tetIs
);
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions without trackData
bool hitPatch
(
const polyPatch& p,
int& td,
trackingData& td,
const label patchI,
const scalar trackFraction,
const tetIndices& tetIs
......@@ -199,31 +203,14 @@ public:
void hitProcessorPatch
(
const processorPolyPatch&,
solidParticle::trackData& td
);
//- Overridable function to handle the particle hitting a
// processorPatch without trackData
void hitProcessorPatch
(
const processorPolyPatch&,
int&
);
//- Overridable function to handle the particle hitting a wallPatch
void hitWallPatch
(
const wallPolyPatch&,
solidParticle::trackData& td,
const tetIndices&
trackingData& td
);
//- Overridable function to handle the particle hitting a wallPatch
//- without trackData
void hitWallPatch
(
const wallPolyPatch&,
int&,
trackingData& td,
const tetIndices&
);
......@@ -231,15 +218,7 @@ public:
void hitPatch
(
const polyPatch&,
solidParticle::trackData& td
);
//- Overridable function to handle the particle hitting a polyPatch
//- without trackData
void hitPatch
(
const polyPatch&,
int&
trackingData& td
);
//- Transform the physical properties of the particle
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -32,8 +32,8 @@ License
namespace Foam
{
defineParticleTypeNameAndDebug(solidParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0);
// defineParticleTypeNameAndDebug(solidParticle, 0);
// defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -81,7 +81,8 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g)
interpolationCellPoint<vector> UInterp(U);
interpolationCellPoint<scalar> nuInterp(nu);
solidParticle::trackData td(*this, rhoInterp, UInterp, nuInterp, g.value());
solidParticle::trackingData
td(*this, rhoInterp, UInterp, nuInterp, g.value());
Cloud<solidParticle>::move(td, mesh_.time().deltaTValue());
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -25,7 +25,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::solidParticle::trackData::trackData
inline Foam::solidParticle::trackingData::trackingData
(
solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp,
......@@ -34,7 +34,7 @@ inline Foam::solidParticle::trackData::trackData
const vector& g
)
:
spc_(spc),
particle::TrackingData<solidParticleCloud>(spc),
rhoInterp_(rhoInterp),
UInterp_(UInterp),
nuInterp_(nuInterp),
......@@ -44,7 +44,7 @@ inline Foam::solidParticle::trackData::trackData
inline Foam::solidParticle::solidParticle
(
const Cloud<solidParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
......@@ -53,7 +53,7 @@ inline Foam::solidParticle::solidParticle
const vector& U
)
:
Particle<solidParticle>(c, position, cellI, tetFaceI, tetPtI),
particle(mesh, position, cellI, tetFaceI, tetPtI),
d_(d),
U_(U)
{}
......@@ -61,33 +61,27 @@ inline Foam::solidParticle::solidParticle
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::solidParticleCloud& Foam::solidParticle::trackData::spc()
{
return spc_;
}
inline const Foam::interpolationCellPoint<Foam::scalar>&
Foam::solidParticle::trackData::rhoInterp() const
Foam::solidParticle::trackingData::rhoInterp() const
{
return rhoInterp_;
}
inline const Foam::interpolationCellPoint<Foam::vector>&
Foam::solidParticle::trackData::UInterp() const
Foam::solidParticle::trackingData::UInterp() const
{
return UInterp_;
}
inline const Foam::interpolationCellPoint<Foam::scalar>&
Foam::solidParticle::trackData::nuInterp() const
Foam::solidParticle::trackingData::nuInterp() const
{
return nuInterp_;
}
inline const Foam::vector& Foam::solidParticle::trackData::g() const
inline const Foam::vector& Foam::solidParticle::trackingData::g() const
{
return g_;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,12 +30,12 @@ License
Foam::solidParticle::solidParticle
(
const Cloud<solidParticle>& cloud,
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
Particle<solidParticle>(cloud, is, readFields)
particle(mesh, is, readFields)
{
if (readFields)
{
......@@ -65,6 +65,9 @@ void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
{
return;
}
particle::readFields(c);
IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ));
c.checkFieldIOobject(c, d);
......@@ -85,7 +88,7 @@ void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
void Foam::solidParticle::writeFields(const Cloud<solidParticle>& c)
{
Particle<solidParticle>::writeFields(c);
particle::writeFields(c);
label np = c.size();
......@@ -113,13 +116,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const solidParticle& p)
{
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Particle<solidParticle>&>(p)
os << static_cast<const particle&>(p)
<< token::SPACE << p.d_
<< token::SPACE << p.U_;
}
else
{
os << static_cast<const Particle<solidParticle>&>(p);
os << static_cast<const particle&>(p);
os.write
(
reinterpret_cast<const char*>(&p.d_),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment