Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2011-03-01 15:15:44 +01:00
290 changed files with 6236 additions and 7099 deletions

View File

@ -19,7 +19,6 @@ EXE_LIBS = \
-ldynamicMesh \
-ledgeMesh \
-lengine \
-lextrudeModel \
-lfieldFunctionObjects \
-lfileFormats \
-lfiniteVolume \
@ -43,7 +42,6 @@ EXE_LIBS = \
-lliquidMixtureProperties \
-lliquidProperties \
-lmeshTools \
-lMGridGenGAMGAgglomeration \
-lmolecularMeasurements \
-lmolecule \
-lmultiphaseInterFoam \

View File

@ -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
@ -100,7 +100,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
(
new passiveParticle
(
positions_,
procMesh,
ppi.position(),
procCelli,
false
@ -112,7 +112,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
particleIndices_.setSize(pi);
IOPosition<passiveParticle>(positions_).write();
IOPosition<Cloud<passiveParticle> >(positions_).write();
}

View File

@ -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
@ -24,8 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "MapLagrangianFields.H"
#include "Cloud.H"
#include "passiveParticle.H"
#include "passiveParticleCloud.H"
#include "meshSearch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,7 +43,9 @@ static label findCell(const Cloud<passiveParticle>& cloud, const point& pt)
label tetFaceI = -1;
label tetPtI = -1;
cloud.findCellFacePt(pt, cellI, tetFaceI, tetPtI);
const polyMesh& mesh = cloud.pMesh();
mesh.findCellFacePt(pt, cellI, tetFaceI, tetPtI);
if (cellI >= 0)
{
@ -55,8 +56,6 @@ static label findCell(const Cloud<passiveParticle>& cloud, const point& pt)
// See if particle on face by finding nearest face and shifting
// particle.
const polyMesh& mesh = cloud.pMesh();
meshSearch meshSearcher(mesh, false);
label faceI = meshSearcher.findNearestBoundaryFace(pt);
@ -67,7 +66,7 @@ static label findCell(const Cloud<passiveParticle>& cloud, const point& pt)
const point perturbPt = (1-perturbFactor)*pt+perturbFactor*cc;
cloud.findCellFacePt(perturbPt, cellI, tetFaceI, tetPtI);
mesh.findCellFacePt(perturbPt, cellI, tetFaceI, tetPtI);
return cellI;
}
@ -124,7 +123,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
Info<< nl << " processing cloud " << cloudDirs[cloudI] << endl;
// Read positions & cell
Cloud<passiveParticle> sourceParcels
passiveParticleCloud sourceParcels
(
meshSource,
cloudDirs[cloudI],
@ -134,13 +133,15 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
<< " parcels from source mesh." << endl;
// Construct empty target cloud
Cloud<passiveParticle> targetParcels
passiveParticleCloud targetParcels
(
meshTarget,
cloudDirs[cloudI],
IDLList<passiveParticle>()
);
particle::TrackingData<passiveParticleCloud> td(targetParcels);
label sourceParticleI = 0;
// Indices of source particles that get added to targetParcels
@ -176,15 +177,14 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
(
new passiveParticle
(
targetParcels,
meshTarget,
targetCc[targetCells[i]],
targetCells[i]
)
);
passiveParticle& newP = newPtr();
scalar fraction = 0;
label faceI = newP.track(iter().position(), fraction);
label faceI = newP.track(iter().position(), td);
if (faceI < 0 && newP.cell() >= 0)
{
@ -246,7 +246,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
if (addParticles.size())
{
IOPosition<passiveParticle>(targetParcels).write();
IOPosition<passiveParticleCloud>(targetParcels).write();
// addParticles now contains the indices of the sourceMesh
// particles that were appended to the target mesh.

View File

@ -38,9 +38,9 @@ parallel/decompose/AllwmakeLnInclude
# dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
dummyThirdParty/Allwmake $*
wmake $makeOption finiteVolume
wmake $makeOption lagrangian/basic
wmake $makeOption lagrangian/distributionModels
wmake $makeOption finiteVolume
wmake $makeOption genericPatchFields
# Build the proper scotchDecomp, metisDecomp etc.

View File

@ -495,6 +495,8 @@ $(pointBoundaryMesh)/pointBoundaryMesh.C
meshes/boundBox/boundBox.C
meshes/treeBoundBox/treeBoundBox.C
meshTools = meshes/meshTools
$(meshTools)/matchPoints.C
$(meshTools)/mergePoints.C
@ -572,6 +574,11 @@ $(interpolations)/patchToPatchInterpolation/PatchToPatchInterpolationName.C
algorithms/MeshWave/MeshWaveName.C
algorithms/MeshWave/FaceCellWaveName.C
algorithms/indexedOctree/indexedOctreeName.C
algorithms/indexedOctree/treeDataCell.C
graph/curve/curve.C
graph/graph.C

View File

@ -25,8 +25,8 @@ License
#include "indexedOctree.H"
#include "linePointRef.H"
#include "meshTools.H"
#include "OFstream.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1730,26 +1730,6 @@ void Foam::indexedOctree<Type>::traverseNode
point perturbedEnd(pushPoint(octantBb, end, false));
//if (debug)
{
// Dump octantBb to obj
writeOBJ(nodeI, octant);
// Dump ray to obj as well
{
OFstream str("ray.obj");
meshTools::writeOBJ(str, start);
meshTools::writeOBJ(str, end);
str << "l 1 2" << nl;
}
WarningIn("indexedOctree<Type>::traverseNode(..)")
<< "Did not intersect ray from endpoint:" << end
<< " to startpoint:" << start
<< " with bounding box:" << octantBb << nl
<< "Re-intersecting with perturbed endpoint:" << perturbedEnd
<< endl;
}
traverseNode
(
findAny,
@ -2316,12 +2296,6 @@ void Foam::indexedOctree<Type>::writeOBJ
pointField bbPoints(subBb.points());
label pointVertI = vertI;
forAll(bbPoints, i)
{
meshTools::writeOBJ(str, bbPoints[i]);
vertI++;
}
forAll(treeBoundBox::edges, i)
{
const edge& e = treeBoundBox::edges[i];

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
@ -41,7 +41,7 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
(
IOobject
(
( cloudName.size() ? cloudName : defaultName ),
(cloudName.size() ? cloudName : defaultName),
obr.time().timeName(),
prefix,
obr,
@ -58,4 +58,12 @@ Foam::cloud::~cloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cloud::autoMap(const mapPolyMesh&)
{
notImplemented("cloud::autoMap(const mapPolyMesh&)");
}
// ************************************************************************* //

View File

@ -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
@ -91,7 +91,7 @@ public:
//- Remap the cells of particles corresponding to the
// mesh topology change
virtual void autoMap(const mapPolyMesh&) = 0;
virtual void autoMap(const mapPolyMesh&);
};

View File

@ -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
@ -1183,10 +1183,123 @@ void Foam::polyMesh::removeFiles(const fileName& instanceDir) const
}
}
void Foam::polyMesh::removeFiles() const
{
removeFiles(instance());
}
void Foam::polyMesh::findCellFacePt
(
const point& pt,
label& cellI,
label& tetFaceI,
label& tetPtI
) const
{
cellI = -1;
tetFaceI = -1;
tetPtI = -1;
const indexedOctree<treeDataCell>& tree = cellTree();
// Find nearest cell to the point
pointIndexHit info = tree.findNearest(pt, sqr(GREAT));
if (info.hit())
{
label nearestCellI = tree.shapes().cellLabels()[info.index()];
// Check the nearest cell to see if the point is inside.
findTetFacePt(nearestCellI, pt, tetFaceI, tetPtI);
if (tetFaceI != -1)
{
// Point was in the nearest cell
cellI = nearestCellI;
return;
}
else
{
// Check the other possible cells that the point may be in
labelList testCells = tree.findIndices(pt);
forAll(testCells, pCI)
{
label testCellI = tree.shapes().cellLabels()[testCells[pCI]];
if (testCellI == nearestCellI)
{
// Don't retest the nearest cell
continue;
}
// Check the test cell to see if the point is inside.
findTetFacePt(testCellI, pt, tetFaceI, tetPtI);
if (tetFaceI != -1)
{
// Point was in the test cell
cellI = testCellI;
return;
}
}
}
}
else
{
FatalErrorIn
(
"void Foam::polyMesh::findCellFacePt"
"("
"const point&, "
"label&, "
"label&, "
"label&"
") const"
) << "Did not find nearest cell in search tree."
<< abort(FatalError);
}
}
void Foam::polyMesh::findTetFacePt
(
const label cellI,
const point& pt,
label& tetFaceI,
label& tetPtI
) const
{
const polyMesh& mesh = *this;
tetFaceI = -1;
tetPtI = -1;
List<tetIndices> cellTets =
polyMeshTetDecomposition::cellTetIndices(mesh, cellI);
forAll(cellTets, tetI)
{
const tetIndices& cellTetIs = cellTets[tetI];
if (cellTetIs.tet(mesh).inside(pt))
{
tetFaceI = cellTetIs.face();
tetPtI = cellTetIs.tetPt();
return;
}
}
}
// ************************************************************************* //

View File

@ -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
@ -34,6 +34,7 @@ SourceFiles
polyMeshFromShapeMesh.C
polyMeshIO.C
polyMeshUpdate.C
polyMeshFindCell.C
\*---------------------------------------------------------------------------*/
@ -391,6 +392,7 @@ public:
return *this;
}
// Mesh motion
//- Is mesh moving
@ -508,6 +510,28 @@ public:
//- Remove all files from mesh instance()
void removeFiles() const;
// Helper functions
//- Find the cell, tetFaceI and tetPtI for the given position
void findCellFacePt
(
const point& pt,
label& cellI,
label& tetFaceI,
label& tetPtI
) const;
//- Find the tetFaceI and tetPtI for the given position in
// the supplied cell, tetFaceI and tetPtI = -1 if not found
void findTetFacePt
(
const label cellI,
const point& pt,
label& tetFaceI,
label& tetPtI
) const;
};

View File

@ -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
@ -26,8 +26,6 @@ License
#include "primitiveMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::primitiveMesh, 0);
@ -63,6 +61,8 @@ Foam::primitiveMesh::primitiveMesh()
ppPtr_(NULL),
cpPtr_(NULL),
cellTreePtr_(NULL),
labels_(0),
cellCentresPtr_(NULL),
@ -105,6 +105,8 @@ Foam::primitiveMesh::primitiveMesh
ppPtr_(NULL),
cpPtr_(NULL),
cellTreePtr_(NULL),
labels_(0),
cellCentresPtr_(NULL),
@ -347,4 +349,36 @@ const Foam::cellShapeList& Foam::primitiveMesh::cellShapes() const
}
const Foam::indexedOctree<Foam::treeDataCell>&
Foam::primitiveMesh::cellTree() const
{
if (!cellTreePtr_)
{
treeBoundBox overallBb(points());
Random rndGen(261782);
overallBb = overallBb.extend(rndGen, 1E-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
cellTreePtr_ =
new indexedOctree<treeDataCell>
(
treeDataCell
(
false, // not cache bb
*this
),
overallBb,
8, // maxLevel
10, // leafsize
3.0 // duplicity
);
}
return *cellTreePtr_;
}
// ************************************************************************* //

View File

@ -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
@ -67,6 +67,8 @@ SourceFiles
#include "Map.H"
#include "EdgeMap.H"
#include "boundBox.H"
#include "indexedOctree.H"
#include "treeDataCell.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -155,6 +157,9 @@ class primitiveMesh
//- Cell-points
mutable labelListList* cpPtr_;
//- Search tree to allow spatial tet searching
mutable indexedOctree<treeDataCell>* cellTreePtr_;
// On-the-fly edge addresing storage
@ -482,6 +487,10 @@ public:
const labelListList& cellPoints() const;
//- Build (if necessary) and return the cell search tree
const indexedOctree<treeDataCell>& cellTree() const;
// Geometric data (raw!)
const vectorField& cellCentres() const;
@ -814,6 +823,9 @@ public:
//- Clear topological data
void clearAddressing();
//- Clear cell tree data
void clearCellTree();
//- Clear all geometry and addressing unnecessary for CFD
void clearOut();
};

View File

@ -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
@ -99,6 +99,11 @@ void Foam::primitiveMesh::printAllocated() const
Pout<< " Cell-point" << endl;
}
if (cellTreePtr_)
{
Pout<< " Cell-tree" << endl;
}
// Geometry
if (cellCentresPtr_)
{
@ -165,6 +170,14 @@ void Foam::primitiveMesh::clearAddressing()
deleteDemandDrivenData(pePtr_);
deleteDemandDrivenData(ppPtr_);
deleteDemandDrivenData(cpPtr_);
deleteDemandDrivenData(cellTreePtr_);
}
void Foam::primitiveMesh::clearCellTree()
{
deleteDemandDrivenData(cellTreePtr_);
}

View File

@ -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
@ -26,10 +26,8 @@ License
#include "primitiveMesh.H"
#include "cell.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Is the point in the cell bounding box
bool Foam::primitiveMesh::pointInCellBB
(
const point& p,
@ -60,7 +58,6 @@ bool Foam::primitiveMesh::pointInCellBB
}
// Is the point in the cell
bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
{
const labelList& f = cells()[celli];
@ -86,7 +83,6 @@ bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
}
// Find the cell with the nearest cell centre
Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
{
const vectorField& centres = cellCentres();
@ -109,7 +105,6 @@ Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
}
// Find cell enclosing this location
Foam::label Foam::primitiveMesh::findCell(const point& location) const
{
if (nCells() == 0)

View File

@ -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
@ -174,10 +174,10 @@ public:
) const;
//- Return nearest point to p on tetrahedron
inline pointHit nearestPoint
(
const point& p
) const;
inline pointHit nearestPoint(const point& p) const;
//- Return true if point is inside tetrahedron
inline bool inside(const point& pt) const;
//- Return (min)containment sphere, i.e. the smallest sphere with
// all points inside. Returns pointHit with:

View File

@ -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
@ -380,6 +380,82 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
}
template<class Point, class PointRef>
bool Foam::tetrahedron<Point, PointRef>::inside(const point& pt) const
{
// For robustness, assuming that the point is in the tet unless
// "definitively" shown otherwise by obtaining a positive dot
// product greater than a tolerance of SMALL.
// The tet is defined: tet(Cc, tetBasePt, pA, pB) where the normal
// vectors and base points for the half-space planes are:
// area[0] = Sa();
// area[1] = Sb();
// area[2] = Sc();
// area[3] = Sd();
// planeBase[0] = tetBasePt = b_
// planeBase[1] = ptA = c_
// planeBase[2] = tetBasePt = b_
// planeBase[3] = tetBasePt = b_
vector n = vector::zero;
{
// 0, a
const point& basePt = b_;
n = Sa();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
{
// 1, b
const point& basePt = c_;
n = Sb();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
{
// 2, c
const point& basePt = b_;
n = Sc();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
{
// 3, d
const point& basePt = b_;
n = Sd();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
return true;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class Point, class PointRef>

View File

@ -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

View File

@ -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

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) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,12 +32,6 @@ License
#include "OFstream.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
const Foam::scalar Foam::Cloud<ParticleType>::trackingCorrectionTol = 1e-5;
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class ParticleType>
@ -47,7 +41,7 @@ void Foam::Cloud<ParticleType>::calcCellWallFaces() const
PackedBoolList& cellWallFaces = cellWallFacesPtr_();
const polyBoundaryMesh& patches = pMesh().boundaryMesh();
const polyBoundaryMesh& patches = polyMesh_.boundaryMesh();
forAll(patches, patchI)
{
@ -78,9 +72,7 @@ Foam::Cloud<ParticleType>::Cloud
cloud(pMesh),
IDLList<ParticleType>(),
polyMesh_(pMesh),
particleCount_(0),
labels_(),
cellTree_(),
nTrackingRescues_(),
cellWallFacesPtr_()
{
@ -104,9 +96,7 @@ Foam::Cloud<ParticleType>::Cloud
cloud(pMesh, cloudName),
IDLList<ParticleType>(),
polyMesh_(pMesh),
particleCount_(0),
labels_(),
cellTree_(),
nTrackingRescues_(),
cellWallFacesPtr_()
{
@ -121,236 +111,6 @@ Foam::Cloud<ParticleType>::Cloud
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
void Foam::Cloud<ParticleType>::findCellFacePt
(
const point& pt,
label& cellI,
label& tetFaceI,
label& tetPtI
) const
{
cellI = -1;
tetFaceI = -1;
tetPtI = -1;
const indexedOctree<treeDataCell>& tree = cellTree();
// Find nearest cell to the point
pointIndexHit info = tree.findNearest(pt, sqr(GREAT));
if (info.hit())
{
label nearestCellI = tree.shapes().cellLabels()[info.index()];
// Check the nearest cell to see if the point is inside.
findFacePt(nearestCellI, pt, tetFaceI, tetPtI);
if (tetFaceI != -1)
{
// Point was in the nearest cell
cellI = nearestCellI;
return;
}
else
{
// Check the other possible cells that the point may be in
labelList testCells = tree.findIndices(pt);
forAll(testCells, pCI)
{
label testCellI = tree.shapes().cellLabels()[testCells[pCI]];
if (testCellI == nearestCellI)
{
// Don't retest the nearest cell
continue;
}
// Check the test cell to see if the point is inside.
findFacePt(testCellI, pt, tetFaceI, tetPtI);
if (tetFaceI != -1)
{
// Point was in the test cell
cellI = testCellI;
return;
}
}
}
}
else
{
FatalErrorIn
(
"void Foam::Cloud<ParticleType>::findCellFacePt"
"("
"const point& pt, "
"label& cellI, "
"label& tetFaceI, "
"label& tetPtI"
") const"
) << "Did not find nearest cell in search tree."
<< abort(FatalError);
}
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::findFacePt
(
label cellI,
const point& pt,
label& tetFaceI,
label& tetPtI
) const
{
tetFaceI = -1;
tetPtI = -1;
List<tetIndices> cellTets = polyMeshTetDecomposition::cellTetIndices
(
polyMesh_,
cellI
);
forAll(cellTets, tetI)
{
const tetIndices& cellTetIs = cellTets[tetI];
if (inTet(pt, cellTetIs.tet(polyMesh_)))
{
tetFaceI = cellTetIs.face();
tetPtI = cellTetIs.tetPt();
return;
}
}
}
template<class ParticleType>
bool Foam::Cloud<ParticleType>::inTet
(
const point& pt,
const tetPointRef& tet
) const
{
// For robustness, assuming that the point is in the tet unless
// "definitively" shown otherwise by obtaining a positive dot
// product greater than a tolerance of SMALL.
// The tet is defined: tet(Cc, tetBasePt, pA, pB) where the normal
// vectors and base points for the half-space planes are:
// area[0] = tet.Sa();
// area[1] = tet.Sb();
// area[2] = tet.Sc();
// area[3] = tet.Sd();
// planeBase[0] = tetBasePt = tet.b()
// planeBase[1] = ptA = tet.c()
// planeBase[2] = tetBasePt = tet.b()
// planeBase[3] = tetBasePt = tet.b()
vector n = vector::zero;
{
// 0, a
const point& basePt = tet.b();
n = tet.Sa();
n /= (mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
{
// 1, b
const point& basePt = tet.c();
n = tet.Sb();
n /= (mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
{
// 2, c
const point& basePt = tet.b();
n = tet.Sc();
n /= (mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
{
// 3, d
const point& basePt = tet.b();
n = tet.Sd();
n /= (mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
{
return false;
}
}
return true;
}
template<class ParticleType>
const Foam::indexedOctree<Foam::treeDataCell>&
Foam::Cloud<ParticleType>::cellTree() const
{
if (cellTree_.empty())
{
treeBoundBox overallBb(polyMesh_.points());
Random rndGen(261782);
overallBb = overallBb.extend(rndGen, 1E-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
cellTree_.reset
(
new indexedOctree<treeDataCell>
(
treeDataCell
(
false, // not cache bb
polyMesh_
),
overallBb,
8, // maxLevel
10, // leafsize
3.0 // duplicity
)
);
}
return cellTree_();
}
template<class ParticleType>
const Foam::PackedBoolList& Foam::Cloud<ParticleType>::cellHasWallFaces()
const
@ -364,22 +124,6 @@ const
}
template<class ParticleType>
Foam::label Foam::Cloud<ParticleType>::getNewParticleID() const
{
label id = particleCount_++;
if (id == labelMax)
{
WarningIn("Cloud<ParticleType>::getNewParticleID() const")
<< "Particle counter has overflowed. This might cause problems"
<< " when reconstructing particle tracks." << endl;
}
return id;
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::addParticle(ParticleType* pPtr)
{
@ -399,14 +143,14 @@ void Foam::Cloud<ParticleType>::cloudReset(const Cloud<ParticleType>& c)
{
// Reset particle cound and particles only
// - not changing the cloud object registry or reference to the polyMesh
particleCount_ = 0;
ParticleType::particleCount_ = 0;
IDLList<ParticleType>::operator=(c);
}
template<class ParticleType>
template<class TrackingData>
void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime)
template<class TrackData>
void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
{
const polyBoundaryMesh& pbm = pMesh().boundaryMesh();
const globalMeshData& pData = polyMesh_.globalData();
@ -472,9 +216,9 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime)
{
// If we are running in parallel and the particle is on a
// boundary face
if (Pstream::parRun() && p.faceI_ >= pMesh().nInternalFaces())
if (Pstream::parRun() && p.face() >= pMesh().nInternalFaces())
{
label patchI = pbm.whichPatch(p.faceI_);
label patchI = pbm.whichPatch(p.face());
// ... and the face is on a processor patch
// prepare it for transfer
@ -571,7 +315,7 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime)
IDLList<ParticleType> newParticles
(
particleStream,
typename ParticleType::iNew(*this)
typename ParticleType::iNew(polyMesh_)
);
label pI = 0;
@ -600,57 +344,64 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime)
template<class ParticleType>
void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper)
template<class TrackData>
void Foam::Cloud<ParticleType>::autoMap
(
TrackData& td,
const mapPolyMesh& mapper
)
{
if (cloud::debug)
{
Info<< "Cloud<ParticleType>::autoMap(const morphFieldMapper& map) "
"for lagrangian cloud " << cloud::name() << endl;
Info<< "Cloud<ParticleType>::autoMap(TrackData&, const mapPolyMesh&) "
<< "for lagrangian cloud " << cloud::name() << endl;
}
const labelList& reverseCellMap = mapper.reverseCellMap();
const labelList& reverseFaceMap = mapper.reverseFaceMap();
// Reset stored data that relies on the mesh
cellTree_.clear();
// polyMesh_.clearCellTree();
cellWallFacesPtr_.clear();
forAllIter(typename Cloud<ParticleType>, *this, pIter)
{
if (reverseCellMap[pIter().cellI_] >= 0)
{
pIter().cellI_ = reverseCellMap[pIter().cellI_];
ParticleType& p = pIter();
if (pIter().faceI_ >= 0 && reverseFaceMap[pIter().faceI_] >= 0)
if (reverseCellMap[p.cell()] >= 0)
{
p.cell() = reverseCellMap[p.cell()];
if (p.face() >= 0 && reverseFaceMap[p.face()] >= 0)
{
pIter().faceI_ = reverseFaceMap[pIter().faceI_];
p.face() = reverseFaceMap[p.face()];
}
else
{
pIter().faceI_ = -1;
p.face() = -1;
}
pIter().initCellFacePt();
p.initCellFacePt();
}
else
{
label trackStartCell = mapper.mergedCell(pIter().cellI_);
label trackStartCell = mapper.mergedCell(p.cell());
if (trackStartCell < 0)
{
trackStartCell = 0;
}
vector p = pIter().position();
vector pos = p.position();
const_cast<vector&>(pIter().position()) =
const_cast<vector&>(p.position()) =
polyMesh_.cellCentres()[trackStartCell];
pIter().stepFraction() = 0;
p.stepFraction() = 0;
pIter().initCellFacePt();
p.initCellFacePt();
pIter().track(p);
p.track(pos, td);
}
}
}

View File

@ -25,6 +25,7 @@ Class
Foam::Cloud
Description
Base cloud calls templated on particle type
SourceFiles
Cloud.C
@ -80,15 +81,9 @@ class Cloud
const polyMesh& polyMesh_;
//- Overall count of particles ever created. Never decreases.
mutable label particleCount_;
//- Temporary storage for addressing. Used in findTris.
mutable DynamicList<label> labels_;
//- Search tree to allow spatial tet searching
mutable autoPtr<indexedOctree<treeDataCell> > cellTree_;
//- Count of how many tracking rescue corrections have been
// applied
mutable label nTrackingRescues_;
@ -114,8 +109,7 @@ class Cloud
public:
template<class ParticleT>
friend class Particle;
friend class particle;
template<class ParticleT>
friend class IOPosition;
@ -133,10 +127,6 @@ public:
//- Name of cloud properties dictionary
static word cloudPropertiesName;
//- Fraction of distance to tet centre to move a particle to
// 'rescue' it from a tracking problem
static const scalar trackingCorrectionTol;
// Constructors
@ -184,65 +174,15 @@ public:
return polyMesh_;
}
//- Is this global face an internal face?
bool internalFace(const label faceI) const
{
return polyMesh_.isInternalFace(faceI);
}
//- Is this global face a boundary face?
bool boundaryFace(const label faceI) const
{
return !internalFace(faceI);
}
//- Which patch is this global face on
label facePatch(const label faceI) const
{
return polyMesh_.boundaryMesh().whichPatch(faceI);
}
//- Which face of this patch is this global face
label patchFace(const label patchI, const label faceI) const
{
return polyMesh_.boundaryMesh()[patchI].whichFace(faceI);
}
label size() const
{
return IDLList<ParticleType>::size();
};
//- Find the cell, tetFaceI and tetPtI for the given
// position
void findCellFacePt
(
const point& pt,
label& cellI,
label& tetFaceI,
label& tetPtI
) const;
//- Find the tetFaceI and tetPtI for the given position in
// the supplied cell, tetFaceI and tetPtI = -1 if not
// found
void findFacePt
(
label cellI,
const point& pt,
label& tetFaceI,
label& tetPtI
) const;
//- Test if the given position is inside the give tet
bool inTet
(
const point& pt,
const tetPointRef& tet
) const;
//- Build (if necessary) and return the cell search tree
const indexedOctree<treeDataCell>& cellTree() const;
DynamicList<label>& labels()
{
return labels_;
}
//- Return nTrackingRescues
label nTrackingRescues() const
@ -314,9 +254,6 @@ public:
return IDLList<ParticleType>::clear();
};
//- Get unique particle creation id
label getNewParticleID() const;
//- Transfer particle to cloud
void addParticle(ParticleType* pPtr);
@ -328,12 +265,13 @@ public:
//- Move the particles
// passing the TrackingData to the track function
template<class TrackingData>
void move(TrackingData& td, const scalar trackTime);
template<class TrackData>
void move(TrackData& td, const scalar trackTime);
//- Remap the cells of particles corresponding to the
// mesh topology change
virtual void autoMap(const mapPolyMesh&);
template<class TrackData>
void autoMap(TrackData& td, const mapPolyMesh&);
// Read

View File

@ -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
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "Cloud.H"
#include "Particle.H"
#include "Time.H"
#include "IOPosition.H"
@ -58,12 +57,12 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
if (uniformPropsDict.found(procName))
{
uniformPropsDict.subDict(procName).lookup("particleCount")
>> particleCount_;
>> ParticleType::particleCount_;
}
}
else
{
particleCount_ = 0;
ParticleType::particleCount_ = 0;
}
}
@ -86,7 +85,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
);
labelList np(Pstream::nProcs(), 0);
np[Pstream::myProcNo()] = particleCount_;
np[Pstream::myProcNo()] = ParticleType::particleCount_;
Pstream::listCombineGather(np, maxEqOp<label>());
Pstream::listCombineScatter(np);
@ -98,7 +97,12 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
uniformPropsDict.subDict(procName).add("particleCount", np[i]);
}
uniformPropsDict.regIOobject::write();
uniformPropsDict.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
time().writeCompression()
);
}
@ -107,7 +111,7 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
{
readCloudUniformProperties();
IOPosition<ParticleType> ioP(*this);
IOPosition<Cloud<ParticleType> > ioP(*this);
if (ioP.headerOk())
{
@ -154,9 +158,7 @@ Foam::Cloud<ParticleType>::Cloud
:
cloud(pMesh),
polyMesh_(pMesh),
particleCount_(0),
labels_(),
cellTree_(),
nTrackingRescues_(),
cellWallFacesPtr_()
{
@ -174,9 +176,7 @@ Foam::Cloud<ParticleType>::Cloud
:
cloud(pMesh, cloudName),
polyMesh_(pMesh),
particleCount_(0),
labels_(),
cellTree_(),
nTrackingRescues_(),
cellWallFacesPtr_()
{
@ -262,8 +262,7 @@ void Foam::Cloud<ParticleType>::writeFields() const
{
if (this->size())
{
const ParticleType& p = *this->first();
ParticleType::writeFields(p.cloud());
ParticleType::writeFields(*this);
}
}

View File

@ -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
@ -27,11 +27,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
Foam::IOPosition<ParticleType>::IOPosition
(
const Cloud<ParticleType>& c
)
template<class CloudType>
Foam::IOPosition<CloudType>::IOPosition(const CloudType& c)
:
regIOobject
(
@ -50,8 +47,8 @@ Foam::IOPosition<ParticleType>::IOPosition
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
bool Foam::IOPosition<ParticleType>::write() const
template<class CloudType>
bool Foam::IOPosition<CloudType>::write() const
{
if (cloud_.size())
{
@ -64,19 +61,18 @@ bool Foam::IOPosition<ParticleType>::write() const
}
template<class ParticleType>
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
template<class CloudType>
bool Foam::IOPosition<CloudType>::writeData(Ostream& os) const
{
os << cloud_.size() << nl << token::BEGIN_LIST << nl;
forAllConstIter(typename Cloud<ParticleType>, cloud_, iter)
forAllConstIter(typename CloudType, cloud_, iter)
{
const typename CloudType::particleType& p = iter();
// Prevent writing additional fields
static_cast<const Particle<ParticleType>&>(iter()).write
(
os,
false
);
p.write(os, false);
os << nl;
}
@ -86,13 +82,11 @@ bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
}
template<class ParticleType>
void Foam::IOPosition<ParticleType>::readData
(
Cloud<ParticleType>& c,
bool checkClass
)
template<class CloudType>
void Foam::IOPosition<CloudType>::readData(CloudType& c, bool checkClass)
{
const polyMesh& mesh = c.pMesh();
Istream& is = readStream(checkClass ? typeName : "");
token firstToken(is);
@ -102,16 +96,16 @@ void Foam::IOPosition<ParticleType>::readData
label s = firstToken.labelToken();
// Read beginning of contents
is.readBeginList("Cloud<ParticleType>");
is.readBeginList("IOPosition<CloudType>::readData(CloudType, bool)");
for (label i=0; i<s; i++)
{
// Do not read any fields, position only
c.append(new ParticleType(c, is, false));
c.append(new typename CloudType::particleType(mesh, is, false));
}
// Read end of contents
is.readEndList("Cloud<ParticleType>");
is.readEndList("IOPosition<CloudType>::readData(CloudType, bool)");
}
else if (firstToken.isPunctuation())
{
@ -119,12 +113,10 @@ void Foam::IOPosition<ParticleType>::readData
{
FatalIOErrorIn
(
"void IOPosition<ParticleType>::readData"
"(Cloud<ParticleType>&, bool)",
"void IOPosition<CloudType>::readData(CloudType&, bool)",
is
) << "incorrect first token, '(', found "
<< firstToken.info()
<< exit(FatalIOError);
<< firstToken.info() << exit(FatalIOError);
}
token lastToken(is);
@ -138,26 +130,24 @@ void Foam::IOPosition<ParticleType>::readData
{
is.putBack(lastToken);
// Do not read any fields, position only
c.append(new ParticleType(c, is, false));
is >> lastToken;
c.append(new typename CloudType::particleType(mesh, is, false));
is >> lastToken;
}
}
else
{
FatalIOErrorIn
(
"void IOPosition<ParticleType>::readData"
"(Cloud<ParticleType>&, bool)",
"void IOPosition<ParticleType>::readData(CloudType&, bool)",
is
) << "incorrect first token, expected <int> or '(', found "
<< firstToken.info()
<< exit(FatalIOError);
<< firstToken.info() << exit(FatalIOError);
}
// Check state of IOstream
is.check
(
"void IOPosition<ParticleType>::readData(Cloud<ParticleType>&, bool)"
"void IOPosition<CloudType>::readData(CloudType&, bool)"
);
}

View File

@ -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
@ -46,7 +46,7 @@ namespace Foam
Class IOPosition Declaration
\*---------------------------------------------------------------------------*/
template<class ParticleType>
template<class CloudType>
class IOPosition
:
public regIOobject
@ -55,7 +55,7 @@ class IOPosition
// Private data
//- Reference to the cloud
const Cloud<ParticleType>& cloud_;
const CloudType& cloud_;
public:
@ -65,19 +65,20 @@ public:
//- Runtime type name information. Use cloud type.
virtual const word& type() const
{
return cloud_.type();
return Cloud<typename CloudType::particleType>::typeName;
//cloud_.type();
}
// Constructors
//- Construct from cloud
IOPosition(const Cloud<ParticleType>&);
IOPosition(const CloudType&);
// Member functions
virtual void readData(Cloud<ParticleType>& c, bool checkClass);
virtual void readData(CloudType& c, bool checkClass);
virtual bool write() const;

View File

@ -29,6 +29,7 @@ License
#include "treeDataFace.H"
#include "treeDataCell.H"
#include "volFields.H"
#include "meshTools.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -1237,7 +1238,7 @@ void Foam::InteractionLists<ParticleType>::receiveReferredData
referredParticles_[constructMap[i]] = IDLList<ParticleType>
(
str,
typename ParticleType::iNew(cloud_)
typename ParticleType::iNew(mesh_)
);
}
}

View File

@ -1,8 +1,7 @@
passiveParticle = passiveParticle
indexedParticle = indexedParticle
$(passiveParticle)/passiveParticleCloud.C
$(indexedParticle)/indexedParticleCloud.C
particle/particle.C
particle/particleIO.C
passiveParticle/passiveParticleCloud.C
indexedParticle/indexedParticleCloud.C
InteractionLists/referredWallFace/referredWallFace.C

View File

@ -1,5 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lmeshTools

View File

@ -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,18 +25,17 @@ Class
Foam::indexedParticle
Description
Adds label index to base particle
SourceFiles
indexedParticleI.H
indexedParticle.C
indexedParticleIO.C
indexedParticle.H
\*---------------------------------------------------------------------------*/
#ifndef indexedParticle_H
#define indexedParticle_H
#include "Particle.H"
#include "particle.H"
#include "IOstream.H"
#include "autoPtr.H"
@ -51,7 +50,7 @@ namespace Foam
class indexedParticle
:
public Particle<indexedParticle>
public particle
{
// Private data
@ -65,7 +64,7 @@ public:
//- Construct from components
indexedParticle
(
const Cloud<indexedParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
@ -73,47 +72,44 @@ public:
const label index = 0
)
:
Particle<indexedParticle>(c, position, cellI, tetFaceI, tetPtI),
particle(mesh, position, cellI, tetFaceI, tetPtI),
index_(index)
{}
//- Construct from components, with searching for tetFace and tetPt
indexedParticle
(
const Cloud<indexedParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label index = 0
)
:
Particle<indexedParticle>(c, position, cellI),
particle(mesh, position, cellI),
index_(index)
{}
//- Construct from Istream
indexedParticle
(
const Cloud<indexedParticle>& c,
const polyMesh& mesh,
Istream& is,
bool readFields = true
)
:
Particle<indexedParticle>(c, is, readFields)
particle(mesh, is, readFields)
{}
//- Construct as a copy
indexedParticle(const indexedParticle& p)
:
Particle<indexedParticle>(p)
particle(p)
{}
//- Construct and return a clone
virtual autoPtr<Particle<indexedParticle> > clone() const
virtual autoPtr<particle> clone() const
{
return autoPtr<Particle<indexedParticle> >
(
new indexedParticle(*this)
);
return autoPtr<particle>(new indexedParticle(*this));
}

View File

@ -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,7 +29,6 @@ License
namespace Foam
{
defineParticleTypeNameAndDebug(indexedParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<indexedParticle>, 0);
}

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-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 "particle.H"
#include "transform.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::label Foam::particle::particleCount_ = 0;
const Foam::scalar Foam::particle::trackingCorrectionTol = 1e-5;
namespace Foam
{
defineTypeNameAndDebug(particle, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::particle::particle
(
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
)
:
mesh_(mesh),
position_(position),
cellI_(cellI),
faceI_(-1),
stepFraction_(0.0),
tetFaceI_(tetFaceI),
tetPtI_(tetPtI),
origProc_(Pstream::myProcNo()),
origId_(getNewParticleID())
{}
Foam::particle::particle
(
const polyMesh& mesh,
const vector& position,
const label cellI,
bool doCellFacePt
)
:
mesh_(mesh),
position_(position),
cellI_(cellI),
faceI_(-1),
stepFraction_(0.0),
tetFaceI_(-1),
tetPtI_(-1),
origProc_(Pstream::myProcNo()),
origId_(getNewParticleID())
{
if (doCellFacePt)
{
initCellFacePt();
}
}
Foam::particle::particle(const particle& p)
:
mesh_(p.mesh_),
position_(p.position_),
cellI_(p.cellI_),
faceI_(p.faceI_),
stepFraction_(p.stepFraction_),
tetFaceI_(p.tetFaceI_),
tetPtI_(p.tetPtI_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
Foam::particle::particle(const particle& p, const polyMesh& mesh)
:
mesh_(mesh),
position_(p.position_),
cellI_(p.cellI_),
faceI_(p.faceI_),
stepFraction_(p.stepFraction_),
tetFaceI_(p.tetFaceI_),
tetPtI_(p.tetPtI_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::particle::transformPosition(const tensor& T)
{
position_ = transform(T, position_);
}
void Foam::particle::transformProperties(const tensor&)
{}
void Foam::particle::transformProperties(const vector&)
{}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
bool Foam::operator==(const particle& pA, const particle& pB)
{
return (pA.origProc() == pB.origProc() && pA.origId() == pB.origId());
}
bool Foam::operator!=(const particle& pA, const particle& pB)
{
return !(pA == pB);
}
// ************************************************************************* //

View File

@ -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
@ -22,108 +22,111 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::Particle
Foam::particle
Description
Base particle class
\*---------------------------------------------------------------------------*/
#ifndef Particle_H
#define Particle_H
#ifndef particle_H
#define particle_H
#include "vector.H"
#include "Cloud.H"
#include "IDLList.H"
#include "labelList.H"
#include "pointField.H"
#include "faceList.H"
#include "typeInfo.H"
//#include "typeInfo.H"
#include "OFstream.H"
#include "tetPointRef.H"
#include "FixedList.H"
#include "polyMeshTetDecomposition.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class Particle>
class Cloud;
// Forward declaration of classes
class particle;
class polyPatch;
class wedgePolyPatch;
class symmetryPolyPatch;
class cyclicPolyPatch;
class processorPolyPatch;
class symmetryPolyPatch;
class wallPolyPatch;
class polyPatch;
class wedgePolyPatch;
// Forward declaration of friend functions and operators
template<class ParticleType>
class Particle;
// Friend Operators
template<class ParticleType>
Ostream& operator<<
(
Ostream&,
const Particle<ParticleType>&
const particle&
);
template<class ParticleType>
bool operator==(const Particle<ParticleType>&, const Particle<ParticleType>&);
bool operator==(const particle&, const particle&);
template<class ParticleType>
bool operator!=(const Particle<ParticleType>&, const Particle<ParticleType>&);
bool operator!=(const particle&, const particle&);
/*---------------------------------------------------------------------------*\
Class Particle Declaration
Class Particle Declaration
\*---------------------------------------------------------------------------*/
template<class ParticleType>
class Particle
class particle
:
public IDLList<ParticleType>::link
public IDLList<particle>::link
{
public:
//- Class used to pass tracking data to the trackToFace function
class trackData
template<class CloudType>
class TrackingData
{
// Private data
//- Reference to the cloud containing this particle
Cloud<ParticleType>& cloud_;
//- Reference to the cloud containing (this) particle
CloudType& cloud_;
public:
bool switchProcessor;
bool keepParticle;
// Public data
typedef CloudType cloudType;
//- Flag to switch processor
bool switchProcessor;
//- Flag to indicate whether to keep particle (false = delete)
bool keepParticle;
// Constructors
inline trackData(Cloud<ParticleType>& cloud);
// Constructor
TrackingData(CloudType& cloud)
:
cloud_(cloud)
{}
// Member functions
//- Return a reference to the cloud
inline Cloud<ParticleType>& cloud();
CloudType& cloud()
{
return cloud_;
}
};
protected:
// Private data
// Protected data
//- Reference to the particle cloud
const Cloud<ParticleType>& cloud_;
//- Reference to the polyMesh database
const polyMesh& mesh_;
//- Position of particle
vector position_;
@ -156,7 +159,7 @@ protected:
// Private Member Functions
//- Find the tet tri faces between position and tet centre
inline void findTris
void findTris
(
const vector& position,
DynamicList<label>& faceList,
@ -179,18 +182,18 @@ protected:
const label tetPtI
) const;
//- Find the lambda value for a moving tri face
inline scalar movingTetLambda
(
const vector& from,
const vector& to,
const label triI,
const vector& tetArea,
const label tetPlaneBasePtI,
const label cellI,
const label tetFaceI,
const label tetPtI
) const;
//- Find the lambda value for a moving tri face
inline scalar movingTetLambda
(
const vector& from,
const vector& to,
const label triI,
const vector& tetArea,
const label tetPlaneBasePtI,
const label cellI,
const label tetFaceI,
const label tetPtI
) const;
//- Modify the tet owner data by crossing triI
inline void tetNeighbour(label triI);
@ -208,8 +211,10 @@ protected:
//- Hit wall faces in the current cell if the
//- wallImpactDistance is non-zero. They may not be in
//- different tets to the current.
template<class CloudType>
inline void hitWallFaces
(
const CloudType& td,
const vector& from,
const vector& to,
scalar& lambdaMin,
@ -239,37 +244,21 @@ protected:
//- Overridable function to handle the particle hitting a wedgePatch
template<class TrackData>
void hitWedgePatch
(
const wedgePolyPatch&,
TrackData& td
);
void hitWedgePatch(const wedgePolyPatch&, TrackData& td);
//- Overridable function to handle the particle hitting a
// symmetryPatch
template<class TrackData>
void hitSymmetryPatch
(
const symmetryPolyPatch&,
TrackData& td
);
void hitSymmetryPatch(const symmetryPolyPatch&, TrackData& td);
//- Overridable function to handle the particle hitting a cyclicPatch
template<class TrackData>
void hitCyclicPatch
(
const cyclicPolyPatch&,
TrackData& td
);
void hitCyclicPatch(const cyclicPolyPatch&, TrackData& td);
//- Overridable function to handle the particle hitting a
// processorPatch
template<class TrackData>
void hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
);
void hitProcessorPatch(const processorPolyPatch&, TrackData& td);
//- Overridable function to handle the particle hitting a wallPatch
template<class TrackData>
@ -283,61 +272,33 @@ protected:
//- Overridable function to handle the particle hitting a
// general patch
template<class TrackData>
void hitPatch
(
const polyPatch&,
TrackData& td
);
// Transformations
//- Transform the position the particle
// according to the given transformation tensor
virtual void transformPosition(const tensor& T);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// Parallel transfer
//- Convert global addressing to the processor patch
// local equivalents
template<class TrackData>
void prepareForParallelTransfer(const label patchI, TrackData& td);
//- Convert processor patch addressing to the global equivalents
// and set the cellI to the face-neighbour
template<class TrackData>
void correctAfterParallelTransfer(const label patchI, TrackData& td);
void hitPatch(const polyPatch&, TrackData& td);
public:
friend class Cloud<ParticleType>;
// Static data members
//- Runtime type information
TypeName("Particle");
TypeName("particle");
//- String representation of properties
static string propHeader;
//- Cumulative particle counter - used to provode unique ID
static label particleCount_;
//- Fraction of distance to tet centre to move a particle to
// 'rescue' it from a tracking problem
static const scalar trackingCorrectionTol;
// Constructors
//- Construct from components
Particle
particle
(
const Cloud<ParticleType>&,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
@ -346,47 +307,27 @@ public:
//- Construct from components, tetFaceI_ and tetPtI_ are not
// supplied so they will be deduced by a search
Particle
particle
(
const Cloud<ParticleType>&,
const polyMesh& mesh,
const vector& position,
const label cellI,
bool doCellFacePt = true
);
//- Construct from Istream
Particle
(
const Cloud<ParticleType>&,
Istream&,
bool readFields = true
);
particle(const polyMesh& mesh, Istream&, bool readFields = true);
//- Construct as a copy
Particle(const Particle& p);
particle(const particle& p);
//- Construct as a copy
Particle(const Particle& p, const Cloud<ParticleType>& c);
//- Construct as a copy with refernce to a new mesh
particle(const particle& p, const polyMesh& mesh);
//- Construct a clone
virtual autoPtr<Particle<ParticleType> > clone() const
virtual autoPtr<particle> clone() const
{
return autoPtr<Particle<ParticleType> >
(
new Particle<ParticleType>(*this)
);
}
//- Construct a clone
virtual autoPtr<Particle<ParticleType> > clone
(
const Cloud<ParticleType>& c
) const
{
return autoPtr<Particle<ParticleType> >
(
new Particle<ParticleType>(*this, c)
);
return autoPtr<particle>(new particle(*this));
}
@ -394,36 +335,24 @@ public:
// parallel transfer
class iNew
{
// Private data
//- Reference to the cloud
const Cloud<ParticleType>& cloud_;
const polyMesh& mesh_;
public:
iNew(const Cloud<ParticleType>& cloud)
iNew(const polyMesh& mesh)
:
cloud_(cloud)
mesh_(mesh)
{}
autoPtr<ParticleType> operator()(Istream& is) const
autoPtr<particle> operator()(Istream& is) const
{
return autoPtr<ParticleType>
(
new ParticleType
(
cloud_,
is,
true
)
);
return autoPtr<particle>(new particle(mesh_, is, true));
}
};
//- Destructor
virtual ~Particle()
virtual ~particle()
{}
@ -431,6 +360,12 @@ public:
// Access
//- Get unique particle creation id
inline label getNewParticleID() const;
//- Return the mesh database
inline const polyMesh& mesh() const;
//- Return current particle position
inline const vector& position() const;
@ -478,9 +413,6 @@ public:
//- Return current face particle is on otherwise -1
inline label face() const;
//- Return reference to the particle cloud
inline const Cloud<ParticleType>& cloud() const;
//- Return the impact model to be used, soft or hard (default).
inline bool softImpact() const;
@ -497,6 +429,12 @@ public:
//- Is the particle on the boundary/(or outside the domain)?
inline bool onBoundary() const;
//- Is this global face an internal face?
inline bool internalFace(const label faceI) const;
//- Is this global face a boundary face?
inline bool boundaryFace(const label faceI) const;
//- Which patch is particle on
inline label patch(const label faceI) const;
@ -540,14 +478,7 @@ public:
// Returns the boundary face index if the track stops at the
// boundary, -1 otherwise.
template<class TrackData>
label track
(
const vector& endPosition,
TrackData& td
);
//- Calls the templated track with dummy TrackData
label track(const vector& endPosition);
label track(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
@ -556,50 +487,62 @@ public:
// on entry 'stepFraction()' should be set to the fraction of the
// time-step at which the tracking starts.
template<class TrackData>
scalar trackToFace
(
const vector& endPosition,
TrackData& td
);
//- Calls the templated trackToFace with dummy TrackData
scalar trackToFace(const vector& endPosition);
scalar trackToFace(const vector& endPosition, TrackData& td);
//- Return the index of the face to be used in the interpolation
// routine
inline label faceInterpolation() const;
// Transformations
//- Transform the position the particle
// according to the given transformation tensor
virtual void transformPosition(const tensor& T);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// Parallel transfer
//- Convert global addressing to the processor patch
// local equivalents
template<class TrackData>
void prepareForParallelTransfer(const label patchI, TrackData& td);
//- Convert processor patch addressing to the global equivalents
// and set the cellI to the face-neighbour
template<class TrackData>
void correctAfterParallelTransfer(const label patchI, TrackData& td);
// I-O
//- Read the fields associated with the owner cloud
static void readFields(Cloud<ParticleType>& c);
template<class CloudType>
static void readFields(CloudType& c);
//- Write the fields associated with the owner cloud
static void writeFields(const Cloud<ParticleType>& c);
template<class CloudType>
static void writeFields(const CloudType& c);
//- Write the particle data
void write(Ostream& os, bool writeFields) const;
// Friend Operators
friend Ostream& operator<< <ParticleType>
(
Ostream&,
const Particle<ParticleType>&
);
friend Ostream& operator<<(Ostream&, const particle&);
friend bool operator== <ParticleType>
(
const Particle<ParticleType>& pA,
const Particle<ParticleType>& pB
);
friend bool operator==(const particle& pA, const particle& pB);
friend bool operator!= <ParticleType>
(
const Particle<ParticleType>& pA,
const Particle<ParticleType>& pB
);
friend bool operator!=(const particle& pA, const particle& pB);
};
@ -609,18 +552,18 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleI.H"
#include "particleI.H"
/*
#define defineParticleTypeNameAndDebug(Type, DebugSwitch) \
template<> \
const Foam::word Particle<Type>::typeName(#Type); \
template<> \
int Particle<Type>::debug(Foam::debug::debugSwitch(#Type, DebugSwitch));
*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Particle.C"
# include "particleTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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
@ -24,11 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParticleType>
inline void Foam::Particle<ParticleType>::findTris
inline void Foam::particle::findTris
(
const vector& position,
DynamicList<label>& faceList,
@ -63,8 +63,7 @@ inline void Foam::Particle<ParticleType>::findTris
}
template<class ParticleType>
inline Foam::scalar Foam::Particle<ParticleType>::tetLambda
inline Foam::scalar Foam::particle::tetLambda
(
const vector& from,
const vector& to,
@ -76,10 +75,9 @@ inline Foam::scalar Foam::Particle<ParticleType>::tetLambda
const label tetPtI
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
const pointField& pPts = mesh.points();
const pointField& pPts = mesh_.points();
if (mesh.moving())
if (mesh_.moving())
{
return movingTetLambda
(
@ -132,9 +130,7 @@ inline Foam::scalar Foam::Particle<ParticleType>::tetLambda
}
template<class ParticleType>
inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
inline Foam::scalar Foam::particle::movingTetLambda
(
const vector& from,
const vector& to,
@ -146,9 +142,8 @@ inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
const label tetPtI
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
const pointField& pPts = mesh.points();
const pointField& oldPPts = mesh.oldPoints();
const pointField& pPts = mesh_.points();
const pointField& oldPPts = mesh_.oldPoints();
// Base point of plane at end of motion
const point& b = pPts[tetPlaneBasePtI];
@ -166,13 +161,13 @@ inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
vector n0 = vector::zero;
{
tetIndices tetIs(cellI, tetFaceI, tetPtI, mesh);
tetIndices tetIs(cellI, tetFaceI, tetPtI, mesh_);
// tet at timestep start
tetPointRef tet00 = tetIs.oldTet(mesh);
tetPointRef tet00 = tetIs.oldTet(mesh_);
// tet at timestep end
tetPointRef tet = tetIs.tet(mesh);
tetPointRef tet = tetIs.tet(mesh_);
point tet0PtA = tet00.a() + stepFraction_*(tet.a() - tet00.a());
point tet0PtB = tet00.b() + stepFraction_*(tet.b() - tet00.b());
@ -329,25 +324,23 @@ inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
}
template<class ParticleType>
inline void Foam::Particle<ParticleType>::tetNeighbour(label triI)
{
const polyMesh& mesh = cloud_.polyMesh_;
const labelList& pOwner = mesh.faceOwner();
const faceList& pFaces = mesh.faces();
inline void Foam::particle::tetNeighbour(label triI)
{
const labelList& pOwner = mesh_.faceOwner();
const faceList& pFaces = mesh_.faces();
bool own = (pOwner[tetFaceI_] == cellI_);
const Foam::face& f = pFaces[tetFaceI_];
label tetBasePtI = mesh.tetBasePtIs()[tetFaceI_];
label tetBasePtI = mesh_.tetBasePtIs()[tetFaceI_];
if (tetBasePtI == -1)
{
FatalErrorIn
(
"inline void Foam::Particle<ParticleType>::tetNeighbour(label triI)"
"inline void Foam::particle::tetNeighbour(label triI)"
)
<< "No base point for face " << tetFaceI_ << ", " << f
<< ", produces a valid tet decomposition."
@ -464,19 +457,18 @@ inline void Foam::Particle<ParticleType>::tetNeighbour(label triI)
FatalErrorIn
(
"inline void "
"Foam::Particle<ParticleType>::tetNeighbour(label triI)"
"Foam::particle::tetNeighbour(label triI)"
)
<< "Tet tri face index error, can only be 0..3, supplied "
<< triI << nl
<< abort(FatalError);
<< triI << abort(FatalError);
break;
}
}
}
template<class ParticleType>
inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace
inline void Foam::particle::crossEdgeConnectedFace
(
const label& cellI,
label& tetFaceI,
@ -484,10 +476,8 @@ inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace
const edge& e
)
{
const polyMesh& mesh = cloud_.polyMesh_;
const faceList& pFaces = mesh.faces();
const cellList& pCells = mesh.cells();
const faceList& pFaces = mesh_.faces();
const cellList& pCells = mesh_.cells();
const Foam::face& f = pFaces[tetFaceI];
@ -536,14 +526,14 @@ inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace
eIndex = findIndex(otherFace, e.end());
}
label tetBasePtI = mesh.tetBasePtIs()[fI];
label tetBasePtI = mesh_.tetBasePtIs()[fI];
if (tetBasePtI == -1)
{
FatalErrorIn
(
"inline void "
"Foam::Particle<ParticleType>::crossEdgeConnectedFace"
"Foam::particle::crossEdgeConnectedFace"
"("
"const label& cellI,"
"label& tetFaceI,"
@ -590,344 +580,117 @@ inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace
}
template<class ParticleType>
inline void Foam::Particle<ParticleType>::hitWallFaces
(
const vector& from,
const vector& to,
scalar& lambdaMin,
tetIndices& closestTetIs
)
{
if (!(cloud_.hasWallImpactDistance() && cloud_.cellHasWallFaces()[cellI_]))
{
return;
}
const polyMesh& mesh = cloud_.polyMesh_;
const faceList& pFaces = mesh.faces();
const ParticleType& p = static_cast<const ParticleType&>(*this);
const Foam::cell& thisCell = mesh.cells()[cellI_];
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(thisCell, cFI)
{
label fI = thisCell[cFI];
if (cloud_.internalFace(fI))
{
continue;
}
label patchI = patches.patchID()[fI - mesh.nInternalFaces()];
if (isA<wallPolyPatch>(patches[patchI]))
{
// Get the decomposition of this wall face
const List<tetIndices>& faceTetIs =
polyMeshTetDecomposition::faceTetIndices(mesh, fI, cellI_);
const Foam::face& f = pFaces[fI];
forAll(faceTetIs, tI)
{
const tetIndices& tetIs = faceTetIs[tI];
triPointRef tri = tetIs.faceTri(mesh);
vector n = tri.normal();
vector nHat = n/mag(n);
// Radius of particle with respect to this wall face
// triangle. Assuming that the wallImpactDistance
// does not change as the particle or the mesh moves
// forward in time.
scalar r = p.wallImpactDistance(nHat);
vector toPlusRNHat = to + r*nHat;
// triI = 0 because it is the cell face tri of the tet
// we are concerned with.
scalar tetClambda = tetLambda
(
tetIs.tet(mesh).centre(),
toPlusRNHat,
0,
n,
f[tetIs.faceBasePt()],
cellI_,
fI,
tetIs.tetPt()
);
if ((tetClambda <= 0.0) || (tetClambda >= 1.0))
{
// toPlusRNHat is not on the outside of the plane of
// the wall face tri, the tri cannot be hit.
continue;
}
// Check if the actual trajectory of the near-tri
// points intersects the triangle.
vector fromPlusRNHat = from + r*nHat;
// triI = 0 because it is the cell face tri of the tet
// we are concerned with.
scalar lambda = tetLambda
(
fromPlusRNHat,
toPlusRNHat,
0,
n,
f[tetIs.faceBasePt()],
cellI_,
fI,
tetIs.tetPt()
);
pointHit hitInfo(vector::zero);
if (mesh.moving())
{
// For a moving mesh, the position of wall
// triangle needs to be moved in time to be
// consistent with the moment defined by the
// current value of stepFraction and the value of
// lambda just calculated.
// Total fraction thought the timestep of the
// motion, including stepFraction before the
// current tracking step and the current
// lambda
// i.e.
// let s = stepFraction, l = lambda
// Motion of x in time:
// |-----------------|---------|---------|
// x00 x0 xi x
//
// where xi is the correct value of x at the required
// tracking instant.
//
// x0 = x00 + s*(x - x00) = s*x + (1 - s)*x00
//
// i.e. the motion covered by previous tracking portions
// within this timestep, and
//
// xi = x0 + l*(x - x0)
// = l*x + (1 - l)*x0
// = l*x + (1 - l)*(s*x + (1 - s)*x00)
// = (s + l - s*l)*x + (1 - (s + l - s*l))*x00
//
// let m = (s + l - s*l)
//
// xi = m*x + (1 - m)*x00 = x00 + m*(x - x00);
//
// In the same form as before.
// Clip lambda to 0.0-1.0 to ensure that sensible
// positions are used for triangle intersections.
scalar lam = max(0.0, min(1.0, lambda));
scalar m = stepFraction_ + lam - (stepFraction_*lam);
triPointRef tri00 = tetIs.oldFaceTri(mesh);
// Use SMALL positive tolerance to make the triangle
// slightly "fat" to improve robustness. Intersection
// is calculated as the ray (from + r*nHat) -> (to +
// r*nHat).
point tPtA = tri00.a() + m*(tri.a() - tri00.a());
point tPtB = tri00.b() + m*(tri.b() - tri00.b());
point tPtC = tri00.c() + m*(tri.c() - tri00.c());
triPointRef t(tPtA, tPtB, tPtC);
// The point fromPlusRNHat + m*(to - from) is on the
// plane of the triangle. Determine the
// intersection with this triangle by testing if
// this point is inside or outside of the triangle.
hitInfo = t.intersection
(
fromPlusRNHat + m*(to - from),
t.normal(),
intersection::FULL_RAY,
SMALL
);
}
else
{
// Use SMALL positive tolerance to make the triangle
// slightly "fat" to improve robustness. Intersection
// is calculated as the ray (from + r*nHat) -> (to +
// r*nHat).
hitInfo = tri.intersection
(
fromPlusRNHat,
(to - from),
intersection::FULL_RAY,
SMALL
);
}
if (hitInfo.hit())
{
if (lambda < lambdaMin)
{
lambdaMin = lambda;
faceI_ = fI;
closestTetIs = tetIs;
}
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
inline Foam::Particle<ParticleType>::trackData::trackData
(
Cloud<ParticleType>& cloud
)
:
cloud_(cloud)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
inline Foam::Cloud<ParticleType>&
Foam::Particle<ParticleType>::trackData::cloud()
inline Foam::label Foam::particle::getNewParticleID() const
{
return cloud_;
label id = particleCount_++;
if (id == labelMax)
{
WarningIn("particle::getNewParticleID() const")
<< "Particle counter has overflowed. This might cause problems"
<< " when reconstructing particle tracks." << endl;
}
return id;
}
template<class ParticleType>
inline const Foam::Cloud<ParticleType>&
Foam::Particle<ParticleType>::cloud() const
inline const Foam::polyMesh& Foam::particle::mesh() const
{
return cloud_;
return mesh_;
}
template<class ParticleType>
inline const Foam::vector& Foam::Particle<ParticleType>::position() const
inline const Foam::vector& Foam::particle::position() const
{
return position_;
}
template<class ParticleType>
inline Foam::vector& Foam::Particle<ParticleType>::position()
inline Foam::vector& Foam::particle::position()
{
return position_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::cell() const
inline Foam::label Foam::particle::cell() const
{
return cellI_;
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::cell()
inline Foam::label& Foam::particle::cell()
{
return cellI_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::tetFace() const
inline Foam::label Foam::particle::tetFace() const
{
return tetFaceI_;
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::tetFace()
inline Foam::label& Foam::particle::tetFace()
{
return tetFaceI_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::tetPt() const
inline Foam::label Foam::particle::tetPt() const
{
return tetPtI_;
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::tetPt()
inline Foam::label& Foam::particle::tetPt()
{
return tetPtI_;
}
template<class ParticleType>
inline Foam::tetIndices Foam::Particle<ParticleType>::currentTetIndices() const
inline Foam::tetIndices Foam::particle::currentTetIndices() const
{
return tetIndices(cellI_, tetFaceI_, tetPtI_, cloud_.polyMesh_);
return tetIndices(cellI_, tetFaceI_, tetPtI_, mesh_);
}
template<class ParticleType>
inline Foam::tetPointRef Foam::Particle<ParticleType>::currentTet() const
inline Foam::tetPointRef Foam::particle::currentTet() const
{
return currentTetIndices().tet(cloud_.polyMesh_);
return currentTetIndices().tet(mesh_);
}
template<class ParticleType>
inline Foam::vector Foam::Particle<ParticleType>::normal() const
inline Foam::vector Foam::particle::normal() const
{
return currentTetIndices().faceTri(cloud_.polyMesh_).normal();
return currentTetIndices().faceTri(mesh_).normal();
}
template<class ParticleType>
inline Foam::vector
Foam::Particle<ParticleType>::oldNormal() const
inline Foam::vector Foam::particle::oldNormal() const
{
return currentTetIndices().oldFaceTri(cloud_.polyMesh_).normal();
return currentTetIndices().oldFaceTri(mesh_).normal();
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::face() const
inline Foam::label Foam::particle::face() const
{
return faceI_;
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::face()
inline Foam::label& Foam::particle::face()
{
return faceI_;
}
template<class ParticleType>
inline void Foam::Particle<ParticleType>::initCellFacePt()
inline void Foam::particle::initCellFacePt()
{
if (cellI_ == -1)
{
cloud_.findCellFacePt
mesh_.findCellFacePt
(
position_,
cellI_,
@ -937,26 +700,20 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
if (cellI_ == -1)
{
FatalErrorIn
(
"Foam::Particle<ParticleType>::Particle"
"("
"void Foam::Particle<ParticleType>::initCellFacePt()"
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< abort(FatalError);
FatalErrorIn("void Foam::particle::initCellFacePt()")
<< "cell, tetFace and tetPt search failure at position "
<< position_ << abort(FatalError);
}
}
else
{
cloud_.findFacePt(cellI_, position_, tetFaceI_, tetPtI_);
mesh_.findTetFacePt(cellI_, position_, tetFaceI_, tetPtI_);
if (tetFaceI_ == -1 || tetPtI_ == -1)
{
label oldCellI = cellI_;
cloud_.findCellFacePt
mesh_.findCellFacePt
(
position_,
cellI_,
@ -970,23 +727,16 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
// number, but hasn't been able to find a cell to
// occupy.
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI, 0.1))
if(!mesh_.pointInCellBB(position_, oldCellI, 0.1))
{
// If the position is not inside the (slightly
// extended) bound-box of the cell that it thought
// it should be in, then this is considered an
// error.
FatalErrorIn
(
"Foam::Particle<ParticleType>::Particle"
"("
"void "
"Foam::Particle<ParticleType>::initCellFacePt()"
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< "for requested cell " << oldCellI << nl
FatalErrorIn("void Foam::particle::initCellFacePt()")
<< "cell, tetFace and tetPt search failure at position "
<< position_ << nl << "for requested cell " << oldCellI
<< abort(FatalError);
}
@ -1005,19 +755,17 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
point newPosition = position_;
const point& cC = cloud_.polyMesh_.cellCentres()[cellI_];
const point& cC = mesh_.cellCentres()[cellI_];
label trap(1.0/Cloud<ParticleType>::trackingCorrectionTol + 1);
label trap(1.0/trackingCorrectionTol + 1);
label iterNo = 0;
do
{
newPosition +=
Cloud<ParticleType>::trackingCorrectionTol
*(cC - position_);
newPosition += trackingCorrectionTol*(cC - position_);
cloud_.findFacePt
mesh_.findTetFacePt
(
cellI_,
newPosition,
@ -1029,27 +777,14 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
} while (tetFaceI_ < 0 && iterNo <= trap);
if(tetFaceI_ == -1)
if (tetFaceI_ == -1)
{
FatalErrorIn
(
"Foam::Particle<ParticleType>::Particle"
"("
"void "
"Foam::Particle<ParticleType>::initCellFacePt()"
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< abort(FatalError);
FatalErrorIn("void Foam::particle::initCellFacePt()")
<< "cell, tetFace and tetPt search failure at position "
<< position_ << abort(FatalError);
}
WarningIn
(
"Foam::Particle<ParticleType>::Particle"
"("
"void Foam::Particle<ParticleType>::initCellFacePt()"
")"
)
WarningIn("void Foam::particle::initCellFacePt()")
<< "Particle moved from " << position_
<< " to " << newPosition
<< " in cell " << cellI_
@ -1067,13 +802,7 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
if (cellI_ != oldCellI)
{
WarningIn
(
"Foam::Particle<ParticleType>::Particle"
"("
"void Foam::Particle<ParticleType>::initCellFacePt()"
")"
)
WarningIn("void Foam::particle::initCellFacePt()")
<< "Particle at position " << position_
<< " searched for a cell, tetFace and tetPt." << nl
<< " Found"
@ -1089,99 +818,100 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
}
template<class ParticleType>
inline bool Foam::Particle<ParticleType>::onBoundary() const
inline bool Foam::particle::onBoundary() const
{
return faceI_ != -1 && faceI_ >= cloud_.pMesh().nInternalFaces();
return faceI_ != -1 && faceI_ >= mesh_.nInternalFaces();
}
template<class ParticleType>
inline Foam::scalar& Foam::Particle<ParticleType>::stepFraction()
inline Foam::scalar& Foam::particle::stepFraction()
{
return stepFraction_;
}
template<class ParticleType>
inline Foam::scalar Foam::Particle<ParticleType>::stepFraction() const
inline Foam::scalar Foam::particle::stepFraction() const
{
return stepFraction_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::origProc() const
inline Foam::label Foam::particle::origProc() const
{
return origProc_;
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::origProc()
inline Foam::label& Foam::particle::origProc()
{
return origProc_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::origId() const
inline Foam::label Foam::particle::origId() const
{
return origId_;
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::origId()
inline Foam::label& Foam::particle::origId()
{
return origId_;
}
template<class ParticleType>
inline bool Foam::Particle<ParticleType>::softImpact() const
inline bool Foam::particle::softImpact() const
{
return false;
}
template<class ParticleType>
inline Foam::scalar Foam::Particle<ParticleType>::currentTime() const
inline Foam::scalar Foam::particle::currentTime() const
{
return
cloud_.pMesh().time().value()
+ stepFraction_*cloud_.pMesh().time().deltaTValue();
mesh_.time().value()
+ stepFraction_*mesh_.time().deltaTValue();
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::patch(const label faceI) const
inline bool Foam::particle::internalFace(const label faceI) const
{
return cloud_.facePatch(faceI);
return mesh_.isInternalFace(faceI);
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::patchFace
bool Foam::particle::boundaryFace(const label faceI) const
{
return !internalFace(faceI);
}
inline Foam::label Foam::particle::patch(const label faceI) const
{
// return cloud_.facePatch(faceI);
return mesh_.boundaryMesh().whichPatch(faceI);
}
inline Foam::label Foam::particle::patchFace
(
const label patchI,
const label faceI
) const
{
return cloud_.patchFace(patchI, faceI);
// return cloud_.patchFace(patchI, faceI);
return mesh_.boundaryMesh()[patchI].whichFace(faceI);
}
template<class ParticleType>
inline Foam::scalar
Foam::Particle<ParticleType>::wallImpactDistance(const vector&) const
Foam::particle::wallImpactDistance(const vector&) const
{
return 0.0;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::faceInterpolation() const
inline Foam::label Foam::particle::faceInterpolation() const
{
return faceI_;
}

View File

@ -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
@ -23,28 +23,21 @@ License
\*---------------------------------------------------------------------------*/
#include "Particle.H"
#include "particle.H"
#include "IOstreams.H"
#include "IOPosition.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::string Foam::Particle<ParticleType>::propHeader =
Foam::string Foam::particle::propHeader =
"(Px Py Pz) cellI tetFaceI tetPtI origProc origId";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
Foam::Particle<ParticleType>::Particle
(
const Cloud<ParticleType>& cloud,
Istream& is,
bool readFields
)
Foam::particle::particle(const polyMesh& mesh, Istream& is, bool readFields)
:
cloud_(cloud),
mesh_(mesh),
position_(),
cellI_(-1),
faceI_(-1),
@ -97,81 +90,11 @@ Foam::Particle<ParticleType>::Particle
}
// Check state of Istream
is.check("Particle<ParticleType>::Particle(Istream&)");
is.check("particle::particle(Istream&, bool)");
}
template<class ParticleType>
void Foam::Particle<ParticleType>::readFields
(
Cloud<ParticleType>& c
)
{
if (!c.size())
{
return;
}
IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ));
if (procIO.headerOk())
{
IOField<label> origProcId(procIO);
c.checkFieldIOobject(c, origProcId);
IOField<label> origId(c.fieldIOobject("origId", IOobject::MUST_READ));
c.checkFieldIOobject(c, origId);
label i = 0;
forAllIter(typename Cloud<ParticleType>, c, iter)
{
ParticleType& p = iter();
p.origProc_ = origProcId[i];
p.origId_ = origId[i];
i++;
}
}
}
template<class ParticleType>
void Foam::Particle<ParticleType>::writeFields
(
const Cloud<ParticleType>& c
)
{
// Write the cloud position file
IOPosition<ParticleType> ioP(c);
ioP.write();
label np = c.size();
IOField<label> origProc
(
c.fieldIOobject
(
"origProcId",
IOobject::NO_READ
),
np
);
IOField<label> origId(c.fieldIOobject("origId", IOobject::NO_READ), np);
label i = 0;
forAllConstIter(typename Cloud<ParticleType>, c, iter)
{
origProc[i] = iter().origProc_;
origId[i] = iter().origId_;
i++;
}
origProc.write();
origId.write();
}
template<class ParticleType>
void Foam::Particle<ParticleType>::write(Ostream& os, bool writeFields) const
void Foam::particle::write(Ostream& os, bool writeFields) const
{
if (os.format() == IOstream::ASCII)
{
@ -223,12 +146,11 @@ void Foam::Particle<ParticleType>::write(Ostream& os, bool writeFields) const
}
// Check state of Ostream
os.check("Particle<ParticleType>::write(Ostream& os, bool) const");
os.check("particle::write(Ostream& os, bool) const");
}
template<class ParticleType>
Foam::Ostream& Foam::operator<<(Ostream& os, const Particle<ParticleType>& p)
Foam::Ostream& Foam::operator<<(Ostream& os, const particle& p)
{
// Write all data
p.write(os, true);

View File

@ -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) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,19 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "Particle.H"
#include "Cloud.H"
#include "wedgePolyPatch.H"
#include "symmetryPolyPatch.H"
#include "IOPosition.H"
#include "cyclicPolyPatch.H"
#include "processorPolyPatch.H"
#include "transform.H"
#include "symmetryPolyPatch.H"
#include "wallPolyPatch.H"
#include "wedgePolyPatch.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::prepareForParallelTransfer
void Foam::particle::prepareForParallelTransfer
(
const label patchI,
TrackData& td
@ -46,17 +45,15 @@ void Foam::Particle<ParticleType>::prepareForParallelTransfer
}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::correctAfterParallelTransfer
void Foam::particle::correctAfterParallelTransfer
(
const label patchI,
TrackData& td
)
{
const processorPolyPatch& ppp =
refCast<const processorPolyPatch>
(cloud_.pMesh().boundaryMesh()[patchI]);
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
cellI_ = ppp.faceCells()[faceI_];
@ -70,7 +67,7 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
);
transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T);
transformProperties(T);
}
else if (ppp.separated())
{
@ -81,10 +78,7 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
: ppp.separation()[faceI_]
);
position_ -= s;
static_cast<ParticleType&>(*this).transformProperties
(
-s
);
transformProperties(-s);
}
tetFaceI_ = faceI_ + ppp.start();
@ -110,7 +104,7 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
// This relationship can be verified for other points and sizes of
// face.
tetPtI_ = cloud_.polyMesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
tetPtI_ = mesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
// Reset the face index for the next tracking operation
if (stepFraction_ > (1.0 - SMALL))
@ -125,99 +119,69 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
Foam::Particle<ParticleType>::Particle
(
const Cloud<ParticleType>& cloud,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
)
:
cloud_(cloud),
position_(position),
cellI_(cellI),
faceI_(-1),
stepFraction_(0.0),
tetFaceI_(tetFaceI),
tetPtI_(tetPtI),
origProc_(Pstream::myProcNo()),
origId_(cloud_.getNewParticleID())
{}
template<class ParticleType>
Foam::Particle<ParticleType>::Particle
(
const Cloud<ParticleType>& cloud,
const vector& position,
const label cellI,
bool doCellFacePt
)
:
cloud_(cloud),
position_(position),
cellI_(cellI),
faceI_(-1),
stepFraction_(0.0),
tetFaceI_(-1),
tetPtI_(-1),
origProc_(Pstream::myProcNo()),
origId_(cloud_.getNewParticleID())
template<class CloudType>
void Foam::particle::readFields(CloudType& c)
{
if (doCellFacePt)
if (!c.size())
{
initCellFacePt();
return;
}
IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ));
if (procIO.headerOk())
{
IOField<label> origProcId(procIO);
c.checkFieldIOobject(c, origProcId);
IOField<label> origId(c.fieldIOobject("origId", IOobject::MUST_READ));
c.checkFieldIOobject(c, origId);
label i = 0;
forAllIter(typename CloudType, c, iter)
{
particle& p = iter();
p.origProc_ = origProcId[i];
p.origId_ = origId[i];
i++;
}
}
}
template<class ParticleType>
Foam::Particle<ParticleType>::Particle(const Particle<ParticleType>& p)
:
cloud_(p.cloud_),
position_(p.position_),
cellI_(p.cellI_),
faceI_(p.faceI_),
stepFraction_(p.stepFraction_),
tetFaceI_(p.tetFaceI_),
tetPtI_(p.tetPtI_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
template<class CloudType>
void Foam::particle::writeFields(const CloudType& c)
{
// Write the cloud position file
IOPosition<CloudType> ioP(c);
ioP.write();
label np = c.size();
IOField<label> origProc
(
c.fieldIOobject("origProcId", IOobject::NO_READ),
np
);
IOField<label> origId(c.fieldIOobject("origId", IOobject::NO_READ), np);
label i = 0;
forAllConstIter(typename CloudType, c, iter)
{
origProc[i] = iter().origProc_;
origId[i] = iter().origId_;
i++;
}
origProc.write();
origId.write();
}
template<class ParticleType>
Foam::Particle<ParticleType>::Particle
(
const Particle<ParticleType>& p,
const Cloud<ParticleType>& c
)
:
cloud_(c),
position_(p.position_),
cellI_(p.cellI_),
faceI_(p.faceI_),
stepFraction_(p.stepFraction_),
tetFaceI_(p.tetFaceI_),
tetPtI_(p.tetPtI_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
template<class TrackData>
Foam::label Foam::Particle<ParticleType>::track
(
const vector& endPosition,
TrackData& td
)
Foam::label Foam::particle::track(const vector& endPosition, TrackData& td)
{
faceI_ = -1;
@ -231,28 +195,22 @@ Foam::label Foam::Particle<ParticleType>::track
}
template<class ParticleType>
Foam::label Foam::Particle<ParticleType>::track(const vector& endPosition)
{
int dummyTd;
return track(endPosition, dummyTd);
}
template<class ParticleType>
template<class TrackData>
Foam::scalar Foam::Particle<ParticleType>::trackToFace
Foam::scalar Foam::particle::trackToFace
(
const vector& endPosition,
TrackData& td
)
{
const polyMesh& mesh = cloud_.polyMesh_;
typedef typename TrackData::cloudType cloudType;
typedef typename cloudType::particleType particleType;
const faceList& pFaces = mesh.faces();
const pointField& pPts = mesh.points();
const vectorField& pC = mesh.cellCentres();
cloudType& cloud = td.cloud();
const faceList& pFaces = mesh_.faces();
const pointField& pPts = mesh_.points();
const vectorField& pC = mesh_.cellCentres();
faceI_ = -1;
@ -317,7 +275,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// current tet centre.
scalar lambdaMin = VGREAT;
DynamicList<label>& tris = cloud_.labels_;
DynamicList<label>& tris = cloud.labels();
// Tet indices that will be set by hitWallFaces if a wall face is
// to be hit, or are set when any wall tri of a tet is hit.
@ -336,9 +294,9 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
const Foam::face& f = pFaces[tetFaceI_];
bool own = (mesh.faceOwner()[tetFaceI_] == cellI_);
bool own = (mesh_.faceOwner()[tetFaceI_] == cellI_);
label tetBasePtI = mesh.tetBasePtIs()[tetFaceI_];
label tetBasePtI = mesh_.tetBasePtIs()[tetFaceI_];
label basePtI = f[tetBasePtI];
@ -376,9 +334,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
Pout<< "tracking rescue using tetCentre from " << position();
}
position_ +=
Cloud<ParticleType>::trackingCorrectionTol
*(tet.centre() - position_);
position_ += trackingCorrectionTol*(tet.centre() - position_);
if (debug)
{
@ -386,12 +342,12 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
<< (tet.centre() - position_) << endl;
}
cloud_.trackingRescue();
cloud.trackingRescue();
return trackFraction;
}
if (triI != -1 && mesh.moving())
if (triI != -1 && mesh_.moving())
{
// Mesh motion requires stepFraction to be correct for
// each tracking portion, so trackToFace must return after
@ -423,7 +379,14 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// Sets a value for lambdaMin and faceI_ if a wall face is hit
// by the track.
hitWallFaces(position_, endPosition, lambdaMin, faceHitTetIs);
hitWallFaces
(
cloud,
position_,
endPosition,
lambdaMin,
faceHitTetIs
);
// Did not hit any tet tri faces, and no wall face has been
// found to hit.
@ -544,10 +507,10 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
} while (faceI_ < 0);
ParticleType& p = static_cast<ParticleType&>(*this);
particleType& p = static_cast<particleType&>(*this);
p.hitFace(td);
if (cloud_.internalFace(faceI_))
if (internalFace(faceI_))
{
// Change tet ownership because a tri face has been crossed,
// in general this is:
@ -556,21 +519,18 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// No modifications are required for triI = 0, no call required to
// tetNeighbour(0);
if (cellI_ == mesh.faceOwner()[faceI_])
if (cellI_ == mesh_.faceOwner()[faceI_])
{
cellI_ = mesh.faceNeighbour()[faceI_];
cellI_ = mesh_.faceNeighbour()[faceI_];
}
else if (cellI_ == mesh.faceNeighbour()[faceI_])
else if (cellI_ == mesh_.faceNeighbour()[faceI_])
{
cellI_ = mesh.faceOwner()[faceI_];
cellI_ = mesh_.faceOwner()[faceI_];
}
else
{
FatalErrorIn
(
"Particle::trackToFace(const vector&, TrackData&)"
) << "addressing failure" << nl
<< abort(FatalError);
FatalErrorIn("Particle::trackToFace(const vector&, TrackData&)")
<< "addressing failure" << abort(FatalError);
}
}
else
@ -585,7 +545,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
(
!p.hitPatch
(
mesh.boundaryMesh()[patchI],
mesh_.boundaryMesh()[patchI],
td,
patchI,
trackFraction,
@ -599,7 +559,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
patchI = patch(faceI_);
}
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<wedgePolyPatch>(patch))
{
@ -656,22 +616,20 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
<< "from " << position();
}
position_ +=
Cloud<ParticleType>::trackingCorrectionTol
*(tet.centre() - position_);
position_ += trackingCorrectionTol*(tet.centre() - position_);
if
(
cloud_.hasWallImpactDistance()
&& !cloud_.internalFace(faceHitTetIs.face())
&& cloud_.cellHasWallFaces()[faceHitTetIs.cell()]
cloud.hasWallImpactDistance()
&& !internalFace(faceHitTetIs.face())
&& cloud.cellHasWallFaces()[faceHitTetIs.cell()]
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
label fI = faceHitTetIs.face();
label patchI = patches.patchID()[fI - mesh.nInternalFaces()];
label patchI = patches.patchID()[fI - mesh_.nInternalFaces()];
if (isA<wallPolyPatch>(patches[patchI]))
{
@ -686,9 +644,9 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// position that hit the wall that is in need of a
// rescue correction.
triPointRef wallTri = faceHitTetIs.faceTri(mesh);
triPointRef wallTri = faceHitTetIs.faceTri(mesh_);
tetPointRef wallTet = faceHitTetIs.tet(mesh);
tetPointRef wallTet = faceHitTetIs.tet(mesh_);
vector nHat = wallTri.normal();
nHat /= mag(nHat);
@ -701,7 +659,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// normal direction is larger towards the wall than
// the new correction is away from it.
position_ +=
Cloud<ParticleType>::trackingCorrectionTol
trackingCorrectionTol
*(
(wallTet.centre() - (position_ + r*nHat))
- (nHat & (tet.centre() - position_))*nHat
@ -714,50 +672,221 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
Pout<< " to " << position() << endl;
}
cloud_.trackingRescue();
cloud.trackingRescue();
}
return trackFraction;
}
template<class ParticleType>
Foam::scalar Foam::Particle<ParticleType>::trackToFace
template<class CloudType>
void Foam::particle::hitWallFaces
(
const vector& endPosition
const CloudType& cloud,
const vector& from,
const vector& to,
scalar& lambdaMin,
tetIndices& closestTetIs
)
{
int dummyTd;
return trackToFace(endPosition, dummyTd);
if (!(cloud.hasWallImpactDistance() && cloud.cellHasWallFaces()[cellI_]))
{
return;
}
const faceList& pFaces = mesh_.faces();
const Foam::cell& thisCell = mesh_.cells()[cellI_];
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
forAll(thisCell, cFI)
{
label fI = thisCell[cFI];
if (internalFace(fI))
{
continue;
}
label patchI = patches.patchID()[fI - mesh_.nInternalFaces()];
if (isA<wallPolyPatch>(patches[patchI]))
{
// Get the decomposition of this wall face
const List<tetIndices>& faceTetIs =
polyMeshTetDecomposition::faceTetIndices(mesh_, fI, cellI_);
const Foam::face& f = pFaces[fI];
forAll(faceTetIs, tI)
{
const tetIndices& tetIs = faceTetIs[tI];
triPointRef tri = tetIs.faceTri(mesh_);
vector n = tri.normal();
vector nHat = n/mag(n);
// Radius of particle with respect to this wall face
// triangle. Assuming that the wallImpactDistance
// does not change as the particle or the mesh moves
// forward in time.
scalar r = wallImpactDistance(nHat);
vector toPlusRNHat = to + r*nHat;
// triI = 0 because it is the cell face tri of the tet
// we are concerned with.
scalar tetClambda = tetLambda
(
tetIs.tet(mesh_).centre(),
toPlusRNHat,
0,
n,
f[tetIs.faceBasePt()],
cellI_,
fI,
tetIs.tetPt()
);
if ((tetClambda <= 0.0) || (tetClambda >= 1.0))
{
// toPlusRNHat is not on the outside of the plane of
// the wall face tri, the tri cannot be hit.
continue;
}
// Check if the actual trajectory of the near-tri
// points intersects the triangle.
vector fromPlusRNHat = from + r*nHat;
// triI = 0 because it is the cell face tri of the tet
// we are concerned with.
scalar lambda = tetLambda
(
fromPlusRNHat,
toPlusRNHat,
0,
n,
f[tetIs.faceBasePt()],
cellI_,
fI,
tetIs.tetPt()
);
pointHit hitInfo(vector::zero);
if (mesh_.moving())
{
// For a moving mesh, the position of wall
// triangle needs to be moved in time to be
// consistent with the moment defined by the
// current value of stepFraction and the value of
// lambda just calculated.
// Total fraction thought the timestep of the
// motion, including stepFraction before the
// current tracking step and the current
// lambda
// i.e.
// let s = stepFraction, l = lambda
// Motion of x in time:
// |-----------------|---------|---------|
// x00 x0 xi x
//
// where xi is the correct value of x at the required
// tracking instant.
//
// x0 = x00 + s*(x - x00) = s*x + (1 - s)*x00
//
// i.e. the motion covered by previous tracking portions
// within this timestep, and
//
// xi = x0 + l*(x - x0)
// = l*x + (1 - l)*x0
// = l*x + (1 - l)*(s*x + (1 - s)*x00)
// = (s + l - s*l)*x + (1 - (s + l - s*l))*x00
//
// let m = (s + l - s*l)
//
// xi = m*x + (1 - m)*x00 = x00 + m*(x - x00);
//
// In the same form as before.
// Clip lambda to 0.0-1.0 to ensure that sensible
// positions are used for triangle intersections.
scalar lam = max(0.0, min(1.0, lambda));
scalar m = stepFraction_ + lam - (stepFraction_*lam);
triPointRef tri00 = tetIs.oldFaceTri(mesh_);
// Use SMALL positive tolerance to make the triangle
// slightly "fat" to improve robustness. Intersection
// is calculated as the ray (from + r*nHat) -> (to +
// r*nHat).
point tPtA = tri00.a() + m*(tri.a() - tri00.a());
point tPtB = tri00.b() + m*(tri.b() - tri00.b());
point tPtC = tri00.c() + m*(tri.c() - tri00.c());
triPointRef t(tPtA, tPtB, tPtC);
// The point fromPlusRNHat + m*(to - from) is on the
// plane of the triangle. Determine the
// intersection with this triangle by testing if
// this point is inside or outside of the triangle.
hitInfo = t.intersection
(
fromPlusRNHat + m*(to - from),
t.normal(),
intersection::FULL_RAY,
SMALL
);
}
else
{
// Use SMALL positive tolerance to make the triangle
// slightly "fat" to improve robustness. Intersection
// is calculated as the ray (from + r*nHat) -> (to +
// r*nHat).
hitInfo = tri.intersection
(
fromPlusRNHat,
(to - from),
intersection::FULL_RAY,
SMALL
);
}
if (hitInfo.hit())
{
if (lambda < lambdaMin)
{
lambdaMin = lambda;
faceI_ = fI;
closestTetIs = tetIs;
}
}
}
}
}
}
template<class ParticleType>
void Foam::Particle<ParticleType>::transformPosition(const tensor& T)
{
position_ = transform(T, position_);
}
template<class ParticleType>
void Foam::Particle<ParticleType>::transformProperties(const tensor&)
{}
template<class ParticleType>
void Foam::Particle<ParticleType>::transformProperties(const vector&)
{}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitFace(TrackData&)
void Foam::particle::hitFace(TrackData&)
{}
template<class ParticleType>
template<class TrackData>
bool Foam::Particle<ParticleType>::hitPatch
bool Foam::particle::hitPatch
(
const polyPatch&,
TrackData&,
@ -770,9 +899,8 @@ bool Foam::Particle<ParticleType>::hitPatch
}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitWedgePatch
void Foam::particle::hitWedgePatch
(
const wedgePolyPatch& wpp,
TrackData&
@ -780,7 +908,7 @@ void Foam::Particle<ParticleType>::hitWedgePatch
{
FatalErrorIn
(
"void Foam::Particle<ParticleType>::hitWedgePatch"
"void Foam::particle::hitWedgePatch"
"("
"const wedgePolyPatch& wpp, "
"TrackData&"
@ -791,13 +919,12 @@ void Foam::Particle<ParticleType>::hitWedgePatch
vector nf = normal();
nf /= mag(nf);
static_cast<ParticleType&>(*this).transformProperties(I - 2.0*nf*nf);
transformProperties(I - 2.0*nf*nf);
}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitSymmetryPatch
void Foam::particle::hitSymmetryPatch
(
const symmetryPolyPatch& spp,
TrackData&
@ -806,28 +933,25 @@ void Foam::Particle<ParticleType>::hitSymmetryPatch
vector nf = normal();
nf /= mag(nf);
static_cast<ParticleType&>(*this).transformProperties(I - 2.0*nf*nf);
transformProperties(I - 2.0*nf*nf);
}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitCyclicPatch
void Foam::particle::hitCyclicPatch
(
const cyclicPolyPatch& cpp,
TrackData&
TrackData& td
)
{
// label patchFaceI_ = cpp.whichFace(faceI_);
faceI_ = cpp.transformGlobalFace(faceI_);
cellI_ = cloud_.polyMesh_.faceOwner()[faceI_];
cellI_ = mesh_.faceOwner()[faceI_];
tetFaceI_ = faceI_;
// See note in correctAfterParallelTransfer for tetPtI_ addressing.
tetPtI_ = cloud_.polyMesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
tetPtI_ = mesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
@ -843,7 +967,7 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
);
transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T);
transformProperties(T);
}
else if (receiveCpp.separated())
{
@ -854,75 +978,29 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
: receiveCpp.separation()[receiveCpp.whichFace(faceI_)]
);
position_ -= s;
static_cast<ParticleType&>(*this).transformProperties
(
-s
);
transformProperties(-s);
}
}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitProcessorPatch
(
const processorPolyPatch& spp,
TrackData& td
)
void Foam::particle::hitProcessorPatch(const processorPolyPatch&, TrackData&)
{}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitWallPatch
void Foam::particle::hitWallPatch
(
const wallPolyPatch& spp,
const wallPolyPatch&,
TrackData&,
const tetIndices&
)
{}
template<class ParticleType>
template<class TrackData>
void Foam::Particle<ParticleType>::hitPatch
(
const polyPatch& spp,
TrackData&
)
void Foam::particle::hitPatch(const polyPatch&, TrackData&)
{}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
template<class ParticleType>
bool Foam::operator==
(
const Particle<ParticleType>& pA,
const Particle<ParticleType>& pB
)
{
return
(
pA.origProc() == pB.origProc()
&& pA.origId() == pB.origId()
);
}
template<class ParticleType>
bool Foam::operator!=
(
const Particle<ParticleType>& pA,
const Particle<ParticleType>& pB
)
{
return !(pA == pB);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleIO.C"
// ************************************************************************* //

View File

@ -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,15 +25,17 @@ Class
Foam::passiveParticle
Description
Copy of base particle
SourceFiles
passiveParticle.H
\*---------------------------------------------------------------------------*/
#ifndef passiveParticle_H
#define passiveParticle_H
#include "Particle.H"
#include "particle.H"
#include "IOstream.H"
#include "autoPtr.H"
@ -48,7 +50,7 @@ namespace Foam
class passiveParticle
:
public Particle<passiveParticle>
public particle
{
public:
@ -58,53 +60,50 @@ public:
//- Construct from components
passiveParticle
(
const Cloud<passiveParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
)
:
Particle<passiveParticle>(c, position, cellI, tetFaceI, tetPtI)
particle(mesh, position, cellI, tetFaceI, tetPtI)
{}
//- Construct from components, with searching for tetFace and
// tetPt unless disabled by doCellFacePt = false.
passiveParticle
(
const Cloud<passiveParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
bool doCellFacePt = true
)
:
Particle<passiveParticle>(c, position, cellI, doCellFacePt)
particle(mesh, position, cellI, doCellFacePt)
{}
//- Construct from Istream
passiveParticle
(
const Cloud<passiveParticle>& c,
const polyMesh& mesh,
Istream& is,
bool readFields = true
)
:
Particle<passiveParticle>(c, is, readFields)
particle(mesh, is, readFields)
{}
//- Construct as copy
passiveParticle(const passiveParticle& p)
:
Particle<passiveParticle>(p)
particle(p)
{}
//- Construct and return a clone
virtual autoPtr<Particle<passiveParticle> > clone() const
virtual autoPtr<particle> clone() const
{
return autoPtr<Particle<passiveParticle> >
(
new passiveParticle(*this)
);
return autoPtr<particle>(new passiveParticle(*this));
}
};

View File

@ -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,7 +29,6 @@ License
namespace Foam
{
defineParticleTypeNameAndDebug(passiveParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<passiveParticle>, 0);
}

View File

@ -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
@ -62,9 +62,6 @@ class passiveParticleCloud
public:
//- Type of parcel the cloud was instantiated for
typedef passiveParticle parcelType;
// Constructors
//- Construct given mesh

View File

@ -1,6 +1,4 @@
/* Coal parcel and sub-models */
coalParcel/coalParcel.C
coalParcel/defineCoalParcel.C
coalParcel/makeCoalParcelSubmodels.C
LIB = $(FOAM_LIBBIN)/libcoalCombustion

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,13 +25,17 @@ Class
CoalCloud
Description
Coal cloud
Cloud class to introduce coal parcels
\*---------------------------------------------------------------------------*/
#ifndef coalCloud_H
#define coalCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "ThermoCloud.H"
#include "ReactingCloud.H"
#include "ReactingMultiphaseCloud.H"
#include "coalParcel.H"
@ -39,7 +43,22 @@ Description
namespace Foam
{
typedef ReactingMultiphaseCloud<coalParcel> coalCloud;
typedef ReactingMultiphaseCloud
<
ReactingCloud
<
ThermoCloud
<
KinematicCloud
<
Cloud
<
coalParcel
>
>
>
>
> coalCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,130 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 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 "coalParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coalParcel::coalParcel
(
ReactingMultiphaseCloud<coalParcel>& owner,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
)
:
ReactingMultiphaseParcel<coalParcel>
(
owner,
position,
cellI,
tetFaceI,
tetPtI
)
{}
Foam::coalParcel::coalParcel
(
ReactingMultiphaseCloud<coalParcel>& 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& pi0,
const vector& tau0,
const scalarField& YMixture0,
const scalarField& YGas0,
const scalarField& YLiquid0,
const scalarField& YSolid0,
const ReactingMultiphaseParcel<coalParcel>::constantProperties& constProps
)
:
ReactingMultiphaseParcel<coalParcel>
(
owner,
position,
cellI,
tetFaceI,
tetPtI,
typeId,
nParticle0,
d0,
dTarget0,
U0,
f0,
pi0,
tau0,
YMixture0,
YGas0,
YLiquid0,
YSolid0,
constProps
)
{}
Foam::coalParcel::coalParcel
(
const Cloud<coalParcel>& cloud,
Istream& is,
bool readFields
)
:
ReactingMultiphaseParcel<coalParcel>(cloud, is, readFields)
{}
Foam::coalParcel::coalParcel(const coalParcel& p)
:
ReactingMultiphaseParcel<coalParcel>(p)
{
}
Foam::coalParcel::coalParcel
(
const coalParcel& p,
const ReactingMultiphaseCloud<coalParcel>& c
)
:
ReactingMultiphaseParcel<coalParcel>(p, c)
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::coalParcel::~coalParcel()
{}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
coalParcel
Description
Coal parcel class
Definition of coal parcel
SourceFiles
CoalParcel.C
@ -35,112 +35,37 @@ SourceFiles
#ifndef coalParcel_H
#define coalParcel_H
#include "contiguous.H"
#include "particle.H"
#include "KinematicParcel.H"
#include "ThermoParcel.H"
#include "ReactingParcel.H"
#include "ReactingMultiphaseParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef ReactingMultiphaseParcel
<
ReactingParcel
<
ThermoParcel
<
KinematicParcel
<
particle
>
>
>
> coalParcel;
/*---------------------------------------------------------------------------*\
Class coalParcel Declaration
\*---------------------------------------------------------------------------*/
class coalParcel
:
public ReactingMultiphaseParcel<coalParcel>
{
public:
// Run-time type information
TypeName("coalParcel");
// Constructors
//- Construct from owner, position, and cloud owner
// Other properties initialised as null
coalParcel
(
ReactingMultiphaseCloud<coalParcel>& owner,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
);
//- Construct from components
coalParcel
(
ReactingMultiphaseCloud<coalParcel>& 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& pi0,
const vector& tau0,
const scalarField& YMixture0,
const scalarField& YGas0,
const scalarField& YLiquid0,
const scalarField& YSolid0,
const ReactingMultiphaseParcel<coalParcel>::constantProperties&
constProps
);
//- Construct from Istream
coalParcel
(
const Cloud<coalParcel>& c,
Istream& is,
bool readFields = true
);
//- Construct as a copy
coalParcel(const coalParcel& p);
//- Construct as a copy
coalParcel
(
const coalParcel& p,
const ReactingMultiphaseCloud<coalParcel>& c
);
//- Construct and return a (basic particle) clone
virtual autoPtr<Particle<coalParcel> > clone() const
{
return autoPtr<Particle<coalParcel> >(new coalParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<Particle<coalParcel> > clone
(
const Cloud<coalParcel>& c
) const
{
return autoPtr<Particle<coalParcel> >
(
new coalParcel
(
*this,
static_cast<const ReactingMultiphaseCloud<coalParcel>&>(c)
)
);
}
//- Destructor
virtual ~coalParcel();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
template<>
inline bool contiguous<coalParcel>()
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,13 +23,12 @@ License
\*---------------------------------------------------------------------------*/
#include "coalParcel.H"
#include "coalCloud.H"
// Kinematic
#include "makeThermoParcelForces.H" // thermo variant
#include "makeParcelDispersionModels.H"
#include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant
#include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H"
#include "makeParcelPostProcessingModels.H"
@ -51,25 +50,28 @@ License
namespace Foam
{
typedef coalCloud::cloudType coalCloud_R;
typedef coalCloud_R::cloudType coalCloud_T;
typedef coalCloud_T::cloudType coalCloud_K;
// Kinematic sub-models
makeThermoParcelForces(coalParcel);
makeParcelDispersionModels(coalParcel);
makeReactingMultiphaseParcelInjectionModels(coalParcel);
makeParcelCollisionModels(coalParcel);
makeParcelPatchInteractionModels(coalParcel);
makeParcelPostProcessingModels(coalParcel);
makeThermoParcelForces(coalCloud_K);
makeParcelDispersionModels(coalCloud_K);
makeReactingMultiphaseParcelInjectionModels(coalCloud_K);
makeParcelPatchInteractionModels(coalCloud_K);
makeParcelPostProcessingModels(coalCloud_K);
// Thermo sub-models
makeParcelHeatTransferModels(coalParcel);
makeParcelHeatTransferModels(coalCloud_T);
// Reacting sub-models
makeReactingMultiphaseParcelCompositionModels(coalParcel);
makeReactingParcelPhaseChangeModels(coalParcel);
makeReactingMultiphaseParcelCompositionModels(coalCloud_R);
makeReactingParcelPhaseChangeModels(coalCloud_R);
// Reacting multiphase sub-models
makeReactingMultiphaseParcelDevolatilisationModels(coalParcel);
makeReactingParcelSurfaceFilmModels(coalParcel);
makeCoalParcelSurfaceReactionModels(coalParcel);
makeReactingMultiphaseParcelDevolatilisationModels(coalCloud);
makeReactingParcelSurfaceFilmModels(coalCloud_K);
makeCoalParcelSurfaceReactionModels(coalCloud);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,8 +28,6 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ReactingMultiphaseCloud.H"
#include "NoSurfaceReaction.H"
#include "COxidationDiffusionLimitedRate.H"
#include "COxidationKineticDiffusionLimitedRate.H"
@ -37,34 +35,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCoalParcelSurfaceReactionModels(ParcelType) \
#define makeCoalParcelSurfaceReactionModels(CloudType) \
\
makeSurfaceReactionModel(ReactingMultiphaseCloud<ParcelType>); \
\
makeSurfaceReactionModelType \
( \
NoSurfaceReaction, \
ReactingMultiphaseCloud, \
ParcelType \
); \
makeSurfaceReactionModelType \
( \
COxidationDiffusionLimitedRate, \
ReactingMultiphaseCloud, \
ParcelType \
); \
makeSurfaceReactionModel(CloudType); \
makeSurfaceReactionModelType(NoSurfaceReaction, CloudType); \
makeSurfaceReactionModelType(COxidationDiffusionLimitedRate, CloudType); \
makeSurfaceReactionModelType \
( \
COxidationKineticDiffusionLimitedRate, \
ReactingMultiphaseCloud, \
ParcelType \
CloudType \
); \
makeSurfaceReactionModelType \
( \
COxidationMurphyShaddix, \
ReactingMultiphaseCloud, \
ParcelType \
);
makeSurfaceReactionModelType(COxidationMurphyShaddix, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,6 +1,6 @@
if (isA<wallPolyPatch>(pbMesh[patch(face())]))
{
keepParcel = sDB.wall().wallTreatment(*this, face());
td.keepParticle = sDB.wall().wallTreatment(*this, face());
if (sDB.twoD())
{
@ -50,5 +50,5 @@ else if (isA<symmetryPolyPatch>(pbMesh[patch(face())]))
else if (isType<polyPatch>(pbMesh[patch(face())]))
{
// Parcel has hit an inlet or outlet or some such so throw it away
keepParcel = false;
td.keepParticle = false;
}

View File

@ -35,19 +35,11 @@ License
#include "processorPolyPatch.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::parcel::parcel
(
const Cloud<parcel>& cloud,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
@ -69,11 +61,8 @@ Foam::parcel::parcel
const List<word>& liquidNames
)
:
Particle<parcel>(cloud, position, cellI, tetFaceI, tetPtI),
liquidComponents_
(
liquidNames
),
particle(mesh, position, cellI, tetFaceI, tetPtI),
liquidComponents_(liquidNames),
d_(d),
T_(T),
m_(m),
@ -94,11 +83,14 @@ Foam::parcel::parcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::parcel::move(spray& sDB, const scalar trackTime)
bool Foam::parcel::move(trackingData& td, const scalar trackTime)
{
const polyMesh& mesh = cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
td.switchProcessor = false;
td.keepParticle = true;
const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
spray& sDB = td.cloud();
const liquidMixtureProperties& fuels = sDB.fuels();
label Nf = fuels.components().size();
@ -139,8 +131,6 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
scalarField tauEvaporation(Nf, GREAT);
scalarField tauBoiling(Nf, GREAT);
bool keepParcel = true;
setRelaxationTimes
(
cell(),
@ -185,7 +175,6 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
// (10 000 seems high enough)
dtMax = max(dtMax, 1.0e-4*tEnd);
bool switchProcessor = false;
vector planeNormal = vector::zero;
if (sDB.twoD())
{
@ -194,7 +183,7 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
}
// move the parcel until there is no 'timeLeft'
while (keepParcel && tEnd > SMALL && !switchProcessor)
while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
{
// set the lagrangian time-step
scalar dt = min(dtMax, tEnd);
@ -205,10 +194,10 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
scalar p = sDB.p()[cellI];
// track parcel to face, or end of trajectory
if (keepParcel)
if (td.keepParticle)
{
// Track and adjust the time step if the trajectory is not completed
dt *= trackToFace(position() + dt*U_, sDB);
dt *= trackToFace(position() + dt*U_, td);
// Decrement the end-time acording to how much time the track took
tEnd -= dt;
@ -218,11 +207,11 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
if (onBoundary()) // hit face
{
# include "boundaryTreatment.H"
#include "boundaryTreatment.H"
}
}
if (keepParcel && sDB.twoD())
if (td.keepParticle && sDB.twoD())
{
scalar z = position() & sDB.axisOfSymmetry();
vector r = position() - z*sDB.axisOfSymmetry();
@ -297,7 +286,7 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
// remove parcel if it is 'small'
if (m() < 1.0e-12)
{
keepParcel = false;
td.keepParticle = false;
// ... and add the removed 'stuff' to the gas
forAll(nMass, i)
@ -309,19 +298,19 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
sDB.shs()[cellI] += m()*(nH + nPE);
}
if (onBoundary() && keepParcel)
if (onBoundary() && td.keepParticle)
{
if (face() > -1)
{
if (isA<processorPolyPatch>(pbMesh[patch(face())]))
{
switchProcessor = true;
td.switchProcessor = true;
}
}
}
}
return keepParcel;
return td.keepParticle;
}

View File

@ -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,7 +32,7 @@ Description
#ifndef parcel_H
#define parcel_H
#include "Particle.H"
#include "particle.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,7 +48,7 @@ class spray;
class parcel
:
public Particle<parcel>
public particle
{
// Private member data
@ -142,13 +142,25 @@ public:
friend class Cloud<parcel>;
//- Class used to pass tracking data to the trackToFace function
class trackingData
:
public particle::TrackingData<spray>
{
public:
trackingData(spray& cloud)
:
particle::TrackingData<spray>(cloud)
{}
};
// Constructors
//- Construct from components
parcel
(
const Cloud<parcel>& cloud,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
@ -173,11 +185,30 @@ public:
//- Construct from Istream reading field values if required
parcel
(
const Cloud<parcel>& cloud,
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<parcel> operator()(Istream& is) const
{
return autoPtr<parcel>(new parcel(mesh_, is, true));
}
};
// Member Functions
@ -349,7 +380,7 @@ public:
// Parcel operations
bool move(spray& sprayData, const scalar trackTime);
bool move(trackingData& td, const scalar trackTime);
//- Transform the position and physical properties of the particle
// according to the given transformation tensor

View File

@ -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
@ -23,182 +23,205 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const List<word>& parcel::liquidNames() const
inline const Foam::List<Foam::word>& Foam::parcel::liquidNames() const
{
return liquidComponents_;
}
inline const List<word>& parcel::fuelNames() const
inline const Foam::List<Foam::word>& Foam::parcel::fuelNames() const
{
return liquidComponents_;
}
inline scalar parcel::d() const
inline Foam::scalar Foam::parcel::d() const
{
return d_;
}
inline scalar& parcel::d()
inline Foam::scalar& Foam::parcel::d()
{
return d_;
}
inline scalar parcel::T() const
inline Foam::scalar Foam::parcel::T() const
{
return T_;
}
inline scalar& parcel::T()
inline Foam::scalar& Foam::parcel::T()
{
return T_;
}
inline scalar parcel::m() const
inline Foam::scalar Foam::parcel::m() const
{
return m_;
}
inline scalar& parcel::m()
inline Foam::scalar& Foam::parcel::m()
{
return m_;
}
inline scalar parcel::dev() const
inline Foam::scalar Foam::parcel::dev() const
{
return y_;
}
inline scalar& parcel::dev()
inline Foam::scalar& Foam::parcel::dev()
{
return y_;
}
inline scalar parcel::ddev() const
inline Foam::scalar Foam::parcel::ddev() const
{
return yDot_;
}
inline scalar& parcel::ddev()
inline Foam::scalar& Foam::parcel::ddev()
{
return yDot_;
}
inline scalar parcel::ct() const
inline Foam::scalar Foam::parcel::ct() const
{
return ct_;
}
inline scalar& parcel::ct()
inline Foam::scalar& Foam::parcel::ct()
{
return ct_;
}
inline scalar& parcel::ms()
inline Foam::scalar& Foam::parcel::ms()
{
return ms_;
}
inline scalar parcel::ms() const
inline Foam::scalar Foam::parcel::ms() const
{
return ms_;
}
inline scalar& parcel::tTurb()
inline Foam::scalar& Foam::parcel::tTurb()
{
return tTurb_;
}
inline scalar parcel::tTurb() const
inline Foam::scalar Foam::parcel::tTurb() const
{
return tTurb_;
}
inline scalar& parcel::liquidCore()
inline Foam::scalar& Foam::parcel::liquidCore()
{
return liquidCore_;
}
inline scalar parcel::liquidCore() const
inline Foam::scalar Foam::parcel::liquidCore() const
{
return liquidCore_;
}
inline scalar& parcel::injector()
inline Foam::scalar& Foam::parcel::injector()
{
return injector_;
}
inline scalar parcel::injector() const
inline Foam::scalar Foam::parcel::injector() const
{
return injector_;
}
inline const vector& parcel::U() const
inline const Foam::vector& Foam::parcel::U() const
{
return U_;
}
inline vector& parcel::U()
inline Foam::vector& Foam::parcel::U()
{
return U_;
}
inline const vector& parcel::Uturb() const
inline const Foam::vector& Foam::parcel::Uturb() const
{
return Uturb_;
}
inline vector& parcel::Uturb()
inline Foam::vector& Foam::parcel::Uturb()
{
return Uturb_;
}
inline const vector& parcel::n() const
inline const Foam::vector& Foam::parcel::n() const
{
return n_;
}
inline vector& parcel::n()
inline Foam::vector& Foam::parcel::n()
{
return n_;
}
inline const scalarField& parcel::X() const
inline const Foam::scalarField& Foam::parcel::X() const
{
return X_;
}
inline scalarField& parcel::X()
inline Foam::scalarField& Foam::parcel::X()
{
return X_;
}
inline scalar& parcel::tMom()
inline Foam::scalar& Foam::parcel::tMom()
{
return tMom_;
}
inline scalar parcel::tMom() const
inline Foam::scalar Foam::parcel::tMom() const
{
return tMom_;
}
inline vector parcel::Urel(const vector& U) const
inline Foam::vector Foam::parcel::Urel(const vector& U) const
{
return U_ - U;
}
inline void parcel::correctNormal
(
const vector& sym
)
inline void Foam::parcel::correctNormal(const vector& sym)
{
scalar d = position() & sym;
n_ = position() - d*sym;
@ -206,8 +229,4 @@ inline void parcel::correctNormal
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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,17 +30,18 @@ License
Foam::parcel::parcel
(
const Cloud<parcel>& cloud,
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
Particle<parcel>(cloud, is, readFields),
particle(mesh, is, readFields),
liquidComponents_
(
(cloud.pMesh().lookupObject<dictionary>("thermophysicalProperties"))
.lookup("liquidComponents")
(
mesh.lookupObject<dictionary>("thermophysicalProperties")
).lookup("liquidComponents")
),
X_(liquidComponents_.size(), 0.0),
@ -102,7 +103,7 @@ void Foam::parcel::readFields(Cloud<parcel>& c)
return;
}
Particle<parcel>::readFields(c);
particle::readFields(c);
IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ));
c.checkFieldIOobject(c, d);
@ -195,7 +196,7 @@ void Foam::parcel::readFields(Cloud<parcel>& c)
void Foam::parcel::writeFields(const Cloud<parcel>& c)
{
Particle<parcel>::writeFields(c);
particle::writeFields(c);
label np = c.size();
@ -289,10 +290,9 @@ void Foam::parcel::writeFields(const Cloud<parcel>& c)
Foam::Ostream& Foam::operator<<(Ostream& os, const parcel& p)
{
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Particle<parcel>&>(p)
os << static_cast<const particle&>(p)
<< token::SPACE << p.d_
<< token::SPACE << p.T_
<< token::SPACE << p.m_
@ -310,7 +310,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const parcel& p)
}
else
{
os << static_cast<const Particle<parcel>&>(p);
os << static_cast<const particle>(p);
os.write
(
reinterpret_cast<const char*>(&p.d_),

View File

@ -23,7 +23,7 @@ if (!foundCell)
{
injectionPosition = it->position(n);
findCellFacePt
mesh_.findCellFacePt
(
injectionPosition,
injectorCell,

View File

@ -46,6 +46,7 @@ License
namespace Foam
{
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
defineTemplateTypeNameAndDebug(IOPtrList<injector>, 0);
}

View File

@ -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
@ -36,6 +36,8 @@ void Foam::spray::inject()
scalar time = runTime_.value();
scalar time0 = time0_;
parcel::trackingData td(*this);
// Inject the parcels for each injector sequentially
forAll(injectors_, i)
{
@ -111,7 +113,7 @@ void Foam::spray::inject()
label injectorTetFaceI = -1;
label injectorTetPtI = -1;
findCellFacePt
mesh_.findCellFacePt
(
injectionPosition,
injectorCell,
@ -119,7 +121,7 @@ void Foam::spray::inject()
injectorTetPtI
);
# include "findInjectorCell.H"
#include "findInjectorCell.H"
if (injectorCell >= 0)
{
@ -129,7 +131,7 @@ void Foam::spray::inject()
parcel* pPtr = new parcel
(
*this,
mesh_,
injectionPosition,
injectorCell,
injectorTetFaceI,
@ -160,7 +162,7 @@ void Foam::spray::inject()
/runTime_.deltaTValue();
bool keepParcel =
pPtr->move(*this, runTime_.deltaTValue());
pPtr->move(td, runTime_.deltaTValue());
if (keepParcel)
{

View File

@ -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
@ -76,7 +76,8 @@ void Foam::spray::move()
srhos_[i] = 0.0;
}
Cloud<parcel>::move(*this, runTime_.deltaTValue());
parcel::trackingData td(*this);
Cloud<parcel>::move(td, runTime_.deltaTValue());
}

View File

@ -233,7 +233,7 @@ void Foam::SHF::breakupParcel
(
new parcel
(
spray_,
p.mesh(),
p.position(),
p.cell(),
p.tetFace(),

View File

@ -195,7 +195,7 @@ void Foam::reitzKHRT::breakupParcel
(
new parcel
(
spray_,
p.mesh(),
p.position(),
p.cell(),
p.tetFace(),

View File

@ -34,9 +34,9 @@ Foam::distributionModels::distributionModel::New
cachedRandom& rndGen
)
{
const word modelType(dict.lookup("distributionModelType"));
const word modelType(dict.lookup("type"));
Info<< "Selecting distributionModelType " << modelType << endl;
Info<< "Selecting distribution model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
@ -51,8 +51,8 @@ Foam::distributionModels::distributionModel::New
"cachedRandom&"
")"
)
<< "Unknown distributionModel type " << modelType << nl << nl
<< "Valid distributionModel types are:" << nl
<< "Unknown distribution model type " << modelType << nl << nl
<< "Valid distribution model types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

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
@ -501,7 +501,7 @@ void Foam::DsmcCloud<ParcelType>::addNewParcel
{
ParcelType* pPtr = new ParcelType
(
*this,
mesh_,
position,
U,
Ei,
@ -970,7 +970,7 @@ Foam::DsmcCloud<ParcelType>::~DsmcCloud()
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::evolve()
{
typename ParcelType::trackData td(*this);
typename ParcelType::trackingData td(*this);
// Reset the data collection fields
resetFields();

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
@ -30,13 +30,10 @@ License
template<class ParcelType>
template<class TrackData>
bool Foam::DsmcParcel<ParcelType>::move
(
TrackData& td,
const scalar trackTime
)
bool Foam::DsmcParcel<ParcelType>::move(TrackData& td, const scalar trackTime)
{
ParcelType& p = static_cast<ParcelType&>(*this);
typename TrackData::cloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this);
td.switchProcessor = false;
td.keepParticle = true;
@ -113,15 +110,6 @@ void Foam::DsmcParcel<ParcelType>::hitProcessorPatch
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitProcessorPatch
(
const processorPolyPatch&,
int&
)
{}
template<class ParcelType>
template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitWallPatch
@ -174,7 +162,7 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
td.cloud().wallInteraction().correct
(
static_cast<ParcelType&>(*this),
static_cast<DsmcParcel<ParcelType> &>(*this),
wpp
);
@ -215,44 +203,18 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitWallPatch
(
const wallPolyPatch&,
int&,
const tetIndices&
)
{}
template<class ParcelType>
template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitPatch
(
const polyPatch&,
TrackData& td
)
void Foam::DsmcParcel<ParcelType>::hitPatch(const polyPatch&, TrackData& td)
{
td.keepParticle = false;
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitPatch
(
const polyPatch&,
int&
)
{}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::transformProperties
(
const tensor& T
)
void Foam::DsmcParcel<ParcelType>::transformProperties(const tensor& T)
{
Particle<ParcelType>::transformProperties(T);
ParcelType::transformProperties(T);
U_ = transform(T, U_);
}
@ -263,7 +225,7 @@ void Foam::DsmcParcel<ParcelType>::transformProperties
const vector& separation
)
{
Particle<ParcelType>::transformProperties(separation);
ParcelType::transformProperties(separation);
}

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
@ -37,7 +37,7 @@ SourceFiles
#ifndef DsmcParcel_H
#define DsmcParcel_H
#include "Particle.H"
#include "particle.H"
#include "IOstream.H"
#include "autoPtr.H"
#include "contiguous.H"
@ -68,7 +68,7 @@ Ostream& operator<<
template<class ParcelType>
class DsmcParcel
:
public Particle<ParcelType>
public ParcelType
{
public:
@ -123,31 +123,22 @@ public:
//- Class used to pass kinematic tracking data to the trackToFace function
class trackData
class trackingData
:
public Particle<ParcelType>::trackData
public particle::TrackingData<DsmcCloud<DsmcParcel<ParcelType> > >
{
// Private data
//- Reference to the cloud containing this particle
DsmcCloud<ParcelType>& cloud_;
public:
// Constructors
//- Construct from components
inline trackData
(
DsmcCloud<ParcelType>& cloud
);
// Member functions
//- Return access to the owner cloud
inline DsmcCloud<ParcelType>& cloud();
trackingData(DsmcCloud<DsmcParcel<ParcelType> >& cloud)
:
particle::TrackingData<DsmcCloud<DsmcParcel<ParcelType> > >
(
cloud
)
{}
};
@ -181,7 +172,7 @@ public:
//- Construct from components
inline DsmcParcel
(
DsmcCloud<ParcelType>& owner,
const polyMesh& mesh,
const vector& position,
const vector& U,
const scalar Ei,
@ -194,21 +185,41 @@ public:
//- Construct from Istream
DsmcParcel
(
const Cloud<ParcelType>& c,
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone
virtual autoPtr<Particle<ParcelType> > clone() const
virtual autoPtr<particle> clone() const
{
return autoPtr<Particle<ParcelType> >
(
new DsmcParcel<ParcelType>(*this)
);
return autoPtr<particle>(new DsmcParcel<ParcelType>(*this));
}
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<DsmcParcel<ParcelType> > operator()(Istream& is) const
{
return autoPtr<DsmcParcel<ParcelType> >
(
new DsmcParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions
// Access
@ -263,14 +274,6 @@ public:
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
template<class TrackData>
void hitWallPatch
@ -280,15 +283,6 @@ public:
const tetIndices&
);
//- Overridable function to handle the particle hitting a wallPatch
// without trackData
void hitWallPatch
(
const wallPolyPatch&,
int&,
const tetIndices&
);
//- Overridable function to handle the particle hitting a polyPatch
template<class TrackData>
void hitPatch
@ -297,14 +291,6 @@ public:
TrackData& td
);
//- Overridable function to handle the particle hitting a polyPatch
//- without trackData
void hitPatch
(
const polyPatch&,
int&
);
//- Transform the physical properties of the particle
// according to the given transformation tensor
void transformProperties(const tensor& T);
@ -316,9 +302,9 @@ public:
// I-O
static void readFields(Cloud<ParcelType>& c);
static void readFields(Cloud<DsmcParcel<ParcelType> >& c);
static void writeFields(const Cloud<ParcelType>& c);
static void writeFields(const Cloud<DsmcParcel<ParcelType> >& c);
// Ostream Operator

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
@ -27,7 +27,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class ParcelType>
template<class ParcelType>
inline Foam::DsmcParcel<ParcelType>::constantProperties::constantProperties()
:
mass_(0),
@ -35,7 +35,7 @@ inline Foam::DsmcParcel<ParcelType>::constantProperties::constantProperties()
{}
template <class ParcelType>
template<class ParcelType>
inline Foam::DsmcParcel<ParcelType>::constantProperties::constantProperties
(
const dictionary& dict
@ -51,21 +51,10 @@ inline Foam::DsmcParcel<ParcelType>::constantProperties::constantProperties
{}
template <class ParcelType>
inline Foam::DsmcParcel<ParcelType>::trackData::trackData
(
DsmcCloud<ParcelType>& cloud
)
:
Particle<ParcelType>::trackData(cloud),
cloud_(cloud)
{}
template <class ParcelType>
template<class ParcelType>
inline Foam::DsmcParcel<ParcelType>::DsmcParcel
(
DsmcCloud<ParcelType>& owner,
const polyMesh& mesh,
const vector& position,
const vector& U,
const scalar Ei,
@ -75,7 +64,7 @@ inline Foam::DsmcParcel<ParcelType>::DsmcParcel
const label typeId
)
:
Particle<ParcelType>(owner, position, cellI, tetFaceI, tetPtI),
ParcelType(mesh, position, cellI, tetFaceI, tetPtI),
U_(U),
Ei_(Ei),
typeId_(typeId)
@ -84,7 +73,7 @@ inline Foam::DsmcParcel<ParcelType>::DsmcParcel
// * * * * * * * * * constantProperties Member Functions * * * * * * * * * * //
template <class ParcelType>
template<class ParcelType>
inline Foam::scalar
Foam::DsmcParcel<ParcelType>::constantProperties::mass() const
{
@ -92,15 +81,14 @@ Foam::DsmcParcel<ParcelType>::constantProperties::mass() const
}
template <class ParcelType>
inline Foam::scalar
Foam::DsmcParcel<ParcelType>::constantProperties::d() const
template<class ParcelType>
inline Foam::scalar Foam::DsmcParcel<ParcelType>::constantProperties::d() const
{
return d_;
}
template <class ParcelType>
template<class ParcelType>
inline Foam::scalar
Foam::DsmcParcel<ParcelType>::constantProperties::sigmaT() const
{
@ -108,7 +96,7 @@ Foam::DsmcParcel<ParcelType>::constantProperties::sigmaT() const
}
template <class ParcelType>
template<class ParcelType>
inline Foam::scalar
Foam::DsmcParcel<ParcelType>::constantProperties::internalDegreesOfFreedom()
const
@ -117,7 +105,7 @@ const
}
template <class ParcelType>
template<class ParcelType>
inline Foam::scalar
Foam::DsmcParcel<ParcelType>::constantProperties::omega() const
{
@ -125,47 +113,37 @@ Foam::DsmcParcel<ParcelType>::constantProperties::omega() const
}
// * * * * * * * * * * * trackData Member Functions * * * * * * * * * * * * //
template <class ParcelType>
inline Foam::DsmcCloud<ParcelType>&
Foam::DsmcParcel<ParcelType>::trackData::cloud()
{
return cloud_;
}
// * * * * * * * * * * DsmcParcel Member Functions * * * * * * * * * * //
template <class ParcelType>
template<class ParcelType>
inline Foam::label Foam::DsmcParcel<ParcelType>::typeId() const
{
return typeId_;
}
template <class ParcelType>
template<class ParcelType>
inline const Foam::vector& Foam::DsmcParcel<ParcelType>::U() const
{
return U_;
}
template <class ParcelType>
template<class ParcelType>
inline Foam::scalar Foam::DsmcParcel<ParcelType>::Ei() const
{
return Ei_;
}
template <class ParcelType>
template<class ParcelType>
inline Foam::vector& Foam::DsmcParcel<ParcelType>::U()
{
return U_;
}
template <class ParcelType>
template<class ParcelType>
inline Foam::scalar& Foam::DsmcParcel<ParcelType>::Ei()
{
return Ei_;

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
@ -33,12 +33,12 @@ License
template <class ParcelType>
Foam::DsmcParcel<ParcelType>::DsmcParcel
(
const Cloud<ParcelType>& cloud,
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
Particle<ParcelType>(cloud, is, readFields),
ParcelType(mesh, is, readFields),
U_(vector::zero),
Ei_(0.0),
typeId_(-1)
@ -73,14 +73,14 @@ Foam::DsmcParcel<ParcelType>::DsmcParcel
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
void Foam::DsmcParcel<ParcelType>::readFields(Cloud<DsmcParcel<ParcelType> >& c)
{
if (!c.size())
{
return;
}
Particle<ParcelType>::readFields(c);
ParcelType::readFields(c);
IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ));
c.checkFieldIOobject(c, U);
@ -92,9 +92,9 @@ void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
c.checkFieldIOobject(c, typeId);
label i = 0;
forAllIter(typename Cloud<ParcelType>, c, iter)
forAllIter(typename Cloud<DsmcParcel<ParcelType> >, c, iter)
{
ParcelType& p = iter();
DsmcParcel<ParcelType>& p = iter();
p.U_ = U[i];
p.Ei_ = Ei[i];
@ -105,9 +105,12 @@ void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
void Foam::DsmcParcel<ParcelType>::writeFields
(
const Cloud<DsmcParcel<ParcelType> >& c
)
{
Particle<ParcelType>::writeFields(c);
ParcelType::writeFields(c);
label np = c.size();
@ -116,7 +119,7 @@ void Foam::DsmcParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np);
label i = 0;
forAllConstIter(typename Cloud<ParcelType>, c, iter)
forAllConstIter(typename Cloud<DsmcParcel<ParcelType> >, c, iter)
{
const DsmcParcel<ParcelType>& p = iter();
@ -143,14 +146,14 @@ Foam::Ostream& Foam::operator<<
{
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Particle<ParcelType>& >(p)
os << static_cast<const ParcelType& >(p)
<< token::SPACE << p.U()
<< token::SPACE << p.Ei()
<< token::SPACE << p.typeId();
}
else
{
os << static_cast<const Particle<ParcelType>& >(p);
os << static_cast<const ParcelType& >(p);
os.write
(
reinterpret_cast<const char*>(&p.U_),

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
@ -24,13 +24,13 @@ License
\*---------------------------------------------------------------------------*/
#include "dsmcParcel.H"
#include "DsmcParcel.H"
#include "DsmcCloud.H"
namespace Foam
{
defineTemplateTypeNameAndDebug(DsmcParcel<particle>, 0);
defineTemplateTypeNameAndDebug(Cloud<dsmcParcel>, 0);
defineParcelTypeNameAndDebug(DsmcCloud<dsmcParcel>, 0);
}

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
@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "dsmcParcel.H"
/*
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(dsmcParcel, 0);
defineParticleTypeNameAndDebug(dsmcParcel, 0);
defineParcelTypeNameAndDebug(dsmcParcel, 0);
// defineTypeNameAndDebug(dsmcParcel, 0);
// defineParticleTypeNameAndDebug(dsmcParcel, 0);
// defineParcelTypeNameAndDebug(dsmcParcel, 0);
}
@ -39,7 +39,7 @@ namespace Foam
Foam::dsmcParcel::dsmcParcel
(
DsmcCloud<dsmcParcel>& owner,
c& owner,
const vector& position,
const vector& U,
const scalar Ei,
@ -78,6 +78,6 @@ Foam::dsmcParcel::dsmcParcel
Foam::dsmcParcel::~dsmcParcel()
{}
*/
// ************************************************************************* //

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
@ -25,7 +25,7 @@ Class
Foam::dsmcParcel
Description
Declaration of dsmc parcel type
SourceFiles
dsmcParcel.C
@ -35,6 +35,7 @@ SourceFiles
#ifndef dsmcParcel_H
#define dsmcParcel_H
#include "particle.H"
#include "DsmcParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -42,10 +43,11 @@ SourceFiles
namespace Foam
{
typedef DsmcParcel<particle> dsmcParcel;
/*---------------------------------------------------------------------------*\
Class dsmcParcel Declaration
\*---------------------------------------------------------------------------*/
/*
class dsmcParcel
:
public DsmcParcel<dsmcParcel>
@ -100,7 +102,7 @@ inline bool contiguous<dsmcParcel>()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
*/
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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
@ -29,29 +29,18 @@ License
#include "VariableHardSphere.H"
#include "LarsenBorgnakkeVariableHardSphere.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef DsmcCloud<dsmcParcel> CloudType;
makeBinaryCollisionModel(DsmcCloud<dsmcParcel>);
// Add instances of collision model to the table
makeBinaryCollisionModelType
(
NoBinaryCollision,
DsmcCloud,
dsmcParcel
);
makeBinaryCollisionModelType
(
VariableHardSphere,
DsmcCloud,
dsmcParcel
);
makeBinaryCollisionModelType
(
LarsenBorgnakkeVariableHardSphere,
DsmcCloud,
dsmcParcel
);
makeBinaryCollisionModelType(NoBinaryCollision, CloudType);
makeBinaryCollisionModelType(VariableHardSphere, CloudType);
makeBinaryCollisionModelType(LarsenBorgnakkeVariableHardSphere, CloudType);
}

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
@ -28,23 +28,17 @@ License
#include "FreeStream.H"
#include "NoInflow.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeInflowBoundaryModel(DsmcCloud<dsmcParcel>);
typedef DsmcCloud<dsmcParcel> CloudType;
makeInflowBoundaryModel(CloudType);
// Add instances of inflow boundary model to the table
makeInflowBoundaryModelType
(
FreeStream,
DsmcCloud,
dsmcParcel
);
makeInflowBoundaryModelType
(
NoInflow,
DsmcCloud,
dsmcParcel
);
makeInflowBoundaryModelType(FreeStream, CloudType);
makeInflowBoundaryModelType(NoInflow, CloudType);
}

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
@ -29,29 +29,18 @@ License
#include "SpecularReflection.H"
#include "MixedDiffuseSpecular.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWallInteractionModel(DsmcCloud<dsmcParcel>);
typedef DsmcCloud<dsmcParcel> CloudType;
makeWallInteractionModel(CloudType);
// Add instances of wall interaction model to the table
makeWallInteractionModelType
(
MaxwellianThermal,
DsmcCloud,
dsmcParcel
);
makeWallInteractionModelType
(
SpecularReflection,
DsmcCloud,
dsmcParcel
);
makeWallInteractionModelType
(
MixedDiffuseSpecular,
DsmcCloud,
dsmcParcel
);
makeWallInteractionModelType(MaxwellianThermal, CloudType);
makeWallInteractionModelType(SpecularReflection, CloudType);
makeWallInteractionModelType(MixedDiffuseSpecular, CloudType);
}

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
@ -166,13 +166,13 @@ public:
);
#define makeBinaryCollisionModelType(SS, CloudType, ParcelType) \
#define makeBinaryCollisionModelType(SS, CloudType) \
\
defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
defineNamedTemplateTypeNameAndDebug(SS<CloudType>, 0); \
\
BinaryCollisionModel<CloudType<ParcelType> >:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
add##SS##CloudType##ParcelType##ConstructorToTable_;
BinaryCollisionModel<CloudType>:: \
adddictionaryConstructorToTable<SS<CloudType> > \
add##SS##CloudType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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
@ -146,13 +146,13 @@ public:
);
#define makeInflowBoundaryModelType(SS, CloudType, ParcelType) \
#define makeInflowBoundaryModelType(SS, CloudType) \
\
defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
defineNamedTemplateTypeNameAndDebug(SS<CloudType>, 0); \
\
InflowBoundaryModel<CloudType<ParcelType> >:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
add##SS##CloudType##ParcelType##ConstructorToTable_;
InflowBoundaryModel<CloudType>:: \
adddictionaryConstructorToTable<SS<CloudType> > \
add##SS##CloudType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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
@ -152,13 +152,13 @@ public:
);
#define makeWallInteractionModelType(SS, CloudType, ParcelType) \
#define makeWallInteractionModelType(SS, CloudType) \
\
defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
defineNamedTemplateTypeNameAndDebug(SS<CloudType>, 0); \
\
WallInteractionModel<CloudType<ParcelType> >:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
add##SS##CloudType##ParcelType##ConstructorToTable_;
WallInteractionModel<CloudType>:: \
adddictionaryConstructorToTable<SS<CloudType> > \
add##SS##CloudType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -51,7 +51,7 @@ class Analytical
public:
//- Runtime type information
TypeName("Analytical");
TypeName("analytical");
// Constructors

View File

@ -128,7 +128,7 @@ private:
public:
//- Runtime type information
TypeName("IntegrationScheme");
TypeName("integrationScheme");
//- Declare runtime constructor selection table

View File

@ -38,7 +38,7 @@ Foam::IntegrationScheme<Type>::New
{
const word schemeName(dict.lookup(phiName));
Info<< "Selecting " << phiName << " IntegrationScheme "
Info<< "Selecting " << phiName << " integration scheme "
<< schemeName << endl;
typename dictionaryConstructorTable::iterator cstrIter =
@ -49,9 +49,9 @@ Foam::IntegrationScheme<Type>::New
FatalErrorIn
(
"IntegrationScheme::New(const dictionary&)"
) << "Unknown IntegrationScheme type "
) << "Unknown integration scheme type "
<< schemeName << nl << nl
<< "Valid IntegrationScheme types are:" << nl
<< "Valid integration scheme types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}

View File

@ -7,10 +7,6 @@ BASECLOUDS=$(CLOUDS)/baseClasses
DERIVEDCLOUDS=$(CLOUDS)/derived
/* Parcels */
$(BASEPARCELS)/reactingParcel/reactingParcel.C
/* Cloud base classes */
$(BASECLOUDS)/kinematicCloud/kinematicCloud.C
$(BASECLOUDS)/thermoCloud/thermoCloud.C
@ -20,28 +16,28 @@ $(BASECLOUDS)/reactingMultiphaseCloud/reactingMultiphaseCloud.C
/* kinematic parcel sub-models */
KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/basicKinematicParcel.C
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
KINEMATICCOLLIDINGPARCEL=$(DERIVEDPARCELS)/basicKinematicCollidingParcel
$(KINEMATICCOLLIDINGPARCEL)/defineBasicKinematicCollidingParcel.C
$(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C
/* thermo parcel sub-models */
THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel
$(THERMOPARCEL)/basicThermoParcel.C
$(THERMOPARCEL)/defineBasicThermoParcel.C
$(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C
/* reacting parcel sub-models */
REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel
$(REACTINGPARCEL)/basicReactingParcel.C
$(REACTINGPARCEL)/defineBasicReactingParcel.C
$(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C
/* reacting multiphase parcel sub-models */
REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel
$(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
@ -63,6 +59,7 @@ $(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
@ -83,5 +80,8 @@ phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C
phaseProperties/phasePropertiesList/phasePropertiesList.C
/* Additional helper classes */
clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C
LIB = $(FOAM_LIBBIN)/liblagrangianIntermediate

View File

@ -0,0 +1,70 @@
PARCELS=parcels
BASEPARCELS=$(PARCELS)/baseClasses
DERIVEDPARCELS=$(PARCELS)/derived
CLOUDS=clouds
BASECLOUDS=$(CLOUDS)/baseClasses
DERIVEDCLOUDS=$(CLOUDS)/derived
/* Parcels */
$(BASEPARCELS)/reactingParcel/reactingParcel.C
/* Cloud base classes */
$(BASECLOUDS)/kinematicCloud/kinematicCloud.C
$(BASECLOUDS)/thermoCloud/thermoCloud.C
$(BASECLOUDS)/reactingCloud/reactingCloud.C
/* kinematic parcel sub-models */
KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/basicKinematicParcel.C
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
/* thermo parcel sub-models */
THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel
$(THERMOPARCEL)/basicThermoParcel.C
$(THERMOPARCEL)/defineBasicThermoParcel.C
$(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C
/* reacting parcel sub-models */
REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel
$(REACTINGPARCEL)/basicReactingParcel.C
$(REACTINGPARCEL)/defineBasicReactingParcel.C
$(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C
/* bolt-on models */
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
KINEMATICINJECTION=submodels/Kinematic/InjectionModel
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.C
THERMOINJECTION=submodels/Thermodynamic/InjectionModel
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.C
/* integration schemes */
IntegrationScheme/makeIntegrationSchemes.C
/* phase properties */
phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C
phaseProperties/phasePropertiesList/phasePropertiesList.C
LIB = $(FOAM_LIBBIN)/liblagrangianIntermediate

View File

@ -0,0 +1,226 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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().steadyState())
{
FatalErrorIn
(
"Foam::CollidingCloud<CloudType>::CollidingCloud"
"("
"const word&, "
"const volScalarField&, "
"const volVectorField&, "
"const volScalarField&, "
"const dimensionedVector&, "
"bool"
")"
) << "Collision modelling not currently available for steady state "
<< "calculations" << exit(FatalError);
}
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,180 +28,20 @@ License
#include "interpolation.H"
#include "subCycleTime.H"
#include "CollisionModel.H"
#include "DispersionModel.H"
#include "InjectionModel.H"
#include "PatchInteractionModel.H"
#include "PostProcessingModel.H"
#include "SurfaceFilmModel.H"
// * * * * * * * * * * * * * * cloudSolution * * * * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::cloudSolution::read()
{
dict_.lookup("transient") >> transient_;
dict_.lookup("coupled") >> coupled_;
dict_.lookup("cellValueSourceCorrection") >> cellValueSourceCorrection_;
if (steadyState())
{
dict_.lookup("calcFrequency") >> calcFrequency_;
dict_.lookup("maxCo") >> maxCo_;
dict_.lookup("maxTrackTime") >> maxTrackTime_;
dict_.subDict("sourceTerms").lookup("resetOnStartup")
>> resetSourcesOnStartup_;
}
}
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::cloudSolution::cloudSolution
(
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
dict_(dict),
active_(dict.lookup("active")),
transient_(false),
calcFrequency_(1),
maxCo_(0.3),
iter_(1),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(true)
{
if (active_)
{
read();
}
}
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::cloudSolution::cloudSolution
(
const cloudSolution& cs
)
:
mesh_(cs.mesh_),
dict_(cs.dict_),
active_(cs.active_),
transient_(cs.transient_),
calcFrequency_(cs.calcFrequency_),
maxCo_(cs.maxCo_),
iter_(cs.iter_),
deltaT_(cs.deltaT_),
coupled_(cs.coupled_),
cellValueSourceCorrection_(cs.cellValueSourceCorrection_),
maxTrackTime_(cs.maxTrackTime_),
resetSourcesOnStartup_(cs.resetSourcesOnStartup_)
{}
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::cloudSolution::cloudSolution
(
const fvMesh& mesh
)
:
mesh_(mesh),
dict_(dictionary::null),
active_(false),
transient_(false),
calcFrequency_(0),
maxCo_(GREAT),
iter_(0),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(false)
{}
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::cloudSolution::~cloudSolution()
{}
template<class ParcelType>
Foam::scalar Foam::KinematicCloud<ParcelType>::cloudSolution::relaxCoeff
(
const word& fieldName
) const
{
return readScalar(sourceTermDict().subDict(fieldName).lookup("alpha"));
}
template<class ParcelType>
bool Foam::KinematicCloud<ParcelType>::cloudSolution::semiImplicit
(
const word& fieldName
) const
{
return readBool(sourceTermDict().subDict(fieldName).lookup("semiImplicit"));
}
template<class ParcelType>
bool Foam::KinematicCloud<ParcelType>::cloudSolution::solveThisStep() const
{
return
active_
&& (
mesh_.time().outputTime()
|| (mesh_.time().timeIndex() % calcFrequency_ == 0)
);
}
template<class ParcelType>
bool Foam::KinematicCloud<ParcelType>::cloudSolution::canEvolve()
{
// Set the calculation time step
if (transient_)
{
deltaT_ = mesh_.time().deltaTValue();
}
else
{
deltaT_ = maxTrackTime_;
}
return solveThisStep();
}
template<class ParcelType>
bool Foam::KinematicCloud<ParcelType>::cloudSolution::output() const
{
return active_ && mesh_.time().outputTime();
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::setModels()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::setModels()
{
collisionModel_.reset
(
CollisionModel<KinematicCloud<ParcelType> >::New
(
subModelProperties_,
*this
).ptr()
);
dispersionModel_.reset
(
DispersionModel<KinematicCloud<ParcelType> >::New
DispersionModel<KinematicCloud<CloudType> >::New
(
subModelProperties_,
*this
@ -210,7 +50,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
injectionModel_.reset
(
InjectionModel<KinematicCloud<ParcelType> >::New
InjectionModel<KinematicCloud<CloudType> >::New
(
subModelProperties_,
*this
@ -219,7 +59,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
patchInteractionModel_.reset
(
PatchInteractionModel<KinematicCloud<ParcelType> >::New
PatchInteractionModel<KinematicCloud<CloudType> >::New
(
subModelProperties_,
*this
@ -228,7 +68,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
postProcessingModel_.reset
(
PostProcessingModel<KinematicCloud<ParcelType> >::New
PostProcessingModel<KinematicCloud<CloudType> >::New
(
subModelProperties_,
*this
@ -237,7 +77,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
surfaceFilmModel_.reset
(
SurfaceFilmModel<KinematicCloud<ParcelType> >::New
SurfaceFilmModel<KinematicCloud<CloudType> >::New
(
subModelProperties_,
*this,
@ -256,11 +96,9 @@ void Foam::KinematicCloud<ParcelType>::setModels()
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::solve
(
typename ParcelType::trackData& td
)
template<class CloudType>
template<class TrackData>
void Foam::KinematicCloud<CloudType>::solve(TrackData& td)
{
if (solution_.transient())
{
@ -290,8 +128,8 @@ void Foam::KinematicCloud<ParcelType>::solve
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::preEvolve()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::preEvolve()
{
Info<< "\nSolving cloud " << this->name() << endl;
@ -301,14 +139,14 @@ void Foam::KinematicCloud<ParcelType>::preEvolve()
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::buildCellOccupancy()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::buildCellOccupancy()
{
if (cellOccupancyPtr_.empty())
{
cellOccupancyPtr_.reset
(
new List<DynamicList<ParcelType*> >(mesh_.nCells())
new List<DynamicList<parcelType*> >(mesh_.nCells())
);
}
else if (cellOccupancyPtr_().size() != mesh_.nCells())
@ -319,22 +157,22 @@ void Foam::KinematicCloud<ParcelType>::buildCellOccupancy()
cellOccupancyPtr_().setSize(mesh_.nCells());
}
List<DynamicList<ParcelType*> >& cellOccupancy = cellOccupancyPtr_();
List<DynamicList<parcelType*> >& cellOccupancy = cellOccupancyPtr_();
forAll(cellOccupancy, cO)
{
cellOccupancy[cO].clear();
}
forAllIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllIter(typename KinematicCloud<CloudType>, *this, iter)
{
cellOccupancy[iter().cell()].append(&iter());
}
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::updateCellOccupancy()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::updateCellOccupancy()
{
// Only build the cellOccupancy if the pointer is set, i.e. it has
// been requested before.
@ -346,11 +184,9 @@ void Foam::KinematicCloud<ParcelType>::updateCellOccupancy()
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::evolveCloud
(
typename ParcelType::trackData& td
)
template<class CloudType>
template<class TrackData>
void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td)
{
if (solution_.coupled())
{
@ -376,7 +212,7 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud
// Assume that motion will update the cellOccupancy as necessary
// before it is required.
motion(td);
td.cloud().motion(td);
}
else
{
@ -384,76 +220,14 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud
this->injection().injectSteadyState(td, solution_.deltaT());
td.part() = ParcelType::trackData::tpLinearTrack;
Cloud<ParcelType>::move(td, solution_.deltaT());
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, solution_.deltaT());
}
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::motion
(
typename ParcelType::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 ParcelType>
void Foam::KinematicCloud<ParcelType>::moveCollide
(
typename ParcelType::trackData& td
)
{
td.part() = ParcelType::trackData::tpVelocityHalfStep;
Cloud<ParcelType>::move(td, solution_.deltaT());
td.part() = ParcelType::trackData::tpLinearTrack;
Cloud<ParcelType>::move(td, solution_.deltaT());
// td.part() = ParcelType::trackData::tpRotationalTrack;
// Cloud<ParcelType>::move(td);
updateCellOccupancy();
this->collision().collide();
td.part() = ParcelType::trackData::tpVelocityHalfStep;
Cloud<ParcelType>::move(td, solution_.deltaT());
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::postEvolve()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::postEvolve()
{
Info<< endl;
@ -471,16 +245,15 @@ void Foam::KinematicCloud<ParcelType>::postEvolve()
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c)
template<class CloudType>
void Foam::KinematicCloud<CloudType>::cloudReset(KinematicCloud<CloudType>& c)
{
Cloud<ParcelType>::cloudReset(c);
CloudType::cloudReset(c);
rndGen_ = c.rndGen_;
forces_.transfer(c.forces_);
collisionModel_.reset(c.collisionModel_.ptr());
dispersionModel_.reset(c.dispersionModel_.ptr());
injectionModel_.reset(c.injectionModel_.ptr());
patchInteractionModel_.reset(c.patchInteractionModel_.ptr());
@ -492,8 +265,8 @@ void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::KinematicCloud
template<class CloudType>
Foam::KinematicCloud<CloudType>::KinematicCloud
(
const word& cloudName,
const volScalarField& rho,
@ -503,7 +276,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
bool readFields
)
:
Cloud<ParcelType>(rho.mesh(), cloudName, false),
CloudType(rho.mesh(), cloudName, false),
kinematicCloud(),
cloudCopyPtr_(NULL),
mesh_(rho.mesh()),
@ -545,7 +318,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
),
solution_.active()
),
collisionModel_(NULL),
dispersionModel_(NULL),
injectionModel_(NULL),
patchInteractionModel_(NULL),
@ -592,7 +364,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
if (readFields)
{
ParcelType::readFields(*this);
parcelType::readFields(*this);
}
if (solution_.resetSourcesOnStartup())
@ -602,14 +374,14 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
}
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::KinematicCloud
template<class CloudType>
Foam::KinematicCloud<CloudType>::KinematicCloud
(
KinematicCloud<ParcelType>& c,
KinematicCloud<CloudType>& c,
const word& name
)
:
Cloud<ParcelType>(c.mesh_, name, c),
CloudType(c.mesh_, name, c),
kinematicCloud(),
cloudCopyPtr_(NULL),
mesh_(c.mesh_),
@ -624,7 +396,6 @@ Foam::KinematicCloud<ParcelType>::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()),
@ -666,15 +437,15 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
{}
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::KinematicCloud
template<class CloudType>
Foam::KinematicCloud<CloudType>::KinematicCloud
(
const fvMesh& mesh,
const word& name,
const KinematicCloud<ParcelType>& c
const KinematicCloud<CloudType>& c
)
:
Cloud<ParcelType>(mesh, name, IDLList<ParcelType>()),
CloudType(mesh, name, IDLList<parcelType>()),
kinematicCloud(),
cloudCopyPtr_(NULL),
mesh_(mesh),
@ -700,7 +471,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
mu_(c.mu_),
g_(c.g_),
forces_(*this, mesh),
collisionModel_(NULL),
dispersionModel_(NULL),
injectionModel_(NULL),
patchInteractionModel_(NULL),
@ -714,17 +484,17 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::KinematicCloud<ParcelType>::~KinematicCloud()
template<class CloudType>
Foam::KinematicCloud<CloudType>::~KinematicCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::checkParcelProperties
template<class CloudType>
void Foam::KinematicCloud<CloudType>::checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
@ -736,15 +506,16 @@ void Foam::KinematicCloud<ParcelType>::checkParcelProperties
const scalar carrierDt = this->db().time().deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
parcel.typeId() = constProps_.parcelTypeId();
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::storeState()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<KinematicCloud<ParcelType>*>
static_cast<KinematicCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
@ -752,25 +523,25 @@ void Foam::KinematicCloud<ParcelType>::storeState()
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::restoreState()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::resetSourceTerms()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::resetSourceTerms()
{
UTrans().field() = vector::zero;
UCoeff().field() = 0.0;
}
template<class ParcelType>
template<class CloudType>
template<class Type>
void Foam::KinematicCloud<ParcelType>::relax
void Foam::KinematicCloud<CloudType>::relax
(
DimensionedField<Type, volMesh>& field,
const DimensionedField<Type, volMesh>& field0,
@ -783,30 +554,42 @@ void Foam::KinematicCloud<ParcelType>::relax
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::relaxSources
template<class CloudType>
void Foam::KinematicCloud<CloudType>::relaxSources
(
const KinematicCloud<ParcelType>& cloudOldTime
const KinematicCloud<CloudType>& cloudOldTime
)
{
this->relax(UTrans_(), cloudOldTime.UTrans(), "U");
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::evolve()
template<class CloudType>
void Foam::KinematicCloud<CloudType>::evolve()
{
if (solution_.canEvolve())
{
typename ParcelType::trackData td(*this);
typename parcelType::template
TrackingData<KinematicCloud<CloudType> > td(*this);
solve(td);
}
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::info() const
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
{
vector linearMomentum = linearMomentumOfSystem();
reduce(linearMomentum, sumOp<vector>());

View File

@ -27,15 +27,12 @@ Class
Description
Templated base class for kinematic cloud
- holds a 'cloudSolution' class that stores all relevant solution info
- particle forces
- buoyancy
- drag
- pressure gradient
- sub-models:
- Collision model
- Dispersion model
- Injection model
- Patch interaction model
@ -51,6 +48,7 @@ SourceFiles
#ifndef KinematicCloud_H
#define KinematicCloud_H
#include "particle.H"
#include "Cloud.H"
#include "kinematicCloud.H"
#include "IOdictionary.H"
@ -59,8 +57,10 @@ SourceFiles
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
#include "IntegrationSchemesFwd.H"
#include "cloudSolution.H"
#include "ParticleForceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,9 +69,6 @@ namespace Foam
// Forward declaration of classes
template<class CloudType>
class CollisionModel;
template<class CloudType>
class DispersionModel;
@ -92,16 +89,21 @@ class SurfaceFilmModel;
Class KinematicCloud Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
template<class CloudType>
class KinematicCloud
:
public Cloud<ParcelType>,
public CloudType,
public kinematicCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Public typedefs
//- Redefine particle type as parcel type
typedef typename CloudType::particleType parcelType;
//- Force type
typedef ParticleForceList<KinematicCloud<CloudType> > forceType;
private:
@ -109,7 +111,7 @@ private:
// Private data
//- Cloud copy pointer
autoPtr<KinematicCloud<ParcelType> > cloudCopyPtr_;
autoPtr<KinematicCloud<CloudType> > cloudCopyPtr_;
// Private Member Functions
@ -121,164 +123,6 @@ private:
void operator=(const KinematicCloud&);
public:
// Cloud solution helper class
class cloudSolution
{
// Private Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Dictionary used during construction
dictionary dict_;
//- Cloud active flag
const Switch active_;
//- Transient flag
Switch transient_;
//- Calculation frequency - carrier steps per cloud step
// NOTE: Steady operation only
label calcFrequency_;
//- Maximum particle Courant number
// Max fraction of current cell that can be traversed in a single
// step
scalar maxCo_;
//- Current cloud iteration
label iter_;
//- Cloud solution time step
scalar deltaT_;
// Run-time options
//- Flag to indicate whether parcels are coupled to the carrier
// phase, i.e. whether or not to generate source terms for
// carrier phase
Switch coupled_;
//- Flag to correct cell values with latest transfer information
// during the lagrangian timestep
Switch cellValueSourceCorrection_;
//- Maximum particle track time [s]
scalar maxTrackTime_;
//- Flag to indicate whether coupling source terms should be
// reset on start-up/first read
Switch resetSourcesOnStartup_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const cloudSolution&);
public:
// Constructors
//- Construct null from mesh reference
cloudSolution(const fvMesh& mesh);
//- Construct from mesh and dictionary
cloudSolution(const fvMesh& mesh, const dictionary& dict);
//- Construct copy
cloudSolution(const cloudSolution& cs);
//- Destructor
virtual ~cloudSolution();
// Member functions
//- Read properties from dictionary
void read();
// Access
//- Return relaxation coefficient for field
scalar relaxCoeff(const word& fieldName) const;
//- Return semi-implicit flag coefficient for field
bool semiImplicit(const word& fieldName) const;
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return const access to the dictionary
inline const dictionary& dict() const;
//- Return the active flag
inline const Switch active() const;
//- Return const access to the transient flag
inline const Switch transient() const;
//- Return const access to the steady flag
inline const Switch steadyState() const;
//- Return const access to the calculation frequency
inline label calcFrequency() const;
//- Return const access to the max particle Courant number
inline scalar maxCo() const;
//- Return const access to the current cloud iteration
inline label iter() const;
//- Increment and return iter counter
inline label nextIter();
//- Return the time step
inline scalar deltaT() const;
//- Return const access to the coupled flag
inline const Switch coupled() const;
//- Return const access to the cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return const access to the particle track time
inline scalar maxTrackTime() const;
//- Return const access to the reset sources flag
inline const Switch resetSourcesOnStartup() const;
//- Source terms dictionary
inline const dictionary& sourceTermDict() const;
//- Interpolation schemes dictionary
inline const dictionary& interpolationSchemes() const;
//- Integration schemes dictionary
inline const dictionary& integrationSchemes() const;
// Helper functions
//- Returns true if performing a cloud iteration this calc step
bool solveThisStep() const;
//- Returns true if possible to evolve the cloud and sets timestep
// parameters
bool canEvolve();
//- Returns true if writing this step
bool output() const;
};
protected:
// Protected data
@ -293,7 +137,7 @@ protected:
cloudSolution solution_;
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
typename parcelType::constantProperties constProps_;
//- Sub-models dictionary
const dictionary subModelProperties_;
@ -302,7 +146,7 @@ protected:
cachedRandom rndGen_;
//- Cell occupancy information for each parcel, (demand driven)
autoPtr<List<DynamicList<ParcelType*> > > cellOccupancyPtr_;
autoPtr<List<DynamicList<parcelType*> > > cellOccupancyPtr_;
// References to the carrier gas fields
@ -324,33 +168,29 @@ protected:
//- Optional particle forces
typename ParcelType::forceType forces_;
forceType forces_;
// References to the cloud sub-models
//- Collision model
autoPtr<CollisionModel<KinematicCloud<ParcelType> > >
collisionModel_;
//- Dispersion model
autoPtr<DispersionModel<KinematicCloud<ParcelType> > >
autoPtr<DispersionModel<KinematicCloud<CloudType> > >
dispersionModel_;
//- Injector model
autoPtr<InjectionModel<KinematicCloud<ParcelType> > >
autoPtr<InjectionModel<KinematicCloud<CloudType> > >
injectionModel_;
//- Patch interaction model
autoPtr<PatchInteractionModel<KinematicCloud<ParcelType> > >
autoPtr<PatchInteractionModel<KinematicCloud<CloudType> > >
patchInteractionModel_;
//- Post-processing model
autoPtr<PostProcessingModel<KinematicCloud<ParcelType> > >
autoPtr<PostProcessingModel<KinematicCloud<CloudType> > >
postProcessingModel_;
//- Surface film model
autoPtr<SurfaceFilmModel<KinematicCloud<ParcelType> > >
autoPtr<SurfaceFilmModel<KinematicCloud<CloudType> > >
surfaceFilmModel_;
@ -378,7 +218,8 @@ protected:
// Cloud evolution functions
//- Solve the cloud - calls all evolution functions
void solve(typename ParcelType::trackData& td);
template<class TrackData>
void solve(TrackData& td);
//- Pre-evolve
void preEvolve();
@ -391,23 +232,20 @@ protected:
void updateCellOccupancy();
//- Evolve the cloud
void evolveCloud(typename ParcelType::trackData& td);
//- Particle motion
void motion(typename ParcelType::trackData& td);
//- Move-collide particles
void moveCollide(typename ParcelType::trackData& td);
template<class TrackData>
void evolveCloud(TrackData& td);
//- Post-evolve
void postEvolve();
//- Reset state of cloud
void cloudReset(KinematicCloud<ParcelType>& c);
void cloudReset(KinematicCloud<CloudType>& c);
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields
@ -422,29 +260,33 @@ public:
);
//- Copy constructor with new name
KinematicCloud(KinematicCloud<ParcelType>& c, const word& name);
KinematicCloud
(
KinematicCloud<CloudType>& c,
const word& name
);
//- Copy constructor with new name - creates bare cloud
KinematicCloud
(
const fvMesh& mesh,
const word& name,
const KinematicCloud<ParcelType>& c
const KinematicCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > clone(const word& name)
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new KinematicCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > cloneBare(const word& name) const
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new KinematicCloud(this->mesh(), name, *this)
);
@ -462,16 +304,10 @@ 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
//- Return refernce to the mesh
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return particle properties dictionary
@ -484,7 +320,7 @@ public:
inline cloudSolution& solution();
//- Return the constant properties
inline const typename ParcelType::constantProperties&
inline const typename parcelType::constantProperties&
constProps() const;
//- Return reference to the sub-models dictionary
@ -493,14 +329,14 @@ public:
// Cloud data
//- Return refernce to the random object
//- Return reference to the random object
inline cachedRandom& rndGen();
//- Return the cell occupancy information for each
// parcel, non-const access, the caller is
// responsible for updating it for its own purposes
// if particles are removed or created.
inline List<DynamicList<ParcelType*> >& cellOccupancy();
inline List<DynamicList<parcelType*> >& cellOccupancy();
// References to the carrier gas fields
@ -522,53 +358,46 @@ public:
//- Optional particle forces
inline const typename ParcelType::forceType& forces() const;
// inline const typename parcelType::forceType& forces() const;
inline const forceType& forces() const;
// Sub-models
//- Return const access to the collision model
inline const CollisionModel<KinematicCloud<ParcelType> >&
collision() const;
//- Return reference to the collision model
inline CollisionModel<KinematicCloud<ParcelType> >&
collision();
//- Return const-access to the dispersion model
inline const DispersionModel<KinematicCloud<ParcelType> >&
inline const DispersionModel<KinematicCloud<CloudType> >&
dispersion() const;
//- Return reference to the dispersion model
inline DispersionModel<KinematicCloud<ParcelType> >&
inline DispersionModel<KinematicCloud<CloudType> >&
dispersion();
//- Return const access to the injection model
inline const InjectionModel<KinematicCloud<ParcelType> >&
inline const InjectionModel<KinematicCloud<CloudType> >&
injection() const;
//- Return reference to the injection model
inline InjectionModel<KinematicCloud<ParcelType> >&
inline InjectionModel<KinematicCloud<CloudType> >&
injection();
//- Return const-access to the patch interaction model
inline const PatchInteractionModel<KinematicCloud<ParcelType> >&
inline const PatchInteractionModel<KinematicCloud<CloudType> >&
patchInteraction() const;
//- Return reference to the patch interaction model
inline PatchInteractionModel<KinematicCloud<ParcelType> >&
inline PatchInteractionModel<KinematicCloud<CloudType> >&
patchInteraction();
//- Return reference to post-processing model
inline PostProcessingModel<KinematicCloud<ParcelType> >&
inline PostProcessingModel<KinematicCloud<CloudType> >&
postProcessing();
//- Return const-access to the surface film model
inline const SurfaceFilmModel<KinematicCloud<ParcelType> >&
inline const SurfaceFilmModel<KinematicCloud<CloudType> >&
surfaceFilm() const;
//- Return reference to the surface film model
inline SurfaceFilmModel<KinematicCloud<ParcelType> >&
inline SurfaceFilmModel<KinematicCloud<CloudType> >&
surfaceFilm();
@ -638,7 +467,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
@ -662,11 +491,15 @@ public:
) const;
//- Apply relaxation to (steady state) cloud sources
void relaxSources(const KinematicCloud<ParcelType>& cloudOldTime);
void relaxSources(const KinematicCloud<CloudType>& cloudOldTime);
//- Evolve the cloud
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
//- Print cloud information
void info() const;
};

View File

@ -25,348 +25,186 @@ License
#include "fvmSup.H"
// * * * * * * * * * * * cloudSolution Member Functions * * * * * * * * * * //
template<class ParcelType>
inline const Foam::fvMesh&
Foam::KinematicCloud<ParcelType>::cloudSolution::mesh() const
{
return mesh_;
}
template<class ParcelType>
inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::cloudSolution::dict() const
{
return dict_;
}
template<class ParcelType>
inline const Foam::Switch
Foam::KinematicCloud<ParcelType>::cloudSolution::active() const
{
return active_;
}
template<class ParcelType>
inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::cloudSolution::sourceTermDict() const
{
return dict_.subDict("sourceTerms");
}
template<class ParcelType>
inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::cloudSolution::interpolationSchemes() const
{
return dict_.subDict("interpolationSchemes");
}
template<class ParcelType>
inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::cloudSolution::integrationSchemes() const
{
return dict_.subDict("integrationSchemes");
}
template<class ParcelType>
inline const Foam::Switch
Foam::KinematicCloud<ParcelType>::cloudSolution::transient() const
{
return transient_;
}
template<class ParcelType>
inline const Foam::Switch
Foam::KinematicCloud<ParcelType>::cloudSolution::steadyState() const
{
return !transient_;
}
template<class ParcelType>
inline Foam::label
Foam::KinematicCloud<ParcelType>::cloudSolution::calcFrequency() const
{
return calcFrequency_;
}
template<class ParcelType>
inline Foam::scalar
Foam::KinematicCloud<ParcelType>::cloudSolution::maxCo() const
{
return maxCo_;
}
template<class ParcelType>
inline Foam::label Foam::KinematicCloud<ParcelType>::cloudSolution::iter() const
{
return iter_;
}
template<class ParcelType>
inline Foam::label Foam::KinematicCloud<ParcelType>::cloudSolution::nextIter()
{
return ++iter_;
}
template<class ParcelType>
inline Foam::scalar
Foam::KinematicCloud<ParcelType>::cloudSolution::deltaT() const
{
return deltaT_;
}
template<class ParcelType>
inline const Foam::Switch
Foam::KinematicCloud<ParcelType>::cloudSolution::coupled() const
{
return coupled_;
}
template<class ParcelType>
inline const Foam::Switch
Foam::KinematicCloud<ParcelType>::cloudSolution::cellValueSourceCorrection()
const
{
return cellValueSourceCorrection_;
}
template<class ParcelType>
inline Foam::scalar
Foam::KinematicCloud<ParcelType>::cloudSolution::maxTrackTime() const
{
return maxTrackTime_;
}
template<class ParcelType>
inline const Foam::Switch
Foam::KinematicCloud<ParcelType>::cloudSolution::resetSourcesOnStartup() const
{
return resetSourcesOnStartup_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
inline const Foam::KinematicCloud<ParcelType>&
Foam::KinematicCloud<ParcelType>::cloudCopy() const
template<class CloudType>
inline const Foam::KinematicCloud<CloudType>&
Foam::KinematicCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class ParcelType>
inline bool Foam::KinematicCloud<ParcelType>::hasWallImpactDistance() const
{
return !collision().controlsWallInteraction();
}
template<class ParcelType>
inline const Foam::fvMesh& Foam::KinematicCloud<ParcelType>::mesh() const
template<class CloudType>
inline const Foam::fvMesh& Foam::KinematicCloud<CloudType>::mesh() const
{
return mesh_;
}
template<class ParcelType>
template<class CloudType>
inline const Foam::IOdictionary&
Foam::KinematicCloud<ParcelType>::particleProperties() const
Foam::KinematicCloud<CloudType>::particleProperties() const
{
return particleProperties_;
}
template<class ParcelType>
inline const typename Foam::KinematicCloud<ParcelType>::cloudSolution&
Foam::KinematicCloud<ParcelType>::solution() const
template<class CloudType>
inline const Foam::cloudSolution&
Foam::KinematicCloud<CloudType>::solution() const
{
return solution_;
}
template<class ParcelType>
inline typename Foam::KinematicCloud<ParcelType>::cloudSolution&
Foam::KinematicCloud<ParcelType>::solution()
template<class CloudType>
inline Foam::cloudSolution& Foam::KinematicCloud<CloudType>::solution()
{
return solution_;
}
template<class ParcelType>
inline const typename ParcelType::constantProperties&
Foam::KinematicCloud<ParcelType>::constProps() const
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::KinematicCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class ParcelType>
template<class CloudType>
inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::subModelProperties() const
Foam::KinematicCloud<CloudType>::subModelProperties() const
{
return subModelProperties_;
}
template<class ParcelType>
inline const Foam::volScalarField&
Foam::KinematicCloud<ParcelType>::rho() const
template<class CloudType>
inline const Foam::volScalarField& Foam::KinematicCloud<CloudType>::rho() const
{
return rho_;
}
template<class ParcelType>
inline const Foam::volVectorField& Foam::KinematicCloud<ParcelType>::U() const
template<class CloudType>
inline const Foam::volVectorField& Foam::KinematicCloud<CloudType>::U() const
{
return U_;
}
template<class ParcelType>
inline const Foam::volScalarField& Foam::KinematicCloud<ParcelType>::mu() const
template<class CloudType>
inline const Foam::volScalarField& Foam::KinematicCloud<CloudType>::mu() const
{
return mu_;
}
template<class ParcelType>
inline const Foam::dimensionedVector&
Foam::KinematicCloud<ParcelType>::g() const
template<class CloudType>
inline const Foam::dimensionedVector& Foam::KinematicCloud<CloudType>::g() const
{
return g_;
}
template<class ParcelType>
inline const typename ParcelType::forceType&
Foam::KinematicCloud<ParcelType>::forces() const
template<class CloudType>
//inline const typename CloudType::parcelType::forceType&
inline const typename Foam::KinematicCloud<CloudType>::forceType&
Foam::KinematicCloud<CloudType>::forces() const
{
return forces_;
}
template<class ParcelType>
inline const Foam::CollisionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::collision() const
{
return collisionModel_();
}
template<class ParcelType>
inline Foam::CollisionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::collision()
{
return collisionModel_();
}
template<class ParcelType>
inline const Foam::DispersionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::dispersion() const
template<class CloudType>
inline const Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::dispersion() const
{
return dispersionModel_;
}
template<class ParcelType>
inline Foam::DispersionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::dispersion()
template<class CloudType>
inline Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::dispersion()
{
return dispersionModel_();
}
template<class ParcelType>
inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::injection() const
template<class CloudType>
inline const Foam::InjectionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::injection() const
{
return injectionModel_;
}
template<class ParcelType>
inline const Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::patchInteraction() const
template<class CloudType>
inline const Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::patchInteraction() const
{
return patchInteractionModel_;
}
template<class ParcelType>
inline Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::patchInteraction()
template<class CloudType>
inline Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::patchInteraction()
{
return patchInteractionModel_();
}
template<class ParcelType>
inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::injection()
template<class CloudType>
inline Foam::InjectionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::injection()
{
return injectionModel_();
}
template<class ParcelType>
inline Foam::PostProcessingModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::postProcessing()
template<class CloudType>
inline Foam::PostProcessingModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::postProcessing()
{
return postProcessingModel_();
}
template<class ParcelType>
inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::surfaceFilm() const
template<class CloudType>
inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::surfaceFilm() const
{
return surfaceFilmModel_();
}
template<class ParcelType>
inline Foam::SurfaceFilmModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::surfaceFilm()
template<class CloudType>
inline Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::surfaceFilm()
{
return surfaceFilmModel_();
}
template<class ParcelType>
template<class CloudType>
inline const Foam::vectorIntegrationScheme&
Foam::KinematicCloud<ParcelType>::UIntegrator() const
Foam::KinematicCloud<CloudType>::UIntegrator() const
{
return UIntegrator_;
}
template<class ParcelType>
inline Foam::scalar Foam::KinematicCloud<ParcelType>::massInSystem() const
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const
{
scalar sysMass = 0.0;
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
sysMass += p.mass()*p.nParticle();
}
@ -374,15 +212,15 @@ inline Foam::scalar Foam::KinematicCloud<ParcelType>::massInSystem() const
}
template<class ParcelType>
template<class CloudType>
inline Foam::vector
Foam::KinematicCloud<ParcelType>::linearMomentumOfSystem() const
Foam::KinematicCloud<CloudType>::linearMomentumOfSystem() const
{
vector linearMomentum(vector::zero);
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
linearMomentum += p.mass()*p.U();
}
@ -391,15 +229,15 @@ Foam::KinematicCloud<ParcelType>::linearMomentumOfSystem() const
}
template<class ParcelType>
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<ParcelType>::linearKineticEnergyOfSystem() const
Foam::KinematicCloud<CloudType>::linearKineticEnergyOfSystem() const
{
scalar linearKineticEnergy = 0.0;
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
linearKineticEnergy += 0.5*p.mass()*(p.U() & p.U());
}
@ -408,16 +246,15 @@ Foam::KinematicCloud<ParcelType>::linearKineticEnergyOfSystem() const
}
template<class ParcelType>
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<ParcelType>::
rotationalKineticEnergyOfSystem() const
Foam::KinematicCloud<CloudType>::rotationalKineticEnergyOfSystem() const
{
scalar rotationalKineticEnergy = 0.0;
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
rotationalKineticEnergy +=
0.5*p.momentOfInertia()*(p.omega() & p.omega());
@ -427,16 +264,16 @@ rotationalKineticEnergyOfSystem() const
}
template<class ParcelType>
inline Foam::cachedRandom& Foam::KinematicCloud<ParcelType>::rndGen()
template<class CloudType>
inline Foam::cachedRandom& Foam::KinematicCloud<CloudType>::rndGen()
{
return rndGen_;
}
template<class ParcelType>
inline Foam::List<Foam::DynamicList<ParcelType*> >&
Foam::KinematicCloud<ParcelType>::cellOccupancy()
template<class CloudType>
inline Foam::List<Foam::DynamicList<typename CloudType::particleType*> >&
Foam::KinematicCloud<CloudType>::cellOccupancy()
{
if (cellOccupancyPtr_.empty())
{
@ -447,41 +284,41 @@ Foam::KinematicCloud<ParcelType>::cellOccupancy()
}
template<class ParcelType>
template<class CloudType>
inline Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UTrans()
Foam::KinematicCloud<CloudType>::UTrans()
{
return UTrans_();
}
template<class ParcelType>
template<class CloudType>
inline const Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UTrans() const
Foam::KinematicCloud<CloudType>::UTrans() const
{
return UTrans_();
}
template<class ParcelType>
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UCoeff()
Foam::KinematicCloud<CloudType>::UCoeff()
{
return UCoeff_();
}
template<class ParcelType>
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UCoeff() const
Foam::KinematicCloud<CloudType>::UCoeff() const
{
return UCoeff_();
}
template<class ParcelType>
template<class CloudType>
inline Foam::tmp<Foam::fvVectorMatrix>
Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const
Foam::KinematicCloud<CloudType>::SU(volVectorField& U) const
{
if (debug)
{
@ -497,7 +334,7 @@ Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const
{
return
UTrans()/(mesh_.V()*this->db().time().deltaT())
+ fvm::SuSp(-UCoeff()/mesh_.V(), U)
- fvm::Sp(UCoeff()/mesh_.V(), U)
+ UCoeff()/mesh_.V()*U;
}
else
@ -515,9 +352,9 @@ Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const
}
template<class ParcelType>
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<ParcelType>::theta() const
Foam::KinematicCloud<CloudType>::theta() const
{
tmp<volScalarField> ttheta
(
@ -538,9 +375,9 @@ Foam::KinematicCloud<ParcelType>::theta() const
);
scalarField& theta = ttheta().internalField();
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
const label cellI = p.cell();
theta[cellI] += p.nParticle()*p.volume();
@ -552,9 +389,9 @@ Foam::KinematicCloud<ParcelType>::theta() const
}
template<class ParcelType>
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<ParcelType>::alpha() const
Foam::KinematicCloud<CloudType>::alpha() const
{
tmp<volScalarField> talpha
(
@ -575,9 +412,9 @@ Foam::KinematicCloud<ParcelType>::alpha() const
);
scalarField& alpha = talpha().internalField();
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
const label cellI = p.cell();
alpha[cellI] += p.nParticle()*p.mass();
@ -589,9 +426,9 @@ Foam::KinematicCloud<ParcelType>::alpha() const
}
template<class ParcelType>
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<ParcelType>::rhoEff() const
Foam::KinematicCloud<CloudType>::rhoEff() const
{
tmp<volScalarField> trhoEff
(
@ -612,9 +449,9 @@ Foam::KinematicCloud<ParcelType>::rhoEff() const
);
scalarField& rhoEff = trhoEff().internalField();
forAllConstIter(typename KinematicCloud<ParcelType>, *this, iter)
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
const label cellI = p.cell();
rhoEff[cellI] += p.nParticle()*p.mass();

View File

@ -0,0 +1,225 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "cloudSolution.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cloudSolution::cloudSolution
(
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
dict_(dict),
active_(dict.lookup("active")),
transient_(false),
calcFrequency_(1),
maxCo_(0.3),
iter_(1),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(true),
schemes_()
{
if (active_)
{
read();
}
}
Foam::cloudSolution::cloudSolution
(
const cloudSolution& cs
)
:
mesh_(cs.mesh_),
dict_(cs.dict_),
active_(cs.active_),
transient_(cs.transient_),
calcFrequency_(cs.calcFrequency_),
maxCo_(cs.maxCo_),
iter_(cs.iter_),
deltaT_(cs.deltaT_),
coupled_(cs.coupled_),
cellValueSourceCorrection_(cs.cellValueSourceCorrection_),
maxTrackTime_(cs.maxTrackTime_),
resetSourcesOnStartup_(cs.resetSourcesOnStartup_),
schemes_(cs.schemes_)
{}
Foam::cloudSolution::cloudSolution
(
const fvMesh& mesh
)
:
mesh_(mesh),
dict_(dictionary::null),
active_(false),
transient_(false),
calcFrequency_(0),
maxCo_(GREAT),
iter_(0),
deltaT_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(false),
schemes_()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cloudSolution::~cloudSolution()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cloudSolution::read()
{
dict_.lookup("transient") >> transient_;
dict_.lookup("coupled") >> coupled_;
dict_.lookup("cellValueSourceCorrection") >> cellValueSourceCorrection_;
if (steadyState())
{
dict_.lookup("calcFrequency") >> calcFrequency_;
dict_.lookup("maxCo") >> maxCo_;
dict_.lookup("maxTrackTime") >> maxTrackTime_;
dict_.subDict("sourceTerms").lookup("resetOnStartup")
>> resetSourcesOnStartup_;
}
const dictionary&
schemesDict(dict_.subDict("sourceTerms").subDict("schemes"));
wordList vars(schemesDict.toc());
schemes_.setSize(vars.size());
forAll(vars, i)
{
schemes_[i].first() = vars[i];
Istream& is = schemesDict.lookup(vars[i]);
const word scheme(is);
if (scheme == "semiImplicit")
{
is >> schemes_[i].second();
}
else if (scheme == "explicit")
{
schemes_[i].second() = -1;
}
else
{
FatalErrorIn("void cloudSolution::read()")
<< "Invalid scheme " << scheme << ". Valid schemes are "
<< "explicit and semiImplicit" << exit(FatalError);
}
}
}
Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
{
forAll(schemes_, i)
{
if (fieldName == schemes_[i].first())
{
return schemes_[i].second();
}
}
FatalErrorIn
(
"scalar cloudSolution::relaxCoeff(const word& fieldName) const"
) << "Field name " << fieldName << " not found in schemes"
<< abort(FatalError);
return 1.0;
}
bool Foam::cloudSolution::semiImplicit(const word& fieldName) const
{
forAll(schemes_, i)
{
if (fieldName == schemes_[i].first())
{
return schemes_[i].second() >= 0;
}
}
FatalErrorIn
(
"bool cloudSolution::semiImplicit(const word& fieldName) const"
) << "Field name " << fieldName << " not found in schemes"
<< abort(FatalError);
return false;
}
bool Foam::cloudSolution::solveThisStep() const
{
return
active_
&& (
mesh_.time().outputTime()
|| (mesh_.time().timeIndex() % calcFrequency_ == 0)
);
}
bool Foam::cloudSolution::canEvolve()
{
// Set the calculation time step
if (transient_)
{
deltaT_ = mesh_.time().deltaTValue();
}
else
{
deltaT_ = maxTrackTime_;
}
return solveThisStep();
}
bool Foam::cloudSolution::output() const
{
return active_ && mesh_.time().outputTime();
}
// ************************************************************************* //

View File

@ -0,0 +1,222 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::cloudSolution
Description
- Stores all relevant solution info
SourceFiles
cloudSolutionI.H
cloudSolution.C
\*---------------------------------------------------------------------------*/
#ifndef cloudSolution_H
#define cloudSolution_H
#include "fvMesh.H"
#include "Switch.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cloudSolution Declaration
\*---------------------------------------------------------------------------*/
class cloudSolution
{
// Private Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Dictionary used during construction
dictionary dict_;
//- Cloud active flag
const Switch active_;
//- Transient flag
Switch transient_;
//- Calculation frequency - carrier steps per cloud step
// NOTE: Steady operation only
label calcFrequency_;
//- Maximum particle Courant number
// Max fraction of current cell that can be traversed in a single
// step
scalar maxCo_;
//- Current cloud iteration
label iter_;
//- Cloud solution time step
scalar deltaT_;
// Run-time options
//- Flag to indicate whether parcels are coupled to the carrier
// phase, i.e. whether or not to generate source terms for
// carrier phase
Switch coupled_;
//- Flag to correct cell values with latest transfer information
// during the lagrangian timestep
Switch cellValueSourceCorrection_;
//- Maximum particle track time [s]
scalar maxTrackTime_;
//- Flag to indicate whether coupling source terms should be
// reset on start-up/first read
Switch resetSourcesOnStartup_;
//- List schemes, e.g. U semiImplicit 1
List<Tuple2<word, scalar> > schemes_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const cloudSolution&);
public:
// Constructors
//- Construct null from mesh reference
cloudSolution(const fvMesh& mesh);
//- Construct from mesh and dictionary
cloudSolution(const fvMesh& mesh, const dictionary& dict);
//- Construct copy
cloudSolution(const cloudSolution& cs);
//- Destructor
virtual ~cloudSolution();
// Member functions
//- Read properties from dictionary
void read();
// Access
//- Return relaxation coefficient for field
scalar relaxCoeff(const word& fieldName) const;
//- Return semi-implicit flag coefficient for field
bool semiImplicit(const word& fieldName) const;
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return const access to the dictionary
inline const dictionary& dict() const;
//- Return the active flag
inline const Switch active() const;
//- Return const access to the transient flag
inline const Switch transient() const;
//- Return const access to the steady flag
inline const Switch steadyState() const;
//- Return const access to the calculation frequency
inline label calcFrequency() const;
//- Return const access to the max particle Courant number
inline scalar maxCo() const;
//- Return const access to the current cloud iteration
inline label iter() const;
//- Increment and return iter counter
inline label nextIter();
//- Return the time step
inline scalar deltaT() const;
//- Return const access to the coupled flag
inline const Switch coupled() const;
//- Return const access to the cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return const access to the particle track time
inline scalar maxTrackTime() const;
//- Return const access to the reset sources flag
inline const Switch resetSourcesOnStartup() const;
//- Source terms dictionary
inline const dictionary& sourceTermDict() const;
//- Interpolation schemes dictionary
inline const dictionary& interpolationSchemes() const;
//- Integration schemes dictionary
inline const dictionary& integrationSchemes() const;
// Helper functions
//- Returns true if performing a cloud iteration this calc step
bool solveThisStep() const;
//- Returns true if possible to evolve the cloud and sets timestep
// parameters
bool canEvolve();
//- Returns true if writing this step
bool output() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "cloudSolutionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
inline const Foam::fvMesh& Foam::cloudSolution::mesh() const
{
return mesh_;
}
inline const Foam::dictionary& Foam::cloudSolution::dict() const
{
return dict_;
}
inline const Foam::Switch Foam::cloudSolution::active() const
{
return active_;
}
inline const Foam::dictionary& Foam::cloudSolution::sourceTermDict() const
{
return dict_.subDict("sourceTerms");
}
inline const Foam::dictionary& Foam::cloudSolution::interpolationSchemes() const
{
return dict_.subDict("interpolationSchemes");
}
inline const Foam::dictionary& Foam::cloudSolution::integrationSchemes() const
{
return dict_.subDict("integrationSchemes");
}
inline const Foam::Switch Foam::cloudSolution::transient() const
{
return transient_;
}
inline const Foam::Switch Foam::cloudSolution::steadyState() const
{
return !transient_;
}
inline Foam::label Foam::cloudSolution::calcFrequency() const
{
return calcFrequency_;
}
inline Foam::scalar Foam::cloudSolution::maxCo() const
{
return maxCo_;
}
inline Foam::label Foam::cloudSolution::iter() const
{
return iter_;
}
inline Foam::label Foam::cloudSolution::nextIter()
{
return ++iter_;
}
inline Foam::scalar Foam::cloudSolution::deltaT() const
{
return deltaT_;
}
inline const Foam::Switch Foam::cloudSolution::coupled() const
{
return coupled_;
}
inline const Foam::Switch Foam::cloudSolution::cellValueSourceCorrection() const
{
return cellValueSourceCorrection_;
}
inline Foam::scalar Foam::cloudSolution::maxTrackTime() const
{
return maxTrackTime_;
}
inline const Foam::Switch Foam::cloudSolution::resetSourcesOnStartup() const
{
return resetSourcesOnStartup_;
}
// ************************************************************************* //

View File

@ -30,12 +30,12 @@ License
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::setModels()
template<class CloudType>
void Foam::ReactingCloud<CloudType>::setModels()
{
compositionModel_.reset
(
CompositionModel<ReactingCloud<ParcelType> >::New
CompositionModel<ReactingCloud<CloudType> >::New
(
this->subModelProperties(),
*this
@ -44,7 +44,7 @@ void Foam::ReactingCloud<ParcelType>::setModels()
phaseChangeModel_.reset
(
PhaseChangeModel<ReactingCloud<ParcelType> >::New
PhaseChangeModel<ReactingCloud<CloudType> >::New
(
this->subModelProperties(),
*this
@ -53,8 +53,8 @@ void Foam::ReactingCloud<ParcelType>::setModels()
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
template<class CloudType>
void Foam::ReactingCloud<CloudType>::checkSuppliedComposition
(
const scalarField& YSupplied,
const scalarField& Y,
@ -65,7 +65,7 @@ void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
{
FatalErrorIn
(
"ReactingCloud<ParcelType>::checkSuppliedComposition"
"ReactingCloud<CloudType>::checkSuppliedComposition"
"("
"const scalarField&, "
"const scalarField&, "
@ -80,10 +80,10 @@ void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::cloudReset(ReactingCloud<ParcelType>& c)
template<class CloudType>
void Foam::ReactingCloud<CloudType>::cloudReset(ReactingCloud<CloudType>& c)
{
ThermoCloud<ParcelType>::cloudReset(c);
CloudType::cloudReset(c);
compositionModel_.reset(c.compositionModel_.ptr());
phaseChangeModel_.reset(c.phaseChangeModel_.ptr());
@ -94,8 +94,8 @@ void Foam::ReactingCloud<ParcelType>::cloudReset(ReactingCloud<ParcelType>& c)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ReactingCloud<ParcelType>::ReactingCloud
template<class CloudType>
Foam::ReactingCloud<CloudType>::ReactingCloud
(
const word& cloudName,
const volScalarField& rho,
@ -105,7 +105,7 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
bool readFields
)
:
ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
CloudType(cloudName, rho, U, g, thermo, false),
reactingCloud(),
cloudCopyPtr_(NULL),
constProps_(this->particleProperties(), this->solution().active()),
@ -144,7 +144,7 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
if (readFields)
{
ParcelType::readFields(*this);
parcelType::readFields(*this, this->composition());
}
if (this->solution().resetSourcesOnStartup())
@ -154,14 +154,14 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
}
template<class ParcelType>
Foam::ReactingCloud<ParcelType>::ReactingCloud
template<class CloudType>
Foam::ReactingCloud<CloudType>::ReactingCloud
(
ReactingCloud<ParcelType>& c,
ReactingCloud<CloudType>& c,
const word& name
)
:
ThermoCloud<ParcelType>(c, name),
CloudType(c, name),
reactingCloud(),
cloudCopyPtr_(NULL),
constProps_(c.constProps_),
@ -194,15 +194,15 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
}
template<class ParcelType>
Foam::ReactingCloud<ParcelType>::ReactingCloud
template<class CloudType>
Foam::ReactingCloud<CloudType>::ReactingCloud
(
const fvMesh& mesh,
const word& name,
const ReactingCloud<ParcelType>& c
const ReactingCloud<CloudType>& c
)
:
ThermoCloud<ParcelType>(mesh, name, c),
CloudType(mesh, name, c),
reactingCloud(),
cloudCopyPtr_(NULL),
constProps_(),
@ -216,22 +216,22 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ReactingCloud<ParcelType>::~ReactingCloud()
template<class CloudType>
Foam::ReactingCloud<CloudType>::~ReactingCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::checkParcelProperties
template<class CloudType>
void Foam::ReactingCloud<CloudType>::checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ThermoCloud<ParcelType>::checkParcelProperties
CloudType::checkParcelProperties
(
parcel,
lagrangianDt,
@ -257,12 +257,12 @@ void Foam::ReactingCloud<ParcelType>::checkParcelProperties
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::storeState()
template<class CloudType>
void Foam::ReactingCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<ReactingCloud<ParcelType>*>
static_cast<ReactingCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
@ -270,18 +270,18 @@ void Foam::ReactingCloud<ParcelType>::storeState()
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::restoreState()
template<class CloudType>
void Foam::ReactingCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
template<class CloudType>
void Foam::ReactingCloud<CloudType>::resetSourceTerms()
{
ThermoCloud<ParcelType>::resetSourceTerms();
CloudType::resetSourceTerms();
forAll(rhoTrans_, i)
{
rhoTrans_[i].field() = 0.0;
@ -289,15 +289,15 @@ void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::relaxSources
template<class CloudType>
void Foam::ReactingCloud<CloudType>::relaxSources
(
const ReactingCloud<ParcelType>& cloudOldTime
const ReactingCloud<CloudType>& cloudOldTime
)
{
typedef DimensionedField<scalar, volMesh> dsfType;
ThermoCloud<ParcelType>::relaxSources(cloudOldTime);
CloudType::relaxSources(cloudOldTime);
forAll(rhoTrans_, fieldI)
{
@ -308,33 +308,44 @@ void Foam::ReactingCloud<ParcelType>::relaxSources
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::evolve()
template<class CloudType>
void Foam::ReactingCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename ParcelType::trackData td(*this);
typename parcelType::template
TrackingData<ReactingCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::addToMassPhaseChange(const scalar dMass)
template<class CloudType>
void Foam::ReactingCloud<CloudType>::addToMassPhaseChange(const scalar dMass)
{
dMassPhaseChange_ += dMass;
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::info() const
template<class CloudType>
void Foam::ReactingCloud<CloudType>::info() const
{
ThermoCloud<ParcelType>::info();
CloudType::info();
Info<< " Mass transfer phase change = "
<< returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::writeFields() const
{
if (this->size())
{
CloudType::particleType::writeFields(*this, this->composition());
}
}
// ************************************************************************* //

View File

@ -40,7 +40,6 @@ SourceFiles
#ifndef ReactingCloud_H
#define ReactingCloud_H
#include "ThermoCloud.H"
#include "reactingCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,19 +59,24 @@ class PhaseChangeModel;
Class ReactingCloud Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
template<class CloudType>
class ReactingCloud
:
public ThermoCloud<ParcelType>,
public CloudType,
public reactingCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
private:
// Private data
//- Cloud copy pointer
autoPtr<ReactingCloud<ParcelType> > cloudCopyPtr_;
autoPtr<ReactingCloud<CloudType> > cloudCopyPtr_;
// Private member functions
@ -89,17 +93,17 @@ protected:
// Protected data
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
typename parcelType::constantProperties constProps_;
// References to the cloud sub-models
//- Reacting composition model
autoPtr<CompositionModel<ReactingCloud<ParcelType> > >
autoPtr<CompositionModel<ReactingCloud<CloudType> > >
compositionModel_;
//- Reacting phase change model
autoPtr<PhaseChangeModel<ReactingCloud<ParcelType> > >
autoPtr<PhaseChangeModel<ReactingCloud<CloudType> > >
phaseChangeModel_;
@ -137,11 +141,13 @@ protected:
// Cloud evolution functions
//- Reset state of cloud
void cloudReset(ReactingCloud<ParcelType>& c);
void cloudReset(ReactingCloud<CloudType>& c);
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields
@ -156,29 +162,29 @@ public:
);
//- Copy constructor with new name
ReactingCloud(ReactingCloud<ParcelType>& c, const word& name);
ReactingCloud(ReactingCloud<CloudType>& c, const word& name);
//- Copy constructor with new name - creates bare cloud
ReactingCloud
(
const fvMesh& mesh,
const word& name,
const ReactingCloud<ParcelType>& c
const ReactingCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > clone(const word& name)
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new ReactingCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > cloneBare(const word& name) const
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new ReactingCloud(this->mesh(), name, *this)
);
@ -189,10 +195,6 @@ public:
virtual ~ReactingCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions
// Access
@ -201,18 +203,18 @@ public:
inline const ReactingCloud& cloudCopy() const;
//- Return the constant properties
inline const typename ParcelType::constantProperties&
inline const typename parcelType::constantProperties&
constProps() const;
// Sub-models
//- Return reference to reacting composition model
inline const CompositionModel<ReactingCloud<ParcelType> >&
inline const CompositionModel<ReactingCloud<CloudType> >&
composition() const;
//- Return reference to reacting phase change model
inline const PhaseChangeModel<ReactingCloud<ParcelType> >&
inline const PhaseChangeModel<ReactingCloud<CloudType> >&
phaseChange() const;
@ -262,7 +264,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
@ -277,13 +279,19 @@ public:
void resetSourceTerms();
//- Apply relaxation to (steady state) cloud sources
void relaxSources(const ReactingCloud<ParcelType>& cloudOldTime);
void relaxSources(const ReactingCloud<CloudType>& cloudOldTime);
//- Evolve the cloud
void evolve();
//- Print cloud information
void info() const;
// I-O
//- Write the field data for the cloud
virtual void writeFields() const;
};

View File

@ -25,66 +25,65 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
inline const Foam::ReactingCloud<ParcelType>&
Foam::ReactingCloud<ParcelType>::cloudCopy() const
template<class CloudType>
inline const Foam::ReactingCloud<CloudType>&
Foam::ReactingCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class ParcelType>
inline const typename ParcelType::constantProperties&
Foam::ReactingCloud<ParcelType>::constProps() const
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::ReactingCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class ParcelType>
inline const Foam::CompositionModel<Foam::ReactingCloud<ParcelType> >&
Foam::ReactingCloud<ParcelType>::composition() const
template<class CloudType>
inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::composition() const
{
return compositionModel_;
}
template<class ParcelType>
inline const Foam::PhaseChangeModel<Foam::ReactingCloud<ParcelType> >&
Foam::ReactingCloud<ParcelType>::phaseChange() const
template<class CloudType>
inline const Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::phaseChange() const
{
return phaseChangeModel_;
}
template<class ParcelType>
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ReactingCloud<ParcelType>::rhoTrans(const label i)
Foam::ReactingCloud<CloudType>::rhoTrans(const label i)
{
return rhoTrans_[i];
}
template<class ParcelType>
template<class CloudType>
inline
const Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ReactingCloud<ParcelType>::rhoTrans() const
Foam::ReactingCloud<CloudType>::rhoTrans() const
{
return rhoTrans_;
}
template<class ParcelType>
template<class CloudType>
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ReactingCloud<ParcelType>::rhoTrans()
Foam::ReactingCloud<CloudType>::rhoTrans()
{
return rhoTrans_;
}
template<class ParcelType>
inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ReactingCloud<ParcelType>::SYi
template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
(
const label i,
volScalarField& Yi
@ -138,9 +137,9 @@ Foam::ReactingCloud<ParcelType>::SYi
}
template<class ParcelType>
template<class CloudType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ReactingCloud<ParcelType>::Srho(const label i) const
Foam::ReactingCloud<CloudType>::Srho(const label i) const
{
tmp<DimensionedField<scalar, volMesh> > tRhoi
(
@ -175,9 +174,9 @@ Foam::ReactingCloud<ParcelType>::Srho(const label i) const
}
template<class ParcelType>
template<class CloudType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ReactingCloud<ParcelType>::Srho() const
Foam::ReactingCloud<CloudType>::Srho() const
{
tmp<DimensionedField<scalar, volMesh> > trhoTrans
(
@ -217,9 +216,9 @@ Foam::ReactingCloud<ParcelType>::Srho() const
}
template<class ParcelType>
template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ReactingCloud<ParcelType>::Srho(volScalarField& rho) const
Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
{
if (this->solution().coupled())
{

View File

@ -30,12 +30,12 @@ License
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::setModels()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::setModels()
{
devolatilisationModel_.reset
(
DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >::New
DevolatilisationModel<ReactingMultiphaseCloud<CloudType> >::New
(
this->subModelProperties(),
*this
@ -44,7 +44,7 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::setModels()
surfaceReactionModel_.reset
(
SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >::New
SurfaceReactionModel<ReactingMultiphaseCloud<CloudType> >::New
(
this->subModelProperties(),
*this
@ -53,13 +53,13 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::setModels()
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::cloudReset
(
ReactingMultiphaseCloud<ParcelType>& c
ReactingMultiphaseCloud<CloudType>& c
)
{
ReactingCloud<ParcelType>::cloudReset(c);
CloudType::cloudReset(c);
devolatilisationModel_.reset(c.devolatilisationModel_.ptr());
surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr());
@ -71,8 +71,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
(
const word& cloudName,
const volScalarField& rho,
@ -82,7 +82,7 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
bool readFields
)
:
ReactingCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
CloudType(cloudName, rho, U, g, thermo, false),
reactingMultiphaseCloud(),
cloudCopyPtr_(NULL),
constProps_(this->particleProperties(), this->solution().active()),
@ -98,7 +98,7 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
if (readFields)
{
ParcelType::readFields(*this);
parcelType::readFields(*this, this->composition());
}
if (this->solution().resetSourcesOnStartup())
@ -108,14 +108,14 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
}
template<class ParcelType>
Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
(
ReactingMultiphaseCloud<ParcelType>& c,
ReactingMultiphaseCloud<CloudType>& c,
const word& name
)
:
ReactingCloud<ParcelType>(c, name),
CloudType(c, name),
reactingMultiphaseCloud(),
cloudCopyPtr_(NULL),
constProps_(c.constProps_),
@ -126,15 +126,15 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
{}
template<class ParcelType>
Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
(
const fvMesh& mesh,
const word& name,
const ReactingMultiphaseCloud<ParcelType>& c
const ReactingMultiphaseCloud<CloudType>& c
)
:
ReactingCloud<ParcelType>(mesh, name, c),
CloudType(mesh, name, c),
reactingMultiphaseCloud(),
cloudCopyPtr_(NULL),
constProps_(),
@ -147,22 +147,22 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud()
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::~ReactingMultiphaseCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ReactingCloud<ParcelType>::checkParcelProperties
CloudType::checkParcelProperties
(
parcel,
lagrangianDt,
@ -203,12 +203,12 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::storeState()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<ReactingMultiphaseCloud<ParcelType>*>
static_cast<ReactingMultiphaseCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
@ -216,35 +216,36 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::storeState()
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::restoreState()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::resetSourceTerms()
{
ReactingCloud<ParcelType>::resetSourceTerms();
CloudType::resetSourceTerms();
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename ParcelType::trackData td(*this);
typename parcelType::template
TrackingData<ReactingMultiphaseCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassDevolatilisation
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::addToMassDevolatilisation
(
const scalar dMass
)
@ -253,8 +254,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassDevolatilisation
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassSurfaceReaction
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::addToMassSurfaceReaction
(
const scalar dMass
)
@ -263,10 +264,10 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassSurfaceReaction
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::info() const
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::info() const
{
ReactingCloud<ParcelType>::info();
CloudType::info();
Info<< " Mass transfer devolatilisation = "
<< returnReduce(dMassDevolatilisation_, sumOp<scalar>()) << nl;
Info<< " Mass transfer surface reaction = "
@ -274,4 +275,14 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::info() const
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::writeFields() const
{
if (this->size())
{
CloudType::particleType::writeFields(*this, this->composition());
}
}
// ************************************************************************* //

View File

@ -61,16 +61,24 @@ class SurfaceReactionModel;
Class ReactingMultiphaseCloud Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
template<class CloudType>
class ReactingMultiphaseCloud
:
public ReactingCloud<ParcelType>,
public CloudType,
public reactingMultiphaseCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
private:
// Private data
//- Cloud copy pointer
autoPtr<ReactingMultiphaseCloud<ParcelType> > cloudCopyPtr_;
autoPtr<ReactingMultiphaseCloud<CloudType> > cloudCopyPtr_;
// Private member functions
@ -87,7 +95,7 @@ protected:
// Protected data
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
typename parcelType::constantProperties constProps_;
// References to the cloud sub-models
@ -95,14 +103,14 @@ protected:
//- Devolatilisation model
autoPtr
<
DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >
DevolatilisationModel<ReactingMultiphaseCloud<CloudType> >
>
devolatilisationModel_;
//- Surface reaction model
autoPtr
<
SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >
SurfaceReactionModel<ReactingMultiphaseCloud<CloudType> >
>
surfaceReactionModel_;
@ -128,11 +136,13 @@ protected:
// Cloud evolution functions
//- Reset state of cloud
void cloudReset(ReactingMultiphaseCloud<ParcelType>& c);
void cloudReset(ReactingMultiphaseCloud<CloudType>& c);
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields
@ -150,7 +160,7 @@ public:
//- Copy constructor with new name
ReactingMultiphaseCloud
(
ReactingMultiphaseCloud<ParcelType>& c,
ReactingMultiphaseCloud<CloudType>& c,
const word& name
);
@ -159,22 +169,22 @@ public:
(
const fvMesh& mesh,
const word& name,
const ReactingMultiphaseCloud<ParcelType>& c
const ReactingMultiphaseCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > clone(const word& name)
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new ReactingMultiphaseCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > cloneBare(const word& name) const
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new ReactingMultiphaseCloud(this->mesh(), name, *this)
);
@ -185,10 +195,6 @@ public:
virtual ~ReactingMultiphaseCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions
// Access
@ -197,7 +203,7 @@ public:
inline const ReactingMultiphaseCloud& cloudCopy() const;
//- Return the constant properties
inline const typename ParcelType::constantProperties&
inline const typename parcelType::constantProperties&
constProps() const;
@ -206,14 +212,14 @@ public:
//- Return reference to devolatilisation model
inline const DevolatilisationModel
<
ReactingMultiphaseCloud<ParcelType>
ReactingMultiphaseCloud<CloudType>
>&
devolatilisation() const;
//- Return reference to reacting surface reaction model
inline const SurfaceReactionModel
<
ReactingMultiphaseCloud<ParcelType>
ReactingMultiphaseCloud<CloudType>
>&
surfaceReaction() const;
@ -232,7 +238,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
@ -251,6 +257,12 @@ public:
//- Print cloud information
void info() const;
// I-O
//- Write the field data for the cloud
virtual void writeFields() const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,39 +25,39 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
inline const Foam::ReactingMultiphaseCloud<ParcelType>&
Foam::ReactingMultiphaseCloud<ParcelType>::cloudCopy() const
template<class CloudType>
inline const Foam::ReactingMultiphaseCloud<CloudType>&
Foam::ReactingMultiphaseCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class ParcelType>
inline const typename ParcelType::constantProperties&
Foam::ReactingMultiphaseCloud<ParcelType>::constProps() const
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::ReactingMultiphaseCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class ParcelType>
template<class CloudType>
inline const Foam::DevolatilisationModel
<
Foam::ReactingMultiphaseCloud<ParcelType>
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<ParcelType>::devolatilisation() const
Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation() const
{
return devolatilisationModel_;
}
template<class ParcelType>
template<class CloudType>
inline const Foam::SurfaceReactionModel
<
Foam::ReactingMultiphaseCloud<ParcelType>
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<ParcelType>::surfaceReaction() const
Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction() const
{
return surfaceReactionModel_;
}

View File

@ -30,12 +30,12 @@ License
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::setModels()
template<class CloudType>
void Foam::ThermoCloud<CloudType>::setModels()
{
heatTransferModel_.reset
(
HeatTransferModel<ThermoCloud<ParcelType> >::New
HeatTransferModel<ThermoCloud<CloudType> >::New
(
this->subModelProperties(),
*this
@ -55,10 +55,10 @@ void Foam::ThermoCloud<ParcelType>::setModels()
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::cloudReset(ThermoCloud<ParcelType>& c)
template<class CloudType>
void Foam::ThermoCloud<CloudType>::cloudReset(ThermoCloud<CloudType>& c)
{
KinematicCloud<ParcelType>::cloudReset(c);
CloudType::cloudReset(c);
heatTransferModel_.reset(c.heatTransferModel_.ptr());
TIntegrator_.reset(c.TIntegrator_.ptr());
@ -69,8 +69,8 @@ void Foam::ThermoCloud<ParcelType>::cloudReset(ThermoCloud<ParcelType>& c)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ThermoCloud<ParcelType>::ThermoCloud
template<class CloudType>
Foam::ThermoCloud<CloudType>::ThermoCloud
(
const word& cloudName,
const volScalarField& rho,
@ -80,7 +80,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
bool readFields
)
:
KinematicCloud<ParcelType>
CloudType
(
cloudName,
rho,
@ -139,7 +139,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
if (readFields)
{
ParcelType::readFields(*this);
parcelType::readFields(*this);
}
if (this->solution().resetSourcesOnStartup())
@ -149,14 +149,14 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
}
template<class ParcelType>
Foam::ThermoCloud<ParcelType>::ThermoCloud
template<class CloudType>
Foam::ThermoCloud<CloudType>::ThermoCloud
(
ThermoCloud<ParcelType>& c,
ThermoCloud<CloudType>& c,
const word& name
)
:
KinematicCloud<ParcelType>(c, name),
CloudType(c, name),
thermoCloud(),
cloudCopyPtr_(NULL),
constProps_(c.constProps_),
@ -201,15 +201,15 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
{}
template<class ParcelType>
Foam::ThermoCloud<ParcelType>::ThermoCloud
template<class CloudType>
Foam::ThermoCloud<CloudType>::ThermoCloud
(
const fvMesh& mesh,
const word& name,
const ThermoCloud<ParcelType>& c
const ThermoCloud<CloudType>& c
)
:
KinematicCloud<ParcelType>(mesh, name, c),
CloudType(mesh, name, c),
thermoCloud(),
cloudCopyPtr_(NULL),
constProps_(),
@ -226,27 +226,22 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ThermoCloud<ParcelType>::~ThermoCloud()
template<class CloudType>
Foam::ThermoCloud<CloudType>::~ThermoCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::checkParcelProperties
template<class CloudType>
void Foam::ThermoCloud<CloudType>::checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
KinematicCloud<ParcelType>::checkParcelProperties
(
parcel,
lagrangianDt,
fullyDescribed
);
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
if (!fullyDescribed)
{
@ -256,12 +251,12 @@ void Foam::ThermoCloud<ParcelType>::checkParcelProperties
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::storeState()
template<class CloudType>
void Foam::ThermoCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<ThermoCloud<ParcelType>*>
static_cast<ThermoCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
@ -269,51 +264,52 @@ void Foam::ThermoCloud<ParcelType>::storeState()
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::restoreState()
template<class CloudType>
void Foam::ThermoCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::resetSourceTerms()
template<class CloudType>
void Foam::ThermoCloud<CloudType>::resetSourceTerms()
{
KinematicCloud<ParcelType>::resetSourceTerms();
CloudType::resetSourceTerms();
hsTrans_->field() = 0.0;
hsCoeff_->field() = 0.0;
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::relaxSources
template<class CloudType>
void Foam::ThermoCloud<CloudType>::relaxSources
(
const ThermoCloud<ParcelType>& cloudOldTime
const ThermoCloud<CloudType>& cloudOldTime
)
{
KinematicCloud<ParcelType>::relaxSources(cloudOldTime);
CloudType::relaxSources(cloudOldTime);
this->relax(hsTrans_(), cloudOldTime.hsTrans(), "hs");
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::evolve()
template<class CloudType>
void Foam::ThermoCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename ParcelType::trackData td(*this);
typename parcelType::template
TrackingData<ThermoCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::info() const
template<class CloudType>
void Foam::ThermoCloud<CloudType>::info() const
{
KinematicCloud<ParcelType>::info();
CloudType::info();
}

View File

@ -57,16 +57,23 @@ class HeatTransferModel;
Class ThermoCloud Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
template<class CloudType>
class ThermoCloud
:
public KinematicCloud<ParcelType>,
public CloudType,
public thermoCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
private:
// Private data
//- Cloud copy pointer
autoPtr<ThermoCloud<ParcelType> > cloudCopyPtr_;
autoPtr<ThermoCloud<CloudType> > cloudCopyPtr_;
// Private member functions
@ -83,7 +90,7 @@ protected:
// Protected data
//- Thermo parcel constant properties
typename ParcelType::constantProperties constProps_;
typename parcelType::constantProperties constProps_;
// References to the carrier gas fields
@ -101,7 +108,7 @@ protected:
// References to the cloud sub-models
//- Heat transfer model
autoPtr<HeatTransferModel<ThermoCloud<ParcelType> > >
autoPtr<HeatTransferModel<ThermoCloud<CloudType> > >
heatTransferModel_;
@ -137,11 +144,13 @@ protected:
// Cloud evolution functions
//- Reset state of cloud
void cloudReset(ThermoCloud<ParcelType>& c);
void cloudReset(ThermoCloud<CloudType>& c);
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields
@ -156,29 +165,29 @@ public:
);
//- Copy constructor with new name
ThermoCloud(ThermoCloud<ParcelType>& c, const word& name);
ThermoCloud(ThermoCloud<CloudType>& c, const word& name);
//- Copy constructor with new name - creates bare cloud
ThermoCloud
(
const fvMesh& mesh,
const word& name,
const ThermoCloud<ParcelType>& c
const ThermoCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > clone(const word& name)
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new ThermoCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<ParcelType> > cloneBare(const word& name) const
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<ParcelType> >
return autoPtr<Cloud<parcelType> >
(
new ThermoCloud(this->mesh(), name, *this)
);
@ -189,10 +198,6 @@ public:
virtual ~ThermoCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions
// Access
@ -201,7 +206,7 @@ public:
inline const ThermoCloud& cloudCopy() const;
//- Return the constant properties
inline const typename ParcelType::constantProperties&
inline const typename parcelType::constantProperties&
constProps() const;
//- Return const access to thermo package
@ -217,7 +222,7 @@ public:
// Sub-models
//- Return reference to heat transfer model
inline const HeatTransferModel<ThermoCloud<ParcelType> >&
inline const HeatTransferModel<ThermoCloud<CloudType> >&
heatTransfer() const;
@ -272,7 +277,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType& parcel,
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
@ -287,7 +292,7 @@ public:
void resetSourceTerms();
//- Apply relaxation to (steady state) cloud sources
void relaxSources(const ThermoCloud<ParcelType>& cloudOldTime);
void relaxSources(const ThermoCloud<CloudType>& cloudOldTime);
//- Evolve the cloud
void evolve();
@ -297,7 +302,6 @@ public:
//- Print cloud information
void info() const;
};

View File

@ -29,101 +29,101 @@ using namespace Foam::constant;
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
inline const Foam::ThermoCloud<ParcelType>&
Foam::ThermoCloud<ParcelType>::cloudCopy() const
template<class CloudType>
inline const Foam::ThermoCloud<CloudType>&
Foam::ThermoCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class ParcelType>
inline const typename ParcelType::constantProperties&
Foam::ThermoCloud<ParcelType>::constProps() const
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::ThermoCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class ParcelType>
inline const Foam::SLGThermo& Foam::ThermoCloud<ParcelType>::thermo() const
template<class CloudType>
inline const Foam::SLGThermo& Foam::ThermoCloud<CloudType>::thermo() const
{
return thermo_;
}
template<class ParcelType>
inline const Foam::volScalarField& Foam::ThermoCloud<ParcelType>::T() const
template<class CloudType>
inline const Foam::volScalarField& Foam::ThermoCloud<CloudType>::T() const
{
return T_;
}
template<class ParcelType>
inline const Foam::volScalarField& Foam::ThermoCloud<ParcelType>::p() const
template<class CloudType>
inline const Foam::volScalarField& Foam::ThermoCloud<CloudType>::p() const
{
return p_;
}
template<class ParcelType>
inline const Foam::HeatTransferModel<Foam::ThermoCloud<ParcelType> >&
Foam::ThermoCloud<ParcelType>::heatTransfer() const
template<class CloudType>
inline const Foam::HeatTransferModel<Foam::ThermoCloud<CloudType> >&
Foam::ThermoCloud<CloudType>::heatTransfer() const
{
return heatTransferModel_;
}
template<class ParcelType>
template<class CloudType>
inline const Foam::scalarIntegrationScheme&
Foam::ThermoCloud<ParcelType>::TIntegrator() const
Foam::ThermoCloud<CloudType>::TIntegrator() const
{
return TIntegrator_;
}
template<class ParcelType>
inline bool Foam::ThermoCloud<ParcelType>::radiation() const
template<class CloudType>
inline bool Foam::ThermoCloud<CloudType>::radiation() const
{
return radiation_;
}
template<class ParcelType>
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<ParcelType>::hsTrans()
Foam::ThermoCloud<CloudType>::hsTrans()
{
return hsTrans_();
}
template<class ParcelType>
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<ParcelType>::hsTrans() const
Foam::ThermoCloud<CloudType>::hsTrans() const
{
return hsTrans_();
}
template<class ParcelType>
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<ParcelType>::hsCoeff()
Foam::ThermoCloud<CloudType>::hsCoeff()
{
return hsCoeff_();
}
template<class ParcelType>
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<ParcelType>::hsCoeff() const
Foam::ThermoCloud<CloudType>::hsCoeff() const
{
return hsCoeff_();
}
template<class ParcelType>
template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ThermoCloud<ParcelType>::Sh(volScalarField& hs) const
Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
{
if (debug)
{
@ -141,7 +141,7 @@ Foam::ThermoCloud<ParcelType>::Sh(volScalarField& hs) const
return
hsTrans()/(this->mesh().V()*this->db().time().deltaT())
+ fvm::SuSp(-hsCoeff()/(Cp*this->mesh().V()), hs)
- fvm::Sp(hsCoeff()/(Cp*this->mesh().V()), hs)
+ hsCoeff()/(Cp*this->mesh().V())*hs;
}
else
@ -159,9 +159,8 @@ Foam::ThermoCloud<ParcelType>::Sh(volScalarField& hs) const
}
template<class ParcelType>
inline Foam::tmp<Foam::volScalarField>
Foam::ThermoCloud<ParcelType>::Ep() const
template<class CloudType>
inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
{
tmp<volScalarField> tEp
(
@ -188,9 +187,9 @@ Foam::ThermoCloud<ParcelType>::Ep() const
const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0();
forAllConstIter(typename ThermoCloud<ParcelType>, *this, iter)
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
const label cellI = p.cell();
Ep[cellI] += p.nParticle()*p.areaP()*pow4(p.T());
}
@ -202,9 +201,8 @@ Foam::ThermoCloud<ParcelType>::Ep() const
}
template<class ParcelType>
inline Foam::tmp<Foam::volScalarField>
Foam::ThermoCloud<ParcelType>::ap() const
template<class CloudType>
inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const
{
tmp<volScalarField> tap
(
@ -231,9 +229,9 @@ Foam::ThermoCloud<ParcelType>::ap() const
const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0();
forAllConstIter(typename ThermoCloud<ParcelType>, *this, iter)
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
const label cellI = p.cell();
ap[cellI] += p.nParticle()*p.areaP();
}
@ -245,9 +243,9 @@ Foam::ThermoCloud<ParcelType>::ap() const
}
template<class ParcelType>
template<class CloudType>
inline Foam::tmp<Foam::volScalarField>
Foam::ThermoCloud<ParcelType>::sigmap() const
Foam::ThermoCloud<CloudType>::sigmap() const
{
tmp<volScalarField> tsigmap
(
@ -276,9 +274,9 @@ Foam::ThermoCloud<ParcelType>::sigmap() const
const scalar epsilon = constProps_.epsilon0();
const scalar f = constProps_.f0();
forAllConstIter(typename ThermoCloud<ParcelType>, *this, iter)
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
{
const ParcelType& p = iter();
const parcelType& p = iter();
const label cellI = p.cell();
sigmap[cellI] += p.nParticle()*p.areaP();
}

View File

@ -27,14 +27,12 @@ Class
Description
Cloud class to introduce kinematic parcels
SourceFiles
basicKinematicCloud.C
\*---------------------------------------------------------------------------*/
#ifndef basicKinematicCloud_H
#define basicKinematicCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "basicKinematicParcel.H"
@ -42,7 +40,7 @@ SourceFiles
namespace Foam
{
typedef KinematicCloud<basicKinematicParcel> basicKinematicCloud;
typedef KinematicCloud<Cloud<basicKinematicParcel> > basicKinematicCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Some files were not shown because too many files have changed in this diff Show More