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 \ -ldynamicMesh \
-ledgeMesh \ -ledgeMesh \
-lengine \ -lengine \
-lextrudeModel \
-lfieldFunctionObjects \ -lfieldFunctionObjects \
-lfileFormats \ -lfileFormats \
-lfiniteVolume \ -lfiniteVolume \
@ -43,7 +42,6 @@ EXE_LIBS = \
-lliquidMixtureProperties \ -lliquidMixtureProperties \
-lliquidProperties \ -lliquidProperties \
-lmeshTools \ -lmeshTools \
-lMGridGenGAMGAgglomeration \
-lmolecularMeasurements \ -lmolecularMeasurements \
-lmolecule \ -lmolecule \
-lmultiphaseInterFoam \ -lmultiphaseInterFoam \

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -100,7 +100,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
( (
new passiveParticle new passiveParticle
( (
positions_, procMesh,
ppi.position(), ppi.position(),
procCelli, procCelli,
false false
@ -112,7 +112,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
particleIndices_.setSize(pi); 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,8 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "MapLagrangianFields.H" #include "MapLagrangianFields.H"
#include "Cloud.H" #include "passiveParticleCloud.H"
#include "passiveParticle.H"
#include "meshSearch.H" #include "meshSearch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,7 +43,9 @@ static label findCell(const Cloud<passiveParticle>& cloud, const point& pt)
label tetFaceI = -1; label tetFaceI = -1;
label tetPtI = -1; label tetPtI = -1;
cloud.findCellFacePt(pt, cellI, tetFaceI, tetPtI); const polyMesh& mesh = cloud.pMesh();
mesh.findCellFacePt(pt, cellI, tetFaceI, tetPtI);
if (cellI >= 0) 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 // See if particle on face by finding nearest face and shifting
// particle. // particle.
const polyMesh& mesh = cloud.pMesh();
meshSearch meshSearcher(mesh, false); meshSearch meshSearcher(mesh, false);
label faceI = meshSearcher.findNearestBoundaryFace(pt); 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; const point perturbPt = (1-perturbFactor)*pt+perturbFactor*cc;
cloud.findCellFacePt(perturbPt, cellI, tetFaceI, tetPtI); mesh.findCellFacePt(perturbPt, cellI, tetFaceI, tetPtI);
return cellI; return cellI;
} }
@ -124,7 +123,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
Info<< nl << " processing cloud " << cloudDirs[cloudI] << endl; Info<< nl << " processing cloud " << cloudDirs[cloudI] << endl;
// Read positions & cell // Read positions & cell
Cloud<passiveParticle> sourceParcels passiveParticleCloud sourceParcels
( (
meshSource, meshSource,
cloudDirs[cloudI], cloudDirs[cloudI],
@ -134,13 +133,15 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
<< " parcels from source mesh." << endl; << " parcels from source mesh." << endl;
// Construct empty target cloud // Construct empty target cloud
Cloud<passiveParticle> targetParcels passiveParticleCloud targetParcels
( (
meshTarget, meshTarget,
cloudDirs[cloudI], cloudDirs[cloudI],
IDLList<passiveParticle>() IDLList<passiveParticle>()
); );
particle::TrackingData<passiveParticleCloud> td(targetParcels);
label sourceParticleI = 0; label sourceParticleI = 0;
// Indices of source particles that get added to targetParcels // Indices of source particles that get added to targetParcels
@ -176,15 +177,14 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
( (
new passiveParticle new passiveParticle
( (
targetParcels, meshTarget,
targetCc[targetCells[i]], targetCc[targetCells[i]],
targetCells[i] targetCells[i]
) )
); );
passiveParticle& newP = newPtr(); passiveParticle& newP = newPtr();
scalar fraction = 0; label faceI = newP.track(iter().position(), td);
label faceI = newP.track(iter().position(), fraction);
if (faceI < 0 && newP.cell() >= 0) if (faceI < 0 && newP.cell() >= 0)
{ {
@ -246,7 +246,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
if (addParticles.size()) if (addParticles.size())
{ {
IOPosition<passiveParticle>(targetParcels).write(); IOPosition<passiveParticleCloud>(targetParcels).write();
// addParticles now contains the indices of the sourceMesh // addParticles now contains the indices of the sourceMesh
// particles that were appended to the target mesh. // 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 (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
dummyThirdParty/Allwmake $* dummyThirdParty/Allwmake $*
wmake $makeOption finiteVolume
wmake $makeOption lagrangian/basic wmake $makeOption lagrangian/basic
wmake $makeOption lagrangian/distributionModels wmake $makeOption lagrangian/distributionModels
wmake $makeOption finiteVolume
wmake $makeOption genericPatchFields wmake $makeOption genericPatchFields
# Build the proper scotchDecomp, metisDecomp etc. # Build the proper scotchDecomp, metisDecomp etc.

View File

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

View File

@ -25,8 +25,8 @@ License
#include "indexedOctree.H" #include "indexedOctree.H"
#include "linePointRef.H" #include "linePointRef.H"
#include "meshTools.H"
#include "OFstream.H" #include "OFstream.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1730,26 +1730,6 @@ void Foam::indexedOctree<Type>::traverseNode
point perturbedEnd(pushPoint(octantBb, end, false)); 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 traverseNode
( (
findAny, findAny,
@ -2316,12 +2296,6 @@ void Foam::indexedOctree<Type>::writeOBJ
pointField bbPoints(subBb.points()); pointField bbPoints(subBb.points());
label pointVertI = vertI; label pointVertI = vertI;
forAll(bbPoints, i)
{
meshTools::writeOBJ(str, bbPoints[i]);
vertI++;
}
forAll(treeBoundBox::edges, i) forAll(treeBoundBox::edges, i)
{ {
const edge& e = treeBoundBox::edges[i]; const edge& e = treeBoundBox::edges[i];

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,7 +91,7 @@ public:
//- Remap the cells of particles corresponding to the //- Remap the cells of particles corresponding to the
// mesh topology change // 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1183,10 +1183,123 @@ void Foam::polyMesh::removeFiles(const fileName& instanceDir) const
} }
} }
void Foam::polyMesh::removeFiles() const void Foam::polyMesh::removeFiles() const
{ {
removeFiles(instance()); 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,6 +34,7 @@ SourceFiles
polyMeshFromShapeMesh.C polyMeshFromShapeMesh.C
polyMeshIO.C polyMeshIO.C
polyMeshUpdate.C polyMeshUpdate.C
polyMeshFindCell.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -391,6 +392,7 @@ public:
return *this; return *this;
} }
// Mesh motion // Mesh motion
//- Is mesh moving //- Is mesh moving
@ -508,6 +510,28 @@ public:
//- Remove all files from mesh instance() //- Remove all files from mesh instance()
void removeFiles() const; 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,8 +26,6 @@ License
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::primitiveMesh, 0); defineTypeNameAndDebug(Foam::primitiveMesh, 0);
@ -63,6 +61,8 @@ Foam::primitiveMesh::primitiveMesh()
ppPtr_(NULL), ppPtr_(NULL),
cpPtr_(NULL), cpPtr_(NULL),
cellTreePtr_(NULL),
labels_(0), labels_(0),
cellCentresPtr_(NULL), cellCentresPtr_(NULL),
@ -105,6 +105,8 @@ Foam::primitiveMesh::primitiveMesh
ppPtr_(NULL), ppPtr_(NULL),
cpPtr_(NULL), cpPtr_(NULL),
cellTreePtr_(NULL),
labels_(0), labels_(0),
cellCentresPtr_(NULL), 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,6 +67,8 @@ SourceFiles
#include "Map.H" #include "Map.H"
#include "EdgeMap.H" #include "EdgeMap.H"
#include "boundBox.H" #include "boundBox.H"
#include "indexedOctree.H"
#include "treeDataCell.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -155,6 +157,9 @@ class primitiveMesh
//- Cell-points //- Cell-points
mutable labelListList* cpPtr_; mutable labelListList* cpPtr_;
//- Search tree to allow spatial tet searching
mutable indexedOctree<treeDataCell>* cellTreePtr_;
// On-the-fly edge addresing storage // On-the-fly edge addresing storage
@ -482,6 +487,10 @@ public:
const labelListList& cellPoints() const; const labelListList& cellPoints() const;
//- Build (if necessary) and return the cell search tree
const indexedOctree<treeDataCell>& cellTree() const;
// Geometric data (raw!) // Geometric data (raw!)
const vectorField& cellCentres() const; const vectorField& cellCentres() const;
@ -814,6 +823,9 @@ public:
//- Clear topological data //- Clear topological data
void clearAddressing(); void clearAddressing();
//- Clear cell tree data
void clearCellTree();
//- Clear all geometry and addressing unnecessary for CFD //- Clear all geometry and addressing unnecessary for CFD
void clearOut(); void clearOut();
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,6 +99,11 @@ void Foam::primitiveMesh::printAllocated() const
Pout<< " Cell-point" << endl; Pout<< " Cell-point" << endl;
} }
if (cellTreePtr_)
{
Pout<< " Cell-tree" << endl;
}
// Geometry // Geometry
if (cellCentresPtr_) if (cellCentresPtr_)
{ {
@ -165,6 +170,14 @@ void Foam::primitiveMesh::clearAddressing()
deleteDemandDrivenData(pePtr_); deleteDemandDrivenData(pePtr_);
deleteDemandDrivenData(ppPtr_); deleteDemandDrivenData(ppPtr_);
deleteDemandDrivenData(cpPtr_); deleteDemandDrivenData(cpPtr_);
deleteDemandDrivenData(cellTreePtr_);
}
void Foam::primitiveMesh::clearCellTree()
{
deleteDemandDrivenData(cellTreePtr_);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,10 +26,8 @@ License
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "cell.H" #include "cell.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Is the point in the cell bounding box
bool Foam::primitiveMesh::pointInCellBB bool Foam::primitiveMesh::pointInCellBB
( (
const point& p, 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 bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
{ {
const labelList& f = cells()[celli]; 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 Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
{ {
const vectorField& centres = cellCentres(); 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 Foam::label Foam::primitiveMesh::findCell(const point& location) const
{ {
if (nCells() == 0) if (nCells() == 0)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -174,10 +174,10 @@ public:
) const; ) const;
//- Return nearest point to p on tetrahedron //- Return nearest point to p on tetrahedron
inline pointHit nearestPoint inline pointHit nearestPoint(const point& p) const;
(
const point& p //- Return true if point is inside tetrahedron
) const; inline bool inside(const point& pt) const;
//- Return (min)containment sphere, i.e. the smallest sphere with //- Return (min)containment sphere, i.e. the smallest sphere with
// all points inside. Returns pointHit with: // all points inside. Returns pointHit with:

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class Point, class PointRef> template<class Point, class PointRef>

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,12 +32,6 @@ License
#include "OFstream.H" #include "OFstream.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
const Foam::scalar Foam::Cloud<ParticleType>::trackingCorrectionTol = 1e-5;
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class ParticleType> template<class ParticleType>
@ -47,7 +41,7 @@ void Foam::Cloud<ParticleType>::calcCellWallFaces() const
PackedBoolList& cellWallFaces = cellWallFacesPtr_(); PackedBoolList& cellWallFaces = cellWallFacesPtr_();
const polyBoundaryMesh& patches = pMesh().boundaryMesh(); const polyBoundaryMesh& patches = polyMesh_.boundaryMesh();
forAll(patches, patchI) forAll(patches, patchI)
{ {
@ -78,9 +72,7 @@ Foam::Cloud<ParticleType>::Cloud
cloud(pMesh), cloud(pMesh),
IDLList<ParticleType>(), IDLList<ParticleType>(),
polyMesh_(pMesh), polyMesh_(pMesh),
particleCount_(0),
labels_(), labels_(),
cellTree_(),
nTrackingRescues_(), nTrackingRescues_(),
cellWallFacesPtr_() cellWallFacesPtr_()
{ {
@ -104,9 +96,7 @@ Foam::Cloud<ParticleType>::Cloud
cloud(pMesh, cloudName), cloud(pMesh, cloudName),
IDLList<ParticleType>(), IDLList<ParticleType>(),
polyMesh_(pMesh), polyMesh_(pMesh),
particleCount_(0),
labels_(), labels_(),
cellTree_(),
nTrackingRescues_(), nTrackingRescues_(),
cellWallFacesPtr_() cellWallFacesPtr_()
{ {
@ -121,236 +111,6 @@ Foam::Cloud<ParticleType>::Cloud
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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> template<class ParticleType>
const Foam::PackedBoolList& Foam::Cloud<ParticleType>::cellHasWallFaces() const Foam::PackedBoolList& Foam::Cloud<ParticleType>::cellHasWallFaces()
const 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> template<class ParticleType>
void Foam::Cloud<ParticleType>::addParticle(ParticleType* pPtr) 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 // Reset particle cound and particles only
// - not changing the cloud object registry or reference to the polyMesh // - not changing the cloud object registry or reference to the polyMesh
particleCount_ = 0; ParticleType::particleCount_ = 0;
IDLList<ParticleType>::operator=(c); IDLList<ParticleType>::operator=(c);
} }
template<class ParticleType> template<class ParticleType>
template<class TrackingData> template<class TrackData>
void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime) void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
{ {
const polyBoundaryMesh& pbm = pMesh().boundaryMesh(); const polyBoundaryMesh& pbm = pMesh().boundaryMesh();
const globalMeshData& pData = polyMesh_.globalData(); 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 // If we are running in parallel and the particle is on a
// boundary face // 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 // ... and the face is on a processor patch
// prepare it for transfer // prepare it for transfer
@ -571,7 +315,7 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime)
IDLList<ParticleType> newParticles IDLList<ParticleType> newParticles
( (
particleStream, particleStream,
typename ParticleType::iNew(*this) typename ParticleType::iNew(polyMesh_)
); );
label pI = 0; label pI = 0;
@ -600,57 +344,64 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td, const scalar trackTime)
template<class ParticleType> 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) if (cloud::debug)
{ {
Info<< "Cloud<ParticleType>::autoMap(const morphFieldMapper& map) " Info<< "Cloud<ParticleType>::autoMap(TrackData&, const mapPolyMesh&) "
"for lagrangian cloud " << cloud::name() << endl; << "for lagrangian cloud " << cloud::name() << endl;
} }
const labelList& reverseCellMap = mapper.reverseCellMap(); const labelList& reverseCellMap = mapper.reverseCellMap();
const labelList& reverseFaceMap = mapper.reverseFaceMap(); const labelList& reverseFaceMap = mapper.reverseFaceMap();
// Reset stored data that relies on the mesh // Reset stored data that relies on the mesh
cellTree_.clear(); // polyMesh_.clearCellTree();
cellWallFacesPtr_.clear(); cellWallFacesPtr_.clear();
forAllIter(typename Cloud<ParticleType>, *this, pIter) forAllIter(typename Cloud<ParticleType>, *this, pIter)
{ {
if (reverseCellMap[pIter().cellI_] >= 0) ParticleType& p = pIter();
{
pIter().cellI_ = reverseCellMap[pIter().cellI_];
if (pIter().faceI_ >= 0 && reverseFaceMap[pIter().faceI_] >= 0) if (reverseCellMap[p.cell()] >= 0)
{ {
pIter().faceI_ = reverseFaceMap[pIter().faceI_]; p.cell() = reverseCellMap[p.cell()];
if (p.face() >= 0 && reverseFaceMap[p.face()] >= 0)
{
p.face() = reverseFaceMap[p.face()];
} }
else else
{ {
pIter().faceI_ = -1; p.face() = -1;
} }
pIter().initCellFacePt(); p.initCellFacePt();
} }
else else
{ {
label trackStartCell = mapper.mergedCell(pIter().cellI_); label trackStartCell = mapper.mergedCell(p.cell());
if (trackStartCell < 0) if (trackStartCell < 0)
{ {
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]; 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 Foam::Cloud
Description Description
Base cloud calls templated on particle type
SourceFiles SourceFiles
Cloud.C Cloud.C
@ -80,15 +81,9 @@ class Cloud
const polyMesh& polyMesh_; const polyMesh& polyMesh_;
//- Overall count of particles ever created. Never decreases.
mutable label particleCount_;
//- Temporary storage for addressing. Used in findTris. //- Temporary storage for addressing. Used in findTris.
mutable DynamicList<label> labels_; 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 //- Count of how many tracking rescue corrections have been
// applied // applied
mutable label nTrackingRescues_; mutable label nTrackingRescues_;
@ -114,8 +109,7 @@ class Cloud
public: public:
template<class ParticleT> friend class particle;
friend class Particle;
template<class ParticleT> template<class ParticleT>
friend class IOPosition; friend class IOPosition;
@ -133,10 +127,6 @@ public:
//- Name of cloud properties dictionary //- Name of cloud properties dictionary
static word cloudPropertiesName; 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 // Constructors
@ -184,65 +174,15 @@ public:
return polyMesh_; 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 label size() const
{ {
return IDLList<ParticleType>::size(); return IDLList<ParticleType>::size();
}; };
//- Find the cell, tetFaceI and tetPtI for the given DynamicList<label>& labels()
// position {
void findCellFacePt return labels_;
( }
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;
//- Return nTrackingRescues //- Return nTrackingRescues
label nTrackingRescues() const label nTrackingRescues() const
@ -314,9 +254,6 @@ public:
return IDLList<ParticleType>::clear(); return IDLList<ParticleType>::clear();
}; };
//- Get unique particle creation id
label getNewParticleID() const;
//- Transfer particle to cloud //- Transfer particle to cloud
void addParticle(ParticleType* pPtr); void addParticle(ParticleType* pPtr);
@ -328,12 +265,13 @@ public:
//- Move the particles //- Move the particles
// passing the TrackingData to the track function // passing the TrackingData to the track function
template<class TrackingData> template<class TrackData>
void move(TrackingData& td, const scalar trackTime); void move(TrackData& td, const scalar trackTime);
//- Remap the cells of particles corresponding to the //- Remap the cells of particles corresponding to the
// mesh topology change // mesh topology change
virtual void autoMap(const mapPolyMesh&); template<class TrackData>
void autoMap(TrackData& td, const mapPolyMesh&);
// Read // Read

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Cloud.H" #include "Cloud.H"
#include "Particle.H"
#include "Time.H" #include "Time.H"
#include "IOPosition.H" #include "IOPosition.H"
@ -58,12 +57,12 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
if (uniformPropsDict.found(procName)) if (uniformPropsDict.found(procName))
{ {
uniformPropsDict.subDict(procName).lookup("particleCount") uniformPropsDict.subDict(procName).lookup("particleCount")
>> particleCount_; >> ParticleType::particleCount_;
} }
} }
else else
{ {
particleCount_ = 0; ParticleType::particleCount_ = 0;
} }
} }
@ -86,7 +85,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
); );
labelList np(Pstream::nProcs(), 0); labelList np(Pstream::nProcs(), 0);
np[Pstream::myProcNo()] = particleCount_; np[Pstream::myProcNo()] = ParticleType::particleCount_;
Pstream::listCombineGather(np, maxEqOp<label>()); Pstream::listCombineGather(np, maxEqOp<label>());
Pstream::listCombineScatter(np); Pstream::listCombineScatter(np);
@ -98,7 +97,12 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
uniformPropsDict.subDict(procName).add("particleCount", np[i]); 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(); readCloudUniformProperties();
IOPosition<ParticleType> ioP(*this); IOPosition<Cloud<ParticleType> > ioP(*this);
if (ioP.headerOk()) if (ioP.headerOk())
{ {
@ -154,9 +158,7 @@ Foam::Cloud<ParticleType>::Cloud
: :
cloud(pMesh), cloud(pMesh),
polyMesh_(pMesh), polyMesh_(pMesh),
particleCount_(0),
labels_(), labels_(),
cellTree_(),
nTrackingRescues_(), nTrackingRescues_(),
cellWallFacesPtr_() cellWallFacesPtr_()
{ {
@ -174,9 +176,7 @@ Foam::Cloud<ParticleType>::Cloud
: :
cloud(pMesh, cloudName), cloud(pMesh, cloudName),
polyMesh_(pMesh), polyMesh_(pMesh),
particleCount_(0),
labels_(), labels_(),
cellTree_(),
nTrackingRescues_(), nTrackingRescues_(),
cellWallFacesPtr_() cellWallFacesPtr_()
{ {
@ -262,8 +262,7 @@ void Foam::Cloud<ParticleType>::writeFields() const
{ {
if (this->size()) if (this->size())
{ {
const ParticleType& p = *this->first(); ParticleType::writeFields(*this);
ParticleType::writeFields(p.cloud());
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,11 +27,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType> template<class CloudType>
Foam::IOPosition<ParticleType>::IOPosition Foam::IOPosition<CloudType>::IOPosition(const CloudType& c)
(
const Cloud<ParticleType>& c
)
: :
regIOobject regIOobject
( (
@ -50,8 +47,8 @@ Foam::IOPosition<ParticleType>::IOPosition
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType> template<class CloudType>
bool Foam::IOPosition<ParticleType>::write() const bool Foam::IOPosition<CloudType>::write() const
{ {
if (cloud_.size()) if (cloud_.size())
{ {
@ -64,19 +61,18 @@ bool Foam::IOPosition<ParticleType>::write() const
} }
template<class ParticleType> template<class CloudType>
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const bool Foam::IOPosition<CloudType>::writeData(Ostream& os) const
{ {
os << cloud_.size() << nl << token::BEGIN_LIST << nl; 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 // Prevent writing additional fields
static_cast<const Particle<ParticleType>&>(iter()).write p.write(os, false);
(
os,
false
);
os << nl; os << nl;
} }
@ -86,13 +82,11 @@ bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
} }
template<class ParticleType> template<class CloudType>
void Foam::IOPosition<ParticleType>::readData void Foam::IOPosition<CloudType>::readData(CloudType& c, bool checkClass)
(
Cloud<ParticleType>& c,
bool checkClass
)
{ {
const polyMesh& mesh = c.pMesh();
Istream& is = readStream(checkClass ? typeName : ""); Istream& is = readStream(checkClass ? typeName : "");
token firstToken(is); token firstToken(is);
@ -102,16 +96,16 @@ void Foam::IOPosition<ParticleType>::readData
label s = firstToken.labelToken(); label s = firstToken.labelToken();
// Read beginning of contents // Read beginning of contents
is.readBeginList("Cloud<ParticleType>"); is.readBeginList("IOPosition<CloudType>::readData(CloudType, bool)");
for (label i=0; i<s; i++) for (label i=0; i<s; i++)
{ {
// Do not read any fields, position only // 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 // Read end of contents
is.readEndList("Cloud<ParticleType>"); is.readEndList("IOPosition<CloudType>::readData(CloudType, bool)");
} }
else if (firstToken.isPunctuation()) else if (firstToken.isPunctuation())
{ {
@ -119,12 +113,10 @@ void Foam::IOPosition<ParticleType>::readData
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"void IOPosition<ParticleType>::readData" "void IOPosition<CloudType>::readData(CloudType&, bool)",
"(Cloud<ParticleType>&, bool)",
is is
) << "incorrect first token, '(', found " ) << "incorrect first token, '(', found "
<< firstToken.info() << firstToken.info() << exit(FatalIOError);
<< exit(FatalIOError);
} }
token lastToken(is); token lastToken(is);
@ -138,7 +130,7 @@ void Foam::IOPosition<ParticleType>::readData
{ {
is.putBack(lastToken); is.putBack(lastToken);
// Do not read any fields, position only // Do not read any fields, position only
c.append(new ParticleType(c, is, false)); c.append(new typename CloudType::particleType(mesh, is, false));
is >> lastToken; is >> lastToken;
} }
} }
@ -146,18 +138,16 @@ void Foam::IOPosition<ParticleType>::readData
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"void IOPosition<ParticleType>::readData" "void IOPosition<ParticleType>::readData(CloudType&, bool)",
"(Cloud<ParticleType>&, bool)",
is is
) << "incorrect first token, expected <int> or '(', found " ) << "incorrect first token, expected <int> or '(', found "
<< firstToken.info() << firstToken.info() << exit(FatalIOError);
<< exit(FatalIOError);
} }
// Check state of IOstream // Check state of IOstream
is.check 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ namespace Foam
Class IOPosition Declaration Class IOPosition Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParticleType> template<class CloudType>
class IOPosition class IOPosition
: :
public regIOobject public regIOobject
@ -55,7 +55,7 @@ class IOPosition
// Private data // Private data
//- Reference to the cloud //- Reference to the cloud
const Cloud<ParticleType>& cloud_; const CloudType& cloud_;
public: public:
@ -65,19 +65,20 @@ public:
//- Runtime type name information. Use cloud type. //- Runtime type name information. Use cloud type.
virtual const word& type() const virtual const word& type() const
{ {
return cloud_.type(); return Cloud<typename CloudType::particleType>::typeName;
//cloud_.type();
} }
// Constructors // Constructors
//- Construct from cloud //- Construct from cloud
IOPosition(const Cloud<ParticleType>&); IOPosition(const CloudType&);
// Member functions // Member functions
virtual void readData(Cloud<ParticleType>& c, bool checkClass); virtual void readData(CloudType& c, bool checkClass);
virtual bool write() const; virtual bool write() const;

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,18 +25,17 @@ Class
Foam::indexedParticle Foam::indexedParticle
Description Description
Adds label index to base particle
SourceFiles SourceFiles
indexedParticleI.H indexedParticle.H
indexedParticle.C
indexedParticleIO.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef indexedParticle_H #ifndef indexedParticle_H
#define indexedParticle_H #define indexedParticle_H
#include "Particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -51,7 +50,7 @@ namespace Foam
class indexedParticle class indexedParticle
: :
public Particle<indexedParticle> public particle
{ {
// Private data // Private data
@ -65,7 +64,7 @@ public:
//- Construct from components //- Construct from components
indexedParticle indexedParticle
( (
const Cloud<indexedParticle>& c, const polyMesh& mesh,
const vector& position, const vector& position,
const label cellI, const label cellI,
const label tetFaceI, const label tetFaceI,
@ -73,47 +72,44 @@ public:
const label index = 0 const label index = 0
) )
: :
Particle<indexedParticle>(c, position, cellI, tetFaceI, tetPtI), particle(mesh, position, cellI, tetFaceI, tetPtI),
index_(index) index_(index)
{} {}
//- Construct from components, with searching for tetFace and tetPt //- Construct from components, with searching for tetFace and tetPt
indexedParticle indexedParticle
( (
const Cloud<indexedParticle>& c, const polyMesh& mesh,
const vector& position, const vector& position,
const label cellI, const label cellI,
const label index = 0 const label index = 0
) )
: :
Particle<indexedParticle>(c, position, cellI), particle(mesh, position, cellI),
index_(index) index_(index)
{} {}
//- Construct from Istream //- Construct from Istream
indexedParticle indexedParticle
( (
const Cloud<indexedParticle>& c, const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields = true bool readFields = true
) )
: :
Particle<indexedParticle>(c, is, readFields) particle(mesh, is, readFields)
{} {}
//- Construct as a copy //- Construct as a copy
indexedParticle(const indexedParticle& p) indexedParticle(const indexedParticle& p)
: :
Particle<indexedParticle>(p) particle(p)
{} {}
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<Particle<indexedParticle> > clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<Particle<indexedParticle> > return autoPtr<particle>(new indexedParticle(*this));
(
new indexedParticle(*this)
);
} }

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,11 +24,11 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "polyMesh.H" #include "polyMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParticleType> inline void Foam::particle::findTris
inline void Foam::Particle<ParticleType>::findTris
( (
const vector& position, const vector& position,
DynamicList<label>& faceList, DynamicList<label>& faceList,
@ -63,8 +63,7 @@ inline void Foam::Particle<ParticleType>::findTris
} }
template<class ParticleType> inline Foam::scalar Foam::particle::tetLambda
inline Foam::scalar Foam::Particle<ParticleType>::tetLambda
( (
const vector& from, const vector& from,
const vector& to, const vector& to,
@ -76,10 +75,9 @@ inline Foam::scalar Foam::Particle<ParticleType>::tetLambda
const label tetPtI const label tetPtI
) const ) const
{ {
const polyMesh& mesh = cloud_.polyMesh_; const pointField& pPts = mesh_.points();
const pointField& pPts = mesh.points();
if (mesh.moving()) if (mesh_.moving())
{ {
return movingTetLambda return movingTetLambda
( (
@ -132,9 +130,7 @@ inline Foam::scalar Foam::Particle<ParticleType>::tetLambda
} }
inline Foam::scalar Foam::particle::movingTetLambda
template<class ParticleType>
inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
( (
const vector& from, const vector& from,
const vector& to, const vector& to,
@ -146,9 +142,8 @@ inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
const label tetPtI const label tetPtI
) const ) const
{ {
const polyMesh& mesh = cloud_.polyMesh_; const pointField& pPts = mesh_.points();
const pointField& pPts = mesh.points(); const pointField& oldPPts = mesh_.oldPoints();
const pointField& oldPPts = mesh.oldPoints();
// Base point of plane at end of motion // Base point of plane at end of motion
const point& b = pPts[tetPlaneBasePtI]; const point& b = pPts[tetPlaneBasePtI];
@ -166,13 +161,13 @@ inline Foam::scalar Foam::Particle<ParticleType>::movingTetLambda
vector n0 = vector::zero; vector n0 = vector::zero;
{ {
tetIndices tetIs(cellI, tetFaceI, tetPtI, mesh); tetIndices tetIs(cellI, tetFaceI, tetPtI, mesh_);
// tet at timestep start // tet at timestep start
tetPointRef tet00 = tetIs.oldTet(mesh); tetPointRef tet00 = tetIs.oldTet(mesh_);
// tet at timestep end // tet at timestep end
tetPointRef tet = tetIs.tet(mesh); tetPointRef tet = tetIs.tet(mesh_);
point tet0PtA = tet00.a() + stepFraction_*(tet.a() - tet00.a()); point tet0PtA = tet00.a() + stepFraction_*(tet.a() - tet00.a());
point tet0PtB = tet00.b() + stepFraction_*(tet.b() - tet00.b()); 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(); inline void Foam::particle::tetNeighbour(label triI)
const faceList& pFaces = mesh.faces(); {
const labelList& pOwner = mesh_.faceOwner();
const faceList& pFaces = mesh_.faces();
bool own = (pOwner[tetFaceI_] == cellI_); bool own = (pOwner[tetFaceI_] == cellI_);
const Foam::face& f = pFaces[tetFaceI_]; const Foam::face& f = pFaces[tetFaceI_];
label tetBasePtI = mesh.tetBasePtIs()[tetFaceI_]; label tetBasePtI = mesh_.tetBasePtIs()[tetFaceI_];
if (tetBasePtI == -1) if (tetBasePtI == -1)
{ {
FatalErrorIn FatalErrorIn
( (
"inline void Foam::Particle<ParticleType>::tetNeighbour(label triI)" "inline void Foam::particle::tetNeighbour(label triI)"
) )
<< "No base point for face " << tetFaceI_ << ", " << f << "No base point for face " << tetFaceI_ << ", " << f
<< ", produces a valid tet decomposition." << ", produces a valid tet decomposition."
@ -464,19 +457,18 @@ inline void Foam::Particle<ParticleType>::tetNeighbour(label triI)
FatalErrorIn FatalErrorIn
( (
"inline void " "inline void "
"Foam::Particle<ParticleType>::tetNeighbour(label triI)" "Foam::particle::tetNeighbour(label triI)"
) )
<< "Tet tri face index error, can only be 0..3, supplied " << "Tet tri face index error, can only be 0..3, supplied "
<< triI << nl << triI << abort(FatalError);
<< abort(FatalError);
break; break;
} }
} }
} }
template<class ParticleType>
inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace inline void Foam::particle::crossEdgeConnectedFace
( (
const label& cellI, const label& cellI,
label& tetFaceI, label& tetFaceI,
@ -484,10 +476,8 @@ inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace
const edge& e 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]; const Foam::face& f = pFaces[tetFaceI];
@ -536,14 +526,14 @@ inline void Foam::Particle<ParticleType>::crossEdgeConnectedFace
eIndex = findIndex(otherFace, e.end()); eIndex = findIndex(otherFace, e.end());
} }
label tetBasePtI = mesh.tetBasePtIs()[fI]; label tetBasePtI = mesh_.tetBasePtIs()[fI];
if (tetBasePtI == -1) if (tetBasePtI == -1)
{ {
FatalErrorIn FatalErrorIn
( (
"inline void " "inline void "
"Foam::Particle<ParticleType>::crossEdgeConnectedFace" "Foam::particle::crossEdgeConnectedFace"
"(" "("
"const label& cellI," "const label& cellI,"
"label& tetFaceI," "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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType> inline Foam::label Foam::particle::getNewParticleID() const
inline Foam::Cloud<ParticleType>&
Foam::Particle<ParticleType>::trackData::cloud()
{ {
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::polyMesh& Foam::particle::mesh() const
inline const Foam::Cloud<ParticleType>&
Foam::Particle<ParticleType>::cloud() const
{ {
return cloud_; return mesh_;
} }
template<class ParticleType> inline const Foam::vector& Foam::particle::position() const
inline const Foam::vector& Foam::Particle<ParticleType>::position() const
{ {
return position_; return position_;
} }
template<class ParticleType> inline Foam::vector& Foam::particle::position()
inline Foam::vector& Foam::Particle<ParticleType>::position()
{ {
return position_; return position_;
} }
template<class ParticleType> inline Foam::label Foam::particle::cell() const
inline Foam::label Foam::Particle<ParticleType>::cell() const
{ {
return cellI_; return cellI_;
} }
template<class ParticleType> inline Foam::label& Foam::particle::cell()
inline Foam::label& Foam::Particle<ParticleType>::cell()
{ {
return cellI_; return cellI_;
} }
template<class ParticleType> inline Foam::label Foam::particle::tetFace() const
inline Foam::label Foam::Particle<ParticleType>::tetFace() const
{ {
return tetFaceI_; return tetFaceI_;
} }
template<class ParticleType> inline Foam::label& Foam::particle::tetFace()
inline Foam::label& Foam::Particle<ParticleType>::tetFace()
{ {
return tetFaceI_; return tetFaceI_;
} }
template<class ParticleType> inline Foam::label Foam::particle::tetPt() const
inline Foam::label Foam::Particle<ParticleType>::tetPt() const
{ {
return tetPtI_; return tetPtI_;
} }
template<class ParticleType> inline Foam::label& Foam::particle::tetPt()
inline Foam::label& Foam::Particle<ParticleType>::tetPt()
{ {
return tetPtI_; return tetPtI_;
} }
template<class ParticleType> inline Foam::tetIndices Foam::particle::currentTetIndices() const
inline Foam::tetIndices Foam::Particle<ParticleType>::currentTetIndices() const
{ {
return tetIndices(cellI_, tetFaceI_, tetPtI_, cloud_.polyMesh_); return tetIndices(cellI_, tetFaceI_, tetPtI_, mesh_);
} }
template<class ParticleType> inline Foam::tetPointRef Foam::particle::currentTet() const
inline Foam::tetPointRef Foam::Particle<ParticleType>::currentTet() const
{ {
return currentTetIndices().tet(cloud_.polyMesh_); return currentTetIndices().tet(mesh_);
} }
template<class ParticleType> inline Foam::vector Foam::particle::normal() const
inline Foam::vector Foam::Particle<ParticleType>::normal() const
{ {
return currentTetIndices().faceTri(cloud_.polyMesh_).normal(); return currentTetIndices().faceTri(mesh_).normal();
} }
template<class ParticleType> inline Foam::vector Foam::particle::oldNormal() const
inline Foam::vector
Foam::Particle<ParticleType>::oldNormal() const
{ {
return currentTetIndices().oldFaceTri(cloud_.polyMesh_).normal(); return currentTetIndices().oldFaceTri(mesh_).normal();
} }
template<class ParticleType> inline Foam::label Foam::particle::face() const
inline Foam::label Foam::Particle<ParticleType>::face() const
{ {
return faceI_; return faceI_;
} }
template<class ParticleType> inline Foam::label& Foam::particle::face()
inline Foam::label& Foam::Particle<ParticleType>::face()
{ {
return faceI_; return faceI_;
} }
template<class ParticleType> inline void Foam::particle::initCellFacePt()
inline void Foam::Particle<ParticleType>::initCellFacePt()
{ {
if (cellI_ == -1) if (cellI_ == -1)
{ {
cloud_.findCellFacePt mesh_.findCellFacePt
( (
position_, position_,
cellI_, cellI_,
@ -937,26 +700,20 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
if (cellI_ == -1) if (cellI_ == -1)
{ {
FatalErrorIn FatalErrorIn("void Foam::particle::initCellFacePt()")
( << "cell, tetFace and tetPt search failure at position "
"Foam::Particle<ParticleType>::Particle" << position_ << abort(FatalError);
"("
"void Foam::Particle<ParticleType>::initCellFacePt()"
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< abort(FatalError);
} }
} }
else else
{ {
cloud_.findFacePt(cellI_, position_, tetFaceI_, tetPtI_); mesh_.findTetFacePt(cellI_, position_, tetFaceI_, tetPtI_);
if (tetFaceI_ == -1 || tetPtI_ == -1) if (tetFaceI_ == -1 || tetPtI_ == -1)
{ {
label oldCellI = cellI_; label oldCellI = cellI_;
cloud_.findCellFacePt mesh_.findCellFacePt
( (
position_, position_,
cellI_, cellI_,
@ -970,23 +727,16 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
// number, but hasn't been able to find a cell to // number, but hasn't been able to find a cell to
// occupy. // occupy.
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI, 0.1)) if(!mesh_.pointInCellBB(position_, oldCellI, 0.1))
{ {
// If the position is not inside the (slightly // If the position is not inside the (slightly
// extended) bound-box of the cell that it thought // extended) bound-box of the cell that it thought
// it should be in, then this is considered an // it should be in, then this is considered an
// error. // error.
FatalErrorIn FatalErrorIn("void Foam::particle::initCellFacePt()")
( << "cell, tetFace and tetPt search failure at position "
"Foam::Particle<ParticleType>::Particle" << position_ << nl << "for requested cell " << oldCellI
"("
"void "
"Foam::Particle<ParticleType>::initCellFacePt()"
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< "for requested cell " << oldCellI << nl
<< abort(FatalError); << abort(FatalError);
} }
@ -1005,19 +755,17 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
point newPosition = position_; 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; label iterNo = 0;
do do
{ {
newPosition += newPosition += trackingCorrectionTol*(cC - position_);
Cloud<ParticleType>::trackingCorrectionTol
*(cC - position_);
cloud_.findFacePt mesh_.findTetFacePt
( (
cellI_, cellI_,
newPosition, newPosition,
@ -1031,25 +779,12 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
if (tetFaceI_ == -1) if (tetFaceI_ == -1)
{ {
FatalErrorIn FatalErrorIn("void Foam::particle::initCellFacePt()")
( << "cell, tetFace and tetPt search failure at position "
"Foam::Particle<ParticleType>::Particle" << position_ << abort(FatalError);
"("
"void "
"Foam::Particle<ParticleType>::initCellFacePt()"
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< abort(FatalError);
} }
WarningIn WarningIn("void Foam::particle::initCellFacePt()")
(
"Foam::Particle<ParticleType>::Particle"
"("
"void Foam::Particle<ParticleType>::initCellFacePt()"
")"
)
<< "Particle moved from " << position_ << "Particle moved from " << position_
<< " to " << newPosition << " to " << newPosition
<< " in cell " << cellI_ << " in cell " << cellI_
@ -1067,13 +802,7 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
if (cellI_ != oldCellI) if (cellI_ != oldCellI)
{ {
WarningIn WarningIn("void Foam::particle::initCellFacePt()")
(
"Foam::Particle<ParticleType>::Particle"
"("
"void Foam::Particle<ParticleType>::initCellFacePt()"
")"
)
<< "Particle at position " << position_ << "Particle at position " << position_
<< " searched for a cell, tetFace and tetPt." << nl << " searched for a cell, tetFace and tetPt." << nl
<< " Found" << " Found"
@ -1089,99 +818,100 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
} }
template<class ParticleType> inline bool Foam::particle::onBoundary() const
inline bool Foam::Particle<ParticleType>::onBoundary() const
{ {
return faceI_ != -1 && faceI_ >= cloud_.pMesh().nInternalFaces(); return faceI_ != -1 && faceI_ >= mesh_.nInternalFaces();
} }
template<class ParticleType> inline Foam::scalar& Foam::particle::stepFraction()
inline Foam::scalar& Foam::Particle<ParticleType>::stepFraction()
{ {
return stepFraction_; return stepFraction_;
} }
template<class ParticleType> inline Foam::scalar Foam::particle::stepFraction() const
inline Foam::scalar Foam::Particle<ParticleType>::stepFraction() const
{ {
return stepFraction_; return stepFraction_;
} }
template<class ParticleType> inline Foam::label Foam::particle::origProc() const
inline Foam::label Foam::Particle<ParticleType>::origProc() const
{ {
return origProc_; return origProc_;
} }
template<class ParticleType> inline Foam::label& Foam::particle::origProc()
inline Foam::label& Foam::Particle<ParticleType>::origProc()
{ {
return origProc_; return origProc_;
} }
template<class ParticleType> inline Foam::label Foam::particle::origId() const
inline Foam::label Foam::Particle<ParticleType>::origId() const
{ {
return origId_; return origId_;
} }
template<class ParticleType> inline Foam::label& Foam::particle::origId()
inline Foam::label& Foam::Particle<ParticleType>::origId()
{ {
return origId_; return origId_;
} }
template<class ParticleType> inline bool Foam::particle::softImpact() const
inline bool Foam::Particle<ParticleType>::softImpact() const
{ {
return false; return false;
} }
template<class ParticleType> inline Foam::scalar Foam::particle::currentTime() const
inline Foam::scalar Foam::Particle<ParticleType>::currentTime() const
{ {
return return
cloud_.pMesh().time().value() mesh_.time().value()
+ stepFraction_*cloud_.pMesh().time().deltaTValue(); + stepFraction_*mesh_.time().deltaTValue();
} }
template<class ParticleType> inline bool Foam::particle::internalFace(const label faceI) const
inline Foam::label Foam::Particle<ParticleType>::patch(const label faceI) const
{ {
return cloud_.facePatch(faceI); return mesh_.isInternalFace(faceI);
} }
template<class ParticleType> bool Foam::particle::boundaryFace(const label faceI) const
inline Foam::label Foam::Particle<ParticleType>::patchFace {
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 patchI,
const label faceI const label faceI
) const ) const
{ {
return cloud_.patchFace(patchI, faceI); // return cloud_.patchFace(patchI, faceI);
return mesh_.boundaryMesh()[patchI].whichFace(faceI);
} }
template<class ParticleType>
inline Foam::scalar inline Foam::scalar
Foam::Particle<ParticleType>::wallImpactDistance(const vector&) const Foam::particle::wallImpactDistance(const vector&) const
{ {
return 0.0; return 0.0;
} }
template<class ParticleType> inline Foam::label Foam::particle::faceInterpolation() const
inline Foam::label Foam::Particle<ParticleType>::faceInterpolation() const
{ {
return faceI_; return faceI_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,28 +23,21 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Particle.H" #include "particle.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "IOPosition.H" #include "IOPosition.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType> Foam::string Foam::particle::propHeader =
Foam::string Foam::Particle<ParticleType>::propHeader =
"(Px Py Pz) cellI tetFaceI tetPtI origProc origId"; "(Px Py Pz) cellI tetFaceI tetPtI origProc origId";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType> Foam::particle::particle(const polyMesh& mesh, Istream& is, bool readFields)
Foam::Particle<ParticleType>::Particle
(
const Cloud<ParticleType>& cloud,
Istream& is,
bool readFields
)
: :
cloud_(cloud), mesh_(mesh),
position_(), position_(),
cellI_(-1), cellI_(-1),
faceI_(-1), faceI_(-1),
@ -97,81 +90,11 @@ Foam::Particle<ParticleType>::Particle
} }
// Check state of Istream // Check state of Istream
is.check("Particle<ParticleType>::Particle(Istream&)"); is.check("particle::particle(Istream&, bool)");
} }
template<class ParticleType> void Foam::particle::write(Ostream& os, bool writeFields) const
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
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
@ -223,12 +146,11 @@ void Foam::Particle<ParticleType>::write(Ostream& os, bool writeFields) const
} }
// Check state of Ostream // 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& p)
Foam::Ostream& Foam::operator<<(Ostream& os, const Particle<ParticleType>& p)
{ {
// Write all data // Write all data
p.write(os, true); p.write(os, true);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,19 +23,18 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Particle.H" #include "IOPosition.H"
#include "Cloud.H"
#include "wedgePolyPatch.H"
#include "symmetryPolyPatch.H"
#include "cyclicPolyPatch.H" #include "cyclicPolyPatch.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "transform.H" #include "symmetryPolyPatch.H"
#include "wallPolyPatch.H"
#include "wedgePolyPatch.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::prepareForParallelTransfer void Foam::particle::prepareForParallelTransfer
( (
const label patchI, const label patchI,
TrackData& td TrackData& td
@ -46,17 +45,15 @@ void Foam::Particle<ParticleType>::prepareForParallelTransfer
} }
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::correctAfterParallelTransfer void Foam::particle::correctAfterParallelTransfer
( (
const label patchI, const label patchI,
TrackData& td TrackData& td
) )
{ {
const processorPolyPatch& ppp = const processorPolyPatch& ppp =
refCast<const processorPolyPatch> refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
(cloud_.pMesh().boundaryMesh()[patchI]);
cellI_ = ppp.faceCells()[faceI_]; cellI_ = ppp.faceCells()[faceI_];
@ -70,7 +67,7 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
); );
transformPosition(T); transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T); transformProperties(T);
} }
else if (ppp.separated()) else if (ppp.separated())
{ {
@ -81,10 +78,7 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
: ppp.separation()[faceI_] : ppp.separation()[faceI_]
); );
position_ -= s; position_ -= s;
static_cast<ParticleType&>(*this).transformProperties transformProperties(-s);
(
-s
);
} }
tetFaceI_ = faceI_ + ppp.start(); tetFaceI_ = faceI_ + ppp.start();
@ -110,7 +104,7 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
// This relationship can be verified for other points and sizes of // This relationship can be verified for other points and sizes of
// face. // 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 // Reset the face index for the next tracking operation
if (stepFraction_ > (1.0 - SMALL)) if (stepFraction_ > (1.0 - SMALL))
@ -125,99 +119,69 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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())
{
if (doCellFacePt)
{
initCellFacePt();
}
}
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 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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType> template<class CloudType>
template<class TrackData> void Foam::particle::readFields(CloudType& c)
Foam::label Foam::Particle<ParticleType>::track {
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 CloudType, c, iter)
{
particle& p = iter();
p.origProc_ = origProcId[i];
p.origId_ = origId[i];
i++;
}
}
}
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
( (
const vector& endPosition, c.fieldIOobject("origProcId", IOobject::NO_READ),
TrackData& td 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 TrackData>
Foam::label Foam::particle::track(const vector& endPosition, TrackData& td)
{ {
faceI_ = -1; 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> template<class TrackData>
Foam::scalar Foam::Particle<ParticleType>::trackToFace Foam::scalar Foam::particle::trackToFace
( (
const vector& endPosition, const vector& endPosition,
TrackData& td TrackData& td
) )
{ {
const polyMesh& mesh = cloud_.polyMesh_; typedef typename TrackData::cloudType cloudType;
typedef typename cloudType::particleType particleType;
const faceList& pFaces = mesh.faces(); cloudType& cloud = td.cloud();
const pointField& pPts = mesh.points();
const vectorField& pC = mesh.cellCentres();
const faceList& pFaces = mesh_.faces();
const pointField& pPts = mesh_.points();
const vectorField& pC = mesh_.cellCentres();
faceI_ = -1; faceI_ = -1;
@ -317,7 +275,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// current tet centre. // current tet centre.
scalar lambdaMin = VGREAT; 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 // 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. // 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_]; 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]; label basePtI = f[tetBasePtI];
@ -376,9 +334,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
Pout<< "tracking rescue using tetCentre from " << position(); Pout<< "tracking rescue using tetCentre from " << position();
} }
position_ += position_ += trackingCorrectionTol*(tet.centre() - position_);
Cloud<ParticleType>::trackingCorrectionTol
*(tet.centre() - position_);
if (debug) if (debug)
{ {
@ -386,12 +342,12 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
<< (tet.centre() - position_) << endl; << (tet.centre() - position_) << endl;
} }
cloud_.trackingRescue(); cloud.trackingRescue();
return trackFraction; return trackFraction;
} }
if (triI != -1 && mesh.moving()) if (triI != -1 && mesh_.moving())
{ {
// Mesh motion requires stepFraction to be correct for // Mesh motion requires stepFraction to be correct for
// each tracking portion, so trackToFace must return after // 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 // Sets a value for lambdaMin and faceI_ if a wall face is hit
// by the track. // 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 // Did not hit any tet tri faces, and no wall face has been
// found to hit. // found to hit.
@ -544,10 +507,10 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
} while (faceI_ < 0); } while (faceI_ < 0);
ParticleType& p = static_cast<ParticleType&>(*this); particleType& p = static_cast<particleType&>(*this);
p.hitFace(td); p.hitFace(td);
if (cloud_.internalFace(faceI_)) if (internalFace(faceI_))
{ {
// Change tet ownership because a tri face has been crossed, // Change tet ownership because a tri face has been crossed,
// in general this is: // 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 // No modifications are required for triI = 0, no call required to
// tetNeighbour(0); // 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 else
{ {
FatalErrorIn FatalErrorIn("Particle::trackToFace(const vector&, TrackData&)")
( << "addressing failure" << abort(FatalError);
"Particle::trackToFace(const vector&, TrackData&)"
) << "addressing failure" << nl
<< abort(FatalError);
} }
} }
else else
@ -585,7 +545,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
( (
!p.hitPatch !p.hitPatch
( (
mesh.boundaryMesh()[patchI], mesh_.boundaryMesh()[patchI],
td, td,
patchI, patchI,
trackFraction, trackFraction,
@ -599,7 +559,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
patchI = patch(faceI_); patchI = patch(faceI_);
} }
const polyPatch& patch = mesh.boundaryMesh()[patchI]; const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<wedgePolyPatch>(patch)) if (isA<wedgePolyPatch>(patch))
{ {
@ -656,22 +616,20 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
<< "from " << position(); << "from " << position();
} }
position_ += position_ += trackingCorrectionTol*(tet.centre() - position_);
Cloud<ParticleType>::trackingCorrectionTol
*(tet.centre() - position_);
if if
( (
cloud_.hasWallImpactDistance() cloud.hasWallImpactDistance()
&& !cloud_.internalFace(faceHitTetIs.face()) && !internalFace(faceHitTetIs.face())
&& cloud_.cellHasWallFaces()[faceHitTetIs.cell()] && cloud.cellHasWallFaces()[faceHitTetIs.cell()]
) )
{ {
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
label fI = faceHitTetIs.face(); label fI = faceHitTetIs.face();
label patchI = patches.patchID()[fI - mesh.nInternalFaces()]; label patchI = patches.patchID()[fI - mesh_.nInternalFaces()];
if (isA<wallPolyPatch>(patches[patchI])) 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 // position that hit the wall that is in need of a
// rescue correction. // 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(); vector nHat = wallTri.normal();
nHat /= mag(nHat); nHat /= mag(nHat);
@ -701,7 +659,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
// normal direction is larger towards the wall than // normal direction is larger towards the wall than
// the new correction is away from it. // the new correction is away from it.
position_ += position_ +=
Cloud<ParticleType>::trackingCorrectionTol trackingCorrectionTol
*( *(
(wallTet.centre() - (position_ + r*nHat)) (wallTet.centre() - (position_ + r*nHat))
- (nHat & (tet.centre() - position_))*nHat - (nHat & (tet.centre() - position_))*nHat
@ -714,50 +672,221 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
Pout<< " to " << position() << endl; Pout<< " to " << position() << endl;
} }
cloud_.trackingRescue(); cloud.trackingRescue();
} }
return trackFraction; return trackFraction;
} }
template<class ParticleType> template<class CloudType>
Foam::scalar Foam::Particle<ParticleType>::trackToFace void Foam::particle::hitWallFaces
( (
const vector& endPosition const CloudType& cloud,
const vector& from,
const vector& to,
scalar& lambdaMin,
tetIndices& closestTetIs
) )
{ {
int dummyTd; if (!(cloud.hasWallImpactDistance() && cloud.cellHasWallFaces()[cellI_]))
return trackToFace(endPosition, dummyTd);
}
template<class ParticleType>
void Foam::Particle<ParticleType>::transformPosition(const tensor& T)
{ {
position_ = transform(T, position_); 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>::transformProperties(const tensor&)
{}
template<class ParticleType>
void Foam::Particle<ParticleType>::transformProperties(const vector&)
{}
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::hitFace(TrackData&) void Foam::particle::hitFace(TrackData&)
{} {}
template<class ParticleType>
template<class TrackData> template<class TrackData>
bool Foam::Particle<ParticleType>::hitPatch bool Foam::particle::hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData&, TrackData&,
@ -770,9 +899,8 @@ bool Foam::Particle<ParticleType>::hitPatch
} }
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::hitWedgePatch void Foam::particle::hitWedgePatch
( (
const wedgePolyPatch& wpp, const wedgePolyPatch& wpp,
TrackData& TrackData&
@ -780,7 +908,7 @@ void Foam::Particle<ParticleType>::hitWedgePatch
{ {
FatalErrorIn FatalErrorIn
( (
"void Foam::Particle<ParticleType>::hitWedgePatch" "void Foam::particle::hitWedgePatch"
"(" "("
"const wedgePolyPatch& wpp, " "const wedgePolyPatch& wpp, "
"TrackData&" "TrackData&"
@ -791,13 +919,12 @@ void Foam::Particle<ParticleType>::hitWedgePatch
vector nf = normal(); vector nf = normal();
nf /= mag(nf); 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> template<class TrackData>
void Foam::Particle<ParticleType>::hitSymmetryPatch void Foam::particle::hitSymmetryPatch
( (
const symmetryPolyPatch& spp, const symmetryPolyPatch& spp,
TrackData& TrackData&
@ -806,28 +933,25 @@ void Foam::Particle<ParticleType>::hitSymmetryPatch
vector nf = normal(); vector nf = normal();
nf /= mag(nf); 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> template<class TrackData>
void Foam::Particle<ParticleType>::hitCyclicPatch void Foam::particle::hitCyclicPatch
( (
const cyclicPolyPatch& cpp, const cyclicPolyPatch& cpp,
TrackData& TrackData& td
) )
{ {
// label patchFaceI_ = cpp.whichFace(faceI_);
faceI_ = cpp.transformGlobalFace(faceI_); faceI_ = cpp.transformGlobalFace(faceI_);
cellI_ = cloud_.polyMesh_.faceOwner()[faceI_]; cellI_ = mesh_.faceOwner()[faceI_];
tetFaceI_ = faceI_; tetFaceI_ = faceI_;
// See note in correctAfterParallelTransfer for tetPtI_ addressing. // 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(); const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
@ -843,7 +967,7 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
); );
transformPosition(T); transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T); transformProperties(T);
} }
else if (receiveCpp.separated()) else if (receiveCpp.separated())
{ {
@ -854,75 +978,29 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
: receiveCpp.separation()[receiveCpp.whichFace(faceI_)] : receiveCpp.separation()[receiveCpp.whichFace(faceI_)]
); );
position_ -= s; position_ -= s;
static_cast<ParticleType&>(*this).transformProperties transformProperties(-s);
(
-s
);
} }
} }
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::hitProcessorPatch void Foam::particle::hitProcessorPatch(const processorPolyPatch&, TrackData&)
(
const processorPolyPatch& spp,
TrackData& td
)
{} {}
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::hitWallPatch void Foam::particle::hitWallPatch
( (
const wallPolyPatch& spp, const wallPolyPatch&,
TrackData&, TrackData&,
const tetIndices& const tetIndices&
) )
{} {}
template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::hitPatch void Foam::particle::hitPatch(const polyPatch&, TrackData&)
(
const polyPatch& spp,
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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,15 +25,17 @@ Class
Foam::passiveParticle Foam::passiveParticle
Description Description
Copy of base particle
SourceFiles SourceFiles
passiveParticle.H
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passiveParticle_H #ifndef passiveParticle_H
#define passiveParticle_H #define passiveParticle_H
#include "Particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -48,7 +50,7 @@ namespace Foam
class passiveParticle class passiveParticle
: :
public Particle<passiveParticle> public particle
{ {
public: public:
@ -58,53 +60,50 @@ public:
//- Construct from components //- Construct from components
passiveParticle passiveParticle
( (
const Cloud<passiveParticle>& c, const polyMesh& mesh,
const vector& position, const vector& position,
const label cellI, const label cellI,
const label tetFaceI, const label tetFaceI,
const label tetPtI const label tetPtI
) )
: :
Particle<passiveParticle>(c, position, cellI, tetFaceI, tetPtI) particle(mesh, position, cellI, tetFaceI, tetPtI)
{} {}
//- Construct from components, with searching for tetFace and //- Construct from components, with searching for tetFace and
// tetPt unless disabled by doCellFacePt = false. // tetPt unless disabled by doCellFacePt = false.
passiveParticle passiveParticle
( (
const Cloud<passiveParticle>& c, const polyMesh& mesh,
const vector& position, const vector& position,
const label cellI, const label cellI,
bool doCellFacePt = true bool doCellFacePt = true
) )
: :
Particle<passiveParticle>(c, position, cellI, doCellFacePt) particle(mesh, position, cellI, doCellFacePt)
{} {}
//- Construct from Istream //- Construct from Istream
passiveParticle passiveParticle
( (
const Cloud<passiveParticle>& c, const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields = true bool readFields = true
) )
: :
Particle<passiveParticle>(c, is, readFields) particle(mesh, is, readFields)
{} {}
//- Construct as copy //- Construct as copy
passiveParticle(const passiveParticle& p) passiveParticle(const passiveParticle& p)
: :
Particle<passiveParticle>(p) particle(p)
{} {}
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<Particle<passiveParticle> > clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<Particle<passiveParticle> > return autoPtr<particle>(new passiveParticle(*this));
(
new passiveParticle(*this)
);
} }
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,6 @@ License
namespace Foam namespace Foam
{ {
defineParticleTypeNameAndDebug(passiveParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<passiveParticle>, 0); defineTemplateTypeNameAndDebug(Cloud<passiveParticle>, 0);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,9 +62,6 @@ class passiveParticleCloud
public: public:
//- Type of parcel the cloud was instantiated for
typedef passiveParticle parcelType;
// Constructors // Constructors
//- Construct given mesh //- Construct given mesh

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,13 +25,17 @@ Class
CoalCloud CoalCloud
Description Description
Coal cloud Cloud class to introduce coal parcels
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coalCloud_H #ifndef coalCloud_H
#define coalCloud_H #define coalCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "ThermoCloud.H"
#include "ReactingCloud.H"
#include "ReactingMultiphaseCloud.H" #include "ReactingMultiphaseCloud.H"
#include "coalParcel.H" #include "coalParcel.H"
@ -39,7 +43,22 @@ Description
namespace Foam 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
coalParcel coalParcel
Description Description
Coal parcel class Definition of coal parcel
SourceFiles SourceFiles
CoalParcel.C CoalParcel.C
@ -35,113 +35,38 @@ SourceFiles
#ifndef coalParcel_H #ifndef coalParcel_H
#define coalParcel_H #define coalParcel_H
#include "contiguous.H"
#include "particle.H"
#include "KinematicParcel.H"
#include "ThermoParcel.H"
#include "ReactingParcel.H"
#include "ReactingMultiphaseParcel.H" #include "ReactingMultiphaseParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
typedef ReactingMultiphaseParcel
<
ReactingParcel
<
ThermoParcel
<
KinematicParcel
<
particle
>
>
>
> coalParcel;
/*---------------------------------------------------------------------------*\ template<>
Class coalParcel Declaration inline bool contiguous<coalParcel>()
\*---------------------------------------------------------------------------*/
class coalParcel
:
public ReactingMultiphaseParcel<coalParcel>
{ {
public: return false;
// 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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

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

View File

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

View File

@ -1,6 +1,6 @@
if (isA<wallPolyPatch>(pbMesh[patch(face())])) if (isA<wallPolyPatch>(pbMesh[patch(face())]))
{ {
keepParcel = sDB.wall().wallTreatment(*this, face()); td.keepParticle = sDB.wall().wallTreatment(*this, face());
if (sDB.twoD()) if (sDB.twoD())
{ {
@ -50,5 +50,5 @@ else if (isA<symmetryPolyPatch>(pbMesh[patch(face())]))
else if (isType<polyPatch>(pbMesh[patch(face())])) else if (isType<polyPatch>(pbMesh[patch(face())]))
{ {
// Parcel has hit an inlet or outlet or some such so throw it away // 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 "processorPolyPatch.H"
#include "basicMultiComponentMixture.H" #include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::parcel::parcel Foam::parcel::parcel
( (
const Cloud<parcel>& cloud, const polyMesh& mesh,
const vector& position, const vector& position,
const label cellI, const label cellI,
const label tetFaceI, const label tetFaceI,
@ -69,11 +61,8 @@ Foam::parcel::parcel
const List<word>& liquidNames const List<word>& liquidNames
) )
: :
Particle<parcel>(cloud, position, cellI, tetFaceI, tetPtI), particle(mesh, position, cellI, tetFaceI, tetPtI),
liquidComponents_ liquidComponents_(liquidNames),
(
liquidNames
),
d_(d), d_(d),
T_(T), T_(T),
m_(m), m_(m),
@ -94,11 +83,14 @@ Foam::parcel::parcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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(); td.switchProcessor = false;
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); td.keepParticle = true;
const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
spray& sDB = td.cloud();
const liquidMixtureProperties& fuels = sDB.fuels(); const liquidMixtureProperties& fuels = sDB.fuels();
label Nf = fuels.components().size(); label Nf = fuels.components().size();
@ -139,8 +131,6 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
scalarField tauEvaporation(Nf, GREAT); scalarField tauEvaporation(Nf, GREAT);
scalarField tauBoiling(Nf, GREAT); scalarField tauBoiling(Nf, GREAT);
bool keepParcel = true;
setRelaxationTimes setRelaxationTimes
( (
cell(), cell(),
@ -185,7 +175,6 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
// (10 000 seems high enough) // (10 000 seems high enough)
dtMax = max(dtMax, 1.0e-4*tEnd); dtMax = max(dtMax, 1.0e-4*tEnd);
bool switchProcessor = false;
vector planeNormal = vector::zero; vector planeNormal = vector::zero;
if (sDB.twoD()) if (sDB.twoD())
{ {
@ -194,7 +183,7 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
} }
// move the parcel until there is no 'timeLeft' // 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 // set the lagrangian time-step
scalar dt = min(dtMax, tEnd); scalar dt = min(dtMax, tEnd);
@ -205,10 +194,10 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
scalar p = sDB.p()[cellI]; scalar p = sDB.p()[cellI];
// track parcel to face, or end of trajectory // 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 // 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 // Decrement the end-time acording to how much time the track took
tEnd -= dt; tEnd -= dt;
@ -222,7 +211,7 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
} }
} }
if (keepParcel && sDB.twoD()) if (td.keepParticle && sDB.twoD())
{ {
scalar z = position() & sDB.axisOfSymmetry(); scalar z = position() & sDB.axisOfSymmetry();
vector r = position() - z*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' // remove parcel if it is 'small'
if (m() < 1.0e-12) if (m() < 1.0e-12)
{ {
keepParcel = false; td.keepParticle = false;
// ... and add the removed 'stuff' to the gas // ... and add the removed 'stuff' to the gas
forAll(nMass, i) forAll(nMass, i)
@ -309,19 +298,19 @@ bool Foam::parcel::move(spray& sDB, const scalar trackTime)
sDB.shs()[cellI] += m()*(nH + nPE); sDB.shs()[cellI] += m()*(nH + nPE);
} }
if (onBoundary() && keepParcel) if (onBoundary() && td.keepParticle)
{ {
if (face() > -1) if (face() > -1)
{ {
if (isA<processorPolyPatch>(pbMesh[patch(face())])) 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ Description
#ifndef parcel_H #ifndef parcel_H
#define parcel_H #define parcel_H
#include "Particle.H" #include "particle.H"
#include "contiguous.H" #include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,7 +48,7 @@ class spray;
class parcel class parcel
: :
public Particle<parcel> public particle
{ {
// Private member data // Private member data
@ -142,13 +142,25 @@ public:
friend class Cloud<parcel>; 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 // Constructors
//- Construct from components //- Construct from components
parcel parcel
( (
const Cloud<parcel>& cloud, const polyMesh& mesh,
const vector& position, const vector& position,
const label cellI, const label cellI,
const label tetFaceI, const label tetFaceI,
@ -173,11 +185,30 @@ public:
//- Construct from Istream reading field values if required //- Construct from Istream reading field values if required
parcel parcel
( (
const Cloud<parcel>& cloud, const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields = true 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 // Member Functions
@ -349,7 +380,7 @@ public:
// Parcel operations // 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 //- Transform the position and physical properties of the particle
// according to the given transformation tensor // according to the given transformation tensor

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,182 +23,205 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // inline const Foam::List<Foam::word>& Foam::parcel::liquidNames() const
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const List<word>& parcel::liquidNames() const
{ {
return liquidComponents_; return liquidComponents_;
} }
inline const List<word>& parcel::fuelNames() const
inline const Foam::List<Foam::word>& Foam::parcel::fuelNames() const
{ {
return liquidComponents_; return liquidComponents_;
} }
inline scalar parcel::d() const
inline Foam::scalar Foam::parcel::d() const
{ {
return d_; return d_;
} }
inline scalar& parcel::d()
inline Foam::scalar& Foam::parcel::d()
{ {
return d_; return d_;
} }
inline scalar parcel::T() const
inline Foam::scalar Foam::parcel::T() const
{ {
return T_; return T_;
} }
inline scalar& parcel::T()
inline Foam::scalar& Foam::parcel::T()
{ {
return T_; return T_;
} }
inline scalar parcel::m() const
inline Foam::scalar Foam::parcel::m() const
{ {
return m_; return m_;
} }
inline scalar& parcel::m()
inline Foam::scalar& Foam::parcel::m()
{ {
return m_; return m_;
} }
inline scalar parcel::dev() const
inline Foam::scalar Foam::parcel::dev() const
{ {
return y_; return y_;
} }
inline scalar& parcel::dev()
inline Foam::scalar& Foam::parcel::dev()
{ {
return y_; return y_;
} }
inline scalar parcel::ddev() const
inline Foam::scalar Foam::parcel::ddev() const
{ {
return yDot_; return yDot_;
} }
inline scalar& parcel::ddev()
inline Foam::scalar& Foam::parcel::ddev()
{ {
return yDot_; return yDot_;
} }
inline scalar parcel::ct() const
inline Foam::scalar Foam::parcel::ct() const
{ {
return ct_; return ct_;
} }
inline scalar& parcel::ct()
inline Foam::scalar& Foam::parcel::ct()
{ {
return ct_; return ct_;
} }
inline scalar& parcel::ms()
inline Foam::scalar& Foam::parcel::ms()
{ {
return ms_; return ms_;
} }
inline scalar parcel::ms() const
inline Foam::scalar Foam::parcel::ms() const
{ {
return ms_; return ms_;
} }
inline scalar& parcel::tTurb()
inline Foam::scalar& Foam::parcel::tTurb()
{ {
return tTurb_; return tTurb_;
} }
inline scalar parcel::tTurb() const
inline Foam::scalar Foam::parcel::tTurb() const
{ {
return tTurb_; return tTurb_;
} }
inline scalar& parcel::liquidCore()
inline Foam::scalar& Foam::parcel::liquidCore()
{ {
return liquidCore_; return liquidCore_;
} }
inline scalar parcel::liquidCore() const
inline Foam::scalar Foam::parcel::liquidCore() const
{ {
return liquidCore_; return liquidCore_;
} }
inline scalar& parcel::injector()
inline Foam::scalar& Foam::parcel::injector()
{ {
return injector_; return injector_;
} }
inline scalar parcel::injector() const
inline Foam::scalar Foam::parcel::injector() const
{ {
return injector_; return injector_;
} }
inline const vector& parcel::U() const
inline const Foam::vector& Foam::parcel::U() const
{ {
return U_; return U_;
} }
inline vector& parcel::U()
inline Foam::vector& Foam::parcel::U()
{ {
return U_; return U_;
} }
inline const vector& parcel::Uturb() const
inline const Foam::vector& Foam::parcel::Uturb() const
{ {
return Uturb_; return Uturb_;
} }
inline vector& parcel::Uturb()
inline Foam::vector& Foam::parcel::Uturb()
{ {
return Uturb_; return Uturb_;
} }
inline const vector& parcel::n() const
inline const Foam::vector& Foam::parcel::n() const
{ {
return n_; return n_;
} }
inline vector& parcel::n()
inline Foam::vector& Foam::parcel::n()
{ {
return n_; return n_;
} }
inline const scalarField& parcel::X() const
inline const Foam::scalarField& Foam::parcel::X() const
{ {
return X_; return X_;
} }
inline scalarField& parcel::X()
inline Foam::scalarField& Foam::parcel::X()
{ {
return X_; return X_;
} }
inline scalar& parcel::tMom()
inline Foam::scalar& Foam::parcel::tMom()
{ {
return tMom_; return tMom_;
} }
inline scalar parcel::tMom() const
inline Foam::scalar Foam::parcel::tMom() const
{ {
return tMom_; return tMom_;
} }
inline vector parcel::Urel(const vector& U) const
inline Foam::vector Foam::parcel::Urel(const vector& U) const
{ {
return U_ - U; return U_ - U;
} }
inline void parcel::correctNormal
( inline void Foam::parcel::correctNormal(const vector& sym)
const vector& sym
)
{ {
scalar d = position() & sym; scalar d = position() & sym;
n_ = position() - d*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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,17 +30,18 @@ License
Foam::parcel::parcel Foam::parcel::parcel
( (
const Cloud<parcel>& cloud, const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields bool readFields
) )
: :
Particle<parcel>(cloud, is, readFields), particle(mesh, is, readFields),
liquidComponents_ liquidComponents_
( (
(cloud.pMesh().lookupObject<dictionary>("thermophysicalProperties")) (
.lookup("liquidComponents") mesh.lookupObject<dictionary>("thermophysicalProperties")
).lookup("liquidComponents")
), ),
X_(liquidComponents_.size(), 0.0), X_(liquidComponents_.size(), 0.0),
@ -102,7 +103,7 @@ void Foam::parcel::readFields(Cloud<parcel>& c)
return; return;
} }
Particle<parcel>::readFields(c); particle::readFields(c);
IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ)); IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ));
c.checkFieldIOobject(c, d); c.checkFieldIOobject(c, d);
@ -195,7 +196,7 @@ void Foam::parcel::readFields(Cloud<parcel>& c)
void Foam::parcel::writeFields(const Cloud<parcel>& c) void Foam::parcel::writeFields(const Cloud<parcel>& c)
{ {
Particle<parcel>::writeFields(c); particle::writeFields(c);
label np = c.size(); 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) Foam::Ostream& Foam::operator<<(Ostream& os, const parcel& p)
{ {
if (os.format() == IOstream::ASCII) 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.d_
<< token::SPACE << p.T_ << token::SPACE << p.T_
<< token::SPACE << p.m_ << token::SPACE << p.m_
@ -310,7 +310,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const parcel& p)
} }
else else
{ {
os << static_cast<const Particle<parcel>&>(p); os << static_cast<const particle>(p);
os.write os.write
( (
reinterpret_cast<const char*>(&p.d_), reinterpret_cast<const char*>(&p.d_),

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,8 @@ void Foam::spray::inject()
scalar time = runTime_.value(); scalar time = runTime_.value();
scalar time0 = time0_; scalar time0 = time0_;
parcel::trackingData td(*this);
// Inject the parcels for each injector sequentially // Inject the parcels for each injector sequentially
forAll(injectors_, i) forAll(injectors_, i)
{ {
@ -111,7 +113,7 @@ void Foam::spray::inject()
label injectorTetFaceI = -1; label injectorTetFaceI = -1;
label injectorTetPtI = -1; label injectorTetPtI = -1;
findCellFacePt mesh_.findCellFacePt
( (
injectionPosition, injectionPosition,
injectorCell, injectorCell,
@ -129,7 +131,7 @@ void Foam::spray::inject()
parcel* pPtr = new parcel parcel* pPtr = new parcel
( (
*this, mesh_,
injectionPosition, injectionPosition,
injectorCell, injectorCell,
injectorTetFaceI, injectorTetFaceI,
@ -160,7 +162,7 @@ void Foam::spray::inject()
/runTime_.deltaTValue(); /runTime_.deltaTValue();
bool keepParcel = bool keepParcel =
pPtr->move(*this, runTime_.deltaTValue()); pPtr->move(td, runTime_.deltaTValue());
if (keepParcel) if (keepParcel)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -76,7 +76,8 @@ void Foam::spray::move()
srhos_[i] = 0.0; 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 new parcel
( (
spray_, p.mesh(),
p.position(), p.position(),
p.cell(), p.cell(),
p.tetFace(), p.tetFace(),

View File

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

View File

@ -34,9 +34,9 @@ Foam::distributionModels::distributionModel::New
cachedRandom& rndGen 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 = dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType); dictionaryConstructorTablePtr_->find(modelType);
@ -51,8 +51,8 @@ Foam::distributionModels::distributionModel::New
"cachedRandom&" "cachedRandom&"
")" ")"
) )
<< "Unknown distributionModel type " << modelType << nl << nl << "Unknown distribution model type " << modelType << nl << nl
<< "Valid distributionModel types are:" << nl << "Valid distribution model types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -501,7 +501,7 @@ void Foam::DsmcCloud<ParcelType>::addNewParcel
{ {
ParcelType* pPtr = new ParcelType ParcelType* pPtr = new ParcelType
( (
*this, mesh_,
position, position,
U, U,
Ei, Ei,
@ -970,7 +970,7 @@ Foam::DsmcCloud<ParcelType>::~DsmcCloud()
template<class ParcelType> template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::evolve() void Foam::DsmcCloud<ParcelType>::evolve()
{ {
typename ParcelType::trackData td(*this); typename ParcelType::trackingData td(*this);
// Reset the data collection fields // Reset the data collection fields
resetFields(); resetFields();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,13 +30,10 @@ License
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackData>
bool Foam::DsmcParcel<ParcelType>::move bool Foam::DsmcParcel<ParcelType>::move(TrackData& td, const scalar trackTime)
(
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.switchProcessor = false;
td.keepParticle = true; 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 ParcelType>
template<class TrackData> template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitWallPatch void Foam::DsmcParcel<ParcelType>::hitWallPatch
@ -174,7 +162,7 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
td.cloud().wallInteraction().correct td.cloud().wallInteraction().correct
( (
static_cast<ParcelType&>(*this), static_cast<DsmcParcel<ParcelType> &>(*this),
wpp 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 ParcelType>
template<class TrackData> template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitPatch void Foam::DsmcParcel<ParcelType>::hitPatch(const polyPatch&, TrackData& td)
(
const polyPatch&,
TrackData& td
)
{ {
td.keepParticle = false; td.keepParticle = false;
} }
template<class ParcelType> template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitPatch void Foam::DsmcParcel<ParcelType>::transformProperties(const tensor& T)
(
const polyPatch&,
int&
)
{}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::transformProperties
(
const tensor& T
)
{ {
Particle<ParcelType>::transformProperties(T); ParcelType::transformProperties(T);
U_ = transform(T, U_); U_ = transform(T, U_);
} }
@ -263,7 +225,7 @@ void Foam::DsmcParcel<ParcelType>::transformProperties
const vector& separation const vector& separation
) )
{ {
Particle<ParcelType>::transformProperties(separation); ParcelType::transformProperties(separation);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,7 +37,7 @@ SourceFiles
#ifndef DsmcParcel_H #ifndef DsmcParcel_H
#define DsmcParcel_H #define DsmcParcel_H
#include "Particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "contiguous.H" #include "contiguous.H"
@ -68,7 +68,7 @@ Ostream& operator<<
template<class ParcelType> template<class ParcelType>
class DsmcParcel class DsmcParcel
: :
public Particle<ParcelType> public ParcelType
{ {
public: public:
@ -123,31 +123,22 @@ public:
//- Class used to pass kinematic tracking data to the trackToFace function //- 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: public:
// Constructors // Constructors
//- Construct from components //- Construct from components
inline trackData trackingData(DsmcCloud<DsmcParcel<ParcelType> >& cloud)
:
particle::TrackingData<DsmcCloud<DsmcParcel<ParcelType> > >
( (
DsmcCloud<ParcelType>& cloud cloud
); )
{}
// Member functions
//- Return access to the owner cloud
inline DsmcCloud<ParcelType>& cloud();
}; };
@ -181,7 +172,7 @@ public:
//- Construct from components //- Construct from components
inline DsmcParcel inline DsmcParcel
( (
DsmcCloud<ParcelType>& owner, const polyMesh& mesh,
const vector& position, const vector& position,
const vector& U, const vector& U,
const scalar Ei, const scalar Ei,
@ -194,19 +185,39 @@ public:
//- Construct from Istream //- Construct from Istream
DsmcParcel DsmcParcel
( (
const Cloud<ParcelType>& c, const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields = true bool readFields = true
); );
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<Particle<ParcelType> > clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<Particle<ParcelType> > 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>(*this) new DsmcParcel<ParcelType>(mesh_, is, true)
); );
} }
};
// Member Functions // Member Functions
@ -263,14 +274,6 @@ public:
TrackData& td 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 //- Overridable function to handle the particle hitting a wallPatch
template<class TrackData> template<class TrackData>
void hitWallPatch void hitWallPatch
@ -280,15 +283,6 @@ public:
const tetIndices& 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 //- Overridable function to handle the particle hitting a polyPatch
template<class TrackData> template<class TrackData>
void hitPatch void hitPatch
@ -297,14 +291,6 @@ public:
TrackData& td 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 //- Transform the physical properties of the particle
// according to the given transformation tensor // according to the given transformation tensor
void transformProperties(const tensor& T); void transformProperties(const tensor& T);
@ -316,9 +302,9 @@ public:
// I-O // 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 // Ostream Operator

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -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 inline Foam::DsmcParcel<ParcelType>::DsmcParcel
( (
DsmcCloud<ParcelType>& owner, const polyMesh& mesh,
const vector& position, const vector& position,
const vector& U, const vector& U,
const scalar Ei, const scalar Ei,
@ -75,7 +64,7 @@ inline Foam::DsmcParcel<ParcelType>::DsmcParcel
const label typeId const label typeId
) )
: :
Particle<ParcelType>(owner, position, cellI, tetFaceI, tetPtI), ParcelType(mesh, position, cellI, tetFaceI, tetPtI),
U_(U), U_(U),
Ei_(Ei), Ei_(Ei),
typeId_(typeId) typeId_(typeId)
@ -93,8 +82,7 @@ Foam::DsmcParcel<ParcelType>::constantProperties::mass() const
template<class ParcelType> template<class ParcelType>
inline Foam::scalar inline Foam::scalar Foam::DsmcParcel<ParcelType>::constantProperties::d() const
Foam::DsmcParcel<ParcelType>::constantProperties::d() const
{ {
return d_; return d_;
} }
@ -125,16 +113,6 @@ 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 * * * * * * * * * * // // * * * * * * * * * * DsmcParcel Member Functions * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,12 +33,12 @@ License
template <class ParcelType> template <class ParcelType>
Foam::DsmcParcel<ParcelType>::DsmcParcel Foam::DsmcParcel<ParcelType>::DsmcParcel
( (
const Cloud<ParcelType>& cloud, const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields bool readFields
) )
: :
Particle<ParcelType>(cloud, is, readFields), ParcelType(mesh, is, readFields),
U_(vector::zero), U_(vector::zero),
Ei_(0.0), Ei_(0.0),
typeId_(-1) typeId_(-1)
@ -73,14 +73,14 @@ Foam::DsmcParcel<ParcelType>::DsmcParcel
template<class ParcelType> template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c) void Foam::DsmcParcel<ParcelType>::readFields(Cloud<DsmcParcel<ParcelType> >& c)
{ {
if (!c.size()) if (!c.size())
{ {
return; return;
} }
Particle<ParcelType>::readFields(c); ParcelType::readFields(c);
IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ)); IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ));
c.checkFieldIOobject(c, U); c.checkFieldIOobject(c, U);
@ -92,9 +92,9 @@ void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
c.checkFieldIOobject(c, typeId); c.checkFieldIOobject(c, typeId);
label i = 0; 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.U_ = U[i];
p.Ei_ = Ei[i]; p.Ei_ = Ei[i];
@ -105,9 +105,12 @@ void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
template<class ParcelType> 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(); 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); IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np);
label i = 0; label i = 0;
forAllConstIter(typename Cloud<ParcelType>, c, iter) forAllConstIter(typename Cloud<DsmcParcel<ParcelType> >, c, iter)
{ {
const DsmcParcel<ParcelType>& p = iter(); const DsmcParcel<ParcelType>& p = iter();
@ -143,14 +146,14 @@ Foam::Ostream& Foam::operator<<
{ {
if (os.format() == IOstream::ASCII) 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.U()
<< token::SPACE << p.Ei() << token::SPACE << p.Ei()
<< token::SPACE << p.typeId(); << token::SPACE << p.typeId();
} }
else else
{ {
os << static_cast<const Particle<ParcelType>& >(p); os << static_cast<const ParcelType& >(p);
os.write os.write
( (
reinterpret_cast<const char*>(&p.U_), reinterpret_cast<const char*>(&p.U_),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,13 +24,13 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "dsmcParcel.H" #include "dsmcParcel.H"
#include "DsmcParcel.H"
#include "DsmcCloud.H" #include "DsmcCloud.H"
namespace Foam namespace Foam
{ {
defineTemplateTypeNameAndDebug(DsmcParcel<particle>, 0);
defineTemplateTypeNameAndDebug(Cloud<dsmcParcel>, 0); defineTemplateTypeNameAndDebug(Cloud<dsmcParcel>, 0);
defineParcelTypeNameAndDebug(DsmcCloud<dsmcParcel>, 0);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "dsmcParcel.H" #include "dsmcParcel.H"
/*
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(dsmcParcel, 0); // defineTypeNameAndDebug(dsmcParcel, 0);
defineParticleTypeNameAndDebug(dsmcParcel, 0); // defineParticleTypeNameAndDebug(dsmcParcel, 0);
defineParcelTypeNameAndDebug(dsmcParcel, 0); // defineParcelTypeNameAndDebug(dsmcParcel, 0);
} }
@ -39,7 +39,7 @@ namespace Foam
Foam::dsmcParcel::dsmcParcel Foam::dsmcParcel::dsmcParcel
( (
DsmcCloud<dsmcParcel>& owner, c& owner,
const vector& position, const vector& position,
const vector& U, const vector& U,
const scalar Ei, const scalar Ei,
@ -78,6 +78,6 @@ Foam::dsmcParcel::dsmcParcel
Foam::dsmcParcel::~dsmcParcel() Foam::dsmcParcel::~dsmcParcel()
{} {}
*/
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::dsmcParcel Foam::dsmcParcel
Description Description
Declaration of dsmc parcel type
SourceFiles SourceFiles
dsmcParcel.C dsmcParcel.C
@ -35,6 +35,7 @@ SourceFiles
#ifndef dsmcParcel_H #ifndef dsmcParcel_H
#define dsmcParcel_H #define dsmcParcel_H
#include "particle.H"
#include "DsmcParcel.H" #include "DsmcParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -42,10 +43,11 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef DsmcParcel<particle> dsmcParcel;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class dsmcParcel Declaration Class dsmcParcel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
/*
class dsmcParcel class dsmcParcel
: :
public DsmcParcel<dsmcParcel> public DsmcParcel<dsmcParcel>
@ -100,7 +102,7 @@ inline bool contiguous<dsmcParcel>()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
*/
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,29 +29,18 @@ License
#include "VariableHardSphere.H" #include "VariableHardSphere.H"
#include "LarsenBorgnakkeVariableHardSphere.H" #include "LarsenBorgnakkeVariableHardSphere.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
typedef DsmcCloud<dsmcParcel> CloudType;
makeBinaryCollisionModel(DsmcCloud<dsmcParcel>); makeBinaryCollisionModel(DsmcCloud<dsmcParcel>);
// Add instances of collision model to the table // Add instances of collision model to the table
makeBinaryCollisionModelType makeBinaryCollisionModelType(NoBinaryCollision, CloudType);
( makeBinaryCollisionModelType(VariableHardSphere, CloudType);
NoBinaryCollision, makeBinaryCollisionModelType(LarsenBorgnakkeVariableHardSphere, CloudType);
DsmcCloud,
dsmcParcel
);
makeBinaryCollisionModelType
(
VariableHardSphere,
DsmcCloud,
dsmcParcel
);
makeBinaryCollisionModelType
(
LarsenBorgnakkeVariableHardSphere,
DsmcCloud,
dsmcParcel
);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,23 +28,17 @@ License
#include "FreeStream.H" #include "FreeStream.H"
#include "NoInflow.H" #include "NoInflow.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeInflowBoundaryModel(DsmcCloud<dsmcParcel>); typedef DsmcCloud<dsmcParcel> CloudType;
makeInflowBoundaryModel(CloudType);
// Add instances of inflow boundary model to the table // Add instances of inflow boundary model to the table
makeInflowBoundaryModelType makeInflowBoundaryModelType(FreeStream, CloudType);
( makeInflowBoundaryModelType(NoInflow, CloudType);
FreeStream,
DsmcCloud,
dsmcParcel
);
makeInflowBoundaryModelType
(
NoInflow,
DsmcCloud,
dsmcParcel
);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,29 +29,18 @@ License
#include "SpecularReflection.H" #include "SpecularReflection.H"
#include "MixedDiffuseSpecular.H" #include "MixedDiffuseSpecular.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeWallInteractionModel(DsmcCloud<dsmcParcel>); typedef DsmcCloud<dsmcParcel> CloudType;
makeWallInteractionModel(CloudType);
// Add instances of wall interaction model to the table // Add instances of wall interaction model to the table
makeWallInteractionModelType makeWallInteractionModelType(MaxwellianThermal, CloudType);
( makeWallInteractionModelType(SpecularReflection, CloudType);
MaxwellianThermal, makeWallInteractionModelType(MixedDiffuseSpecular, CloudType);
DsmcCloud,
dsmcParcel
);
makeWallInteractionModelType
(
SpecularReflection,
DsmcCloud,
dsmcParcel
);
makeWallInteractionModelType
(
MixedDiffuseSpecular,
DsmcCloud,
dsmcParcel
);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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> >:: \ BinaryCollisionModel<CloudType>:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \ adddictionaryConstructorToTable<SS<CloudType> > \
add##SS##CloudType##ParcelType##ConstructorToTable_; add##SS##CloudType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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> >:: \ InflowBoundaryModel<CloudType>:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \ adddictionaryConstructorToTable<SS<CloudType> > \
add##SS##CloudType##ParcelType##ConstructorToTable_; add##SS##CloudType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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> >:: \ WallInteractionModel<CloudType>:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \ adddictionaryConstructorToTable<SS<CloudType> > \
add##SS##CloudType##ParcelType##ConstructorToTable_; add##SS##CloudType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

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

View File

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

View File

@ -7,10 +7,6 @@ BASECLOUDS=$(CLOUDS)/baseClasses
DERIVEDCLOUDS=$(CLOUDS)/derived DERIVEDCLOUDS=$(CLOUDS)/derived
/* Parcels */
$(BASEPARCELS)/reactingParcel/reactingParcel.C
/* Cloud base classes */ /* Cloud base classes */
$(BASECLOUDS)/kinematicCloud/kinematicCloud.C $(BASECLOUDS)/kinematicCloud/kinematicCloud.C
$(BASECLOUDS)/thermoCloud/thermoCloud.C $(BASECLOUDS)/thermoCloud/thermoCloud.C
@ -20,28 +16,28 @@ $(BASECLOUDS)/reactingMultiphaseCloud/reactingMultiphaseCloud.C
/* kinematic parcel sub-models */ /* kinematic parcel sub-models */
KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/basicKinematicParcel.C
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C $(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C $(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
KINEMATICCOLLIDINGPARCEL=$(DERIVEDPARCELS)/basicKinematicCollidingParcel
$(KINEMATICCOLLIDINGPARCEL)/defineBasicKinematicCollidingParcel.C
$(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C
/* thermo parcel sub-models */ /* thermo parcel sub-models */
THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel
$(THERMOPARCEL)/basicThermoParcel.C
$(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/defineBasicThermoParcel.C
$(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C
/* reacting parcel sub-models */ /* reacting parcel sub-models */
REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel
$(REACTINGPARCEL)/basicReactingParcel.C
$(REACTINGPARCEL)/defineBasicReactingParcel.C $(REACTINGPARCEL)/defineBasicReactingParcel.C
$(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C $(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C
/* reacting multiphase parcel sub-models */ /* reacting multiphase parcel sub-models */
REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel
$(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
@ -63,6 +59,7 @@ $(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C $(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C $(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C $(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C $(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
@ -83,5 +80,8 @@ phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C phaseProperties/phaseProperties/phasePropertiesIO.C
phaseProperties/phasePropertiesList/phasePropertiesList.C phaseProperties/phasePropertiesList/phasePropertiesList.C
/* Additional helper classes */
clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C
LIB = $(FOAM_LIBBIN)/liblagrangianIntermediate 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 "interpolation.H"
#include "subCycleTime.H" #include "subCycleTime.H"
#include "CollisionModel.H"
#include "DispersionModel.H" #include "DispersionModel.H"
#include "InjectionModel.H" #include "InjectionModel.H"
#include "PatchInteractionModel.H" #include "PatchInteractionModel.H"
#include "PostProcessingModel.H" #include "PostProcessingModel.H"
#include "SurfaceFilmModel.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 * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::setModels() void Foam::KinematicCloud<CloudType>::setModels()
{ {
collisionModel_.reset
(
CollisionModel<KinematicCloud<ParcelType> >::New
(
subModelProperties_,
*this
).ptr()
);
dispersionModel_.reset dispersionModel_.reset
( (
DispersionModel<KinematicCloud<ParcelType> >::New DispersionModel<KinematicCloud<CloudType> >::New
( (
subModelProperties_, subModelProperties_,
*this *this
@ -210,7 +50,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
injectionModel_.reset injectionModel_.reset
( (
InjectionModel<KinematicCloud<ParcelType> >::New InjectionModel<KinematicCloud<CloudType> >::New
( (
subModelProperties_, subModelProperties_,
*this *this
@ -219,7 +59,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
patchInteractionModel_.reset patchInteractionModel_.reset
( (
PatchInteractionModel<KinematicCloud<ParcelType> >::New PatchInteractionModel<KinematicCloud<CloudType> >::New
( (
subModelProperties_, subModelProperties_,
*this *this
@ -228,7 +68,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
postProcessingModel_.reset postProcessingModel_.reset
( (
PostProcessingModel<KinematicCloud<ParcelType> >::New PostProcessingModel<KinematicCloud<CloudType> >::New
( (
subModelProperties_, subModelProperties_,
*this *this
@ -237,7 +77,7 @@ void Foam::KinematicCloud<ParcelType>::setModels()
surfaceFilmModel_.reset surfaceFilmModel_.reset
( (
SurfaceFilmModel<KinematicCloud<ParcelType> >::New SurfaceFilmModel<KinematicCloud<CloudType> >::New
( (
subModelProperties_, subModelProperties_,
*this, *this,
@ -256,11 +96,9 @@ void Foam::KinematicCloud<ParcelType>::setModels()
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::solve template<class TrackData>
( void Foam::KinematicCloud<CloudType>::solve(TrackData& td)
typename ParcelType::trackData& td
)
{ {
if (solution_.transient()) if (solution_.transient())
{ {
@ -290,8 +128,8 @@ void Foam::KinematicCloud<ParcelType>::solve
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::preEvolve() void Foam::KinematicCloud<CloudType>::preEvolve()
{ {
Info<< "\nSolving cloud " << this->name() << endl; Info<< "\nSolving cloud " << this->name() << endl;
@ -301,14 +139,14 @@ void Foam::KinematicCloud<ParcelType>::preEvolve()
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::buildCellOccupancy() void Foam::KinematicCloud<CloudType>::buildCellOccupancy()
{ {
if (cellOccupancyPtr_.empty()) if (cellOccupancyPtr_.empty())
{ {
cellOccupancyPtr_.reset cellOccupancyPtr_.reset
( (
new List<DynamicList<ParcelType*> >(mesh_.nCells()) new List<DynamicList<parcelType*> >(mesh_.nCells())
); );
} }
else if (cellOccupancyPtr_().size() != mesh_.nCells()) else if (cellOccupancyPtr_().size() != mesh_.nCells())
@ -319,22 +157,22 @@ void Foam::KinematicCloud<ParcelType>::buildCellOccupancy()
cellOccupancyPtr_().setSize(mesh_.nCells()); cellOccupancyPtr_().setSize(mesh_.nCells());
} }
List<DynamicList<ParcelType*> >& cellOccupancy = cellOccupancyPtr_(); List<DynamicList<parcelType*> >& cellOccupancy = cellOccupancyPtr_();
forAll(cellOccupancy, cO) forAll(cellOccupancy, cO)
{ {
cellOccupancy[cO].clear(); cellOccupancy[cO].clear();
} }
forAllIter(typename KinematicCloud<ParcelType>, *this, iter) forAllIter(typename KinematicCloud<CloudType>, *this, iter)
{ {
cellOccupancy[iter().cell()].append(&iter()); cellOccupancy[iter().cell()].append(&iter());
} }
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::updateCellOccupancy() void Foam::KinematicCloud<CloudType>::updateCellOccupancy()
{ {
// Only build the cellOccupancy if the pointer is set, i.e. it has // Only build the cellOccupancy if the pointer is set, i.e. it has
// been requested before. // been requested before.
@ -346,11 +184,9 @@ void Foam::KinematicCloud<ParcelType>::updateCellOccupancy()
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::evolveCloud template<class TrackData>
( void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td)
typename ParcelType::trackData& td
)
{ {
if (solution_.coupled()) if (solution_.coupled())
{ {
@ -376,7 +212,7 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud
// Assume that motion will update the cellOccupancy as necessary // Assume that motion will update the cellOccupancy as necessary
// before it is required. // before it is required.
motion(td); td.cloud().motion(td);
} }
else else
{ {
@ -384,76 +220,14 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud
this->injection().injectSteadyState(td, solution_.deltaT()); this->injection().injectSteadyState(td, solution_.deltaT());
td.part() = ParcelType::trackData::tpLinearTrack; td.part() = TrackData::tpLinearTrack;
Cloud<ParcelType>::move(td, solution_.deltaT()); CloudType::move(td, solution_.deltaT());
} }
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::motion void Foam::KinematicCloud<CloudType>::postEvolve()
(
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()
{ {
Info<< endl; Info<< endl;
@ -471,16 +245,15 @@ void Foam::KinematicCloud<ParcelType>::postEvolve()
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c) void Foam::KinematicCloud<CloudType>::cloudReset(KinematicCloud<CloudType>& c)
{ {
Cloud<ParcelType>::cloudReset(c); CloudType::cloudReset(c);
rndGen_ = c.rndGen_; rndGen_ = c.rndGen_;
forces_.transfer(c.forces_); forces_.transfer(c.forces_);
collisionModel_.reset(c.collisionModel_.ptr());
dispersionModel_.reset(c.dispersionModel_.ptr()); dispersionModel_.reset(c.dispersionModel_.ptr());
injectionModel_.reset(c.injectionModel_.ptr()); injectionModel_.reset(c.injectionModel_.ptr());
patchInteractionModel_.reset(c.patchInteractionModel_.ptr()); patchInteractionModel_.reset(c.patchInteractionModel_.ptr());
@ -492,8 +265,8 @@ void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
Foam::KinematicCloud<ParcelType>::KinematicCloud Foam::KinematicCloud<CloudType>::KinematicCloud
( (
const word& cloudName, const word& cloudName,
const volScalarField& rho, const volScalarField& rho,
@ -503,7 +276,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
bool readFields bool readFields
) )
: :
Cloud<ParcelType>(rho.mesh(), cloudName, false), CloudType(rho.mesh(), cloudName, false),
kinematicCloud(), kinematicCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
mesh_(rho.mesh()), mesh_(rho.mesh()),
@ -545,7 +318,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
), ),
solution_.active() solution_.active()
), ),
collisionModel_(NULL),
dispersionModel_(NULL), dispersionModel_(NULL),
injectionModel_(NULL), injectionModel_(NULL),
patchInteractionModel_(NULL), patchInteractionModel_(NULL),
@ -592,7 +364,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
if (readFields) if (readFields)
{ {
ParcelType::readFields(*this); parcelType::readFields(*this);
} }
if (solution_.resetSourcesOnStartup()) if (solution_.resetSourcesOnStartup())
@ -602,14 +374,14 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
} }
template<class ParcelType> template<class CloudType>
Foam::KinematicCloud<ParcelType>::KinematicCloud Foam::KinematicCloud<CloudType>::KinematicCloud
( (
KinematicCloud<ParcelType>& c, KinematicCloud<CloudType>& c,
const word& name const word& name
) )
: :
Cloud<ParcelType>(c.mesh_, name, c), CloudType(c.mesh_, name, c),
kinematicCloud(), kinematicCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
mesh_(c.mesh_), mesh_(c.mesh_),
@ -624,7 +396,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
mu_(c.mu_), mu_(c.mu_),
g_(c.g_), g_(c.g_),
forces_(c.forces_), forces_(c.forces_),
collisionModel_(c.collisionModel_->clone()),
dispersionModel_(c.dispersionModel_->clone()), dispersionModel_(c.dispersionModel_->clone()),
injectionModel_(c.injectionModel_->clone()), injectionModel_(c.injectionModel_->clone()),
patchInteractionModel_(c.patchInteractionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()),
@ -666,15 +437,15 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
{} {}
template<class ParcelType> template<class CloudType>
Foam::KinematicCloud<ParcelType>::KinematicCloud Foam::KinematicCloud<CloudType>::KinematicCloud
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const KinematicCloud<ParcelType>& c const KinematicCloud<CloudType>& c
) )
: :
Cloud<ParcelType>(mesh, name, IDLList<ParcelType>()), CloudType(mesh, name, IDLList<parcelType>()),
kinematicCloud(), kinematicCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
mesh_(mesh), mesh_(mesh),
@ -700,7 +471,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
mu_(c.mu_), mu_(c.mu_),
g_(c.g_), g_(c.g_),
forces_(*this, mesh), forces_(*this, mesh),
collisionModel_(NULL),
dispersionModel_(NULL), dispersionModel_(NULL),
injectionModel_(NULL), injectionModel_(NULL),
patchInteractionModel_(NULL), patchInteractionModel_(NULL),
@ -714,17 +484,17 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
Foam::KinematicCloud<ParcelType>::~KinematicCloud() Foam::KinematicCloud<CloudType>::~KinematicCloud()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::checkParcelProperties void Foam::KinematicCloud<CloudType>::checkParcelProperties
( (
ParcelType& parcel, parcelType& parcel,
const scalar lagrangianDt, const scalar lagrangianDt,
const bool fullyDescribed const bool fullyDescribed
) )
@ -736,15 +506,16 @@ void Foam::KinematicCloud<ParcelType>::checkParcelProperties
const scalar carrierDt = this->db().time().deltaTValue(); const scalar carrierDt = this->db().time().deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt; parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
parcel.typeId() = constProps_.parcelTypeId();
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::storeState() void Foam::KinematicCloud<CloudType>::storeState()
{ {
cloudCopyPtr_.reset cloudCopyPtr_.reset
( (
static_cast<KinematicCloud<ParcelType>*> static_cast<KinematicCloud<CloudType>*>
( (
clone(this->name() + "Copy").ptr() clone(this->name() + "Copy").ptr()
) )
@ -752,25 +523,25 @@ void Foam::KinematicCloud<ParcelType>::storeState()
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::restoreState() void Foam::KinematicCloud<CloudType>::restoreState()
{ {
cloudReset(cloudCopyPtr_()); cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear(); cloudCopyPtr_.clear();
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::resetSourceTerms() void Foam::KinematicCloud<CloudType>::resetSourceTerms()
{ {
UTrans().field() = vector::zero; UTrans().field() = vector::zero;
UCoeff().field() = 0.0; UCoeff().field() = 0.0;
} }
template<class ParcelType> template<class CloudType>
template<class Type> template<class Type>
void Foam::KinematicCloud<ParcelType>::relax void Foam::KinematicCloud<CloudType>::relax
( (
DimensionedField<Type, volMesh>& field, DimensionedField<Type, volMesh>& field,
const DimensionedField<Type, volMesh>& field0, const DimensionedField<Type, volMesh>& field0,
@ -783,30 +554,42 @@ void Foam::KinematicCloud<ParcelType>::relax
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::relaxSources void Foam::KinematicCloud<CloudType>::relaxSources
( (
const KinematicCloud<ParcelType>& cloudOldTime const KinematicCloud<CloudType>& cloudOldTime
) )
{ {
this->relax(UTrans_(), cloudOldTime.UTrans(), "U"); this->relax(UTrans_(), cloudOldTime.UTrans(), "U");
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::evolve() void Foam::KinematicCloud<CloudType>::evolve()
{ {
if (solution_.canEvolve()) if (solution_.canEvolve())
{ {
typename ParcelType::trackData td(*this); typename parcelType::template
TrackingData<KinematicCloud<CloudType> > td(*this);
solve(td); solve(td);
} }
} }
template<class ParcelType> template<class CloudType>
void Foam::KinematicCloud<ParcelType>::info() const 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(); vector linearMomentum = linearMomentumOfSystem();
reduce(linearMomentum, sumOp<vector>()); reduce(linearMomentum, sumOp<vector>());

View File

@ -27,15 +27,12 @@ Class
Description Description
Templated base class for kinematic cloud Templated base class for kinematic cloud
- holds a 'cloudSolution' class that stores all relevant solution info
- particle forces - particle forces
- buoyancy - buoyancy
- drag - drag
- pressure gradient - pressure gradient
- sub-models: - sub-models:
- Collision model
- Dispersion model - Dispersion model
- Injection model - Injection model
- Patch interaction model - Patch interaction model
@ -51,6 +48,7 @@ SourceFiles
#ifndef KinematicCloud_H #ifndef KinematicCloud_H
#define KinematicCloud_H #define KinematicCloud_H
#include "particle.H"
#include "Cloud.H" #include "Cloud.H"
#include "kinematicCloud.H" #include "kinematicCloud.H"
#include "IOdictionary.H" #include "IOdictionary.H"
@ -59,8 +57,10 @@ SourceFiles
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "IntegrationSchemesFwd.H" #include "IntegrationSchemesFwd.H"
#include "cloudSolution.H"
#include "ParticleForceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,9 +69,6 @@ namespace Foam
// Forward declaration of classes // Forward declaration of classes
template<class CloudType>
class CollisionModel;
template<class CloudType> template<class CloudType>
class DispersionModel; class DispersionModel;
@ -92,16 +89,21 @@ class SurfaceFilmModel;
Class KinematicCloud Declaration Class KinematicCloud Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParcelType> template<class CloudType>
class KinematicCloud class KinematicCloud
: :
public Cloud<ParcelType>, public CloudType,
public kinematicCloud public kinematicCloud
{ {
public: public:
//- Type of parcel the cloud was instantiated for // Public typedefs
typedef ParcelType parcelType;
//- Redefine particle type as parcel type
typedef typename CloudType::particleType parcelType;
//- Force type
typedef ParticleForceList<KinematicCloud<CloudType> > forceType;
private: private:
@ -109,7 +111,7 @@ private:
// Private data // Private data
//- Cloud copy pointer //- Cloud copy pointer
autoPtr<KinematicCloud<ParcelType> > cloudCopyPtr_; autoPtr<KinematicCloud<CloudType> > cloudCopyPtr_;
// Private Member Functions // Private Member Functions
@ -121,164 +123,6 @@ private:
void operator=(const KinematicCloud&); 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:
// Protected data // Protected data
@ -293,7 +137,7 @@ protected:
cloudSolution solution_; cloudSolution solution_;
//- Parcel constant properties //- Parcel constant properties
typename ParcelType::constantProperties constProps_; typename parcelType::constantProperties constProps_;
//- Sub-models dictionary //- Sub-models dictionary
const dictionary subModelProperties_; const dictionary subModelProperties_;
@ -302,7 +146,7 @@ protected:
cachedRandom rndGen_; cachedRandom rndGen_;
//- Cell occupancy information for each parcel, (demand driven) //- Cell occupancy information for each parcel, (demand driven)
autoPtr<List<DynamicList<ParcelType*> > > cellOccupancyPtr_; autoPtr<List<DynamicList<parcelType*> > > cellOccupancyPtr_;
// References to the carrier gas fields // References to the carrier gas fields
@ -324,33 +168,29 @@ protected:
//- Optional particle forces //- Optional particle forces
typename ParcelType::forceType forces_; forceType forces_;
// References to the cloud sub-models // References to the cloud sub-models
//- Collision model
autoPtr<CollisionModel<KinematicCloud<ParcelType> > >
collisionModel_;
//- Dispersion model //- Dispersion model
autoPtr<DispersionModel<KinematicCloud<ParcelType> > > autoPtr<DispersionModel<KinematicCloud<CloudType> > >
dispersionModel_; dispersionModel_;
//- Injector model //- Injector model
autoPtr<InjectionModel<KinematicCloud<ParcelType> > > autoPtr<InjectionModel<KinematicCloud<CloudType> > >
injectionModel_; injectionModel_;
//- Patch interaction model //- Patch interaction model
autoPtr<PatchInteractionModel<KinematicCloud<ParcelType> > > autoPtr<PatchInteractionModel<KinematicCloud<CloudType> > >
patchInteractionModel_; patchInteractionModel_;
//- Post-processing model //- Post-processing model
autoPtr<PostProcessingModel<KinematicCloud<ParcelType> > > autoPtr<PostProcessingModel<KinematicCloud<CloudType> > >
postProcessingModel_; postProcessingModel_;
//- Surface film model //- Surface film model
autoPtr<SurfaceFilmModel<KinematicCloud<ParcelType> > > autoPtr<SurfaceFilmModel<KinematicCloud<CloudType> > >
surfaceFilmModel_; surfaceFilmModel_;
@ -378,7 +218,8 @@ protected:
// Cloud evolution functions // Cloud evolution functions
//- Solve the cloud - calls all evolution functions //- Solve the cloud - calls all evolution functions
void solve(typename ParcelType::trackData& td); template<class TrackData>
void solve(TrackData& td);
//- Pre-evolve //- Pre-evolve
void preEvolve(); void preEvolve();
@ -391,23 +232,20 @@ protected:
void updateCellOccupancy(); void updateCellOccupancy();
//- Evolve the cloud //- Evolve the cloud
void evolveCloud(typename ParcelType::trackData& td); template<class TrackData>
void evolveCloud(TrackData& td);
//- Particle motion
void motion(typename ParcelType::trackData& td);
//- Move-collide particles
void moveCollide(typename ParcelType::trackData& td);
//- Post-evolve //- Post-evolve
void postEvolve(); void postEvolve();
//- Reset state of cloud //- Reset state of cloud
void cloudReset(KinematicCloud<ParcelType>& c); void cloudReset(KinematicCloud<CloudType>& c);
public: public:
typedef CloudType cloudType;
// Constructors // Constructors
//- Construct given carrier gas fields //- Construct given carrier gas fields
@ -422,29 +260,33 @@ public:
); );
//- Copy constructor with new name //- 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 //- Copy constructor with new name - creates bare cloud
KinematicCloud KinematicCloud
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const KinematicCloud<ParcelType>& c const KinematicCloud<CloudType>& c
); );
//- Construct and return clone based on (this) with new name //- 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) new KinematicCloud(*this, name)
); );
} }
//- Construct and return bare clone based on (this) with new 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) new KinematicCloud(this->mesh(), name, *this)
); );
@ -462,16 +304,10 @@ public:
//- Return a reference to the cloud copy //- Return a reference to the cloud copy
inline const KinematicCloud& cloudCopy() const; 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 // References to the mesh and databases
//- Return refernce to the mesh //- Return reference to the mesh
inline const fvMesh& mesh() const; inline const fvMesh& mesh() const;
//- Return particle properties dictionary //- Return particle properties dictionary
@ -484,7 +320,7 @@ public:
inline cloudSolution& solution(); inline cloudSolution& solution();
//- Return the constant properties //- Return the constant properties
inline const typename ParcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
//- Return reference to the sub-models dictionary //- Return reference to the sub-models dictionary
@ -493,14 +329,14 @@ public:
// Cloud data // Cloud data
//- Return refernce to the random object //- Return reference to the random object
inline cachedRandom& rndGen(); inline cachedRandom& rndGen();
//- Return the cell occupancy information for each //- Return the cell occupancy information for each
// parcel, non-const access, the caller is // parcel, non-const access, the caller is
// responsible for updating it for its own purposes // responsible for updating it for its own purposes
// if particles are removed or created. // if particles are removed or created.
inline List<DynamicList<ParcelType*> >& cellOccupancy(); inline List<DynamicList<parcelType*> >& cellOccupancy();
// References to the carrier gas fields // References to the carrier gas fields
@ -522,53 +358,46 @@ public:
//- Optional particle forces //- Optional particle forces
inline const typename ParcelType::forceType& forces() const; // inline const typename parcelType::forceType& forces() const;
inline const forceType& forces() const;
// Sub-models // 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 //- Return const-access to the dispersion model
inline const DispersionModel<KinematicCloud<ParcelType> >& inline const DispersionModel<KinematicCloud<CloudType> >&
dispersion() const; dispersion() const;
//- Return reference to the dispersion model //- Return reference to the dispersion model
inline DispersionModel<KinematicCloud<ParcelType> >& inline DispersionModel<KinematicCloud<CloudType> >&
dispersion(); dispersion();
//- Return const access to the injection model //- Return const access to the injection model
inline const InjectionModel<KinematicCloud<ParcelType> >& inline const InjectionModel<KinematicCloud<CloudType> >&
injection() const; injection() const;
//- Return reference to the injection model //- Return reference to the injection model
inline InjectionModel<KinematicCloud<ParcelType> >& inline InjectionModel<KinematicCloud<CloudType> >&
injection(); injection();
//- Return const-access to the patch interaction model //- Return const-access to the patch interaction model
inline const PatchInteractionModel<KinematicCloud<ParcelType> >& inline const PatchInteractionModel<KinematicCloud<CloudType> >&
patchInteraction() const; patchInteraction() const;
//- Return reference to the patch interaction model //- Return reference to the patch interaction model
inline PatchInteractionModel<KinematicCloud<ParcelType> >& inline PatchInteractionModel<KinematicCloud<CloudType> >&
patchInteraction(); patchInteraction();
//- Return reference to post-processing model //- Return reference to post-processing model
inline PostProcessingModel<KinematicCloud<ParcelType> >& inline PostProcessingModel<KinematicCloud<CloudType> >&
postProcessing(); postProcessing();
//- Return const-access to the surface film model //- Return const-access to the surface film model
inline const SurfaceFilmModel<KinematicCloud<ParcelType> >& inline const SurfaceFilmModel<KinematicCloud<CloudType> >&
surfaceFilm() const; surfaceFilm() const;
//- Return reference to the surface film model //- Return reference to the surface film model
inline SurfaceFilmModel<KinematicCloud<ParcelType> >& inline SurfaceFilmModel<KinematicCloud<CloudType> >&
surfaceFilm(); surfaceFilm();
@ -638,7 +467,7 @@ public:
//- Check parcel properties //- Check parcel properties
void checkParcelProperties void checkParcelProperties
( (
ParcelType& parcel, parcelType& parcel,
const scalar lagrangianDt, const scalar lagrangianDt,
const bool fullyDescribed const bool fullyDescribed
); );
@ -662,11 +491,15 @@ public:
) const; ) const;
//- Apply relaxation to (steady state) cloud sources //- Apply relaxation to (steady state) cloud sources
void relaxSources(const KinematicCloud<ParcelType>& cloudOldTime); void relaxSources(const KinematicCloud<CloudType>& cloudOldTime);
//- Evolve the cloud //- Evolve the cloud
void evolve(); void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
//- Print cloud information //- Print cloud information
void info() const; void info() const;
}; };

View File

@ -25,348 +25,186 @@ License
#include "fvmSup.H" #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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
inline const Foam::KinematicCloud<ParcelType>& inline const Foam::KinematicCloud<CloudType>&
Foam::KinematicCloud<ParcelType>::cloudCopy() const Foam::KinematicCloud<CloudType>::cloudCopy() const
{ {
return cloudCopyPtr_(); return cloudCopyPtr_();
} }
template<class ParcelType> template<class CloudType>
inline bool Foam::KinematicCloud<ParcelType>::hasWallImpactDistance() const inline const Foam::fvMesh& Foam::KinematicCloud<CloudType>::mesh() const
{
return !collision().controlsWallInteraction();
}
template<class ParcelType>
inline const Foam::fvMesh& Foam::KinematicCloud<ParcelType>::mesh() const
{ {
return mesh_; return mesh_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::IOdictionary& inline const Foam::IOdictionary&
Foam::KinematicCloud<ParcelType>::particleProperties() const Foam::KinematicCloud<CloudType>::particleProperties() const
{ {
return particleProperties_; return particleProperties_;
} }
template<class ParcelType> template<class CloudType>
inline const typename Foam::KinematicCloud<ParcelType>::cloudSolution& inline const Foam::cloudSolution&
Foam::KinematicCloud<ParcelType>::solution() const Foam::KinematicCloud<CloudType>::solution() const
{ {
return solution_; return solution_;
} }
template<class ParcelType> template<class CloudType>
inline typename Foam::KinematicCloud<ParcelType>::cloudSolution& inline Foam::cloudSolution& Foam::KinematicCloud<CloudType>::solution()
Foam::KinematicCloud<ParcelType>::solution()
{ {
return solution_; return solution_;
} }
template<class ParcelType> template<class CloudType>
inline const typename ParcelType::constantProperties& inline const typename CloudType::particleType::constantProperties&
Foam::KinematicCloud<ParcelType>::constProps() const Foam::KinematicCloud<CloudType>::constProps() const
{ {
return constProps_; return constProps_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::dictionary& inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::subModelProperties() const Foam::KinematicCloud<CloudType>::subModelProperties() const
{ {
return subModelProperties_; return subModelProperties_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::volScalarField& inline const Foam::volScalarField& Foam::KinematicCloud<CloudType>::rho() const
Foam::KinematicCloud<ParcelType>::rho() const
{ {
return rho_; return rho_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::volVectorField& Foam::KinematicCloud<ParcelType>::U() const inline const Foam::volVectorField& Foam::KinematicCloud<CloudType>::U() const
{ {
return U_; return U_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::volScalarField& Foam::KinematicCloud<ParcelType>::mu() const inline const Foam::volScalarField& Foam::KinematicCloud<CloudType>::mu() const
{ {
return mu_; return mu_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::dimensionedVector& inline const Foam::dimensionedVector& Foam::KinematicCloud<CloudType>::g() const
Foam::KinematicCloud<ParcelType>::g() const
{ {
return g_; return g_;
} }
template<class ParcelType> template<class CloudType>
inline const typename ParcelType::forceType& //inline const typename CloudType::parcelType::forceType&
Foam::KinematicCloud<ParcelType>::forces() const inline const typename Foam::KinematicCloud<CloudType>::forceType&
Foam::KinematicCloud<CloudType>::forces() const
{ {
return forces_; return forces_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::CollisionModel<Foam::KinematicCloud<ParcelType> >& inline const Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::collision() const Foam::KinematicCloud<CloudType>::dispersion() 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
{ {
return dispersionModel_; return dispersionModel_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::DispersionModel<Foam::KinematicCloud<ParcelType> >& inline Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::dispersion() Foam::KinematicCloud<CloudType>::dispersion()
{ {
return dispersionModel_(); return dispersionModel_();
} }
template<class ParcelType> template<class CloudType>
inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >& inline const Foam::InjectionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::injection() const Foam::KinematicCloud<CloudType>::injection() const
{ {
return injectionModel_; return injectionModel_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >& inline const Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::patchInteraction() const Foam::KinematicCloud<CloudType>::patchInteraction() const
{ {
return patchInteractionModel_; return patchInteractionModel_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >& inline Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::patchInteraction() Foam::KinematicCloud<CloudType>::patchInteraction()
{ {
return patchInteractionModel_(); return patchInteractionModel_();
} }
template<class ParcelType> template<class CloudType>
inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >& inline Foam::InjectionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::injection() Foam::KinematicCloud<CloudType>::injection()
{ {
return injectionModel_(); return injectionModel_();
} }
template<class ParcelType> template<class CloudType>
inline Foam::PostProcessingModel<Foam::KinematicCloud<ParcelType> >& inline Foam::PostProcessingModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::postProcessing() Foam::KinematicCloud<CloudType>::postProcessing()
{ {
return postProcessingModel_(); return postProcessingModel_();
} }
template<class ParcelType> template<class CloudType>
inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<ParcelType> >& inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::surfaceFilm() const Foam::KinematicCloud<CloudType>::surfaceFilm() const
{ {
return surfaceFilmModel_(); return surfaceFilmModel_();
} }
template<class ParcelType> template<class CloudType>
inline Foam::SurfaceFilmModel<Foam::KinematicCloud<ParcelType> >& inline Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<ParcelType>::surfaceFilm() Foam::KinematicCloud<CloudType>::surfaceFilm()
{ {
return surfaceFilmModel_(); return surfaceFilmModel_();
} }
template<class ParcelType> template<class CloudType>
inline const Foam::vectorIntegrationScheme& inline const Foam::vectorIntegrationScheme&
Foam::KinematicCloud<ParcelType>::UIntegrator() const Foam::KinematicCloud<CloudType>::UIntegrator() const
{ {
return UIntegrator_; return UIntegrator_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<ParcelType>::massInSystem() const inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const
{ {
scalar sysMass = 0.0; 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(); 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 inline Foam::vector
Foam::KinematicCloud<ParcelType>::linearMomentumOfSystem() const Foam::KinematicCloud<CloudType>::linearMomentumOfSystem() const
{ {
vector linearMomentum(vector::zero); 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(); linearMomentum += p.mass()*p.U();
} }
@ -391,15 +229,15 @@ Foam::KinematicCloud<ParcelType>::linearMomentumOfSystem() const
} }
template<class ParcelType> template<class CloudType>
inline Foam::scalar inline Foam::scalar
Foam::KinematicCloud<ParcelType>::linearKineticEnergyOfSystem() const Foam::KinematicCloud<CloudType>::linearKineticEnergyOfSystem() const
{ {
scalar linearKineticEnergy = 0.0; 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()); 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 inline Foam::scalar
Foam::KinematicCloud<ParcelType>:: Foam::KinematicCloud<CloudType>::rotationalKineticEnergyOfSystem() const
rotationalKineticEnergyOfSystem() const
{ {
scalar rotationalKineticEnergy = 0.0; 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 += rotationalKineticEnergy +=
0.5*p.momentOfInertia()*(p.omega() & p.omega()); 0.5*p.momentOfInertia()*(p.omega() & p.omega());
@ -427,16 +264,16 @@ rotationalKineticEnergyOfSystem() const
} }
template<class ParcelType> template<class CloudType>
inline Foam::cachedRandom& Foam::KinematicCloud<ParcelType>::rndGen() inline Foam::cachedRandom& Foam::KinematicCloud<CloudType>::rndGen()
{ {
return rndGen_; return rndGen_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::List<Foam::DynamicList<ParcelType*> >& inline Foam::List<Foam::DynamicList<typename CloudType::particleType*> >&
Foam::KinematicCloud<ParcelType>::cellOccupancy() Foam::KinematicCloud<CloudType>::cellOccupancy()
{ {
if (cellOccupancyPtr_.empty()) if (cellOccupancyPtr_.empty())
{ {
@ -447,41 +284,41 @@ Foam::KinematicCloud<ParcelType>::cellOccupancy()
} }
template<class ParcelType> template<class CloudType>
inline Foam::DimensionedField<Foam::vector, Foam::volMesh>& inline Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UTrans() Foam::KinematicCloud<CloudType>::UTrans()
{ {
return UTrans_(); return UTrans_();
} }
template<class ParcelType> template<class CloudType>
inline const Foam::DimensionedField<Foam::vector, Foam::volMesh>& inline const Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UTrans() const Foam::KinematicCloud<CloudType>::UTrans() const
{ {
return UTrans_(); return UTrans_();
} }
template<class ParcelType> template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UCoeff() Foam::KinematicCloud<CloudType>::UCoeff()
{ {
return UCoeff_(); return UCoeff_();
} }
template<class ParcelType> template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>& inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UCoeff() const Foam::KinematicCloud<CloudType>::UCoeff() const
{ {
return UCoeff_(); return UCoeff_();
} }
template<class ParcelType> template<class CloudType>
inline Foam::tmp<Foam::fvVectorMatrix> inline Foam::tmp<Foam::fvVectorMatrix>
Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const Foam::KinematicCloud<CloudType>::SU(volVectorField& U) const
{ {
if (debug) if (debug)
{ {
@ -497,7 +334,7 @@ Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const
{ {
return return
UTrans()/(mesh_.V()*this->db().time().deltaT()) UTrans()/(mesh_.V()*this->db().time().deltaT())
+ fvm::SuSp(-UCoeff()/mesh_.V(), U) - fvm::Sp(UCoeff()/mesh_.V(), U)
+ UCoeff()/mesh_.V()*U; + UCoeff()/mesh_.V()*U;
} }
else else
@ -515,9 +352,9 @@ Foam::KinematicCloud<ParcelType>::SU(volVectorField& U) const
} }
template<class ParcelType> template<class CloudType>
inline const Foam::tmp<Foam::volScalarField> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<ParcelType>::theta() const Foam::KinematicCloud<CloudType>::theta() const
{ {
tmp<volScalarField> ttheta tmp<volScalarField> ttheta
( (
@ -538,9 +375,9 @@ Foam::KinematicCloud<ParcelType>::theta() const
); );
scalarField& theta = ttheta().internalField(); 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(); const label cellI = p.cell();
theta[cellI] += p.nParticle()*p.volume(); 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> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<ParcelType>::alpha() const Foam::KinematicCloud<CloudType>::alpha() const
{ {
tmp<volScalarField> talpha tmp<volScalarField> talpha
( (
@ -575,9 +412,9 @@ Foam::KinematicCloud<ParcelType>::alpha() const
); );
scalarField& alpha = talpha().internalField(); 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(); const label cellI = p.cell();
alpha[cellI] += p.nParticle()*p.mass(); 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> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<ParcelType>::rhoEff() const Foam::KinematicCloud<CloudType>::rhoEff() const
{ {
tmp<volScalarField> trhoEff tmp<volScalarField> trhoEff
( (
@ -612,9 +449,9 @@ Foam::KinematicCloud<ParcelType>::rhoEff() const
); );
scalarField& rhoEff = trhoEff().internalField(); 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(); const label cellI = p.cell();
rhoEff[cellI] += p.nParticle()*p.mass(); 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 * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::setModels() void Foam::ReactingCloud<CloudType>::setModels()
{ {
compositionModel_.reset compositionModel_.reset
( (
CompositionModel<ReactingCloud<ParcelType> >::New CompositionModel<ReactingCloud<CloudType> >::New
( (
this->subModelProperties(), this->subModelProperties(),
*this *this
@ -44,7 +44,7 @@ void Foam::ReactingCloud<ParcelType>::setModels()
phaseChangeModel_.reset phaseChangeModel_.reset
( (
PhaseChangeModel<ReactingCloud<ParcelType> >::New PhaseChangeModel<ReactingCloud<CloudType> >::New
( (
this->subModelProperties(), this->subModelProperties(),
*this *this
@ -53,8 +53,8 @@ void Foam::ReactingCloud<ParcelType>::setModels()
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition void Foam::ReactingCloud<CloudType>::checkSuppliedComposition
( (
const scalarField& YSupplied, const scalarField& YSupplied,
const scalarField& Y, const scalarField& Y,
@ -65,7 +65,7 @@ void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
{ {
FatalErrorIn FatalErrorIn
( (
"ReactingCloud<ParcelType>::checkSuppliedComposition" "ReactingCloud<CloudType>::checkSuppliedComposition"
"(" "("
"const scalarField&, " "const scalarField&, "
"const scalarField&, " "const scalarField&, "
@ -80,10 +80,10 @@ void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::cloudReset(ReactingCloud<ParcelType>& c) void Foam::ReactingCloud<CloudType>::cloudReset(ReactingCloud<CloudType>& c)
{ {
ThermoCloud<ParcelType>::cloudReset(c); CloudType::cloudReset(c);
compositionModel_.reset(c.compositionModel_.ptr()); compositionModel_.reset(c.compositionModel_.ptr());
phaseChangeModel_.reset(c.phaseChangeModel_.ptr()); phaseChangeModel_.reset(c.phaseChangeModel_.ptr());
@ -94,8 +94,8 @@ void Foam::ReactingCloud<ParcelType>::cloudReset(ReactingCloud<ParcelType>& c)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
Foam::ReactingCloud<ParcelType>::ReactingCloud Foam::ReactingCloud<CloudType>::ReactingCloud
( (
const word& cloudName, const word& cloudName,
const volScalarField& rho, const volScalarField& rho,
@ -105,7 +105,7 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
bool readFields bool readFields
) )
: :
ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo, false), CloudType(cloudName, rho, U, g, thermo, false),
reactingCloud(), reactingCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
constProps_(this->particleProperties(), this->solution().active()), constProps_(this->particleProperties(), this->solution().active()),
@ -144,7 +144,7 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
if (readFields) if (readFields)
{ {
ParcelType::readFields(*this); parcelType::readFields(*this, this->composition());
} }
if (this->solution().resetSourcesOnStartup()) if (this->solution().resetSourcesOnStartup())
@ -154,14 +154,14 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
} }
template<class ParcelType> template<class CloudType>
Foam::ReactingCloud<ParcelType>::ReactingCloud Foam::ReactingCloud<CloudType>::ReactingCloud
( (
ReactingCloud<ParcelType>& c, ReactingCloud<CloudType>& c,
const word& name const word& name
) )
: :
ThermoCloud<ParcelType>(c, name), CloudType(c, name),
reactingCloud(), reactingCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
constProps_(c.constProps_), constProps_(c.constProps_),
@ -194,15 +194,15 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
} }
template<class ParcelType> template<class CloudType>
Foam::ReactingCloud<ParcelType>::ReactingCloud Foam::ReactingCloud<CloudType>::ReactingCloud
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const ReactingCloud<ParcelType>& c const ReactingCloud<CloudType>& c
) )
: :
ThermoCloud<ParcelType>(mesh, name, c), CloudType(mesh, name, c),
reactingCloud(), reactingCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
constProps_(), constProps_(),
@ -216,22 +216,22 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
Foam::ReactingCloud<ParcelType>::~ReactingCloud() Foam::ReactingCloud<CloudType>::~ReactingCloud()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::checkParcelProperties void Foam::ReactingCloud<CloudType>::checkParcelProperties
( (
ParcelType& parcel, parcelType& parcel,
const scalar lagrangianDt, const scalar lagrangianDt,
const bool fullyDescribed const bool fullyDescribed
) )
{ {
ThermoCloud<ParcelType>::checkParcelProperties CloudType::checkParcelProperties
( (
parcel, parcel,
lagrangianDt, lagrangianDt,
@ -257,12 +257,12 @@ void Foam::ReactingCloud<ParcelType>::checkParcelProperties
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::storeState() void Foam::ReactingCloud<CloudType>::storeState()
{ {
cloudCopyPtr_.reset cloudCopyPtr_.reset
( (
static_cast<ReactingCloud<ParcelType>*> static_cast<ReactingCloud<CloudType>*>
( (
clone(this->name() + "Copy").ptr() clone(this->name() + "Copy").ptr()
) )
@ -270,18 +270,18 @@ void Foam::ReactingCloud<ParcelType>::storeState()
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::restoreState() void Foam::ReactingCloud<CloudType>::restoreState()
{ {
cloudReset(cloudCopyPtr_()); cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear(); cloudCopyPtr_.clear();
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::resetSourceTerms() void Foam::ReactingCloud<CloudType>::resetSourceTerms()
{ {
ThermoCloud<ParcelType>::resetSourceTerms(); CloudType::resetSourceTerms();
forAll(rhoTrans_, i) forAll(rhoTrans_, i)
{ {
rhoTrans_[i].field() = 0.0; rhoTrans_[i].field() = 0.0;
@ -289,15 +289,15 @@ void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::relaxSources void Foam::ReactingCloud<CloudType>::relaxSources
( (
const ReactingCloud<ParcelType>& cloudOldTime const ReactingCloud<CloudType>& cloudOldTime
) )
{ {
typedef DimensionedField<scalar, volMesh> dsfType; typedef DimensionedField<scalar, volMesh> dsfType;
ThermoCloud<ParcelType>::relaxSources(cloudOldTime); CloudType::relaxSources(cloudOldTime);
forAll(rhoTrans_, fieldI) forAll(rhoTrans_, fieldI)
{ {
@ -308,33 +308,44 @@ void Foam::ReactingCloud<ParcelType>::relaxSources
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::evolve() void Foam::ReactingCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename ParcelType::trackData td(*this); typename parcelType::template
TrackingData<ReactingCloud<CloudType> > td(*this);
this->solve(td); this->solve(td);
} }
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::addToMassPhaseChange(const scalar dMass) void Foam::ReactingCloud<CloudType>::addToMassPhaseChange(const scalar dMass)
{ {
dMassPhaseChange_ += dMass; dMassPhaseChange_ += dMass;
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingCloud<ParcelType>::info() const void Foam::ReactingCloud<CloudType>::info() const
{ {
ThermoCloud<ParcelType>::info(); CloudType::info();
Info<< " Mass transfer phase change = " Info<< " Mass transfer phase change = "
<< returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl; << 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 #ifndef ReactingCloud_H
#define ReactingCloud_H #define ReactingCloud_H
#include "ThermoCloud.H"
#include "reactingCloud.H" #include "reactingCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,19 +59,24 @@ class PhaseChangeModel;
Class ReactingCloud Declaration Class ReactingCloud Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParcelType> template<class CloudType>
class ReactingCloud class ReactingCloud
: :
public ThermoCloud<ParcelType>, public CloudType,
public reactingCloud public reactingCloud
{ {
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
private: private:
// Private data // Private data
//- Cloud copy pointer //- Cloud copy pointer
autoPtr<ReactingCloud<ParcelType> > cloudCopyPtr_; autoPtr<ReactingCloud<CloudType> > cloudCopyPtr_;
// Private member functions // Private member functions
@ -89,17 +93,17 @@ protected:
// Protected data // Protected data
//- Parcel constant properties //- Parcel constant properties
typename ParcelType::constantProperties constProps_; typename parcelType::constantProperties constProps_;
// References to the cloud sub-models // References to the cloud sub-models
//- Reacting composition model //- Reacting composition model
autoPtr<CompositionModel<ReactingCloud<ParcelType> > > autoPtr<CompositionModel<ReactingCloud<CloudType> > >
compositionModel_; compositionModel_;
//- Reacting phase change model //- Reacting phase change model
autoPtr<PhaseChangeModel<ReactingCloud<ParcelType> > > autoPtr<PhaseChangeModel<ReactingCloud<CloudType> > >
phaseChangeModel_; phaseChangeModel_;
@ -137,11 +141,13 @@ protected:
// Cloud evolution functions // Cloud evolution functions
//- Reset state of cloud //- Reset state of cloud
void cloudReset(ReactingCloud<ParcelType>& c); void cloudReset(ReactingCloud<CloudType>& c);
public: public:
typedef CloudType cloudType;
// Constructors // Constructors
//- Construct given carrier gas fields //- Construct given carrier gas fields
@ -156,29 +162,29 @@ public:
); );
//- Copy constructor with new name //- 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 //- Copy constructor with new name - creates bare cloud
ReactingCloud ReactingCloud
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const ReactingCloud<ParcelType>& c const ReactingCloud<CloudType>& c
); );
//- Construct and return clone based on (this) with new name //- 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) new ReactingCloud(*this, name)
); );
} }
//- Construct and return bare clone based on (this) with new 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) new ReactingCloud(this->mesh(), name, *this)
); );
@ -189,10 +195,6 @@ public:
virtual ~ReactingCloud(); virtual ~ReactingCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions // Member Functions
// Access // Access
@ -201,18 +203,18 @@ public:
inline const ReactingCloud& cloudCopy() const; inline const ReactingCloud& cloudCopy() const;
//- Return the constant properties //- Return the constant properties
inline const typename ParcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
// Sub-models // Sub-models
//- Return reference to reacting composition model //- Return reference to reacting composition model
inline const CompositionModel<ReactingCloud<ParcelType> >& inline const CompositionModel<ReactingCloud<CloudType> >&
composition() const; composition() const;
//- Return reference to reacting phase change model //- Return reference to reacting phase change model
inline const PhaseChangeModel<ReactingCloud<ParcelType> >& inline const PhaseChangeModel<ReactingCloud<CloudType> >&
phaseChange() const; phaseChange() const;
@ -262,7 +264,7 @@ public:
//- Check parcel properties //- Check parcel properties
void checkParcelProperties void checkParcelProperties
( (
ParcelType& parcel, parcelType& parcel,
const scalar lagrangianDt, const scalar lagrangianDt,
const bool fullyDescribed const bool fullyDescribed
); );
@ -277,13 +279,19 @@ public:
void resetSourceTerms(); void resetSourceTerms();
//- Apply relaxation to (steady state) cloud sources //- Apply relaxation to (steady state) cloud sources
void relaxSources(const ReactingCloud<ParcelType>& cloudOldTime); void relaxSources(const ReactingCloud<CloudType>& cloudOldTime);
//- Evolve the cloud //- Evolve the cloud
void evolve(); void evolve();
//- Print cloud information //- Print cloud information
void info() const; 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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
inline const Foam::ReactingCloud<ParcelType>& inline const Foam::ReactingCloud<CloudType>&
Foam::ReactingCloud<ParcelType>::cloudCopy() const Foam::ReactingCloud<CloudType>::cloudCopy() const
{ {
return cloudCopyPtr_(); return cloudCopyPtr_();
} }
template<class ParcelType> template<class CloudType>
inline const typename ParcelType::constantProperties& inline const typename CloudType::particleType::constantProperties&
Foam::ReactingCloud<ParcelType>::constProps() const Foam::ReactingCloud<CloudType>::constProps() const
{ {
return constProps_; return constProps_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::CompositionModel<Foam::ReactingCloud<ParcelType> >& inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<ParcelType>::composition() const Foam::ReactingCloud<CloudType>::composition() const
{ {
return compositionModel_; return compositionModel_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::PhaseChangeModel<Foam::ReactingCloud<ParcelType> >& inline const Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<ParcelType>::phaseChange() const Foam::ReactingCloud<CloudType>::phaseChange() const
{ {
return phaseChangeModel_; return phaseChangeModel_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ReactingCloud<ParcelType>::rhoTrans(const label i) Foam::ReactingCloud<CloudType>::rhoTrans(const label i)
{ {
return rhoTrans_[i]; return rhoTrans_[i];
} }
template<class ParcelType> template<class CloudType>
inline inline
const Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >& const Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ReactingCloud<ParcelType>::rhoTrans() const Foam::ReactingCloud<CloudType>::rhoTrans() const
{ {
return rhoTrans_; return rhoTrans_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ReactingCloud<ParcelType>::rhoTrans() Foam::ReactingCloud<CloudType>::rhoTrans()
{ {
return rhoTrans_; return rhoTrans_;
} }
template<class ParcelType> template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix> inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
Foam::ReactingCloud<ParcelType>::SYi
( (
const label i, const label i,
volScalarField& Yi 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> > 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 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> > inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ReactingCloud<ParcelType>::Srho() const Foam::ReactingCloud<CloudType>::Srho() const
{ {
tmp<DimensionedField<scalar, volMesh> > trhoTrans 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> inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ReactingCloud<ParcelType>::Srho(volScalarField& rho) const Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
{ {
if (this->solution().coupled()) if (this->solution().coupled())
{ {

View File

@ -30,12 +30,12 @@ License
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::setModels() void Foam::ReactingMultiphaseCloud<CloudType>::setModels()
{ {
devolatilisationModel_.reset devolatilisationModel_.reset
( (
DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >::New DevolatilisationModel<ReactingMultiphaseCloud<CloudType> >::New
( (
this->subModelProperties(), this->subModelProperties(),
*this *this
@ -44,7 +44,7 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::setModels()
surfaceReactionModel_.reset surfaceReactionModel_.reset
( (
SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >::New SurfaceReactionModel<ReactingMultiphaseCloud<CloudType> >::New
( (
this->subModelProperties(), this->subModelProperties(),
*this *this
@ -53,13 +53,13 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::setModels()
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset void Foam::ReactingMultiphaseCloud<CloudType>::cloudReset
( (
ReactingMultiphaseCloud<ParcelType>& c ReactingMultiphaseCloud<CloudType>& c
) )
{ {
ReactingCloud<ParcelType>::cloudReset(c); CloudType::cloudReset(c);
devolatilisationModel_.reset(c.devolatilisationModel_.ptr()); devolatilisationModel_.reset(c.devolatilisationModel_.ptr());
surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr()); surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr());
@ -71,8 +71,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
( (
const word& cloudName, const word& cloudName,
const volScalarField& rho, const volScalarField& rho,
@ -82,7 +82,7 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
bool readFields bool readFields
) )
: :
ReactingCloud<ParcelType>(cloudName, rho, U, g, thermo, false), CloudType(cloudName, rho, U, g, thermo, false),
reactingMultiphaseCloud(), reactingMultiphaseCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
constProps_(this->particleProperties(), this->solution().active()), constProps_(this->particleProperties(), this->solution().active()),
@ -98,7 +98,7 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
if (readFields) if (readFields)
{ {
ParcelType::readFields(*this); parcelType::readFields(*this, this->composition());
} }
if (this->solution().resetSourcesOnStartup()) if (this->solution().resetSourcesOnStartup())
@ -108,14 +108,14 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
} }
template<class ParcelType> template<class CloudType>
Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
( (
ReactingMultiphaseCloud<ParcelType>& c, ReactingMultiphaseCloud<CloudType>& c,
const word& name const word& name
) )
: :
ReactingCloud<ParcelType>(c, name), CloudType(c, name),
reactingMultiphaseCloud(), reactingMultiphaseCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
constProps_(c.constProps_), constProps_(c.constProps_),
@ -126,15 +126,15 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
{} {}
template<class ParcelType> template<class CloudType>
Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const ReactingMultiphaseCloud<ParcelType>& c const ReactingMultiphaseCloud<CloudType>& c
) )
: :
ReactingCloud<ParcelType>(mesh, name, c), CloudType(mesh, name, c),
reactingMultiphaseCloud(), reactingMultiphaseCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
constProps_(), constProps_(),
@ -147,22 +147,22 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud() Foam::ReactingMultiphaseCloud<CloudType>::~ReactingMultiphaseCloud()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties void Foam::ReactingMultiphaseCloud<CloudType>::checkParcelProperties
( (
ParcelType& parcel, parcelType& parcel,
const scalar lagrangianDt, const scalar lagrangianDt,
const bool fullyDescribed const bool fullyDescribed
) )
{ {
ReactingCloud<ParcelType>::checkParcelProperties CloudType::checkParcelProperties
( (
parcel, parcel,
lagrangianDt, lagrangianDt,
@ -203,12 +203,12 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::storeState() void Foam::ReactingMultiphaseCloud<CloudType>::storeState()
{ {
cloudCopyPtr_.reset cloudCopyPtr_.reset
( (
static_cast<ReactingMultiphaseCloud<ParcelType>*> static_cast<ReactingMultiphaseCloud<CloudType>*>
( (
clone(this->name() + "Copy").ptr() clone(this->name() + "Copy").ptr()
) )
@ -216,35 +216,36 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::storeState()
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::restoreState() void Foam::ReactingMultiphaseCloud<CloudType>::restoreState()
{ {
cloudReset(cloudCopyPtr_()); cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear(); cloudCopyPtr_.clear();
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms() void Foam::ReactingMultiphaseCloud<CloudType>::resetSourceTerms()
{ {
ReactingCloud<ParcelType>::resetSourceTerms(); CloudType::resetSourceTerms();
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::evolve() void Foam::ReactingMultiphaseCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename ParcelType::trackData td(*this); typename parcelType::template
TrackingData<ReactingMultiphaseCloud<CloudType> > td(*this);
this->solve(td); this->solve(td);
} }
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassDevolatilisation void Foam::ReactingMultiphaseCloud<CloudType>::addToMassDevolatilisation
( (
const scalar dMass const scalar dMass
) )
@ -253,8 +254,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassDevolatilisation
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassSurfaceReaction void Foam::ReactingMultiphaseCloud<CloudType>::addToMassSurfaceReaction
( (
const scalar dMass const scalar dMass
) )
@ -263,10 +264,10 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassSurfaceReaction
} }
template<class ParcelType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<ParcelType>::info() const void Foam::ReactingMultiphaseCloud<CloudType>::info() const
{ {
ReactingCloud<ParcelType>::info(); CloudType::info();
Info<< " Mass transfer devolatilisation = " Info<< " Mass transfer devolatilisation = "
<< returnReduce(dMassDevolatilisation_, sumOp<scalar>()) << nl; << returnReduce(dMassDevolatilisation_, sumOp<scalar>()) << nl;
Info<< " Mass transfer surface reaction = " 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 Class ReactingMultiphaseCloud Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParcelType> template<class CloudType>
class ReactingMultiphaseCloud class ReactingMultiphaseCloud
: :
public ReactingCloud<ParcelType>, public CloudType,
public reactingMultiphaseCloud public reactingMultiphaseCloud
{ {
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
private:
// Private data // Private data
//- Cloud copy pointer //- Cloud copy pointer
autoPtr<ReactingMultiphaseCloud<ParcelType> > cloudCopyPtr_; autoPtr<ReactingMultiphaseCloud<CloudType> > cloudCopyPtr_;
// Private member functions // Private member functions
@ -87,7 +95,7 @@ protected:
// Protected data // Protected data
//- Parcel constant properties //- Parcel constant properties
typename ParcelType::constantProperties constProps_; typename parcelType::constantProperties constProps_;
// References to the cloud sub-models // References to the cloud sub-models
@ -95,14 +103,14 @@ protected:
//- Devolatilisation model //- Devolatilisation model
autoPtr autoPtr
< <
DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> > DevolatilisationModel<ReactingMultiphaseCloud<CloudType> >
> >
devolatilisationModel_; devolatilisationModel_;
//- Surface reaction model //- Surface reaction model
autoPtr autoPtr
< <
SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> > SurfaceReactionModel<ReactingMultiphaseCloud<CloudType> >
> >
surfaceReactionModel_; surfaceReactionModel_;
@ -128,11 +136,13 @@ protected:
// Cloud evolution functions // Cloud evolution functions
//- Reset state of cloud //- Reset state of cloud
void cloudReset(ReactingMultiphaseCloud<ParcelType>& c); void cloudReset(ReactingMultiphaseCloud<CloudType>& c);
public: public:
typedef CloudType cloudType;
// Constructors // Constructors
//- Construct given carrier gas fields //- Construct given carrier gas fields
@ -150,7 +160,7 @@ public:
//- Copy constructor with new name //- Copy constructor with new name
ReactingMultiphaseCloud ReactingMultiphaseCloud
( (
ReactingMultiphaseCloud<ParcelType>& c, ReactingMultiphaseCloud<CloudType>& c,
const word& name const word& name
); );
@ -159,22 +169,22 @@ public:
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const ReactingMultiphaseCloud<ParcelType>& c const ReactingMultiphaseCloud<CloudType>& c
); );
//- Construct and return clone based on (this) with new name //- 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) new ReactingMultiphaseCloud(*this, name)
); );
} }
//- Construct and return bare clone based on (this) with new 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) new ReactingMultiphaseCloud(this->mesh(), name, *this)
); );
@ -185,10 +195,6 @@ public:
virtual ~ReactingMultiphaseCloud(); virtual ~ReactingMultiphaseCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions // Member Functions
// Access // Access
@ -197,7 +203,7 @@ public:
inline const ReactingMultiphaseCloud& cloudCopy() const; inline const ReactingMultiphaseCloud& cloudCopy() const;
//- Return the constant properties //- Return the constant properties
inline const typename ParcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
@ -206,14 +212,14 @@ public:
//- Return reference to devolatilisation model //- Return reference to devolatilisation model
inline const DevolatilisationModel inline const DevolatilisationModel
< <
ReactingMultiphaseCloud<ParcelType> ReactingMultiphaseCloud<CloudType>
>& >&
devolatilisation() const; devolatilisation() const;
//- Return reference to reacting surface reaction model //- Return reference to reacting surface reaction model
inline const SurfaceReactionModel inline const SurfaceReactionModel
< <
ReactingMultiphaseCloud<ParcelType> ReactingMultiphaseCloud<CloudType>
>& >&
surfaceReaction() const; surfaceReaction() const;
@ -232,7 +238,7 @@ public:
//- Check parcel properties //- Check parcel properties
void checkParcelProperties void checkParcelProperties
( (
ParcelType& parcel, parcelType& parcel,
const scalar lagrangianDt, const scalar lagrangianDt,
const bool fullyDescribed const bool fullyDescribed
); );
@ -251,6 +257,12 @@ public:
//- Print cloud information //- Print cloud information
void info() const; 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,39 +25,39 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class CloudType>
inline const Foam::ReactingMultiphaseCloud<ParcelType>& inline const Foam::ReactingMultiphaseCloud<CloudType>&
Foam::ReactingMultiphaseCloud<ParcelType>::cloudCopy() const Foam::ReactingMultiphaseCloud<CloudType>::cloudCopy() const
{ {
return cloudCopyPtr_(); return cloudCopyPtr_();
} }
template<class ParcelType> template<class CloudType>
inline const typename ParcelType::constantProperties& inline const typename CloudType::particleType::constantProperties&
Foam::ReactingMultiphaseCloud<ParcelType>::constProps() const Foam::ReactingMultiphaseCloud<CloudType>::constProps() const
{ {
return constProps_; return constProps_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::DevolatilisationModel inline const Foam::DevolatilisationModel
< <
Foam::ReactingMultiphaseCloud<ParcelType> Foam::ReactingMultiphaseCloud<CloudType>
>& >&
Foam::ReactingMultiphaseCloud<ParcelType>::devolatilisation() const Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation() const
{ {
return devolatilisationModel_; return devolatilisationModel_;
} }
template<class ParcelType> template<class CloudType>
inline const Foam::SurfaceReactionModel inline const Foam::SurfaceReactionModel
< <
Foam::ReactingMultiphaseCloud<ParcelType> Foam::ReactingMultiphaseCloud<CloudType>
>& >&
Foam::ReactingMultiphaseCloud<ParcelType>::surfaceReaction() const Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction() const
{ {
return surfaceReactionModel_; return surfaceReactionModel_;
} }

View File

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

View File

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

View File

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

View File

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