particle: Removed polyMesh reference

This reference represents unnecessary storage. The mesh can be obtained
from tracking data or passed to the particle evolution functions by
argument.

In addition, removing the mesh reference makes it possible to construct
as particle from an Istream without the need for an iNew class. This
simplifies stream-based transfer, and makes it possible for particles to
be communicated by a polyDistributionMap.
This commit is contained in:
Will Bainbridge
2022-09-20 08:45:34 +01:00
parent 3719f7d9de
commit 4c223b8aee
110 changed files with 787 additions and 1152 deletions

View File

@ -704,13 +704,19 @@ int main(int argc, char *argv[])
<< " for particle with index " << " for particle with index "
<< iter().index() << iter().index()
<< " at position " << " at position "
<< iter().position() << nl << iter().position(meshes.completeMesh())
<< nl
<< "Cell number should be between 0 and " << "Cell number should be between 0 and "
<< meshes.completeMesh().nCells()-1 << nl << meshes.completeMesh().nCells()-1 << nl
<< "On this mesh the particle should" << "On this mesh the particle should"
<< " be in cell " << " be in cell "
<< meshes.completeMesh().findCell << meshes.completeMesh().findCell
(iter().position()) (
iter().position
(
meshes.completeMesh()
)
)
<< 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -88,7 +88,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
ppi.coordinates(), ppi.coordinates(),
procCelli, procCelli,
mappedTetFace, mappedTetFace,
ppi.procTetPt(procMesh, procCelli, mappedTetFace) ppi.procTetPt(mesh, procMesh, procCelli, mappedTetFace)
) )
); );
} }

View File

@ -70,7 +70,7 @@ void Foam::reconstructLagrangianPositions
ppi.coordinates(), ppi.coordinates(),
mappedCell, mappedCell,
mappedTetFace, mappedTetFace,
ppi.procTetPt(mesh, mappedCell, mappedTetFace) ppi.procTetPt(meshes[i], mesh, mappedCell, mappedTetFace)
) )
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ void ensightParticlePositions
// Output positions // Output positions
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt) forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{ {
const vector& p = elmnt().position(); const vector& p = elmnt().position(mesh);
ensightFile ensightFile
<< setw(8) << ++nParcels << setw(8) << ++nParcels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -123,7 +123,7 @@ void Foam::ensightParticlePositions
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt) forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{ {
const vector& p = elmnt().position(); const vector& p = elmnt().position(mesh);
os.write(p.x()); os.write(p.x());
os.write(p.y()); os.write(p.y());
@ -136,7 +136,7 @@ void Foam::ensightParticlePositions
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt) forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{ {
const vector& p = elmnt().position(); const vector& p = elmnt().position(mesh);
os.write(++nParcels, 8); // unusual width os.write(++nParcels, 8); // unusual width
os.write(p.x()); os.write(p.x());

View File

@ -1,21 +1,23 @@
gmvFile << "tracers " << particles.size() << nl; gmvFile << "tracers " << particles.size() << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{
gmvFile << iter().position().x() << ' ';
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{ {
gmvFile << iter().position().y() << ' '; pointField positions(particles.size());
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter) label particlei = 0;
{ forAllConstIter(Cloud<passiveParticle>, particles, iter)
gmvFile << iter().position().z() << ' '; {
positions[particlei ++] = iter().position(mesh);
}
for (i = 0; i < pTraits<point>::nComponents; i ++)
{
forAll(positions, particlei)
{
gmvFile << component(positions[particlei], i) << ' ';
}
gmvFile << nl;
}
} }
gmvFile << nl;
forAll(lagrangianScalarNames, i) forAll(lagrangianScalarNames, i)
{ {
@ -44,8 +46,6 @@ forAll(lagrangianScalarNames, i)
} }
gmvFile << nl; gmvFile << nl;
} }
} }
forAll(lagrangianVectorNames, i) forAll(lagrangianVectorNames, 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -70,7 +70,7 @@ Foam::lagrangianWriter::lagrangianWriter
DynamicList<floatScalar> partField(3*parcels.size()); DynamicList<floatScalar> partField(3*parcels.size());
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt) forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{ {
vtkWriteOps::insert(elmnt().position(), partField); vtkWriteOps::insert(elmnt().position(mesh), partField);
} }
vtkWriteOps::write(os_, binary_, partField); vtkWriteOps::write(os_, binary_, partField);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
vtkIdType particleId = 0; vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter) forAllConstIter(Cloud<passiveParticle>, parcels, iter)
{ {
vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position()); vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position(mesh));
vtkcells->InsertNextCell(1, &particleId); vtkcells->InsertNextCell(1, &particleId);
particleId++; particleId++;

View File

@ -44,9 +44,10 @@ int USERD_get_part_coords
forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter) forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter)
{ {
coord_array[0][indx] = float(iter().position().x()); const point p = iter().position(*meshPtr);
coord_array[1][indx] = float(iter().position().y()); coord_array[0][indx] = float(p.x());
coord_array[2][indx] = float(iter().position().z()); coord_array[1][indx] = float(p.y());
coord_array[2][indx] = float(p.z());
indx++; indx++;
} }

View File

@ -159,7 +159,7 @@ int main(int argc, char *argv[])
label i = 0; label i = 0;
forAllConstIter(passiveParticleCloud, myCloud, iter) forAllConstIter(passiveParticleCloud, myCloud, iter)
{ {
allPositions[Pstream::myProcNo()][i] = iter().position(); allPositions[Pstream::myProcNo()][i] = iter().position(mesh);
allOrigIds[Pstream::myProcNo()][i] = iter().origId(); allOrigIds[Pstream::myProcNo()][i] = iter().origId();
allOrigProcs[Pstream::myProcNo()][i] = iter().origProc(); allOrigProcs[Pstream::myProcNo()][i] = iter().origProc();
i++; 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -279,7 +279,8 @@ int main(int argc, char *argv[])
forAll(ids, j) forAll(ids, j)
{ {
const label localId = particleIds[j]; const label localId = particleIds[j];
const vector& pos = particles[localId].position(); const vector pos =
particles[localId].position(mesh);
os << pos.x() << ' ' << pos.y() << ' ' << pos.z() os << pos.x() << ' ' << pos.y() << ' ' << pos.z()
<< nl; << nl;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -189,7 +189,13 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
); );
passiveParticle& newP = newPtr(); passiveParticle& newP = newPtr();
newP.track(iter().position() - newP.position(), 0); newP.track
(
meshTarget,
iter().position(meshSource)
- newP.position(meshTarget),
0
);
if (!newP.onFace()) if (!newP.onFace())
{ {
@ -228,7 +234,11 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
if (unmappedSource.found(sourceParticleI)) if (unmappedSource.found(sourceParticleI))
{ {
label targetCell = label targetCell =
findCell(targetParcels, iter().position()); findCell
(
targetParcels,
iter().position(meshSource)
);
if (targetCell >= 0) if (targetCell >= 0)
{ {
@ -239,7 +249,7 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
new passiveParticle new passiveParticle
( (
meshTarget, meshTarget,
iter().position(), iter().position(meshSource),
targetCell targetCell
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -178,7 +178,13 @@ void mapLagrangian(const meshToMesh& interp)
); );
passiveParticle& newP = newPtr(); passiveParticle& newP = newPtr();
newP.track(iter().position() - newP.position(), 0); newP.track
(
meshTarget,
iter().position(meshSource)
- newP.position(meshTarget),
0
);
if (!newP.onFace()) if (!newP.onFace())
{ {
@ -217,7 +223,11 @@ void mapLagrangian(const meshToMesh& interp)
if (unmappedSource.found(sourceParticleI)) if (unmappedSource.found(sourceParticleI))
{ {
label targetCell = label targetCell =
findCell(targetParcels, iter().position()); findCell
(
targetParcels,
iter().position(meshSource)
);
if (targetCell >= 0) if (targetCell >= 0)
{ {
@ -228,7 +238,7 @@ void mapLagrangian(const meshToMesh& interp)
new passiveParticle new passiveParticle
( (
meshTarget, meshTarget,
iter().position(), iter().position(meshSource),
targetCell targetCell
) )
); );

View File

@ -59,14 +59,9 @@ Foam::findCellParticle::findCellParticle
{} {}
Foam::findCellParticle::findCellParticle Foam::findCellParticle::findCellParticle(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
particle(mesh, is, readFields) particle(is, readFields)
{ {
if (readFields) if (readFields)
{ {
@ -117,7 +112,7 @@ bool Foam::findCellParticle::move
// Hit endpoint or patch. If patch hit could do fancy stuff but just // Hit endpoint or patch. If patch hit could do fancy stuff but just
// to use the patch point is good enough for now. // to use the patch point is good enough for now.
td.cellToData()[cell()].append(data()); td.cellToData()[cell()].append(data());
td.cellToEnd()[cell()].append(position()); td.cellToEnd()[cell()].append(position(td.mesh));
} }
return td.keepParticle; return td.keepParticle;
@ -188,7 +183,10 @@ void Foam::findCellParticle::hitProcessorPatch
) )
{ {
const processorPolyPatch& ppp = const processorPolyPatch& ppp =
static_cast<const processorPolyPatch&>(mesh().boundaryMesh()[patch()]); static_cast<const processorPolyPatch&>
(
td.mesh.boundaryMesh()[patch(td.mesh)]
);
if (ppp.transform().transforms()) if (ppp.transform().transforms())
{ {

View File

@ -140,12 +140,7 @@ public:
); );
//- Construct from Istream //- Construct from Istream
findCellParticle findCellParticle(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone //- Construct and return a clone
autoPtr<particle> clone() const autoPtr<particle> clone() const
@ -153,27 +148,11 @@ public:
return autoPtr<particle>(new findCellParticle(*this)); return autoPtr<particle>(new findCellParticle(*this));
} }
//- Factory class to read-construct particles used for //- Construct from Istream and return
// parallel transfer static autoPtr<findCellParticle> New(Istream& is)
class iNew
{ {
const polyMesh& mesh_; return autoPtr<findCellParticle>(new findCellParticle(is));
}
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<findCellParticle> operator()(Istream& is) const
{
return autoPtr<findCellParticle>
(
new findCellParticle(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -108,7 +108,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
forAllConstIter(Cloud<findCellParticle>, cloud, iter) forAllConstIter(Cloud<findCellParticle>, cloud, iter)
{ {
const vector p = iter().position(); const vector p = iter().position(mesh_);
str.write(linePointRef(p, p + iter().displacement())); str.write(linePointRef(p, p + iter().displacement()));
} }
} }
@ -135,7 +135,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
forAllConstIter(Cloud<findCellParticle>, cloud, iter) forAllConstIter(Cloud<findCellParticle>, cloud, iter)
{ {
const findCellParticle& tp = iter(); const findCellParticle& tp = iter();
start[nPatchFaces++] = tp.position(); start[nPatchFaces++] = tp.position(mesh_);
} }
} }

View File

@ -145,14 +145,9 @@ Foam::streamlinesParticle::streamlinesParticle
{} {}
Foam::streamlinesParticle::streamlinesParticle Foam::streamlinesParticle::streamlinesParticle(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
particle(mesh, is, readFields) particle(is, readFields)
{ {
if (readFields) if (readFields)
{ {
@ -212,7 +207,7 @@ bool Foam::streamlinesParticle::move
td.keepParticle = true; td.keepParticle = true;
td.sendToProc = -1; td.sendToProc = -1;
const scalar maxDt = mesh().bounds().mag(); const scalar maxDt = td.mesh.bounds().mag();
while (td.keepParticle && td.sendToProc == -1 && lifeTime_ > 0) while (td.keepParticle && td.sendToProc == -1 && lifeTime_ > 0)
{ {
@ -229,11 +224,11 @@ bool Foam::streamlinesParticle::move
sampledPositions_.append sampledPositions_.append
( (
td.trackOutside_ td.trackOutside_
? transform_.invTransformPosition(position()) ? transform_.invTransformPosition(position(td.mesh))
: position() : position(td.mesh)
); );
sampledAges_.append(age_); sampledAges_.append(age_);
vector U = interpolateFields(td, position(), cell(), face()); vector U = interpolateFields(td, position(td.mesh), cell(), face());
if (!td.trackForward_) if (!td.trackForward_)
{ {
@ -260,7 +255,7 @@ bool Foam::streamlinesParticle::move
{ {
// Sub-cycling. Cross the cell in nSubCycle steps. // Sub-cycling. Cross the cell in nSubCycle steps.
particle copy(*this); particle copy(*this);
copy.trackToFace(maxDt*U, 1); copy.trackToFace(td.mesh, maxDt*U, 1);
dt *= (copy.stepFraction() - stepFraction())/td.nSubCycle_; dt *= (copy.stepFraction() - stepFraction())/td.nSubCycle_;
} }
else if (subIter == td.nSubCycle_ - 1) else if (subIter == td.nSubCycle_ - 1)
@ -289,7 +284,7 @@ bool Foam::streamlinesParticle::move
if (debug) if (debug)
{ {
Pout<< "streamlinesParticle: Removing stagnant particle:" Pout<< "streamlinesParticle: Removing stagnant particle:"
<< position() << " sampled positions:" << position(td.mesh) << " sampled positions:"
<< sampledPositions_.size() << endl; << sampledPositions_.size() << endl;
} }
td.keepParticle = false; td.keepParticle = false;
@ -300,17 +295,17 @@ bool Foam::streamlinesParticle::move
sampledPositions_.append sampledPositions_.append
( (
td.trackOutside_ td.trackOutside_
? transform_.invTransformPosition(position()) ? transform_.invTransformPosition(position(td.mesh))
: position() : position(td.mesh)
); );
sampledAges_.append(age_); sampledAges_.append(age_);
interpolateFields(td, position(), cell(), face()); interpolateFields(td, position(td.mesh), cell(), face());
if (debug) if (debug)
{ {
Pout<< "streamlinesParticle: Removing particle:" << position() Pout<< "streamlinesParticle: Removing particle:"
<< " sampled positions:" << sampledPositions_.size() << position(td.mesh) << " sampled positions:"
<< endl; << sampledPositions_.size() << endl;
} }
} }
@ -362,7 +357,10 @@ void Foam::streamlinesParticle::hitCyclicPatch
) )
{ {
const cyclicPolyPatch& cpp = const cyclicPolyPatch& cpp =
static_cast<const cyclicPolyPatch&>(mesh().boundaryMesh()[patch()]); static_cast<const cyclicPolyPatch&>
(
td.mesh.boundaryMesh()[patch(td.mesh)]
);
// End this track // End this track
if (!td.trackOutside_ && cpp.transform().transformsPosition()) if (!td.trackOutside_ && cpp.transform().transformsPosition())
@ -424,7 +422,10 @@ void Foam::streamlinesParticle::hitProcessorPatch
) )
{ {
const processorPolyPatch& ppp = const processorPolyPatch& ppp =
static_cast<const processorPolyPatch&>(mesh().boundaryMesh()[patch()]); static_cast<const processorPolyPatch&>
(
td.mesh.boundaryMesh()[patch(td.mesh)]
);
// End this track // End this track
if (!td.trackOutside_ && ppp.transform().transformsPosition()) if (!td.trackOutside_ && ppp.transform().transformsPosition())

View File

@ -205,7 +205,7 @@ public:
//- Construct from components //- Construct from components
streamlinesParticle streamlinesParticle
( (
const polyMesh& c, const polyMesh& mesh,
const vector& position, const vector& position,
const label celli, const label celli,
const label lifeTime, const label lifeTime,
@ -213,12 +213,7 @@ public:
); );
//- Construct from Istream //- Construct from Istream
streamlinesParticle streamlinesParticle(Istream& is, bool readFields = true);
(
const polyMesh& c,
Istream& is,
bool readFields = true
);
//- Construct copy //- Construct copy
streamlinesParticle(const streamlinesParticle& p); streamlinesParticle(const streamlinesParticle& p);
@ -229,26 +224,11 @@ public:
return autoPtr<particle>(new streamlinesParticle(*this)); return autoPtr<particle>(new streamlinesParticle(*this));
} }
//- Factory class to read-construct particles used for parallel transfer //- Construct from Istream and return
class iNew static autoPtr<streamlinesParticle> New(Istream& is)
{ {
const polyMesh& mesh_; return autoPtr<streamlinesParticle>(new streamlinesParticle(is));
}
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<streamlinesParticle> operator()(Istream& is) const
{
return autoPtr<streamlinesParticle>
(
new streamlinesParticle(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -243,7 +243,7 @@ void Foam::DSMCCloud<ParcelType>::collisions()
forAll(cellParcels, i) forAll(cellParcels, i)
{ {
const ParcelType& p = *cellParcels[i]; const ParcelType& p = *cellParcels[i];
vector relPos = p.position() - cC; vector relPos = p.position(mesh()) - cC;
label subCell = label subCell =
pos0(relPos.x()) + 2*pos0(relPos.y()) + 4*pos0(relPos.z()); pos0(relPos.x()) + 2*pos0(relPos.y()) + 4*pos0(relPos.z());
@ -1071,12 +1071,9 @@ void Foam::DSMCCloud<ParcelType>::dumpParticlePositions() const
forAllConstIter(typename DSMCCloud<ParcelType>, *this, iter) forAllConstIter(typename DSMCCloud<ParcelType>, *this, iter)
{ {
const ParcelType& p = iter(); const point pos = iter().position(mesh());
pObj<< "v " << p.position().x() pObj<< "v " << pos.x() << " " << pos.y() << " " << pos.z() << nl;
<< " " << p.position().y()
<< " " << p.position().z()
<< nl;
} }
pObj.flush(); pObj.flush();

View File

@ -60,7 +60,7 @@ bool Foam::DSMCParcel<ParcelType>::move
meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking); meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking);
// Deviation from the mesh centre for reduced-D cases // Deviation from the mesh centre for reduced-D cases
const vector d = p.deviationFromMeshCentre(); const vector d = p.deviationFromMeshCentre(mesh);
const scalar f = 1 - p.stepFraction(); const scalar f = 1 - p.stepFraction();
p.trackToAndHitFace(f*trackTime*Utracking - d, f, cloud, td); p.trackToAndHitFace(f*trackTime*Utracking - d, f, cloud, td);
@ -78,12 +78,12 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
trackingData& trackingData&
) )
{ {
const label wppIndex = this->patch(); const label wppIndex = this->patch(cloud.pMesh());
const wallPolyPatch& wpp = const wallPolyPatch& wpp =
static_cast<const wallPolyPatch&> static_cast<const wallPolyPatch&>
( (
this->mesh().boundaryMesh()[wppIndex] cloud.pMesh().boundaryMesh()[wppIndex]
); );
const label wppLocalFace = wpp.whichFace(this->face()); const label wppLocalFace = wpp.whichFace(this->face());

View File

@ -184,12 +184,7 @@ public:
); );
//- Construct from Istream //- Construct from Istream
DSMCParcel DSMCParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
@ -197,27 +192,11 @@ public:
return autoPtr<particle>(new DSMCParcel<ParcelType>(*this)); return autoPtr<particle>(new DSMCParcel<ParcelType>(*this));
} }
//- Factory class to read-construct particles used for //- Construct from Istream and return
// parallel transfer static autoPtr<DSMCParcel> New(Istream& is)
class iNew
{ {
const polyMesh& mesh_; return autoPtr<DSMCParcel>(new DSMCParcel(is));
}
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<DSMCParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<DSMCParcel<ParcelType>>
(
new DSMCParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DSMCParcel.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,14 +40,9 @@ const std::size_t Foam::DSMCParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::DSMCParcel<ParcelType>::DSMCParcel Foam::DSMCParcel<ParcelType>::DSMCParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
U_(Zero), U_(Zero),
Ei_(0.0), Ei_(0.0),
typeId_(-1) typeId_(-1)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,19 +56,21 @@ void Foam::MaxwellianThermal<CloudType>::correct
typename CloudType::parcelType& p typename CloudType::parcelType& p
) )
{ {
const polyMesh& mesh = this->owner().mesh();
vector& U = p.U(); vector& U = p.U();
scalar& Ei = p.Ei(); scalar& Ei = p.Ei();
label typeId = p.typeId(); label typeId = p.typeId();
const label wppIndex = p.patch(); const label wppIndex = p.patch(mesh);
const polyPatch& wpp = p.mesh().boundaryMesh()[wppIndex]; const polyPatch& wpp = mesh.boundaryMesh()[wppIndex];
label wppLocalFace = wpp.whichFace(p.face()); label wppLocalFace = wpp.whichFace(p.face());
const vector nw = p.normal(); const vector nw = p.normal(mesh);
// Normal velocity magnitude // Normal velocity magnitude
scalar U_dot_nw = U & nw; scalar U_dot_nw = U & nw;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,19 +57,21 @@ void Foam::MixedDiffuseSpecular<CloudType>::correct
typename CloudType::parcelType& p typename CloudType::parcelType& p
) )
{ {
const polyMesh& mesh = this->owner().mesh();
vector& U = p.U(); vector& U = p.U();
scalar& Ei = p.Ei(); scalar& Ei = p.Ei();
label typeId = p.typeId(); label typeId = p.typeId();
const label wppIndex = p.patch(); const label wppIndex = p.patch(mesh);
const polyPatch& wpp = p.mesh().boundaryMesh()[wppIndex]; const polyPatch& wpp = mesh.boundaryMesh()[wppIndex];
label wppLocalFace = wpp.whichFace(p.face()); label wppLocalFace = wpp.whichFace(p.face());
const vector nw = p.normal(); const vector nw = p.normal(mesh);
// Normal velocity magnitude // Normal velocity magnitude
scalar U_dot_nw = U & nw; scalar U_dot_nw = U & nw;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,9 +55,11 @@ void Foam::SpecularReflection<CloudType>::correct
typename CloudType::parcelType& p typename CloudType::parcelType& p
) )
{ {
const polyMesh& mesh = this->owner().mesh();
vector& U = p.U(); vector& U = p.U();
const vector nw = p.normal(); const vector nw = p.normal(mesh);
scalar U_dot_nw = U & nw; scalar U_dot_nw = U & nw;

View File

@ -41,7 +41,7 @@ License
template<class ParticleType> template<class ParticleType>
void Foam::Cloud<ParticleType>::checkPatches() const void Foam::Cloud<ParticleType>::checkPatches() const
{ {
const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh(); const polyBoundaryMesh& pbm = pMesh_.boundaryMesh();
bool ok = true; bool ok = true;
forAll(pbm, patchi) forAll(pbm, patchi)
{ {
@ -165,7 +165,7 @@ Foam::labelListList Foam::Cloud<ParticleType>::patchNonConformalCyclicPatches
template<class ParticleType> template<class ParticleType>
void Foam::Cloud<ParticleType>::storeRays() const void Foam::Cloud<ParticleType>::storeRays() const
{ {
const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh(); const polyBoundaryMesh& pbm = pMesh_.boundaryMesh();
forAll(patchNonConformalCyclicPatches_, patchi) forAll(patchNonConformalCyclicPatches_, patchi)
{ {
@ -195,7 +195,7 @@ Foam::Cloud<ParticleType>::Cloud
: :
cloud(pMesh, cloudName), cloud(pMesh, cloudName),
IDLList<ParticleType>(), IDLList<ParticleType>(),
polyMesh_(pMesh), pMesh_(pMesh),
patchNbrProc_(patchNbrProc(pMesh)), patchNbrProc_(patchNbrProc(pMesh)),
patchNbrProcPatch_(patchNbrProcPatch(pMesh)), patchNbrProcPatch_(patchNbrProcPatch(pMesh)),
patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)), patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)),
@ -206,8 +206,8 @@ Foam::Cloud<ParticleType>::Cloud
// Ask for the tetBasePtIs and oldCellCentres to trigger all processors to // Ask for the tetBasePtIs and oldCellCentres to trigger all processors to
// build them, otherwise, if some processors have no particles then there // build them, otherwise, if some processors have no particles then there
// is a comms mismatch. // is a comms mismatch.
polyMesh_.tetBasePtIs(); pMesh_.tetBasePtIs();
polyMesh_.oldCellCentres(); pMesh_.oldCellCentres();
if (particles.size()) if (particles.size())
{ {
@ -242,8 +242,8 @@ void Foam::Cloud<ParticleType>::deleteLostParticles()
if (p.cell() == -1) if (p.cell() == -1)
{ {
WarningInFunction WarningInFunction
<< "deleting lost particle at position " << p.position() << "deleting lost particle at position "
<< endl; << p.position(pMesh_) << endl;
deleteParticle(p); deleteParticle(p);
} }
@ -313,7 +313,7 @@ void Foam::Cloud<ParticleType>::move
if (td.sendToProc != -1) if (td.sendToProc != -1)
{ {
#ifdef FULLDEBUG #ifdef FULLDEBUG
if (!Pstream::parRun() || !p.onBoundaryFace()) if (!Pstream::parRun() || !p.onBoundaryFace(pMesh_))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Switch processor flag is true when no parallel " << "Switch processor flag is true when no parallel "
@ -386,11 +386,7 @@ void Foam::Cloud<ParticleType>::move
const labelList receivePatchIndices(particleStream); const labelList receivePatchIndices(particleStream);
IDLList<ParticleType> newParticles IDLList<ParticleType> newParticles(particleStream);
(
particleStream,
typename ParticleType::iNew(polyMesh_)
);
label i = 0; label i = 0;
@ -426,15 +422,15 @@ void Foam::Cloud<ParticleType>::topoChange(const polyTopoChangeMap& map)
// Ask for the tetBasePtIs to trigger all processors to build // Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then // them, otherwise, if some processors have no particles then
// there is a comms mismatch. // there is a comms mismatch.
polyMesh_.tetBasePtIs(); pMesh_.tetBasePtIs();
polyMesh_.oldCellCentres(); pMesh_.oldCellCentres();
const vectorField& positions = globalPositionsPtr_(); const vectorField& positions = globalPositionsPtr_();
label i = 0; label i = 0;
forAllIter(typename Cloud<ParticleType>, *this, iter) forAllIter(typename Cloud<ParticleType>, *this, iter)
{ {
iter().autoMap(positions[i], map); iter().autoMap(pMesh_, positions[i], map);
++ i; ++ i;
} }
} }
@ -464,9 +460,9 @@ void Foam::Cloud<ParticleType>::writePositions() const
forAllConstIter(typename Cloud<ParticleType>, *this, pIter) forAllConstIter(typename Cloud<ParticleType>, *this, pIter)
{ {
const ParticleType& p = pIter(); const point& pos = pIter().position(pMesh_);
pObj<< "v " << p.position().x() << " " << p.position().y() << " "
<< p.position().z() << nl; pObj<< "v " << pos.x() << " " << pos.y() << " " << pos.z() << nl;
} }
pObj.flush(); pObj.flush();
@ -488,7 +484,7 @@ void Foam::Cloud<ParticleType>::storeGlobalPositions() const
label i = 0; label i = 0;
forAllConstIter(typename Cloud<ParticleType>, *this, iter) forAllConstIter(typename Cloud<ParticleType>, *this, iter)
{ {
positions[i] = iter().position(); positions[i] = iter().position(pMesh_);
++ i; ++ i;
} }
} }

View File

@ -76,7 +76,7 @@ class Cloud
// Private Data // Private Data
//- Reference to the mesh //- Reference to the mesh
const polyMesh& polyMesh_; const polyMesh& pMesh_;
//- Map from patch index to the neighbouring processor index //- Map from patch index to the neighbouring processor index
const labelList patchNbrProc_; const labelList patchNbrProc_;
@ -165,7 +165,7 @@ public:
//- Return the polyMesh reference //- Return the polyMesh reference
const polyMesh& pMesh() const const polyMesh& pMesh() const
{ {
return polyMesh_; return pMesh_;
} }
//- Map from patch index to the neighbouring processor index //- Map from patch index to the neighbouring processor index

View File

@ -133,7 +133,7 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
// Ask for the tetBasePtIs to trigger all processors to build // Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then // them, otherwise, if some processors have no particles then
// there is a comms mismatch. // there is a comms mismatch.
polyMesh_.tetBasePtIs(); pMesh_.tetBasePtIs();
} }
@ -148,7 +148,7 @@ Foam::Cloud<ParticleType>::Cloud
) )
: :
cloud(pMesh, cloudName), cloud(pMesh, cloudName),
polyMesh_(pMesh), pMesh_(pMesh),
patchNbrProc_(patchNbrProc(pMesh)), patchNbrProc_(patchNbrProc(pMesh)),
patchNbrProcPatch_(patchNbrProcPatch(pMesh)), patchNbrProcPatch_(patchNbrProcPatch(pMesh)),
patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)), patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)),
@ -156,8 +156,8 @@ Foam::Cloud<ParticleType>::Cloud
{ {
checkPatches(); checkPatches();
polyMesh_.tetBasePtIs(); pMesh_.tetBasePtIs();
polyMesh_.oldCellCentres(); pMesh_.oldCellCentres();
initCloud(checkClass); initCloud(checkClass);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,8 +75,6 @@ bool Foam::IOPosition<CloudType>::writeData(Ostream& os) const
template<class CloudType> template<class CloudType>
void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c) void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
{ {
const polyMesh& mesh = c.pMesh();
token firstToken(is); token firstToken(is);
if (firstToken.isLabel()) if (firstToken.isLabel())
@ -92,7 +90,7 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
for (label i=0; i<s; i++) for (label i=0; i<s; i++)
{ {
// Read position only // Read position only
c.append(new typename CloudType::particleType(mesh, is, false)); c.append(new typename CloudType::particleType(is, false));
} }
// Read end of contents // Read end of contents
@ -121,7 +119,7 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
is.putBack(lastToken); is.putBack(lastToken);
// Read position only // Read position only
c.append(new typename CloudType::particleType(mesh, is, false)); c.append(new typename CloudType::particleType(is, false));
is >> lastToken; is >> lastToken;
} }
} }

View File

@ -966,7 +966,7 @@ void Foam::InteractionLists<ParticleType>::prepareParticleToBeReferred
globalTransforms.transformIndex(ciat) globalTransforms.transformIndex(ciat)
); );
particle->prepareForInteractionListReferral(transform); particle->prepareForInteractionListReferral(mesh_, transform);
} }
@ -1215,11 +1215,8 @@ void Foam::InteractionLists<ParticleType>::receiveReferredData
forAll(constructMap, i) forAll(constructMap, i)
{ {
referredParticles_[constructMap[i]] = IDLList<ParticleType> referredParticles_[constructMap[i]] =
( IDLList<ParticleType>(str);
str,
typename ParticleType::iNew(mesh_)
);
} }
} }
} }
@ -1229,7 +1226,11 @@ void Foam::InteractionLists<ParticleType>::receiveReferredData
IDLList<ParticleType>& refCell = referredParticles_[refCelli]; IDLList<ParticleType>& refCell = referredParticles_[refCelli];
forAllIter(typename IDLList<ParticleType>, refCell, iter) forAllIter(typename IDLList<ParticleType>, refCell, iter)
{ {
iter().correctAfterInteractionListReferral(ril_[refCelli][0]); iter().correctAfterInteractionListReferral
(
mesh_,
ril_[refCelli][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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,14 +77,9 @@ public:
{} {}
//- Construct from Istream //- Construct from Istream
indexedParticle indexedParticle(Istream& is, bool readFields = true)
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
)
: :
particle(mesh, is, readFields) particle(is, readFields)
{} {}
//- Construct as a copy //- Construct as a copy
@ -99,6 +94,12 @@ public:
return autoPtr<particle>(new indexedParticle(*this)); return autoPtr<particle>(new indexedParticle(*this));
} }
//- Construct from Istream and return
static autoPtr<indexedParticle> New(Istream& is)
{
return autoPtr<indexedParticle>(new indexedParticle(is));
}
// Member Functions // Member Functions

View File

@ -45,12 +45,13 @@ namespace Foam
void Foam::particle::stationaryTetReverseTransform void Foam::particle::stationaryTetReverseTransform
( (
const polyMesh& mesh,
vector& centre, vector& centre,
scalar& detA, scalar& detA,
barycentricTensor& T barycentricTensor& T
) const ) const
{ {
barycentricTensor A = stationaryTetTransform(); barycentricTensor A = stationaryTetTransform(mesh);
const vector ab = A.b() - A.a(); const vector ab = A.b() - A.a();
const vector ac = A.c() - A.a(); const vector ac = A.c() - A.a();
@ -74,13 +75,14 @@ void Foam::particle::stationaryTetReverseTransform
void Foam::particle::movingTetReverseTransform void Foam::particle::movingTetReverseTransform
( (
const polyMesh& mesh,
const scalar fraction, const scalar fraction,
Pair<vector>& centre, Pair<vector>& centre,
FixedList<scalar, 4>& detA, FixedList<scalar, 4>& detA,
FixedList<barycentricTensor, 3>& T FixedList<barycentricTensor, 3>& T
) const ) const
{ {
Pair<barycentricTensor> A = movingTetTransform(fraction); Pair<barycentricTensor> A = movingTetTransform(mesh, fraction);
const Pair<vector> ab(A[0].b() - A[0].a(), A[1].b() - A[1].a()); const Pair<vector> ab(A[0].b() - A[0].a(), A[1].b() - A[1].a());
const Pair<vector> ac(A[0].c() - A[0].a(), A[1].c() - A[1].a()); const Pair<vector> ac(A[0].c() - A[0].a(), A[1].c() - A[1].a());
@ -151,21 +153,21 @@ void Foam::particle::rotate(const bool reverse)
} }
void Foam::particle::changeTet(const label tetTriI) void Foam::particle::changeTet(const polyMesh& mesh, const label tetTriI)
{ {
if (debug) if (debug)
{ {
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl; Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
} }
const bool isOwner = mesh_.faceOwner()[tetFacei_] == celli_; const bool isOwner = mesh.faceOwner()[tetFacei_] == celli_;
const label firstTetPtI = 1; const label firstTetPtI = 1;
const label lastTetPtI = mesh_.faces()[tetFacei_].size() - 2; const label lastTetPtI = mesh.faces()[tetFacei_].size() - 2;
if (tetTriI == 1) if (tetTriI == 1)
{ {
changeFace(tetTriI); changeFace(mesh, tetTriI);
} }
else if (tetTriI == 2) else if (tetTriI == 2)
{ {
@ -173,7 +175,7 @@ void Foam::particle::changeTet(const label tetTriI)
{ {
if (tetPti_ == lastTetPtI) if (tetPti_ == lastTetPtI)
{ {
changeFace(tetTriI); changeFace(mesh, tetTriI);
} }
else else
{ {
@ -185,7 +187,7 @@ void Foam::particle::changeTet(const label tetTriI)
{ {
if (tetPti_ == firstTetPtI) if (tetPti_ == firstTetPtI)
{ {
changeFace(tetTriI); changeFace(mesh, tetTriI);
} }
else else
{ {
@ -200,7 +202,7 @@ void Foam::particle::changeTet(const label tetTriI)
{ {
if (tetPti_ == firstTetPtI) if (tetPti_ == firstTetPtI)
{ {
changeFace(tetTriI); changeFace(mesh, tetTriI);
} }
else else
{ {
@ -212,7 +214,7 @@ void Foam::particle::changeTet(const label tetTriI)
{ {
if (tetPti_ == lastTetPtI) if (tetPti_ == lastTetPtI)
{ {
changeFace(tetTriI); changeFace(mesh, tetTriI);
} }
else else
{ {
@ -231,7 +233,7 @@ void Foam::particle::changeTet(const label tetTriI)
} }
void Foam::particle::changeFace(const label tetTriI) void Foam::particle::changeFace(const polyMesh& mesh, const label tetTriI)
{ {
if (debug) if (debug)
{ {
@ -239,7 +241,7 @@ void Foam::particle::changeFace(const label tetTriI)
} }
// Get the old topology // Get the old topology
const triFace triOldIs(currentTetIndices().faceTriIs(mesh_)); const triFace triOldIs(currentTetIndices(mesh).faceTriIs(mesh));
// Get the shared edge and the pre-rotation // Get the shared edge and the pre-rotation
edge sharedEdge; edge sharedEdge;
@ -268,11 +270,11 @@ void Foam::particle::changeFace(const label tetTriI)
// Find the face in the same cell that shares the edge, and the // Find the face in the same cell that shares the edge, and the
// corresponding tetrahedra point // corresponding tetrahedra point
tetPti_ = -1; tetPti_ = -1;
forAll(mesh_.cells()[celli_], cellFaceI) forAll(mesh.cells()[celli_], cellFaceI)
{ {
const label newFaceI = mesh_.cells()[celli_][cellFaceI]; const label newFaceI = mesh.cells()[celli_][cellFaceI];
const class face& newFace = mesh_.faces()[newFaceI]; const class face& newFace = mesh.faces()[newFaceI];
const label newOwner = mesh_.faceOwner()[newFaceI]; const label newOwner = mesh.faceOwner()[newFaceI];
// Exclude the current face // Exclude the current face
if (tetFacei_ == newFaceI) if (tetFacei_ == newFaceI)
@ -298,7 +300,7 @@ void Foam::particle::changeFace(const label tetTriI)
} }
// Make the edge index relative to the base point // Make the edge index relative to the base point
const label newBaseI = max(0, mesh_.tetBasePtIs()[newFaceI]); const label newBaseI = max(0, mesh.tetBasePtIs()[newFaceI]);
edgeI = (edgeI - newBaseI + newFace.size()) % newFace.size(); edgeI = (edgeI - newBaseI + newFace.size()) % newFace.size();
// If the edge is next the base point (i.e., the index is 0 or n - 1), // If the edge is next the base point (i.e., the index is 0 or n - 1),
@ -332,7 +334,7 @@ void Foam::particle::changeFace(const label tetTriI)
} }
// Get the new topology // Get the new topology
const triFace triNewIs = currentTetIndices().faceTriIs(mesh_); const triFace triNewIs = currentTetIndices(mesh).faceTriIs(mesh);
// Reflect to account for the change of triangle orientation on the new face // Reflect to account for the change of triangle orientation on the new face
reflect(); reflect();
@ -349,7 +351,7 @@ void Foam::particle::changeFace(const label tetTriI)
} }
void Foam::particle::changeCell() void Foam::particle::changeCell(const polyMesh& mesh)
{ {
if (debug) if (debug)
{ {
@ -357,9 +359,9 @@ void Foam::particle::changeCell()
} }
// Set the cell to be the one on the other side of the face // Set the cell to be the one on the other side of the face
const label ownerCellI = mesh_.faceOwner()[tetFacei_]; const label ownerCellI = mesh.faceOwner()[tetFacei_];
const bool isOwner = celli_ == ownerCellI; const bool isOwner = celli_ == ownerCellI;
celli_ = isOwner ? mesh_.faceNeighbour()[tetFacei_] : ownerCellI; celli_ = isOwner ? mesh.faceNeighbour()[tetFacei_] : ownerCellI;
// Reflect to account for the change of triangle orientation in the new cell // Reflect to account for the change of triangle orientation in the new cell
reflect(); reflect();
@ -368,6 +370,7 @@ void Foam::particle::changeCell()
void Foam::particle::locate void Foam::particle::locate
( (
const polyMesh& mesh,
const vector& position, const vector& position,
label celli, label celli,
const bool boundaryFail, const bool boundaryFail,
@ -382,7 +385,7 @@ void Foam::particle::locate
// Find the cell, if it has not been given // Find the cell, if it has not been given
if (celli < 0) if (celli < 0)
{ {
celli = mesh_.cellTree().findInside(position); celli = mesh.cellTree().findInside(position);
} }
if (celli < 0) if (celli < 0)
{ {
@ -393,17 +396,17 @@ void Foam::particle::locate
celli_ = celli; celli_ = celli;
// Track from the centre of the cell to the desired position // Track from the centre of the cell to the desired position
const vector displacement = position - mesh_.cellCentres()[celli_]; const vector displacement = position - mesh.cellCentres()[celli_];
// Loop all cell tets to find the one containing the position. Track // Loop all cell tets to find the one containing the position. Track
// through each tet from the cell centre. If a tet contains the position // through each tet from the cell centre. If a tet contains the position
// then the track will end with a single trackToTri. // then the track will end with a single trackToTri.
const class cell& c = mesh_.cells()[celli_]; const class cell& c = mesh.cells()[celli_];
scalar minF = vGreat; scalar minF = vGreat;
label minTetFacei = -1, minTetPti = -1; label minTetFacei = -1, minTetPti = -1;
forAll(c, cellTetFacei) forAll(c, cellTetFacei)
{ {
const class face& f = mesh_.faces()[c[cellTetFacei]]; const class face& f = mesh.faces()[c[cellTetFacei]];
for (label tetPti = 1; tetPti < f.size() - 1; ++ tetPti) for (label tetPti = 1; tetPti < f.size() - 1; ++ tetPti)
{ {
coordinates_ = barycentric(1, 0, 0, 0); coordinates_ = barycentric(1, 0, 0, 0);
@ -413,7 +416,7 @@ void Foam::particle::locate
reset(1); reset(1);
label tetTriI = -1; label tetTriI = -1;
const scalar f = trackToTri(displacement, 0, tetTriI); const scalar f = trackToTri(mesh, displacement, 0, tetTriI);
if (tetTriI == -1) if (tetTriI == -1)
{ {
@ -437,7 +440,7 @@ void Foam::particle::locate
facei_ = -1; facei_ = -1;
reset(1); reset(1);
track(displacement, 0); track(mesh, displacement, 0);
if (!onFace()) if (!onFace())
{ {
return; return;
@ -479,7 +482,6 @@ Foam::particle::particle
const label tetPti const label tetPti
) )
: :
mesh_(mesh),
coordinates_(coordinates), coordinates_(coordinates),
celli_(celli), celli_(celli),
tetFacei_(tetFacei), tetFacei_(tetFacei),
@ -500,7 +502,6 @@ Foam::particle::particle
const label celli const label celli
) )
: :
mesh_(mesh),
coordinates_(- vGreat, - vGreat, - vGreat, - vGreat), coordinates_(- vGreat, - vGreat, - vGreat, - vGreat),
celli_(celli), celli_(celli),
tetFacei_(-1), tetFacei_(-1),
@ -514,6 +515,7 @@ Foam::particle::particle
{ {
locate locate
( (
mesh,
position, position,
celli, celli,
false, false,
@ -524,23 +526,6 @@ Foam::particle::particle
Foam::particle::particle(const particle& p) Foam::particle::particle(const particle& p)
: :
mesh_(p.mesh_),
coordinates_(p.coordinates_),
celli_(p.celli_),
tetFacei_(p.tetFacei_),
tetPti_(p.tetPti_),
facei_(p.facei_),
stepFraction_(p.stepFraction_),
stepFractionBehind_(p.stepFractionBehind_),
nTracksBehind_(p.nTracksBehind_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
Foam::particle::particle(const particle& p, const polyMesh& mesh)
:
mesh_(mesh),
coordinates_(p.coordinates_), coordinates_(p.coordinates_),
celli_(p.celli_), celli_(p.celli_),
tetFacei_(p.tetFacei_), tetFacei_(p.tetFacei_),
@ -558,6 +543,7 @@ Foam::particle::particle(const particle& p, const polyMesh& mesh)
Foam::scalar Foam::particle::track Foam::scalar Foam::particle::track
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction const scalar fraction
) )
@ -567,13 +553,13 @@ Foam::scalar Foam::particle::track
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl; Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
} }
scalar f = trackToFace(displacement, fraction); scalar f = trackToFace(mesh, displacement, fraction);
while (onInternalFace()) while (onInternalFace(mesh))
{ {
changeCell(); changeCell(mesh);
f *= trackToFace(f*displacement, f*fraction); f *= trackToFace(mesh, f*displacement, f*fraction);
} }
return f; return f;
@ -582,6 +568,7 @@ Foam::scalar Foam::particle::track
Foam::scalar Foam::particle::trackToCell Foam::scalar Foam::particle::trackToCell
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction const scalar fraction
) )
@ -591,11 +578,11 @@ Foam::scalar Foam::particle::trackToCell
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl; Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
} }
const scalar f = trackToFace(displacement, fraction); const scalar f = trackToFace(mesh, displacement, fraction);
if (onInternalFace()) if (onInternalFace(mesh))
{ {
changeCell(); changeCell(mesh);
} }
return f; return f;
@ -604,6 +591,7 @@ Foam::scalar Foam::particle::trackToCell
Foam::scalar Foam::particle::trackToFace Foam::scalar Foam::particle::trackToFace
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction const scalar fraction
) )
@ -622,7 +610,7 @@ Foam::scalar Foam::particle::trackToFace
// Loop the tets in the current cell // Loop the tets in the current cell
while (nTracksBehind_ < maxNTracksBehind_) while (nTracksBehind_ < maxNTracksBehind_)
{ {
f *= trackToTri(f*displacement, f*fraction, tetTriI); f *= trackToTri(mesh, f*displacement, f*fraction, tetTriI);
if (tetTriI == -1) if (tetTriI == -1)
{ {
@ -638,13 +626,14 @@ Foam::scalar Foam::particle::trackToFace
else else
{ {
// Move to the next tet and continue the track // Move to the next tet and continue the track
changeTet(tetTriI); changeTet(mesh, tetTriI);
} }
} }
// Warn if stuck, and incorrectly advance the step fraction to completion // Warn if stuck, and incorrectly advance the step fraction to completion
WarningInFunction WarningInFunction
<< "Particle #" << origId_ << " got stuck at " << position() << endl; << "Particle #" << origId_ << " got stuck at " << position(mesh)
<< endl;
stepFraction_ += f*fraction; stepFraction_ += f*fraction;
@ -657,12 +646,13 @@ Foam::scalar Foam::particle::trackToFace
Foam::scalar Foam::particle::trackToStationaryTri Foam::scalar Foam::particle::trackToStationaryTri
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction, const scalar fraction,
label& tetTriI label& tetTriI
) )
{ {
const vector x0 = position(); const vector x0 = position(mesh);
const vector x1 = displacement; const vector x1 = displacement;
const barycentric y0 = coordinates_; const barycentric y0 = coordinates_;
@ -676,12 +666,12 @@ Foam::scalar Foam::particle::trackToStationaryTri
vector centre; vector centre;
scalar detA; scalar detA;
barycentricTensor T; barycentricTensor T;
stationaryTetReverseTransform(centre, detA, T); stationaryTetReverseTransform(mesh, centre, detA, T);
if (debug) if (debug)
{ {
vector o, b, v1, v2; vector o, b, v1, v2;
stationaryTetGeometry(o, b, v1, v2); stationaryTetGeometry(mesh, o, b, v1, v2);
Info<< "Tet points o=" << o << ", b=" << b Info<< "Tet points o=" << o << ", b=" << b
<< ", v1=" << v1 << ", v2=" << v2 << endl << ", v1=" << v1 << ", v2=" << v2 << endl
<< "Tet determinant = " << detA << endl << "Tet determinant = " << detA << endl
@ -762,8 +752,8 @@ Foam::scalar Foam::particle::trackToStationaryTri
Info<< "Track hit no tet faces" << endl; Info<< "Track hit no tet faces" << endl;
} }
Info<< "End local coordinates = " << yH << endl Info<< "End local coordinates = " << yH << endl
<< "End global coordinates = " << position() << endl << "End global coordinates = " << position(mesh) << endl
<< "Tracking displacement = " << position() - x0 << endl << "Tracking displacement = " << position(mesh) - x0 << endl
<< muH*detA*100 << "% of the step from " << muH*detA*100 << "% of the step from "
<< stepFraction_ - fraction*muH*detA << " to " << stepFraction_ - fraction*muH*detA << " to "
<< stepFraction_ - fraction*muH*detA + fraction << stepFraction_ - fraction*muH*detA + fraction
@ -792,12 +782,13 @@ Foam::scalar Foam::particle::trackToStationaryTri
Foam::scalar Foam::particle::trackToMovingTri Foam::scalar Foam::particle::trackToMovingTri
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction, const scalar fraction,
label& tetTriI label& tetTriI
) )
{ {
const vector x0 = position(); const vector x0 = position(mesh);
const vector x1 = displacement; const vector x1 = displacement;
const barycentric y0 = coordinates_; const barycentric y0 = coordinates_;
@ -811,12 +802,12 @@ Foam::scalar Foam::particle::trackToMovingTri
Pair<vector> centre; Pair<vector> centre;
FixedList<scalar, 4> detA; FixedList<scalar, 4> detA;
FixedList<barycentricTensor, 3> T; FixedList<barycentricTensor, 3> T;
movingTetReverseTransform(fraction, centre, detA, T); movingTetReverseTransform(mesh, fraction, centre, detA, T);
if (debug) if (debug)
{ {
Pair<vector> o, b, v1, v2; Pair<vector> o, b, v1, v2;
movingTetGeometry(fraction, o, b, v1, v2); movingTetGeometry(mesh, fraction, o, b, v1, v2);
Info<< "Tet points o=" << o[0] << ", b=" << b[0] Info<< "Tet points o=" << o[0] << ", b=" << b[0]
<< ", v1=" << v1[0] << ", v2=" << v2[0] << endl << ", v1=" << v1[0] << ", v2=" << v2[0] << endl
<< "Tet determinant = " << detA[0] << endl << "Tet determinant = " << detA[0] << endl
@ -959,8 +950,8 @@ Foam::scalar Foam::particle::trackToMovingTri
Info<< "Track hit no tet faces" << endl; Info<< "Track hit no tet faces" << endl;
} }
Info<< "End local coordinates = " << yH << endl Info<< "End local coordinates = " << yH << endl
<< "End global coordinates = " << position() << endl << "End global coordinates = " << position(mesh) << endl
<< "Tracking displacement = " << position() - x0 << endl << "Tracking displacement = " << position(mesh) - x0 << endl
<< muH*detA[0]*100 << "% of the step from " << muH*detA[0]*100 << "% of the step from "
<< stepFraction_ - fraction*muH*detA[0] << " to " << stepFraction_ - fraction*muH*detA[0] << " to "
<< stepFraction_ - fraction*muH*detA[0] + fraction << stepFraction_ - fraction*muH*detA[0] + fraction
@ -989,28 +980,32 @@ Foam::scalar Foam::particle::trackToMovingTri
Foam::scalar Foam::particle::trackToTri Foam::scalar Foam::particle::trackToTri
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction, const scalar fraction,
label& tetTriI label& tetTriI
) )
{ {
if (mesh_.moving() && (stepFraction_ != 1 || fraction != 0)) if (mesh.moving() && (stepFraction_ != 1 || fraction != 0))
{ {
return trackToMovingTri(displacement, fraction, tetTriI); return trackToMovingTri(mesh, displacement, fraction, tetTriI);
} }
else else
{ {
return trackToStationaryTri(displacement, fraction, tetTriI); return trackToStationaryTri(mesh, displacement, fraction, tetTriI);
} }
} }
Foam::vector Foam::particle::deviationFromMeshCentre() const Foam::vector Foam::particle::deviationFromMeshCentre
(
const polyMesh& mesh
) const
{ {
if (cmptMin(mesh_.geometricD()) == -1) if (cmptMin(mesh.geometricD()) == -1)
{ {
vector pos = position(), posC = pos; vector pos = position(mesh), posC = pos;
meshTools::constrainToMeshCentre(mesh_, posC); meshTools::constrainToMeshCentre(mesh, posC);
return pos - posC; return pos - posC;
} }
else else
@ -1029,7 +1024,7 @@ void Foam::particle::prepareForParallelTransfer
trackingData& td trackingData& td
) )
{ {
if (td.sendFromPatch == patch()) if (td.sendFromPatch == patch(td.mesh))
{ {
prepareForProcessorTransfer(td); prepareForProcessorTransfer(td);
} }
@ -1037,6 +1032,7 @@ void Foam::particle::prepareForParallelTransfer
{ {
prepareForNonConformalCyclicTransfer prepareForNonConformalCyclicTransfer
( (
td.mesh,
td.sendFromPatch, td.sendFromPatch,
td.sendToPatchFace td.sendToPatchFace
); );
@ -1046,7 +1042,7 @@ void Foam::particle::prepareForParallelTransfer
void Foam::particle::correctAfterParallelTransfer(trackingData& td) void Foam::particle::correctAfterParallelTransfer(trackingData& td)
{ {
const polyPatch& pp = mesh_.boundaryMesh()[td.sendToPatch]; const polyPatch& pp = td.mesh.boundaryMesh()[td.sendToPatch];
if (isA<processorPolyPatch>(pp)) if (isA<processorPolyPatch>(pp))
{ {
@ -1054,7 +1050,7 @@ void Foam::particle::correctAfterParallelTransfer(trackingData& td)
} }
else if (isA<nonConformalCyclicPolyPatch>(pp)) else if (isA<nonConformalCyclicPolyPatch>(pp))
{ {
correctAfterNonConformalCyclicTransfer(td.sendToPatch); correctAfterNonConformalCyclicTransfer(td.mesh, td.sendToPatch);
} }
else else
{ {
@ -1075,7 +1071,10 @@ void Foam::particle::prepareForProcessorTransfer(trackingData& td)
void Foam::particle::correctAfterProcessorTransfer(trackingData& td) void Foam::particle::correctAfterProcessorTransfer(trackingData& td)
{ {
const processorPolyPatch& ppp = const processorPolyPatch& ppp =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[td.sendToPatch]); refCast<const processorPolyPatch>
(
td.mesh.boundaryMesh()[td.sendToPatch]
);
if (ppp.transform().transformsPosition()) if (ppp.transform().transformsPosition())
{ {
@ -1091,7 +1090,7 @@ void Foam::particle::correctAfterProcessorTransfer(trackingData& td)
// directions as their normals both point away from their connected // directions as their normals both point away from their connected
// cells. The tet point therefore counts in the opposite direction from // cells. The tet point therefore counts in the opposite direction from
// the base point. // the base point.
tetPti_ = mesh_.faces()[tetFacei_].size() - 1 - tetPti_; tetPti_ = td.mesh.faces()[tetFacei_].size() - 1 - tetPti_;
// Reflect to account for the change of tri orientation in the new cell // Reflect to account for the change of tri orientation in the new cell
reflect(); reflect();
@ -1105,16 +1104,20 @@ void Foam::particle::correctAfterProcessorTransfer(trackingData& td)
void Foam::particle::prepareForNonConformalCyclicTransfer void Foam::particle::prepareForNonConformalCyclicTransfer
( (
const polyMesh& mesh,
const label sendFromPatch, const label sendFromPatch,
const label sendToPatchFace const label sendToPatchFace
) )
{ {
const nonConformalCyclicPolyPatch& nccpp = const nonConformalCyclicPolyPatch& nccpp =
static_cast<const nonConformalCyclicPolyPatch&> static_cast<const nonConformalCyclicPolyPatch&>
(mesh_.boundaryMesh()[sendFromPatch]); (
mesh.boundaryMesh()[sendFromPatch]
);
// Get the transformed position // Get the transformed position
const vector pos = nccpp.transform().invTransformPosition(position()); const vector pos =
nccpp.transform().invTransformPosition(position(mesh));
// Store the position in the barycentric data // Store the position in the barycentric data
coordinates_ = barycentric(1 - cmptSum(pos), pos.x(), pos.y(), pos.z()); coordinates_ = barycentric(1 - cmptSum(pos), pos.x(), pos.y(), pos.z());
@ -1137,12 +1140,15 @@ void Foam::particle::prepareForNonConformalCyclicTransfer
void Foam::particle::correctAfterNonConformalCyclicTransfer void Foam::particle::correctAfterNonConformalCyclicTransfer
( (
const polyMesh& mesh,
const label sendToPatch const label sendToPatch
) )
{ {
const nonConformalCyclicPolyPatch& nccpp = const nonConformalCyclicPolyPatch& nccpp =
static_cast<const nonConformalCyclicPolyPatch&> static_cast<const nonConformalCyclicPolyPatch&>
(mesh_.boundaryMesh()[sendToPatch]); (
mesh.boundaryMesh()[sendToPatch]
);
// Get the position from the barycentric data // Get the position from the barycentric data
const vector receivePos const vector receivePos
@ -1155,8 +1161,9 @@ void Foam::particle::correctAfterNonConformalCyclicTransfer
// Locate the particle on the receiving side // Locate the particle on the receiving side
locate locate
( (
mesh,
receivePos, receivePos,
mesh_.faceOwner()[facei_ + nccpp.origPatch().start()], mesh.faceOwner()[facei_ + nccpp.origPatch().start()],
false, false,
"Particle crossed between " + nonConformalCyclicPolyPatch::typeName + "Particle crossed between " + nonConformalCyclicPolyPatch::typeName +
" patches " + nccpp.name() + " and " + nccpp.nbrPatch().name() + " patches " + nccpp.name() + " and " + nccpp.nbrPatch().name() +
@ -1171,11 +1178,12 @@ void Foam::particle::correctAfterNonConformalCyclicTransfer
void Foam::particle::prepareForInteractionListReferral void Foam::particle::prepareForInteractionListReferral
( (
const polyMesh& mesh,
const transformer& transform const transformer& transform
) )
{ {
// Get the transformed position // Get the transformed position
const vector pos = transform.invTransformPosition(position()); const vector pos = transform.invTransformPosition(position(mesh));
// Break the topology // Break the topology
celli_ = -1; celli_ = -1;
@ -1193,14 +1201,18 @@ void Foam::particle::prepareForInteractionListReferral
} }
void Foam::particle::correctAfterInteractionListReferral(const label celli) void Foam::particle::correctAfterInteractionListReferral
(
const polyMesh& mesh,
const label celli
)
{ {
// Get the position from the barycentric data // Get the position from the barycentric data
const vector pos(coordinates_.b(), coordinates_.c(), coordinates_.d()); const vector pos(coordinates_.b(), coordinates_.c(), coordinates_.d());
// Create some arbitrary topology for the supplied cell // Create some arbitrary topology for the supplied cell
celli_ = celli; celli_ = celli;
tetFacei_ = mesh_.cells()[celli_][0]; tetFacei_ = mesh.cells()[celli_][0];
tetPti_ = 1; tetPti_ = 1;
// Get the reverse transform and directly set the coordinates from the // Get the reverse transform and directly set the coordinates from the
@ -1210,12 +1222,12 @@ void Foam::particle::correctAfterInteractionListReferral(const label celli)
// so this approximate topology is good enough. By using the nearby cell we // so this approximate topology is good enough. By using the nearby cell we
// minimise the error associated with the incorrect topology. // minimise the error associated with the incorrect topology.
coordinates_ = barycentric(1, 0, 0, 0); coordinates_ = barycentric(1, 0, 0, 0);
if (mesh_.moving() && stepFraction_ != 1) if (mesh.moving() && stepFraction_ != 1)
{ {
Pair<vector> centre; Pair<vector> centre;
FixedList<scalar, 4> detA; FixedList<scalar, 4> detA;
FixedList<barycentricTensor, 3> T; FixedList<barycentricTensor, 3> T;
movingTetReverseTransform(0, centre, detA, T); movingTetReverseTransform(mesh, 0, centre, detA, T);
coordinates_ += (pos - centre[0]) & T[0]/detA[0]; coordinates_ += (pos - centre[0]) & T[0]/detA[0];
} }
else else
@ -1223,7 +1235,7 @@ void Foam::particle::correctAfterInteractionListReferral(const label celli)
vector centre; vector centre;
scalar detA; scalar detA;
barycentricTensor T; barycentricTensor T;
stationaryTetReverseTransform(centre, detA, T); stationaryTetReverseTransform(mesh, centre, detA, T);
coordinates_ += (pos - centre) & T/detA; coordinates_ += (pos - centre) & T/detA;
} }
} }
@ -1231,6 +1243,7 @@ void Foam::particle::correctAfterInteractionListReferral(const label celli)
Foam::label Foam::particle::procTetPt Foam::label Foam::particle::procTetPt
( (
const polyMesh& mesh,
const polyMesh& procMesh, const polyMesh& procMesh,
const label procCell, const label procCell,
const label procTetFace const label procTetFace
@ -1242,7 +1255,7 @@ Foam::label Foam::particle::procTetPt
if if
( (
(mesh_.faceOwner()[tetFacei_] == celli_) (mesh.faceOwner()[tetFacei_] == celli_)
== (procMesh.faceOwner()[procTetFace] == procCell) == (procMesh.faceOwner()[procTetFace] == procCell)
) )
{ {
@ -1257,12 +1270,14 @@ Foam::label Foam::particle::procTetPt
void Foam::particle::autoMap void Foam::particle::autoMap
( (
const polyMesh& mesh,
const vector& position, const vector& position,
const polyTopoChangeMap& map const polyTopoChangeMap& map
) )
{ {
locate locate
( (
mesh,
position, position,
map.reverseCellMap()[celli_], map.reverseCellMap()[celli_],
true, true,

View File

@ -104,6 +104,9 @@ public:
// Public data // Public data
//- Reference to the mesh
const polyMesh& mesh;
//- Flag to indicate whether to keep particle (false = delete) //- Flag to indicate whether to keep particle (false = delete)
bool keepParticle; bool keepParticle;
@ -125,6 +128,7 @@ public:
template <class TrackCloudType> template <class TrackCloudType>
trackingData(const TrackCloudType& cloud) trackingData(const TrackCloudType& cloud)
: :
mesh(cloud.pMesh()),
keepParticle(false), keepParticle(false),
sendToProc(-1), sendToProc(-1),
sendFromPatch(-1), sendFromPatch(-1),
@ -138,9 +142,6 @@ private:
// Private Data // Private Data
//- Reference to the polyMesh database
const polyMesh& mesh_;
//- Coordinates of particle //- Coordinates of particle
barycentric coordinates_; barycentric coordinates_;
@ -200,6 +201,7 @@ private:
//- Get the vertices of the current tet //- Get the vertices of the current tet
inline void stationaryTetGeometry inline void stationaryTetGeometry
( (
const polyMesh& mesh,
vector& centre, vector& centre,
vector& base, vector& base,
vector& vertex1, vector& vertex1,
@ -211,7 +213,10 @@ private:
// cartesian position in the global coordinate system. The // cartesian position in the global coordinate system. The
// conversion is x = A & y, where x is the cartesian position, y is // conversion is x = A & y, where x is the cartesian position, y is
// the barycentric position and A is the transformation tensor. // the barycentric position and A is the transformation tensor.
inline barycentricTensor stationaryTetTransform() const; inline barycentricTensor stationaryTetTransform
(
const polyMesh& mesh
) const;
//- Get the reverse transform associated with the current tet. The //- Get the reverse transform associated with the current tet. The
// conversion is detA*y = (x - centre) & T. The variables x, y and // conversion is detA*y = (x - centre) & T. The variables x, y and
@ -222,6 +227,7 @@ private:
// degenerate tetrahedra. // degenerate tetrahedra.
void stationaryTetReverseTransform void stationaryTetReverseTransform
( (
const polyMesh& mesh,
vector& centre, vector& centre,
scalar& detA, scalar& detA,
barycentricTensor& T barycentricTensor& T
@ -232,6 +238,7 @@ private:
// second is a linear coefficient of the track fraction. // second is a linear coefficient of the track fraction.
inline void movingTetGeometry inline void movingTetGeometry
( (
const polyMesh& mesh,
const scalar endStepFraction, const scalar endStepFraction,
Pair<vector>& centre, Pair<vector>& centre,
Pair<vector>& base, Pair<vector>& base,
@ -245,6 +252,7 @@ private:
// returned for each component. // returned for each component.
inline Pair<barycentricTensor> movingTetTransform inline Pair<barycentricTensor> movingTetTransform
( (
const polyMesh& mesh,
const scalar endStepFraction const scalar endStepFraction
) const; ) const;
@ -256,6 +264,7 @@ private:
// tensor is quadratic. // tensor is quadratic.
void movingTetReverseTransform void movingTetReverseTransform
( (
const polyMesh& mesh,
const scalar endStepFraction, const scalar endStepFraction,
Pair<vector>& centre, Pair<vector>& centre,
FixedList<scalar, 4>& detA, FixedList<scalar, 4>& detA,
@ -281,13 +290,13 @@ private:
// Topology changes // Topology changes
//- Change tet within a cell. Called after a triangle is hit. //- Change tet within a cell. Called after a triangle is hit.
void changeTet(const label tetTriI); void changeTet(const polyMesh& mesh, const label tetTriI);
//- Change tet face within a cell. Called by changeTet. //- Change tet face within a cell. Called by changeTet.
void changeFace(const label tetTriI); void changeFace(const polyMesh& mesh, const label tetTriI);
//- Change cell. Called when the particle hits an internal face. //- Change cell. Called when the particle hits an internal face.
void changeCell(); void changeCell(const polyMesh& mesh);
// Geometry changes // Geometry changes
@ -295,6 +304,7 @@ private:
//- Locate the particle at the given position //- Locate the particle at the given position
void locate void locate
( (
const polyMesh& mesh,
const vector& position, const vector& position,
label celli, label celli,
const bool boundaryFail, const bool boundaryFail,
@ -400,38 +410,22 @@ public:
); );
//- Construct from Istream //- Construct from Istream
particle(const polyMesh& mesh, Istream&, bool readFields = true); particle(Istream&, bool readFields = true);
//- Construct as a copy //- Construct as a copy
particle(const particle& p); particle(const particle& p);
//- Construct as a copy with references to a new mesh //- Construct and return a clone
particle(const particle& p, const polyMesh& mesh);
//- Construct a clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new particle(*this)); return autoPtr<particle>(new particle(*this));
} }
//- Factory class to read-construct particles used for //- Construct from Istream and return
// parallel transfer static autoPtr<particle> New(Istream& is)
class iNew
{ {
const polyMesh& mesh_; return autoPtr<particle>(new particle(is));
}
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<particle> operator()(Istream& is) const
{
return autoPtr<particle>(new particle(mesh_, is, true));
}
};
//- Destructor //- Destructor
@ -446,9 +440,6 @@ public:
//- Get unique particle creation id //- Get unique particle creation id
inline label getNewParticleID() const; inline label getNewParticleID() const;
//- Return the mesh database
inline const polyMesh& mesh() const;
//- Return current particle coordinates //- Return current particle coordinates
inline const barycentric& coordinates() const; inline const barycentric& coordinates() const;
@ -490,37 +481,40 @@ public:
// return Pair<scalar>(0, 1), unless sub-cycling is in effect, in // return Pair<scalar>(0, 1), unless sub-cycling is in effect, in
// which case the values will reflect the span of the sub-cycle // which case the values will reflect the span of the sub-cycle
// within the time-step. // within the time-step.
inline Pair<scalar> stepFractionSpan() const; inline Pair<scalar> stepFractionSpan(const polyMesh& mesh) const;
//- Return the current fraction within the timestep. This differs //- Return the current fraction within the timestep. This differs
// from the stored step fraction due to sub-cycling. // from the stored step fraction due to sub-cycling.
inline scalar currentTimeFraction() const; inline scalar currentTimeFraction(const polyMesh& mesh) const;
//- Return the indices of the current tet that the //- Return the indices of the current tet that the
// particle occupies. // particle occupies.
inline tetIndices currentTetIndices() const; inline tetIndices currentTetIndices(const polyMesh& mesh) const;
//- Return the current tet transformation tensor //- Return the current tet transformation tensor
inline barycentricTensor currentTetTransform() const; inline barycentricTensor currentTetTransform
(
const polyMesh& mesh
) const;
//- Return the normal of the tri on tetFacei_ for the //- Return the normal of the tri on tetFacei_ for the
// current tet. // current tet.
inline vector normal() const; inline vector normal(const polyMesh& mesh) const;
//- Is the particle on a face? //- Is the particle on a face?
inline bool onFace() const; inline bool onFace() const;
//- Is the particle on an internal face? //- Is the particle on an internal face?
inline bool onInternalFace() const; inline bool onInternalFace(const polyMesh& mesh) const;
//- Is the particle on a boundary face? //- Is the particle on a boundary face?
inline bool onBoundaryFace() const; inline bool onBoundaryFace(const polyMesh& mesh) const;
//- Return the index of patch that the particle is on //- Return the index of patch that the particle is on
inline label patch() const; inline label patch(const polyMesh& mesh) const;
//- Return current particle position //- Return current particle position
inline vector position() const; inline vector position(const polyMesh& mesh) const;
// Track // Track
@ -538,6 +532,7 @@ public:
// returned. // returned.
scalar track scalar track
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction const scalar fraction
); );
@ -545,6 +540,7 @@ public:
//- As particle::track, but stops when a new cell is reached. //- As particle::track, but stops when a new cell is reached.
scalar trackToCell scalar trackToCell
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction const scalar fraction
); );
@ -552,6 +548,7 @@ public:
//- As particle::track, but stops when a face is hit. //- As particle::track, but stops when a face is hit.
scalar trackToFace scalar trackToFace
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction const scalar fraction
); );
@ -561,6 +558,7 @@ public:
// or -1 if the end position was reached. // or -1 if the end position was reached.
scalar trackToTri scalar trackToTri
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction, const scalar fraction,
label& tetTriI label& tetTriI
@ -569,6 +567,7 @@ public:
//- As particle::trackToTri, but for stationary meshes //- As particle::trackToTri, but for stationary meshes
scalar trackToStationaryTri scalar trackToStationaryTri
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction, const scalar fraction,
label& tetTriI label& tetTriI
@ -577,6 +576,7 @@ public:
//- As particle::trackToTri, but for moving meshes //- As particle::trackToTri, but for moving meshes
scalar trackToMovingTri scalar trackToMovingTri
( (
const polyMesh& mesh,
const vector& displacement, const vector& displacement,
const scalar fraction, const scalar fraction,
label& tetTriI label& tetTriI
@ -607,13 +607,18 @@ public:
//- Get the displacement from the mesh centre. Used to correct the //- Get the displacement from the mesh centre. Used to correct the
// particle position in cases with reduced dimensionality. Returns a // particle position in cases with reduced dimensionality. Returns a
// zero vector for three-dimensional cases. // zero vector for three-dimensional cases.
vector deviationFromMeshCentre() const; vector deviationFromMeshCentre(const polyMesh& mesh) const;
// Patch data // Patch data
//- Get the normal and displacement of the current patch location //- Get the normal and displacement of the current patch location
inline void patchData(vector& normal, vector& displacement) const; inline void patchData
(
const polyMesh& mesh,
vector& normal,
vector& displacement
) const;
// Transformations // Transformations
@ -648,6 +653,7 @@ public:
// topology and stores the cartesian position. // topology and stores the cartesian position.
void prepareForNonConformalCyclicTransfer void prepareForNonConformalCyclicTransfer
( (
const polyMesh& mesh,
const label sendToPatch, const label sendToPatch,
const label sendToPatchFace const label sendToPatchFace
); );
@ -655,7 +661,11 @@ public:
//- Make changes following a transfer across a non conformal cyclic //- Make changes following a transfer across a non conformal cyclic
// boundary. Locates the particle using the stored face index and // boundary. Locates the particle using the stored face index and
// cartesian position. // cartesian position.
void correctAfterNonConformalCyclicTransfer(const label sendToPatch); void correctAfterNonConformalCyclicTransfer
(
const polyMesh& mesh,
const label sendToPatch
);
// Interaction list referral // Interaction list referral
@ -664,13 +674,18 @@ public:
// particle can be referred. // particle can be referred.
void prepareForInteractionListReferral void prepareForInteractionListReferral
( (
const polyMesh& mesh,
const transformer& transform const transformer& transform
); );
//- Correct the topology after referral. Locates the particle relative //- Correct the topology after referral. Locates the particle relative
// to a nearby cell/tet. The particle may end up outside this cell/tet // to a nearby cell/tet. The particle may end up outside this cell/tet
// and cannot therefore be tracked. // and cannot therefore be tracked.
void correctAfterInteractionListReferral(const label celli); void correctAfterInteractionListReferral
(
const polyMesh& mesh,
const label celli
);
// Decompose and reconstruct // Decompose and reconstruct
@ -679,6 +694,7 @@ public:
// to or from the given mesh. // to or from the given mesh.
label procTetPt label procTetPt
( (
const polyMesh& mesh,
const polyMesh& procMesh, const polyMesh& procMesh,
const label procCell, const label procCell,
const label procTetFace const label procTetFace
@ -687,8 +703,13 @@ public:
// Mapping // Mapping
//- Map after a topology change //- Map after a mesh change
void autoMap(const vector& position, const polyTopoChangeMap& map); void autoMap
(
const polyMesh& mesh,
const point& position,
const polyTopoChangeMap& map
);
// I-O // I-O

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "particle.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "Time.H" #include "Time.H"
@ -30,15 +31,16 @@ License
void Foam::particle::stationaryTetGeometry void Foam::particle::stationaryTetGeometry
( (
const polyMesh& mesh,
vector& centre, vector& centre,
vector& base, vector& base,
vector& vertex1, vector& vertex1,
vector& vertex2 vector& vertex2
) const ) const
{ {
const triFace triIs(currentTetIndices().faceTriIs(mesh_)); const triFace triIs(currentTetIndices(mesh).faceTriIs(mesh));
const vectorField& ccs = mesh_.cellCentres(); const vectorField& ccs = mesh.cellCentres();
const pointField& pts = mesh_.points(); const pointField& pts = mesh.points();
centre = ccs[celli_]; centre = ccs[celli_];
base = pts[triIs[0]]; base = pts[triIs[0]];
@ -47,10 +49,13 @@ void Foam::particle::stationaryTetGeometry
} }
inline Foam::barycentricTensor Foam::particle::stationaryTetTransform() const inline Foam::barycentricTensor Foam::particle::stationaryTetTransform
(
const polyMesh& mesh
) const
{ {
vector centre, base, vertex1, vertex2; vector centre, base, vertex1, vertex2;
stationaryTetGeometry(centre, base, vertex1, vertex2); stationaryTetGeometry(mesh, centre, base, vertex1, vertex2);
return barycentricTensor(centre, base, vertex1, vertex2); return barycentricTensor(centre, base, vertex1, vertex2);
} }
@ -58,6 +63,7 @@ inline Foam::barycentricTensor Foam::particle::stationaryTetTransform() const
inline void Foam::particle::movingTetGeometry inline void Foam::particle::movingTetGeometry
( (
const polyMesh& mesh,
const scalar fraction, const scalar fraction,
Pair<vector>& centre, Pair<vector>& centre,
Pair<vector>& base, Pair<vector>& base,
@ -65,16 +71,16 @@ inline void Foam::particle::movingTetGeometry
Pair<vector>& vertex2 Pair<vector>& vertex2
) const ) const
{ {
const triFace triIs(currentTetIndices().faceTriIs(mesh_)); const triFace triIs(currentTetIndices(mesh).faceTriIs(mesh));
const pointField& ptsOld = mesh_.oldPoints(); const pointField& ptsOld = mesh.oldPoints();
const pointField& ptsNew = mesh_.points(); const pointField& ptsNew = mesh.points();
const vector ccOld = mesh_.oldCellCentres()[celli_]; const vector ccOld = mesh.oldCellCentres()[celli_];
const vector ccNew = mesh_.cellCentres()[celli_]; const vector ccNew = mesh.cellCentres()[celli_];
// Old and new points and cell centres are not sub-cycled. If we are sub- // Old and new points and cell centres are not sub-cycled. If we are sub-
// cycling, then we have to account for the timestep change here by // cycling, then we have to account for the timestep change here by
// modifying the fractions that we take of the old and new geometry. // modifying the fractions that we take of the old and new geometry.
const Pair<scalar> s = stepFractionSpan(); const Pair<scalar> s = stepFractionSpan(mesh);
const scalar f0 = s[0] + stepFraction_*s[1], f1 = fraction*s[1]; const scalar f0 = s[0] + stepFraction_*s[1], f1 = fraction*s[1];
centre[0] = ccOld + f0*(ccNew - ccOld); centre[0] = ccOld + f0*(ccNew - ccOld);
@ -91,11 +97,12 @@ inline void Foam::particle::movingTetGeometry
inline Foam::Pair<Foam::barycentricTensor> Foam::particle::movingTetTransform inline Foam::Pair<Foam::barycentricTensor> Foam::particle::movingTetTransform
( (
const polyMesh& mesh,
const scalar fraction const scalar fraction
) const ) const
{ {
Pair<vector> centre, base, vertex1, vertex2; Pair<vector> centre, base, vertex1, vertex2;
movingTetGeometry(fraction, centre, base, vertex1, vertex2); movingTetGeometry(mesh, fraction, centre, base, vertex1, vertex2);
return return
Pair<barycentricTensor> Pair<barycentricTensor>
@ -122,12 +129,6 @@ inline Foam::label Foam::particle::getNewParticleID() const
} }
inline const Foam::polyMesh& Foam::particle::mesh() const
{
return mesh_;
}
inline const Foam::barycentric& Foam::particle::coordinates() const inline const Foam::barycentric& Foam::particle::coordinates() const
{ {
return coordinates_; return coordinates_;
@ -194,12 +195,15 @@ inline Foam::label& Foam::particle::origId()
} }
inline Foam::Pair<Foam::scalar> Foam::particle::stepFractionSpan() const inline Foam::Pair<Foam::scalar> Foam::particle::stepFractionSpan
(
const polyMesh& mesh
) const
{ {
if (mesh_.time().subCycling()) if (mesh.time().subCycling())
{ {
const TimeState& tsNew = mesh_.time(); const TimeState& tsNew = mesh.time();
const TimeState& tsOld = mesh_.time().prevTimeState(); const TimeState& tsOld = mesh.time().prevTimeState();
const scalar tFrac = const scalar tFrac =
( (
@ -218,36 +222,45 @@ inline Foam::Pair<Foam::scalar> Foam::particle::stepFractionSpan() const
} }
inline Foam::scalar Foam::particle::currentTimeFraction() const inline Foam::scalar Foam::particle::currentTimeFraction
(
const polyMesh& mesh
) const
{ {
const Pair<scalar> s = stepFractionSpan(); const Pair<scalar> s = stepFractionSpan(mesh);
return s[0] + stepFraction_*s[1]; return s[0] + stepFraction_*s[1];
} }
inline Foam::tetIndices Foam::particle::currentTetIndices() const inline Foam::tetIndices Foam::particle::currentTetIndices
(
const polyMesh& mesh
) const
{ {
return tetIndices(celli_, tetFacei_, tetPti_); return tetIndices(celli_, tetFacei_, tetPti_);
} }
inline Foam::barycentricTensor Foam::particle::currentTetTransform() const inline Foam::barycentricTensor Foam::particle::currentTetTransform
(
const polyMesh& mesh
) const
{ {
if (mesh_.moving() && stepFraction_ != 1) if (mesh.moving() && stepFraction_ != 1)
{ {
return movingTetTransform(0)[0]; return movingTetTransform(mesh, 0)[0];
} }
else else
{ {
return stationaryTetTransform(); return stationaryTetTransform(mesh);
} }
} }
inline Foam::vector Foam::particle::normal() const inline Foam::vector Foam::particle::normal(const polyMesh& mesh) const
{ {
return currentTetIndices().faceTri(mesh_).normal(); return currentTetIndices(mesh).faceTri(mesh).normal();
} }
@ -257,27 +270,27 @@ inline bool Foam::particle::onFace() const
} }
inline bool Foam::particle::onInternalFace() const inline bool Foam::particle::onInternalFace(const polyMesh& mesh) const
{ {
return onFace() && mesh_.isInternalFace(facei_); return onFace() && mesh.isInternalFace(facei_);
} }
inline bool Foam::particle::onBoundaryFace() const inline bool Foam::particle::onBoundaryFace(const polyMesh& mesh) const
{ {
return onFace() && !mesh_.isInternalFace(facei_); return onFace() && !mesh.isInternalFace(facei_);
} }
inline Foam::label Foam::particle::patch() const inline Foam::label Foam::particle::patch(const polyMesh& mesh) const
{ {
return onFace() ? mesh_.boundaryMesh().whichPatch(facei_) : -1; return onFace() ? mesh.boundaryMesh().whichPatch(facei_) : -1;
} }
inline Foam::vector Foam::particle::position() const inline Foam::vector Foam::particle::position(const polyMesh& mesh) const
{ {
return currentTetTransform() & coordinates_; return currentTetTransform(mesh) & coordinates_;
} }
@ -289,19 +302,24 @@ inline void Foam::particle::reset(const scalar stepFraction)
} }
void Foam::particle::patchData(vector& normal, vector& displacement) const void Foam::particle::patchData
(
const polyMesh& mesh,
vector& normal,
vector& displacement
) const
{ {
if (!onBoundaryFace()) if (!onBoundaryFace(mesh))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Patch data was requested for a particle that isn't on a patch" << "Patch data was requested for a particle that isn't on a patch"
<< exit(FatalError); << exit(FatalError);
} }
if (mesh_.moving() && stepFraction_ != 1) if (mesh.moving() && stepFraction_ != 1)
{ {
Pair<vector> centre, base, vertex1, vertex2; Pair<vector> centre, base, vertex1, vertex2;
movingTetGeometry(1, centre, base, vertex1, vertex2); movingTetGeometry(mesh, 1, centre, base, vertex1, vertex2);
normal = triPointRef(base[0], vertex1[0], vertex2[0]).normal(); normal = triPointRef(base[0], vertex1[0], vertex2[0]).normal();
@ -315,7 +333,7 @@ void Foam::particle::patchData(vector& normal, vector& displacement) const
else else
{ {
vector centre, base, vertex1, vertex2; vector centre, base, vertex1, vertex2;
stationaryTetGeometry(centre, base, vertex1, vertex2); stationaryTetGeometry(mesh, centre, base, vertex1, vertex2);
normal = triPointRef(base, vertex1, vertex2).normal(); normal = triPointRef(base, vertex1, vertex2).normal();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,9 +43,8 @@ const std::size_t Foam::particle::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::particle::particle(const polyMesh& mesh, Istream& is, bool readFields) Foam::particle::particle(Istream& is, bool readFields)
: :
mesh_(mesh),
coordinates_(), coordinates_(),
celli_(-1), celli_(-1),
tetFacei_(-1), tetFacei_(-1),

View File

@ -126,13 +126,13 @@ void Foam::particle::hitFace
{ {
return; return;
} }
else if (onInternalFace()) else if (onInternalFace(td.mesh))
{ {
changeCell(); changeCell(td.mesh);
} }
else if (onBoundaryFace()) else if (onBoundaryFace(td.mesh))
{ {
forAll(cloud.patchNonConformalCyclicPatches()[p.patch()], i) forAll(cloud.patchNonConformalCyclicPatches()[p.patch(td.mesh)], i)
{ {
if if
( (
@ -140,7 +140,7 @@ void Foam::particle::hitFace
( (
displacement, displacement,
fraction, fraction,
cloud.patchNonConformalCyclicPatches()[p.patch()][i], cloud.patchNonConformalCyclicPatches()[p.patch(td.mesh)][i],
cloud, cloud,
ttd ttd
) )
@ -152,7 +152,7 @@ void Foam::particle::hitFace
if (!p.hitPatch(cloud, ttd)) if (!p.hitPatch(cloud, ttd))
{ {
const polyPatch& patch = mesh_.boundaryMesh()[p.patch()]; const polyPatch& patch = td.mesh.boundaryMesh()[p.patch(td.mesh)];
if (isA<wedgePolyPatch>(patch)) if (isA<wedgePolyPatch>(patch))
{ {
@ -205,7 +205,7 @@ Foam::scalar Foam::particle::trackToAndHitFace
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl; Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
} }
const scalar f = trackToFace(displacement, fraction); const scalar f = trackToFace(td.mesh, displacement, fraction);
hitFace(displacement, fraction, cloud, td); hitFace(displacement, fraction, cloud, td);
@ -243,26 +243,29 @@ void Foam::particle::hitSymmetryPlanePatch
template<class TrackCloudType> template<class TrackCloudType>
void Foam::particle::hitSymmetryPatch(TrackCloudType&, trackingData&) void Foam::particle::hitSymmetryPatch(TrackCloudType&, trackingData& td)
{ {
const vector nf = normal(); const vector nf = normal(td.mesh);
transformProperties(transformer::rotation(I - 2.0*nf*nf)); transformProperties(transformer::rotation(I - 2.0*nf*nf));
} }
template<class TrackCloudType> template<class TrackCloudType>
void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&) void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData& td)
{ {
const cyclicPolyPatch& cpp = const cyclicPolyPatch& cpp =
static_cast<const cyclicPolyPatch&>(mesh_.boundaryMesh()[patch()]); static_cast<const cyclicPolyPatch&>
(
td.mesh.boundaryMesh()[patch(td.mesh)]
);
const cyclicPolyPatch& receiveCpp = cpp.nbrPatch(); const cyclicPolyPatch& receiveCpp = cpp.nbrPatch();
// Set the topology // Set the topology
facei_ = tetFacei_ = cpp.transformGlobalFace(facei_); facei_ = tetFacei_ = cpp.transformGlobalFace(facei_);
celli_ = mesh_.faceOwner()[facei_]; celli_ = td.mesh.faceOwner()[facei_];
// See note in correctAfterParallelTransfer for tetPti addressing ... // See note in correctAfterParallelTransfer for tetPti addressing ...
tetPti_ = mesh_.faces()[tetFacei_].size() - 1 - tetPti_; tetPti_ = td.mesh.faces()[tetFacei_].size() - 1 - tetPti_;
// Reflect to account for the change of triangle orientation in the new cell // Reflect to account for the change of triangle orientation in the new cell
reflect(); reflect();
@ -285,7 +288,10 @@ void Foam::particle::hitCyclicAMIPatch
) )
{ {
const cyclicAMIPolyPatch& cpp = const cyclicAMIPolyPatch& cpp =
static_cast<const cyclicAMIPolyPatch&>(mesh_.boundaryMesh()[patch()]); static_cast<const cyclicAMIPolyPatch&>
(
td.mesh.boundaryMesh()[patch(td.mesh)]
);
const cyclicAMIPolyPatch& receiveCpp = cpp.nbrPatch(); const cyclicAMIPolyPatch& receiveCpp = cpp.nbrPatch();
if (debug) if (debug)
@ -296,9 +302,9 @@ void Foam::particle::hitCyclicAMIPatch
// Get the send patch data // Get the send patch data
vector sendNormal, sendDisplacement; vector sendNormal, sendDisplacement;
patchData(sendNormal, sendDisplacement); patchData(td.mesh, sendNormal, sendDisplacement);
vector pos = position(); vector pos = position(td.mesh);
const labelPair receiveIs = const labelPair receiveIs =
cpp.pointAMIAndFace cpp.pointAMIAndFace
@ -331,8 +337,9 @@ void Foam::particle::hitCyclicAMIPatch
// Locate the particle on the receiving side // Locate the particle on the receiving side
locate locate
( (
td.mesh,
pos, pos,
mesh_.faceOwner()[facei_], td.mesh.faceOwner()[facei_],
false, false,
"Particle crossed between " + cyclicAMIPolyPatch::typeName + "Particle crossed between " + cyclicAMIPolyPatch::typeName +
" patches " + cpp.name() + " and " + receiveCpp.name() + " patches " + cpp.name() + " and " + receiveCpp.name() +
@ -365,10 +372,10 @@ void Foam::particle::hitCyclicAMIPatch
// If on a boundary and the displacement points into the receiving face // If on a boundary and the displacement points into the receiving face
// then issue a warning and remove the particle // then issue a warning and remove the particle
if (onBoundaryFace()) if (onBoundaryFace(td.mesh))
{ {
vector receiveNormal, receiveDisplacement; vector receiveNormal, receiveDisplacement;
patchData(receiveNormal, receiveDisplacement); patchData(td.mesh, receiveNormal, receiveDisplacement);
if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0) if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
{ {
@ -399,20 +406,21 @@ bool Foam::particle::hitNonConformalCyclicPatch
{ {
const nonConformalCyclicPolyPatch& nccpp = const nonConformalCyclicPolyPatch& nccpp =
static_cast<const nonConformalCyclicPolyPatch&> static_cast<const nonConformalCyclicPolyPatch&>
(mesh_.boundaryMesh()[patchi]); (td.mesh.boundaryMesh()[patchi]);
const point sendPos = this->position(); const point sendPos = position(td.mesh);
// Get the send patch data // Get the send patch data
vector sendNormal, sendDisplacement; vector sendNormal, sendDisplacement;
patchData(sendNormal, sendDisplacement); patchData(td.mesh, sendNormal, sendDisplacement);
// Project the particle through the non-conformal patch // Project the particle through the non-conformal patch
point receivePos; point receivePos;
const patchToPatch::procFace receiveProcFace = const patchToPatch::procFace receiveProcFace =
nccpp.ray nccpp.ray
( (
stepFractionSpan()[0] + stepFraction_*stepFractionSpan()[1], stepFractionSpan(td.mesh)[0]
+ stepFraction_*stepFractionSpan(td.mesh)[1],
nccpp.origPatch().whichFace(facei_), nccpp.origPatch().whichFace(facei_),
sendPos, sendPos,
displacement - fraction*sendDisplacement, displacement - fraction*sendDisplacement,
@ -439,11 +447,13 @@ bool Foam::particle::hitNonConformalCyclicPatch
// If both sides are on the same process, then do the local transfer // If both sides are on the same process, then do the local transfer
prepareForNonConformalCyclicTransfer prepareForNonConformalCyclicTransfer
( (
td.mesh,
nccpp.index(), nccpp.index(),
receiveProcFace.facei receiveProcFace.facei
); );
correctAfterNonConformalCyclicTransfer correctAfterNonConformalCyclicTransfer
( (
td.mesh,
nccpp.nbrPatchID() nccpp.nbrPatchID()
); );
@ -454,10 +464,11 @@ bool Foam::particle::hitNonConformalCyclicPatch
template<class TrackCloudType> template<class TrackCloudType>
void Foam::particle::hitProcessorPatch(TrackCloudType& cloud, trackingData& td) void Foam::particle::hitProcessorPatch(TrackCloudType& cloud, trackingData& td)
{ {
td.sendToProc = cloud.patchNbrProc()[patch()]; td.sendToProc = cloud.patchNbrProc()[patch(td.mesh)];
td.sendFromPatch = patch(); td.sendFromPatch = patch(td.mesh);
td.sendToPatch = cloud.patchNbrProcPatch()[patch()]; td.sendToPatch = cloud.patchNbrProcPatch()[patch(td.mesh)];
td.sendToPatchFace = mesh().boundaryMesh()[patch()].whichFace(face()); td.sendToPatchFace =
td.mesh.boundaryMesh()[patch(td.mesh)].whichFace(face());
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,14 +84,9 @@ public:
{} {}
//- Construct from Istream //- Construct from Istream
passiveParticle passiveParticle(Istream& is, bool readFields = true)
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
)
: :
particle(mesh, is, readFields) particle(is, readFields)
{} {}
//- Copy constructor //- Copy constructor
@ -105,6 +100,12 @@ public:
{ {
return autoPtr<particle>(new passiveParticle(*this)); return autoPtr<particle>(new passiveParticle(*this));
} }
//- Construct from Istream and return
static autoPtr<passiveParticle> New(Istream& is)
{
return autoPtr<passiveParticle>(new passiveParticle(is));
}
}; };

View File

@ -135,7 +135,7 @@ bool Foam::molecule::move
} }
} }
setSitePositions(constProps); setSitePositions(td.mesh, constProps);
} }
else if (td.part() == trackingData::tpVelocityHalfStep1) else if (td.part() == trackingData::tpVelocityHalfStep1)
{ {
@ -213,9 +213,15 @@ void Foam::molecule::transformProperties(const transformer& transform)
} }
void Foam::molecule::setSitePositions(const constantProperties& constProps) void Foam::molecule::setSitePositions
(
const polyMesh& mesh,
const constantProperties& constProps
)
{ {
sitePositions_ = position() + (Q_ & constProps.siteReferencePositions()); sitePositions_ =
position(mesh)
+ (Q_ & constProps.siteReferencePositions());
} }
@ -227,9 +233,9 @@ void Foam::molecule::setSiteSizes(label size)
} }
void Foam::molecule::hitWallPatch(moleculeCloud&, trackingData&) void Foam::molecule::hitWallPatch(moleculeCloud&, trackingData& td)
{ {
const vector nw = normal(); const vector nw = normal(td.mesh);
const scalar vn = v_ & nw; const scalar vn = v_ & nw;
// Specular reflection // Specular reflection

View File

@ -297,12 +297,7 @@ public:
); );
//- Construct from Istream //- Construct from Istream
molecule molecule(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone //- Construct and return a clone
autoPtr<particle> clone() const autoPtr<particle> clone() const
@ -310,24 +305,11 @@ public:
return autoPtr<particle>(new molecule(*this)); return autoPtr<particle>(new molecule(*this));
} }
//- Factory class to read-construct particles used for //- Construct from Istream and return
// parallel transfer static autoPtr<molecule> New(Istream& is)
class iNew
{ {
const polyMesh& mesh_; return autoPtr<molecule>(new molecule(is));
}
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<molecule> operator()(Istream& is) const
{
return autoPtr<molecule>(new molecule(mesh_, is, true));
}
};
// Member Functions // Member Functions
@ -338,7 +320,11 @@ public:
virtual void transformProperties(const transformer&); virtual void transformProperties(const transformer&);
void setSitePositions(const constantProperties& constProps); void setSitePositions
(
const polyMesh& mesh,
const constantProperties& constProps
);
void setSiteSizes(label size); void setSiteSizes(label size);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "molecule.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::molecule::constantProperties::constantProperties() inline Foam::molecule::constantProperties::constantProperties()
@ -250,7 +252,7 @@ inline Foam::molecule::molecule
siteForces_(constProps.nSites(), Zero), siteForces_(constProps.nSites(), Zero),
sitePositions_(constProps.nSites()) sitePositions_(constProps.nSites())
{ {
setSitePositions(constProps); setSitePositions(mesh, constProps);
} }
@ -285,7 +287,7 @@ inline Foam::molecule::molecule
siteForces_(constProps.nSites(), Zero), siteForces_(constProps.nSites(), Zero),
sitePositions_(constProps.nSites()) sitePositions_(constProps.nSites())
{ {
setSitePositions(constProps); setSitePositions(mesh, constProps);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,14 +37,9 @@ const std::size_t Foam::molecule::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::molecule::molecule Foam::molecule::molecule(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
particle(mesh, is, readFields), particle(is, readFields),
Q_(Zero), Q_(Zero),
v_(Zero), v_(Zero),
a_(Zero), a_(Zero),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -101,7 +101,7 @@ void Foam::moleculeCloud::setSiteSizesAndPositions()
mol().setSiteSizes(cP.nSites()); mol().setSiteSizes(cP.nSites());
mol().setSitePositions(cP); mol().setSitePositions(mesh(), cP);
} }
} }
@ -221,7 +221,7 @@ void Foam::moleculeCloud::calculateTetherForce()
{ {
if (mol().tethered()) if (mol().tethered())
{ {
vector rIT = mol().position() - mol().specialPosition(); vector rIT = mol().position(mesh()) - mol().specialPosition();
label idI = mol().id(); label idI = mol().id();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -95,7 +95,7 @@ inline void Foam::moleculeCloud::evaluatePair
molJ.potentialEnergy() += 0.5*potentialEnergy; molJ.potentialEnergy() += 0.5*potentialEnergy;
vector rIJ = molI.position() - molJ.position(); vector rIJ = molI.position(mesh()) - molJ.position(mesh());
tensor virialContribution = tensor virialContribution =
(rsIsJ*fsIsJ)*(rsIsJ & rIJ)/rsIsJMagSq; (rsIsJ*fsIsJ)*(rsIsJ & rIJ)/rsIsJMagSq;
@ -137,7 +137,7 @@ inline void Foam::moleculeCloud::evaluatePair
molJ.potentialEnergy() += 0.5*potentialEnergy; molJ.potentialEnergy() += 0.5*potentialEnergy;
vector rIJ = molI.position() - molJ.position(); vector rIJ = molI.position(mesh()) - molJ.position(mesh());
tensor virialContribution = tensor virialContribution =
(rsIsJ*fsIsJ)*(rsIsJ & rIJ)/rsIsJMagSq; (rsIsJ*fsIsJ)*(rsIsJ & rIJ)/rsIsJMagSq;

View File

@ -709,8 +709,8 @@ void Foam::MomentumCloud<CloudType>::patchData
vector& Up vector& Up
) const ) const
{ {
p.patchData(nw, Up); p.patchData(this->mesh(), nw, Up);
Up /= p.mesh().time().deltaTValue(); Up /= this->mesh().time().deltaTValue();
// If this is a wall patch, then there may be a non-zero tangential velocity // If this is a wall patch, then there may be a non-zero tangential velocity
// component; the lid velocity in a lid-driven cavity case, for example. We // component; the lid velocity in a lid-driven cavity case, for example. We
@ -731,7 +731,7 @@ void Foam::MomentumCloud<CloudType>::patchData
const vector& Uw0 = const vector& Uw0 =
U_.oldTime().boundaryField()[patchi][patchFacei]; U_.oldTime().boundaryField()[patchi][patchFacei];
const scalar f = p.currentTimeFraction(); const scalar f = p.currentTimeFraction(this->mesh());
const vector Uw = Uw0 + f*(Uw1 - Uw0); const vector Uw = Uw0 + f*(Uw1 - Uw0);

View File

@ -171,7 +171,7 @@ void Foam::SprayCloud<CloudType>::checkParcelProperties
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
// store the injection position and initial drop size // store the injection position and initial drop size
parcel.position0() = parcel.position(); parcel.position0() = parcel.position(this->mesh());
parcel.d0() = parcel.d(); parcel.d0() = parcel.d();
parcel.y() = breakup().y0(); parcel.y() = breakup().y0();

View File

@ -80,6 +80,8 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
<< exit(FatalError); << exit(FatalError);
} }
const polyMesh& mesh = this->mesh();
scalar distance = 0.0; scalar distance = 0.0;
const label nParcel = this->size(); const label nParcel = this->size();
@ -107,7 +109,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
{ {
const parcelType& p = iter(); const parcelType& p = iter();
scalar m = p.nParticle()*p.mass(); scalar m = p.nParticle()*p.mass();
scalar d = mag(p.position() - p.position0()); scalar d = mag(p.position(mesh) - p.position0());
mSum += m; mSum += m;
mass[i] = m; mass[i] = m;

View File

@ -41,21 +41,6 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
{} {}
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const CollidingParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
collisionRecords_(p.collisionRecords_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -232,53 +232,23 @@ public:
); );
//- Construct from Istream //- Construct from Istream
CollidingParcel CollidingParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy //- Construct as a copy
CollidingParcel(const CollidingParcel& p); CollidingParcel(const CollidingParcel& p);
//- Construct as a copy //- Construct and return a clone
CollidingParcel(const CollidingParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new CollidingParcel(*this)); return autoPtr<particle>(new CollidingParcel(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<CollidingParcel> New(Istream& is)
{ {
return autoPtr<particle>(new CollidingParcel(*this, mesh)); return autoPtr<CollidingParcel>(new CollidingParcel(is));
} }
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<CollidingParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<CollidingParcel<ParcelType>>
(
new CollidingParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,14 +62,14 @@ inline Foam::CollidingParcel<ParcelType>::constantProperties::constantProperties
template<class ParcelType> template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::CollidingParcel inline Foam::CollidingParcel<ParcelType>::CollidingParcel
( (
const polyMesh& owner, const polyMesh& mesh,
const barycentric& coordinates, const barycentric& coordinates,
const label celli, const label celli,
const label tetFacei, const label tetFacei,
const label tetPti const label tetPti
) )
: :
ParcelType(owner, coordinates, celli, tetFacei, tetPti), ParcelType(mesh, coordinates, celli, tetFacei, tetPti),
f_(Zero), f_(Zero),
angularMomentum_(Zero), angularMomentum_(Zero),
torque_(Zero), torque_(Zero),
@ -80,12 +80,12 @@ inline Foam::CollidingParcel<ParcelType>::CollidingParcel
template<class ParcelType> template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::CollidingParcel inline Foam::CollidingParcel<ParcelType>::CollidingParcel
( (
const polyMesh& owner, const polyMesh& mesh,
const vector& position, const vector& position,
const label celli const label celli
) )
: :
ParcelType(owner, position, celli), ParcelType(mesh, position, celli),
f_(Zero), f_(Zero),
angularMomentum_(Zero), angularMomentum_(Zero),
torque_(Zero), torque_(Zero),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,14 +44,9 @@ const std::size_t Foam::CollidingParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel Foam::CollidingParcel<ParcelType>::CollidingParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
f_(Zero), f_(Zero),
angularMomentum_(Zero), angularMomentum_(Zero),
torque_(Zero), torque_(Zero),

View File

@ -38,18 +38,6 @@ Foam::MPPICParcel<ParcelType>::MPPICParcel
{} {}
template<class ParcelType>
Foam::MPPICParcel<ParcelType>::MPPICParcel
(
const MPPICParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
UCorrect_(p.UCorrect_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -204,53 +204,23 @@ public:
); );
//- Construct from Istream //- Construct from Istream
MPPICParcel MPPICParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy //- Construct as a copy
MPPICParcel(const MPPICParcel& p); MPPICParcel(const MPPICParcel& p);
//- Construct as a copy //- Construct and return a clone
MPPICParcel(const MPPICParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new MPPICParcel(*this)); return autoPtr<particle>(new MPPICParcel(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<MPPICParcel> New(Istream& is)
{ {
return autoPtr<particle>(new MPPICParcel(*this, mesh)); return autoPtr<MPPICParcel>(new MPPICParcel(is));
} }
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<MPPICParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<MPPICParcel<ParcelType>>
(
new MPPICParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,19 +23,21 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "MPPICParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
inline Foam::MPPICParcel<ParcelType>::MPPICParcel inline Foam::MPPICParcel<ParcelType>::MPPICParcel
( (
const polyMesh& owner, const polyMesh& mesh,
const barycentric& coordinates, const barycentric& coordinates,
const label celli, const label celli,
const label tetFacei, const label tetFacei,
const label tetPti const label tetPti
) )
: :
ParcelType(owner, coordinates, celli, tetFacei, tetPti), ParcelType(mesh, coordinates, celli, tetFacei, tetPti),
UCorrect_(Zero) UCorrect_(Zero)
{} {}
@ -43,12 +45,12 @@ inline Foam::MPPICParcel<ParcelType>::MPPICParcel
template<class ParcelType> template<class ParcelType>
inline Foam::MPPICParcel<ParcelType>::MPPICParcel inline Foam::MPPICParcel<ParcelType>::MPPICParcel
( (
const polyMesh& owner, const polyMesh& mesh,
const vector& position, const vector& position,
const label celli const label celli
) )
: :
ParcelType(owner, position, celli), ParcelType(mesh, position, celli),
UCorrect_(Zero) UCorrect_(Zero)
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,14 +43,9 @@ const std::size_t Foam::MPPICParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::MPPICParcel<ParcelType>::MPPICParcel Foam::MPPICParcel<ParcelType>::MPPICParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
UCorrect_(Zero) UCorrect_(Zero)
{ {
if (readFields) if (readFields)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -174,7 +174,7 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
forAllConstIter(typename TrackCloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename TrackCloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices(cloud.mesh());
const scalar m = p.nParticle()*p.mass(); const scalar m = p.nParticle()*p.mass();
@ -192,7 +192,7 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
forAllConstIter(typename TrackCloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename TrackCloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices(cloud.mesh());
const vector u = uAverage_->interpolate(p.coordinates(), tetIs); const vector u = uAverage_->interpolate(p.coordinates(), tetIs);
@ -211,7 +211,7 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
forAllConstIter(typename TrackCloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename TrackCloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices(cloud.mesh());
weightAverage.add weightAverage.add
( (
@ -228,7 +228,7 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
forAllConstIter(typename TrackCloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename TrackCloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices(cloud.mesh());
const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs); const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs);
const scalar r = radiusAverage_->interpolate(p.coordinates(), tetIs); const scalar r = radiusAverage_->interpolate(p.coordinates(), tetIs);

View File

@ -44,7 +44,7 @@ void Foam::MomentumParcel<ParcelType>::setCellValues
trackingData& td trackingData& td
) )
{ {
tetIndices tetIs = this->currentTetIndices(); tetIndices tetIs = this->currentTetIndices(td.mesh);
td.rhoc() = td.rhoInterp().interpolate(this->coordinates(), tetIs); td.rhoc() = td.rhoInterp().interpolate(this->coordinates(), tetIs);
@ -250,27 +250,6 @@ Foam::MomentumParcel<ParcelType>::MomentumParcel
{} {}
template<class ParcelType>
Foam::MomentumParcel<ParcelType>::MomentumParcel
(
const MomentumParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
moving_(p.moving_),
typeId_(p.typeId_),
nParticle_(p.nParticle_),
d_(p.d_),
dTarget_(p.dTarget_),
U_(p.U_),
rho_(p.rho_),
age_(p.age_),
tTurb_(p.tTurb_),
UTurb_(p.UTurb_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
@ -296,7 +275,7 @@ bool Foam::MomentumParcel<ParcelType>::move
while (ttd.keepParticle && ttd.sendToProc == -1 && p.stepFraction() < 1) while (ttd.keepParticle && ttd.sendToProc == -1 && p.stepFraction() < 1)
{ {
// Cache the current position, cell and step-fraction // Cache the current position, cell and step-fraction
const point start = p.position(); const point start = p.position(td.mesh);
const scalar sfrac = p.stepFraction(); const scalar sfrac = p.stepFraction();
// Total displacement over the time-step // Total displacement over the time-step
@ -306,7 +285,7 @@ bool Foam::MomentumParcel<ParcelType>::move
const scalar l = cellLengthScale[p.cell()]; const scalar l = cellLengthScale[p.cell()];
// Deviation from the mesh centre for reduced-D cases // Deviation from the mesh centre for reduced-D cases
const vector d = p.deviationFromMeshCentre(); const vector d = p.deviationFromMeshCentre(td.mesh);
// Fraction of the displacement to track in this loop. This is limited // Fraction of the displacement to track in this loop. This is limited
// to ensure that the both the time and distance tracked is less than // to ensure that the both the time and distance tracked is less than
@ -317,7 +296,7 @@ bool Foam::MomentumParcel<ParcelType>::move
if (p.moving()) if (p.moving())
{ {
// Track to the next face // Track to the next face
p.trackToFace(f*s - d, f); p.trackToFace(td.mesh, f*s - d, f);
} }
else else
{ {
@ -377,7 +356,7 @@ bool Foam::MomentumParcel<ParcelType>::hitPatch
typename TrackCloudType::parcelType& p = typename TrackCloudType::parcelType& p =
static_cast<typename TrackCloudType::parcelType&>(*this); static_cast<typename TrackCloudType::parcelType&>(*this);
const polyPatch& pp = p.mesh().boundaryMesh()[p.patch()]; const polyPatch& pp = td.mesh.boundaryMesh()[p.patch(td.mesh)];
// Invoke post-processing model // Invoke post-processing model
cloud.functions().postPatch(p, pp, td.keepParticle); cloud.functions().postPatch(p, pp, td.keepParticle);
@ -406,14 +385,14 @@ template<class TrackCloudType>
void Foam::MomentumParcel<ParcelType>::hitWallPatch void Foam::MomentumParcel<ParcelType>::hitWallPatch
( (
TrackCloudType&, TrackCloudType&,
trackingData& trackingData& td
) )
{ {
const polyPatch& pp = this->mesh().boundaryMesh()[this->patch()]; const polyPatch& pp = td.mesh.boundaryMesh()[this->patch(td.mesh)];
FatalErrorInFunction FatalErrorInFunction
<< "Particle " << this->origId() << " hit " << pp.type() << " patch " << "Particle " << this->origId() << " hit " << pp.type() << " patch "
<< pp.name() << " at " << this->position() << pp.name() << " at " << this->position(td.mesh)
<< " but no interaction model was specified for this patch" << " but no interaction model was specified for this patch"
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -336,53 +336,23 @@ public:
); );
//- Construct from Istream //- Construct from Istream
MomentumParcel MomentumParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy //- Construct as a copy
MomentumParcel(const MomentumParcel& p); MomentumParcel(const MomentumParcel& p);
//- Construct as a copy //- Construct and return a clone
MomentumParcel(const MomentumParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new MomentumParcel(*this)); return autoPtr<particle>(new MomentumParcel(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<MomentumParcel> New(Istream& is)
{ {
return autoPtr<particle>(new MomentumParcel(*this, mesh)); return autoPtr<MomentumParcel>(new MomentumParcel(is));
} }
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<MomentumParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<MomentumParcel<ParcelType>>
(
new MomentumParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "MomentumParcel.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
using namespace Foam::constant::mathematical; using namespace Foam::constant::mathematical;
@ -72,14 +73,14 @@ inline Foam::MomentumParcel<ParcelType>::constantProperties::constantProperties
template<class ParcelType> template<class ParcelType>
inline Foam::MomentumParcel<ParcelType>::MomentumParcel inline Foam::MomentumParcel<ParcelType>::MomentumParcel
( (
const polyMesh& owner, const polyMesh& mesh,
const barycentric& coordinates, const barycentric& coordinates,
const label celli, const label celli,
const label tetFacei, const label tetFacei,
const label tetPti const label tetPti
) )
: :
ParcelType(owner, coordinates, celli, tetFacei, tetPti), ParcelType(mesh, coordinates, celli, tetFacei, tetPti),
moving_(true), moving_(true),
typeId_(-1), typeId_(-1),
nParticle_(0), nParticle_(0),
@ -305,7 +306,7 @@ inline Foam::scalar Foam::MomentumParcel<ParcelType>::massCell
const trackingData& td const trackingData& td
) const ) const
{ {
return td.rhoc()*this->mesh().cellVolumes()[this->cell()]; return td.rhoc()*td.mesh.cellVolumes()[this->cell()];
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,14 +45,9 @@ const std::size_t Foam::MomentumParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::MomentumParcel<ParcelType>::MomentumParcel Foam::MomentumParcel<ParcelType>::MomentumParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
moving_(false), moving_(false),
typeId_(0), typeId_(0),
nParticle_(0.0), nParticle_(0.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -723,21 +723,6 @@ Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
{} {}
template<class ParcelType>
Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
(
const ReactingMultiphaseParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
YGas_(p.YGas_),
YLiquid_(p.YLiquid_),
YSolid_(p.YSolid_),
canCombust_(p.canCombust_)
{}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ReactingMultiphaseParcelIO.C" #include "ReactingMultiphaseParcelIO.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -282,7 +282,7 @@ public:
// Constructors // Constructors
//- Construct from mesh, position and topology //- Construct from mesh, coordinates and topology
// Other properties initialised as null // Other properties initialised as null
inline ReactingMultiphaseParcel inline ReactingMultiphaseParcel
( (
@ -303,59 +303,26 @@ public:
); );
//- Construct from Istream //- Construct from Istream
ReactingMultiphaseParcel ReactingMultiphaseParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy //- Construct as a copy
ReactingMultiphaseParcel(const ReactingMultiphaseParcel& p); ReactingMultiphaseParcel(const ReactingMultiphaseParcel& p);
//- Construct as a copy //- Construct and return a clone
ReactingMultiphaseParcel
(
const ReactingMultiphaseParcel& p,
const polyMesh& mesh
);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new ReactingMultiphaseParcel(*this)); return autoPtr<particle>(new ReactingMultiphaseParcel(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<ReactingMultiphaseParcel> New(Istream& is)
{ {
return autoPtr<particle>(new ReactingMultiphaseParcel(*this, mesh)); return
} autoPtr<ReactingMultiphaseParcel>
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<ReactingMultiphaseParcel<ParcelType>> operator()
(
Istream& is
) const
{
return autoPtr<ReactingMultiphaseParcel<ParcelType>>
( (
new ReactingMultiphaseParcel<ParcelType>(mesh_, is, true) new ReactingMultiphaseParcel(is)
); );
} }
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "ReactingMultiphaseParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,12 +44,11 @@ const std::size_t Foam::ReactingMultiphaseParcel<ParcelType>::sizeofFields_
template<class ParcelType> template<class ParcelType>
Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
( (
const polyMesh& mesh,
Istream& is, Istream& is,
bool readFields bool readFields
) )
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
YGas_(0), YGas_(0),
YLiquid_(0), YLiquid_(0),
YSolid_(0), YSolid_(0),

View File

@ -189,19 +189,6 @@ Foam::ReactingParcel<ParcelType>::ReactingParcel
{} {}
template<class ParcelType>
Foam::ReactingParcel<ParcelType>::ReactingParcel
(
const ReactingParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
mass0_(p.mass0_),
Y_(p.Y_)
{}
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
@ -217,7 +204,7 @@ void Foam::ReactingParcel<ParcelType>::setCellValues
td.pc() = td.pInterp().interpolate td.pc() = td.pInterp().interpolate
( (
this->coordinates(), this->coordinates(),
this->currentTetIndices() this->currentTetIndices(td.mesh)
); );
if (td.pc() < cloud.constProps().pMin()) if (td.pc() < cloud.constProps().pMin())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -210,60 +210,23 @@ public:
); );
//- Construct from Istream //- Construct from Istream
ReactingParcel ReactingParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy
ReactingParcel
(
const ReactingParcel& p,
const polyMesh& mesh
);
//- Construct as a copy //- Construct as a copy
ReactingParcel(const ReactingParcel& p); ReactingParcel(const ReactingParcel& p);
//- Construct and return a (basic particle) clone //- Construct and return a clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new ReactingParcel<ParcelType>(*this)); return autoPtr<particle>(new ReactingParcel<ParcelType>(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<ReactingParcel> New(Istream& is)
{ {
return autoPtr<particle> return autoPtr<ReactingParcel>(new ReactingParcel(is));
(
new ReactingParcel<ParcelType>(*this, mesh)
);
} }
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<ReactingParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<ReactingParcel<ParcelType>>
(
new ReactingParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "ReactingParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,14 +42,9 @@ const std::size_t Foam::ReactingParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::ReactingParcel<ParcelType>::ReactingParcel Foam::ReactingParcel<ParcelType>::ReactingParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
mass0_(0.0), mass0_(0.0),
Y_(0) Y_(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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -171,7 +171,7 @@ void Foam::SprayParcel<ParcelType>::calcAtomisation
scalar soi = cloud.injectors().timeStart(); scalar soi = cloud.injectors().timeStart();
scalar currentTime = cloud.db().time().value(); scalar currentTime = cloud.db().time().value();
const vector& pos = this->position(); const vector& pos = this->position(td.mesh);
const vector& injectionPos = this->position0(); const vector& injectionPos = this->position0();
// Disregard the continuous phase when calculating the relative velocity // Disregard the continuous phase when calculating the relative velocity
@ -431,30 +431,6 @@ Foam::SprayParcel<ParcelType>::SprayParcel(const SprayParcel<ParcelType>& p)
{} {}
template<class ParcelType>
Foam::SprayParcel<ParcelType>::SprayParcel
(
const SprayParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
d0_(p.d0_),
position0_(p.position0_),
sigma_(p.sigma_),
mu_(p.mu_),
liquidCore_(p.liquidCore_),
KHindex_(p.KHindex_),
y_(p.y_),
yDot_(p.yDot_),
tc_(p.tc_),
ms_(p.ms_),
injector_(p.injector_),
tMom_(p.tMom_),
user_(p.user_)
{}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "SprayParcelIO.C" #include "SprayParcelIO.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -212,60 +212,23 @@ public:
); );
//- Construct from Istream //- Construct from Istream
SprayParcel SprayParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy
SprayParcel
(
const SprayParcel& p,
const polyMesh& mesh
);
//- Construct as a copy //- Construct as a copy
SprayParcel(const SprayParcel& p); SprayParcel(const SprayParcel& p);
//- Construct and return a (basic particle) clone //- Construct and return a clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new SprayParcel<ParcelType>(*this)); return autoPtr<particle>(new SprayParcel<ParcelType>(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<SprayParcel> New(Istream& is)
{ {
return autoPtr<particle> return autoPtr<SprayParcel>(new SprayParcel(is));
(
new SprayParcel<ParcelType>(*this, mesh)
);
} }
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<SprayParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<SprayParcel<ParcelType>>
(
new SprayParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SprayParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
@ -115,7 +117,7 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel
: :
ParcelType(mesh, coordinates, celli, tetFacei, tetPti), ParcelType(mesh, coordinates, celli, tetFacei, tetPti),
d0_(this->d()), d0_(this->d()),
position0_(this->position()), position0_(this->position(mesh)),
sigma_(0.0), sigma_(0.0),
mu_(0.0), mu_(0.0),
liquidCore_(0.0), liquidCore_(0.0),
@ -140,7 +142,7 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel
: :
ParcelType(mesh, position, celli), ParcelType(mesh, position, celli),
d0_(this->d()), d0_(this->d()),
position0_(this->position()), position0_(this->position(mesh)),
sigma_(0.0), sigma_(0.0),
mu_(0.0), mu_(0.0),
liquidCore_(0.0), liquidCore_(0.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,14 +38,9 @@ const std::size_t Foam::SprayParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::SprayParcel<ParcelType>::SprayParcel Foam::SprayParcel<ParcelType>::SprayParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
d0_(0.0), d0_(0.0),
position0_(Zero), position0_(Zero),
sigma_(0.0), sigma_(0.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,7 +41,7 @@ void Foam::ThermoParcel<ParcelType>::setCellValues
{ {
ParcelType::setCellValues(cloud, td); ParcelType::setCellValues(cloud, td);
tetIndices tetIs = this->currentTetIndices(); tetIndices tetIs = this->currentTetIndices(td.mesh);
td.Cpc() = td.CpInterp().interpolate(this->coordinates(), tetIs); td.Cpc() = td.CpInterp().interpolate(this->coordinates(), tetIs);
@ -123,7 +123,7 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
rhos = td.rhoc()*TRatio; rhos = td.rhoc()*TRatio;
tetIndices tetIs = this->currentTetIndices(); tetIndices tetIs = this->currentTetIndices(td.mesh);
mus = td.muInterp().interpolate(this->coordinates(), tetIs)/TRatio; mus = td.muInterp().interpolate(this->coordinates(), tetIs)/TRatio;
kappas = td.kappaInterp().interpolate(this->coordinates(), tetIs)/TRatio; kappas = td.kappaInterp().interpolate(this->coordinates(), tetIs)/TRatio;
@ -287,7 +287,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
scalar ancp = Sh; scalar ancp = Sh;
if (cloud.radiation()) if (cloud.radiation())
{ {
const tetIndices tetIs = this->currentTetIndices(); const tetIndices tetIs = this->currentTetIndices(td.mesh);
const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs); const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs);
const scalar sigma = physicoChemical::sigma.value(); const scalar sigma = physicoChemical::sigma.value();
const scalar epsilon = cloud.constProps().epsilon0(); const scalar epsilon = cloud.constProps().epsilon0();
@ -327,19 +327,6 @@ Foam::ThermoParcel<ParcelType>::ThermoParcel
{} {}
template<class ParcelType>
Foam::ThermoParcel<ParcelType>::ThermoParcel
(
const ThermoParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
T_(p.T_),
Cp_(p.Cp_)
{}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ThermoParcelIO.C" #include "ThermoParcelIO.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -327,53 +327,23 @@ public:
); );
//- Construct from Istream //- Construct from Istream
ThermoParcel ThermoParcel(Istream& is, bool readFields = true);
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy //- Construct as a copy
ThermoParcel(const ThermoParcel& p); ThermoParcel(const ThermoParcel& p);
//- Construct as a copy //- Construct and return a clone
ThermoParcel(const ThermoParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const virtual autoPtr<particle> clone() const
{ {
return autoPtr<particle>(new ThermoParcel(*this)); return autoPtr<particle>(new ThermoParcel(*this));
} }
//- Construct and return a (basic particle) clone //- Construct from Istream and return
virtual autoPtr<particle> clone(const polyMesh& mesh) const static autoPtr<ThermoParcel> New(Istream& is)
{ {
return autoPtr<particle>(new ThermoParcel(*this, mesh)); return autoPtr<ThermoParcel>(new ThermoParcel(is));
} }
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<ThermoParcel<ParcelType>> operator()(Istream& is) const
{
return autoPtr<ThermoParcel<ParcelType>>
(
new ThermoParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions // Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "ThermoParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,14 +43,9 @@ const std::size_t Foam::ThermoParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
Foam::ThermoParcel<ParcelType>::ThermoParcel Foam::ThermoParcel<ParcelType>::ThermoParcel(Istream& is, bool readFields)
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
: :
ParcelType(mesh, is, readFields), ParcelType(is, readFields),
T_(0.0), T_(0.0),
Cp_(0.0) Cp_(0.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -644,12 +644,20 @@ void Foam::ParticleCollector<CloudType>::postMove
{ {
case mtPolygon: case mtPolygon:
{ {
collectParcelPolygon(position0, p.position()); collectParcelPolygon
(
position0,
p.position(this->owner().mesh())
);
break; break;
} }
case mtConcentricCircle: case mtConcentricCircle:
{ {
collectParcelConcentricCircles(position0, p.position()); collectParcelConcentricCircles
(
position0,
p.position(this->owner().mesh())
);
break; break;
} }
default: default:

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -142,7 +142,7 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
{ {
cloudPtr_->append cloudPtr_->append
( (
static_cast<parcelType*>(p.clone(this->owner().mesh()).ptr()) static_cast<parcelType*>(p.clone().ptr())
); );
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,7 +53,7 @@ void Foam::RelativeVelocity<CloudType>::write()
- UcInterp->interpolate - UcInterp->interpolate
( (
iter().coordinates(), iter().coordinates(),
iter().currentTetIndices() iter().currentTetIndices(this->owner().mesh())
); );
++ i; ++ 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -139,7 +139,7 @@ Foam::vector Foam::DampingModels::Relaxation<CloudType>::velocityCorrection
const scalar deltaT const scalar deltaT
) const ) const
{ {
const tetIndices tetIs(p.currentTetIndices()); const tetIndices tetIs(p.currentTetIndices(this->owner().mesh()));
const scalar x = const scalar x =
deltaT*oneByTimeScaleAverage_->interpolate(p.coordinates(), tetIs); deltaT*oneByTimeScaleAverage_->interpolate(p.coordinates(), tetIs);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -166,7 +166,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), iter) forAllIter(typename CloudType, this->owner(), iter)
{ {
typename CloudType::parcelType& p = iter(); typename CloudType::parcelType& p = iter();
const tetIndices tetIs(p.currentTetIndices()); const tetIndices tetIs(p.currentTetIndices(mesh));
const scalar x = exponentAverage.interpolate(p.coordinates(), tetIs); const scalar x = exponentAverage.interpolate(p.coordinates(), tetIs);
@ -201,7 +201,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), iter) forAllIter(typename CloudType, this->owner(), iter)
{ {
typename CloudType::parcelType& p = iter(); typename CloudType::parcelType& p = iter();
const tetIndices tetIs(p.currentTetIndices()); const tetIndices tetIs(p.currentTetIndices(mesh));
uTildeAverage.add(p.coordinates(), tetIs, p.nParticle()*p.mass()*p.U()); uTildeAverage.add(p.coordinates(), tetIs, p.nParticle()*p.mass()*p.U());
} }
uTildeAverage.average(massAverage); uTildeAverage.average(massAverage);
@ -224,7 +224,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), iter) forAllIter(typename CloudType, this->owner(), iter)
{ {
typename CloudType::parcelType& p = iter(); typename CloudType::parcelType& p = iter();
const tetIndices tetIs(p.currentTetIndices()); const tetIndices tetIs(p.currentTetIndices(mesh));
const vector uTilde = uTildeAverage.interpolate(p.coordinates(), tetIs); const vector uTilde = uTildeAverage.interpolate(p.coordinates(), tetIs);
uTildeSqrAverage.add uTildeSqrAverage.add
( (
@ -239,7 +239,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), iter) forAllIter(typename CloudType, this->owner(), iter)
{ {
typename CloudType::parcelType& p = iter(); typename CloudType::parcelType& p = iter();
const tetIndices tetIs(p.currentTetIndices()); const tetIndices tetIs(p.currentTetIndices(mesh));
const vector u = uAverage.interpolate(p.coordinates(), tetIs); const vector u = uAverage.interpolate(p.coordinates(), tetIs);
const scalar uRms = const scalar uRms =

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -143,7 +143,7 @@ Foam::vector Foam::PackingModels::Explicit<CloudType>::velocityCorrection
const scalar deltaT const scalar deltaT
) const ) const
{ {
const tetIndices tetIs(p.currentTetIndices()); const tetIndices tetIs(p.currentTetIndices(this->owner().mesh()));
// interpolated quantities // interpolated quantities
const scalar alpha = const scalar alpha =

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -220,7 +220,7 @@ void Foam::PairCollision<CloudType>::wallInteraction()
typename CloudType::parcelType& p = typename CloudType::parcelType& p =
*cellOccupancy[realCelli][cellParticleI]; *cellOccupancy[realCelli][cellParticleI];
const point& pos = p.position(); const point& pos = p.position(mesh);
scalar r = wallModel_->pREff(p); scalar r = wallModel_->pREff(p);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "PairSpringSliderDashpot.H" #include "PairSpringSliderDashpot.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -172,7 +173,9 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
typename CloudType::parcelType& pB typename CloudType::parcelType& pB
) const ) const
{ {
vector r_AB = (pA.position() - pB.position()); const polyMesh& mesh = this->owner().mesh();
vector r_AB = pA.position(mesh) - pB.position(mesh);
scalar dAEff = pA.d(); scalar dAEff = pA.d();
@ -232,7 +235,7 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
U_AB - (U_AB & rHat_AB)*rHat_AB U_AB - (U_AB & rHat_AB)*rHat_AB
- ((dAEff/2*pA.omega() + dBEff/2*pB.omega()) ^ rHat_AB); - ((dAEff/2*pA.omega() + dBEff/2*pB.omega()) ^ rHat_AB);
scalar deltaT = this->owner().mesh().time().deltaTValue(); scalar deltaT = mesh.time().deltaTValue();
vector& tangentialOverlap_AB = vector& tangentialOverlap_AB =
pA.collisionRecords().matchPairRecord pA.collisionRecords().matchPairRecord

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,9 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "WallLocalSpringSliderDashpot.H" #include "WallLocalSpringSliderDashpot.H"
#include "polyMesh.H"
#include "wallPolyPatch.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -80,6 +83,8 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
bool cohesion bool cohesion
) const ) const
{ {
const polyMesh& mesh = this->owner().mesh();
// wall patch index // wall patch index
label wPI = patchMap_[data.patchIndex()]; label wPI = patchMap_[data.patchIndex()];
@ -92,7 +97,7 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
scalar cohesionEnergyDensity = cohesionEnergyDensity_[wPI]; scalar cohesionEnergyDensity = cohesionEnergyDensity_[wPI];
cohesion = cohesion && cohesion_[wPI]; cohesion = cohesion && cohesion_[wPI];
vector r_PW = p.position() - site; vector r_PW = p.position(mesh) - site;
vector U_PW = p.U() - data.wallData(); vector U_PW = p.U() - data.wallData();
@ -116,7 +121,7 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
{ {
fN_PW += fN_PW +=
-cohesionEnergyDensity -cohesionEnergyDensity
*mathematical::pi*(sqr(pREff) - sqr(r_PW_mag)) *constant::mathematical::pi*(sqr(pREff) - sqr(r_PW_mag))
*rHat_PW; *rHat_PW;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,6 +34,8 @@ Description
#define WallLocalSpringSliderDashpot_H #define WallLocalSpringSliderDashpot_H
#include "WallModel.H" #include "WallModel.H"
#include "scalarList.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,6 +40,7 @@ SourceFiles
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "WallSiteData.H" #include "WallSiteData.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "WallSpringSliderDashpot.H" #include "WallSpringSliderDashpot.H"
#include "polyMesh.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -81,7 +83,9 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
bool cohesion bool cohesion
) const ) const
{ {
vector r_PW = p.position() - site; const polyMesh& mesh = this->owner().mesh();
vector r_PW = p.position(mesh) - site;
vector U_PW = p.U() - data.wallData(); vector U_PW = p.U() - data.wallData();
@ -103,7 +107,7 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
{ {
fN_PW += fN_PW +=
-cohesionEnergyDensity_ -cohesionEnergyDensity_
*mathematical::pi*(sqr(pREff) - sqr(r_PW_mag)) *constant::mathematical::pi*(sqr(pREff) - sqr(r_PW_mag))
*rHat_PW; *rHat_PW;
} }

View File

@ -378,6 +378,8 @@ void Foam::ConeInjection<CloudType>::setProperties
typename CloudType::parcelType& parcel typename CloudType::parcelType& parcel
) )
{ {
const polyMesh& mesh = this->owner().mesh();
Random& rndGen = this->owner().rndGen(); Random& rndGen = this->owner().rndGen();
const scalar t = time - this->SOI_; const scalar t = time - this->SOI_;
@ -412,9 +414,9 @@ void Foam::ConeInjection<CloudType>::setProperties
} }
case imDisc: case imDisc:
{ {
const scalar r = mag(parcel.position() - position_.value(t)); const scalar r = mag(parcel.position(mesh) - position_.value(t));
const scalar frac = (2*r - dInner_)/(dOuter_ - dInner_); const scalar frac = (2*r - dInner_)/(dOuter_ - dInner_);
tanVec = normalised(parcel.position() - position_.value(t)); tanVec = normalised(parcel.position(mesh) - position_.value(t));
theta = theta =
degToRad degToRad
( (

View File

@ -286,7 +286,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
continue; continue;
} }
const point& pP = pPtr->position(); const point& pP = pPtr->position(mesh);
const vector& pU = pPtr->U(); const vector& pU = pPtr->U();
// Generate a tetrahedron of new positions with the // Generate a tetrahedron of new positions with the

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -73,7 +73,7 @@ Foam::forceSuSp Foam::ErgunWenYuDragForce<CloudType>::calcCoupled
this->alphacInterp().interpolate this->alphacInterp().interpolate
( (
p.coordinates(), p.coordinates(),
p.currentTetIndices() p.currentTetIndices(td.mesh)
); );
if (alphac < 0.8) if (alphac < 0.8)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,7 +74,7 @@ Foam::forceSuSp Foam::PlessisMasliyahDragForce<CloudType>::calcCoupled
this->alphacInterp().interpolate this->alphacInterp().interpolate
( (
p.coordinates(), p.coordinates(),
p.currentTetIndices() p.currentTetIndices(td.mesh)
); );
const scalar cbrtAlphap = pow(1 - alphac, 1.0/3.0); const scalar cbrtAlphap = pow(1 - alphac, 1.0/3.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -87,8 +87,9 @@ Foam::forceSuSp Foam::WenYuDragForce<CloudType>::calcCoupled
this->alphacInterp().interpolate this->alphacInterp().interpolate
( (
p.coordinates(), p.coordinates(),
p.currentTetIndices() p.currentTetIndices(td.mesh)
); );
const scalar CdRe = SchillerNaumannDragForce<CloudType>::CdRe(alphac*Re); const scalar CdRe = SchillerNaumannDragForce<CloudType>::CdRe(alphac*Re);
return forceSuSp return forceSuSp

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -138,10 +138,14 @@ Foam::forceSuSp Foam::LiftForce<CloudType>::calcCoupled
{ {
forceSuSp value(Zero, 0.0); forceSuSp value(Zero, 0.0);
vector curlUc = const vector curlUc =
curlUcInterp().interpolate(p.coordinates(), p.currentTetIndices()); curlUcInterp().interpolate
(
p.coordinates(),
p.currentTetIndices(td.mesh)
);
scalar Cl = this->Cl(p, td, curlUc, Re, muc); const scalar Cl = this->Cl(p, td, curlUc, Re, muc);
value.Su() = mass/p.rho()*td.rhoc()*Cl*((td.Uc() - p.U())^curlUc); value.Su() = mass/p.rho()*td.rhoc()*Cl*((td.Uc() - p.U())^curlUc);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -190,7 +190,7 @@ Foam::forceSuSp Foam::NonInertialFrameForce<CloudType>::calcNonCoupled
{ {
forceSuSp value(Zero, 0.0); forceSuSp value(Zero, 0.0);
const vector r = p.position() - centreOfRotation_; const vector r = p.position(td.mesh) - centreOfRotation_;
value.Su() = value.Su() =
mass mass

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -111,7 +111,11 @@ Foam::forceSuSp Foam::ParamagneticForce<CloudType>::calcNonCoupled
value.Su()= value.Su()=
mass*3.0*constant::electromagnetic::mu0.value()/p.rho() mass*3.0*constant::electromagnetic::mu0.value()/p.rho()
*magneticSusceptibility_/(magneticSusceptibility_ + 3) *magneticSusceptibility_/(magneticSusceptibility_ + 3)
*HdotGradHInterp.interpolate(p.coordinates(), p.currentTetIndices()); *HdotGradHInterp.interpolate
(
p.coordinates(),
p.currentTetIndices(td.mesh)
);
return value; return value;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -128,8 +128,12 @@ Foam::forceSuSp Foam::PressureGradientForce<CloudType>::calcCoupled
{ {
forceSuSp value(Zero, 0.0); forceSuSp value(Zero, 0.0);
vector DUcDt = const vector DUcDt =
DUcDtInterp().interpolate(p.coordinates(), p.currentTetIndices()); DUcDtInterp().interpolate
(
p.coordinates(),
p.currentTetIndices(td.mesh)
);
value.Su() = mass*td.rhoc()/p.rho()*DUcDt; value.Su() = mass*td.rhoc()/p.rho()*DUcDt;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,8 +50,8 @@ bool Foam::TrajectoryCollision<CloudType>::collideParcels
{ {
bool coalescence = false; bool coalescence = false;
const vector& pos1 = p1.position(); const point pos1 = p1.position(this->owner().mesh());
const vector& pos2 = p2.position(); const point pos2 = p2.position(this->owner().mesh());
const vector& U1 = p1.U(); const vector& U1 = p1.U();
const vector& U2 = p2.U(); const vector& U2 = p2.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -456,7 +456,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
} }
// Perturb new parcels towards the owner cell centre // Perturb new parcels towards the owner cell centre
pPtr->track(0.5*rndGen_.sample01<scalar>()*(posC - posCf), 0); pPtr->track(mesh, 0.5*rndGen_.sample01<scalar>()*(posC - posCf), 0);
pPtr->nParticle() = npNew[i]; pPtr->nParticle() = npNew[i];

View File

@ -49,7 +49,7 @@ bool Foam::solidParticle::move
{ {
if (debug) if (debug)
{ {
Info<< "Time = " << mesh().time().timeName() Info<< "Time = " << td.mesh.time().timeName()
<< " trackTime = " << trackTime << " trackTime = " << trackTime
<< " stepFraction() = " << stepFraction() << endl; << " stepFraction() = " << stepFraction() << endl;
} }
@ -62,7 +62,7 @@ bool Foam::solidParticle::move
const scalar dt = (stepFraction() - sfrac)*trackTime; const scalar dt = (stepFraction() - sfrac)*trackTime;
const tetIndices tetIs = this->currentTetIndices(); const tetIndices tetIs = this->currentTetIndices(td.mesh);
scalar rhoc = td.rhoInterp().interpolate(this->coordinates(), tetIs); scalar rhoc = td.rhoInterp().interpolate(this->coordinates(), tetIs);
vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs); vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs);
scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs); scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs);
@ -87,9 +87,13 @@ bool Foam::solidParticle::move
} }
void Foam::solidParticle::hitWallPatch(solidParticleCloud& cloud, trackingData&) void Foam::solidParticle::hitWallPatch
(
solidParticleCloud& cloud,
trackingData& td
)
{ {
const vector nw = normal(); const vector nw = normal(td.mesh);
const scalar Un = U_ & nw; const scalar Un = U_ & nw;
const vector Ut = U_ - Un*nw; const vector Ut = U_ - Un*nw;

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