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 "
<< iter().index()
<< " at position "
<< iter().position() << nl
<< iter().position(meshes.completeMesh())
<< nl
<< "Cell number should be between 0 and "
<< meshes.completeMesh().nCells()-1 << nl
<< "On this mesh the particle should"
<< " be in cell "
<< meshes.completeMesh().findCell
(iter().position())
(
iter().position
(
meshes.completeMesh()
)
)
<< exit(FatalError);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -88,7 +88,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
ppi.coordinates(),
procCelli,
mappedTetFace,
ppi.procTetPt(procMesh, procCelli, mappedTetFace)
ppi.procTetPt(mesh, procMesh, procCelli, mappedTetFace)
)
);
}

View File

@ -70,7 +70,7 @@ void Foam::reconstructLagrangianPositions
ppi.coordinates(),
mappedCell,
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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -84,7 +84,7 @@ void ensightParticlePositions
// Output positions
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{
const vector& p = elmnt().position();
const vector& p = elmnt().position(mesh);
ensightFile
<< setw(8) << ++nParcels

View File

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

View File

@ -1,21 +1,23 @@
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() << ' ';
}
gmvFile << nl;
pointField positions(particles.size());
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{
gmvFile << iter().position().z() << ' ';
label particlei = 0;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{
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)
{
@ -44,8 +46,6 @@ forAll(lagrangianScalarNames, i)
}
gmvFile << nl;
}
}
forAll(lagrangianVectorNames, i)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,7 +70,7 @@ Foam::lagrangianWriter::lagrangianWriter
DynamicList<floatScalar> partField(3*parcels.size());
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{
vtkWriteOps::insert(elmnt().position(), partField);
vtkWriteOps::insert(elmnt().position(mesh), partField);
}
vtkWriteOps::write(os_, binary_, partField);

View File

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

View File

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

View File

@ -159,7 +159,7 @@ int main(int argc, char *argv[])
label i = 0;
forAllConstIter(passiveParticleCloud, myCloud, iter)
{
allPositions[Pstream::myProcNo()][i] = iter().position();
allPositions[Pstream::myProcNo()][i] = iter().position(mesh);
allOrigIds[Pstream::myProcNo()][i] = iter().origId();
allOrigProcs[Pstream::myProcNo()][i] = iter().origProc();
i++;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -279,7 +279,8 @@ int main(int argc, char *argv[])
forAll(ids, 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()
<< nl;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -243,7 +243,7 @@ void Foam::DSMCCloud<ParcelType>::collisions()
forAll(cellParcels, i)
{
const ParcelType& p = *cellParcels[i];
vector relPos = p.position() - cC;
vector relPos = p.position(mesh()) - cC;
label subCell =
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)
{
const ParcelType& p = iter();
const point pos = iter().position(mesh());
pObj<< "v " << p.position().x()
<< " " << p.position().y()
<< " " << p.position().z()
<< nl;
pObj<< "v " << pos.x() << " " << pos.y() << " " << pos.z() << nl;
}
pObj.flush();

View File

@ -60,7 +60,7 @@ bool Foam::DSMCParcel<ParcelType>::move
meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking);
// 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();
p.trackToAndHitFace(f*trackTime*Utracking - d, f, cloud, td);
@ -78,12 +78,12 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
trackingData&
)
{
const label wppIndex = this->patch();
const label wppIndex = this->patch(cloud.pMesh());
const wallPolyPatch& wpp =
static_cast<const wallPolyPatch&>
(
this->mesh().boundaryMesh()[wppIndex]
cloud.pMesh().boundaryMesh()[wppIndex]
);
const label wppLocalFace = wpp.whichFace(this->face());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,7 +76,7 @@ class Cloud
// Private Data
//- Reference to the mesh
const polyMesh& polyMesh_;
const polyMesh& pMesh_;
//- Map from patch index to the neighbouring processor index
const labelList patchNbrProc_;
@ -165,7 +165,7 @@ public:
//- Return the polyMesh reference
const polyMesh& pMesh() const
{
return polyMesh_;
return pMesh_;
}
//- 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
// them, otherwise, if some processors have no particles then
// there is a comms mismatch.
polyMesh_.tetBasePtIs();
pMesh_.tetBasePtIs();
}
@ -148,7 +148,7 @@ Foam::Cloud<ParticleType>::Cloud
)
:
cloud(pMesh, cloudName),
polyMesh_(pMesh),
pMesh_(pMesh),
patchNbrProc_(patchNbrProc(pMesh)),
patchNbrProcPatch_(patchNbrProcPatch(pMesh)),
patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)),
@ -156,8 +156,8 @@ Foam::Cloud<ParticleType>::Cloud
{
checkPatches();
polyMesh_.tetBasePtIs();
polyMesh_.oldCellCentres();
pMesh_.tetBasePtIs();
pMesh_.oldCellCentres();
initCloud(checkClass);
}

View File

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

View File

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

View File

@ -45,12 +45,13 @@ namespace Foam
void Foam::particle::stationaryTetReverseTransform
(
const polyMesh& mesh,
vector& centre,
scalar& detA,
barycentricTensor& T
) const
{
barycentricTensor A = stationaryTetTransform();
barycentricTensor A = stationaryTetTransform(mesh);
const vector ab = A.b() - A.a();
const vector ac = A.c() - A.a();
@ -74,13 +75,14 @@ void Foam::particle::stationaryTetReverseTransform
void Foam::particle::movingTetReverseTransform
(
const polyMesh& mesh,
const scalar fraction,
Pair<vector>& centre,
FixedList<scalar, 4>& detA,
FixedList<barycentricTensor, 3>& T
) 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> 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)
{
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 lastTetPtI = mesh_.faces()[tetFacei_].size() - 2;
const label lastTetPtI = mesh.faces()[tetFacei_].size() - 2;
if (tetTriI == 1)
{
changeFace(tetTriI);
changeFace(mesh, tetTriI);
}
else if (tetTriI == 2)
{
@ -173,7 +175,7 @@ void Foam::particle::changeTet(const label tetTriI)
{
if (tetPti_ == lastTetPtI)
{
changeFace(tetTriI);
changeFace(mesh, tetTriI);
}
else
{
@ -185,7 +187,7 @@ void Foam::particle::changeTet(const label tetTriI)
{
if (tetPti_ == firstTetPtI)
{
changeFace(tetTriI);
changeFace(mesh, tetTriI);
}
else
{
@ -200,7 +202,7 @@ void Foam::particle::changeTet(const label tetTriI)
{
if (tetPti_ == firstTetPtI)
{
changeFace(tetTriI);
changeFace(mesh, tetTriI);
}
else
{
@ -212,7 +214,7 @@ void Foam::particle::changeTet(const label tetTriI)
{
if (tetPti_ == lastTetPtI)
{
changeFace(tetTriI);
changeFace(mesh, tetTriI);
}
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)
{
@ -239,7 +241,7 @@ void Foam::particle::changeFace(const label tetTriI)
}
// 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
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
// corresponding tetrahedra point
tetPti_ = -1;
forAll(mesh_.cells()[celli_], cellFaceI)
forAll(mesh.cells()[celli_], cellFaceI)
{
const label newFaceI = mesh_.cells()[celli_][cellFaceI];
const class face& newFace = mesh_.faces()[newFaceI];
const label newOwner = mesh_.faceOwner()[newFaceI];
const label newFaceI = mesh.cells()[celli_][cellFaceI];
const class face& newFace = mesh.faces()[newFaceI];
const label newOwner = mesh.faceOwner()[newFaceI];
// Exclude the current face
if (tetFacei_ == newFaceI)
@ -298,7 +300,7 @@ void Foam::particle::changeFace(const label tetTriI)
}
// 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();
// 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
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();
@ -349,7 +351,7 @@ void Foam::particle::changeFace(const label tetTriI)
}
void Foam::particle::changeCell()
void Foam::particle::changeCell(const polyMesh& mesh)
{
if (debug)
{
@ -357,9 +359,9 @@ void Foam::particle::changeCell()
}
// 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;
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();
@ -368,6 +370,7 @@ void Foam::particle::changeCell()
void Foam::particle::locate
(
const polyMesh& mesh,
const vector& position,
label celli,
const bool boundaryFail,
@ -382,7 +385,7 @@ void Foam::particle::locate
// Find the cell, if it has not been given
if (celli < 0)
{
celli = mesh_.cellTree().findInside(position);
celli = mesh.cellTree().findInside(position);
}
if (celli < 0)
{
@ -393,17 +396,17 @@ void Foam::particle::locate
celli_ = celli;
// 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
// through each tet from the cell centre. If a tet contains the position
// 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;
label minTetFacei = -1, minTetPti = -1;
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)
{
coordinates_ = barycentric(1, 0, 0, 0);
@ -413,7 +416,7 @@ void Foam::particle::locate
reset(1);
label tetTriI = -1;
const scalar f = trackToTri(displacement, 0, tetTriI);
const scalar f = trackToTri(mesh, displacement, 0, tetTriI);
if (tetTriI == -1)
{
@ -437,7 +440,7 @@ void Foam::particle::locate
facei_ = -1;
reset(1);
track(displacement, 0);
track(mesh, displacement, 0);
if (!onFace())
{
return;
@ -479,7 +482,6 @@ Foam::particle::particle
const label tetPti
)
:
mesh_(mesh),
coordinates_(coordinates),
celli_(celli),
tetFacei_(tetFacei),
@ -500,7 +502,6 @@ Foam::particle::particle
const label celli
)
:
mesh_(mesh),
coordinates_(- vGreat, - vGreat, - vGreat, - vGreat),
celli_(celli),
tetFacei_(-1),
@ -514,6 +515,7 @@ Foam::particle::particle
{
locate
(
mesh,
position,
celli,
false,
@ -524,23 +526,6 @@ Foam::particle::particle
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_),
celli_(p.celli_),
tetFacei_(p.tetFacei_),
@ -558,6 +543,7 @@ Foam::particle::particle(const particle& p, const polyMesh& mesh)
Foam::scalar Foam::particle::track
(
const polyMesh& mesh,
const vector& displacement,
const scalar fraction
)
@ -567,13 +553,13 @@ Foam::scalar Foam::particle::track
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;
@ -582,6 +568,7 @@ Foam::scalar Foam::particle::track
Foam::scalar Foam::particle::trackToCell
(
const polyMesh& mesh,
const vector& displacement,
const scalar fraction
)
@ -591,11 +578,11 @@ Foam::scalar Foam::particle::trackToCell
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;
@ -604,6 +591,7 @@ Foam::scalar Foam::particle::trackToCell
Foam::scalar Foam::particle::trackToFace
(
const polyMesh& mesh,
const vector& displacement,
const scalar fraction
)
@ -622,7 +610,7 @@ Foam::scalar Foam::particle::trackToFace
// Loop the tets in the current cell
while (nTracksBehind_ < maxNTracksBehind_)
{
f *= trackToTri(f*displacement, f*fraction, tetTriI);
f *= trackToTri(mesh, f*displacement, f*fraction, tetTriI);
if (tetTriI == -1)
{
@ -638,13 +626,14 @@ Foam::scalar Foam::particle::trackToFace
else
{
// 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
WarningInFunction
<< "Particle #" << origId_ << " got stuck at " << position() << endl;
<< "Particle #" << origId_ << " got stuck at " << position(mesh)
<< endl;
stepFraction_ += f*fraction;
@ -657,12 +646,13 @@ Foam::scalar Foam::particle::trackToFace
Foam::scalar Foam::particle::trackToStationaryTri
(
const polyMesh& mesh,
const vector& displacement,
const scalar fraction,
label& tetTriI
)
{
const vector x0 = position();
const vector x0 = position(mesh);
const vector x1 = displacement;
const barycentric y0 = coordinates_;
@ -676,12 +666,12 @@ Foam::scalar Foam::particle::trackToStationaryTri
vector centre;
scalar detA;
barycentricTensor T;
stationaryTetReverseTransform(centre, detA, T);
stationaryTetReverseTransform(mesh, centre, detA, T);
if (debug)
{
vector o, b, v1, v2;
stationaryTetGeometry(o, b, v1, v2);
stationaryTetGeometry(mesh, o, b, v1, v2);
Info<< "Tet points o=" << o << ", b=" << b
<< ", v1=" << v1 << ", v2=" << v2 << endl
<< "Tet determinant = " << detA << endl
@ -762,8 +752,8 @@ Foam::scalar Foam::particle::trackToStationaryTri
Info<< "Track hit no tet faces" << endl;
}
Info<< "End local coordinates = " << yH << endl
<< "End global coordinates = " << position() << endl
<< "Tracking displacement = " << position() - x0 << endl
<< "End global coordinates = " << position(mesh) << endl
<< "Tracking displacement = " << position(mesh) - x0 << endl
<< muH*detA*100 << "% of the step from "
<< stepFraction_ - fraction*muH*detA << " to "
<< stepFraction_ - fraction*muH*detA + fraction
@ -792,12 +782,13 @@ Foam::scalar Foam::particle::trackToStationaryTri
Foam::scalar Foam::particle::trackToMovingTri
(
const polyMesh& mesh,
const vector& displacement,
const scalar fraction,
label& tetTriI
)
{
const vector x0 = position();
const vector x0 = position(mesh);
const vector x1 = displacement;
const barycentric y0 = coordinates_;
@ -811,12 +802,12 @@ Foam::scalar Foam::particle::trackToMovingTri
Pair<vector> centre;
FixedList<scalar, 4> detA;
FixedList<barycentricTensor, 3> T;
movingTetReverseTransform(fraction, centre, detA, T);
movingTetReverseTransform(mesh, fraction, centre, detA, T);
if (debug)
{
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]
<< ", v1=" << v1[0] << ", v2=" << v2[0] << endl
<< "Tet determinant = " << detA[0] << endl
@ -959,8 +950,8 @@ Foam::scalar Foam::particle::trackToMovingTri
Info<< "Track hit no tet faces" << endl;
}
Info<< "End local coordinates = " << yH << endl
<< "End global coordinates = " << position() << endl
<< "Tracking displacement = " << position() - x0 << endl
<< "End global coordinates = " << position(mesh) << endl
<< "Tracking displacement = " << position(mesh) - x0 << endl
<< muH*detA[0]*100 << "% of the step from "
<< stepFraction_ - fraction*muH*detA[0] << " to "
<< stepFraction_ - fraction*muH*detA[0] + fraction
@ -989,28 +980,32 @@ Foam::scalar Foam::particle::trackToMovingTri
Foam::scalar Foam::particle::trackToTri
(
const polyMesh& mesh,
const vector& displacement,
const scalar fraction,
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
{
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;
meshTools::constrainToMeshCentre(mesh_, posC);
vector pos = position(mesh), posC = pos;
meshTools::constrainToMeshCentre(mesh, posC);
return pos - posC;
}
else
@ -1029,7 +1024,7 @@ void Foam::particle::prepareForParallelTransfer
trackingData& td
)
{
if (td.sendFromPatch == patch())
if (td.sendFromPatch == patch(td.mesh))
{
prepareForProcessorTransfer(td);
}
@ -1037,6 +1032,7 @@ void Foam::particle::prepareForParallelTransfer
{
prepareForNonConformalCyclicTransfer
(
td.mesh,
td.sendFromPatch,
td.sendToPatchFace
);
@ -1046,7 +1042,7 @@ void Foam::particle::prepareForParallelTransfer
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))
{
@ -1054,7 +1050,7 @@ void Foam::particle::correctAfterParallelTransfer(trackingData& td)
}
else if (isA<nonConformalCyclicPolyPatch>(pp))
{
correctAfterNonConformalCyclicTransfer(td.sendToPatch);
correctAfterNonConformalCyclicTransfer(td.mesh, td.sendToPatch);
}
else
{
@ -1075,7 +1071,10 @@ void Foam::particle::prepareForProcessorTransfer(trackingData& td)
void Foam::particle::correctAfterProcessorTransfer(trackingData& td)
{
const processorPolyPatch& ppp =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[td.sendToPatch]);
refCast<const processorPolyPatch>
(
td.mesh.boundaryMesh()[td.sendToPatch]
);
if (ppp.transform().transformsPosition())
{
@ -1091,7 +1090,7 @@ void Foam::particle::correctAfterProcessorTransfer(trackingData& td)
// directions as their normals both point away from their connected
// cells. The tet point therefore counts in the opposite direction from
// 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();
@ -1105,16 +1104,20 @@ void Foam::particle::correctAfterProcessorTransfer(trackingData& td)
void Foam::particle::prepareForNonConformalCyclicTransfer
(
const polyMesh& mesh,
const label sendFromPatch,
const label sendToPatchFace
)
{
const nonConformalCyclicPolyPatch& nccpp =
static_cast<const nonConformalCyclicPolyPatch&>
(mesh_.boundaryMesh()[sendFromPatch]);
(
mesh.boundaryMesh()[sendFromPatch]
);
// 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
coordinates_ = barycentric(1 - cmptSum(pos), pos.x(), pos.y(), pos.z());
@ -1137,12 +1140,15 @@ void Foam::particle::prepareForNonConformalCyclicTransfer
void Foam::particle::correctAfterNonConformalCyclicTransfer
(
const polyMesh& mesh,
const label sendToPatch
)
{
const nonConformalCyclicPolyPatch& nccpp =
static_cast<const nonConformalCyclicPolyPatch&>
(mesh_.boundaryMesh()[sendToPatch]);
(
mesh.boundaryMesh()[sendToPatch]
);
// Get the position from the barycentric data
const vector receivePos
@ -1155,8 +1161,9 @@ void Foam::particle::correctAfterNonConformalCyclicTransfer
// Locate the particle on the receiving side
locate
(
mesh,
receivePos,
mesh_.faceOwner()[facei_ + nccpp.origPatch().start()],
mesh.faceOwner()[facei_ + nccpp.origPatch().start()],
false,
"Particle crossed between " + nonConformalCyclicPolyPatch::typeName +
" patches " + nccpp.name() + " and " + nccpp.nbrPatch().name() +
@ -1171,11 +1178,12 @@ void Foam::particle::correctAfterNonConformalCyclicTransfer
void Foam::particle::prepareForInteractionListReferral
(
const polyMesh& mesh,
const transformer& transform
)
{
// Get the transformed position
const vector pos = transform.invTransformPosition(position());
const vector pos = transform.invTransformPosition(position(mesh));
// Break the topology
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
const vector pos(coordinates_.b(), coordinates_.c(), coordinates_.d());
// Create some arbitrary topology for the supplied cell
celli_ = celli;
tetFacei_ = mesh_.cells()[celli_][0];
tetFacei_ = mesh.cells()[celli_][0];
tetPti_ = 1;
// 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
// minimise the error associated with the incorrect topology.
coordinates_ = barycentric(1, 0, 0, 0);
if (mesh_.moving() && stepFraction_ != 1)
if (mesh.moving() && stepFraction_ != 1)
{
Pair<vector> centre;
FixedList<scalar, 4> detA;
FixedList<barycentricTensor, 3> T;
movingTetReverseTransform(0, centre, detA, T);
movingTetReverseTransform(mesh, 0, centre, detA, T);
coordinates_ += (pos - centre[0]) & T[0]/detA[0];
}
else
@ -1223,7 +1235,7 @@ void Foam::particle::correctAfterInteractionListReferral(const label celli)
vector centre;
scalar detA;
barycentricTensor T;
stationaryTetReverseTransform(centre, detA, T);
stationaryTetReverseTransform(mesh, centre, detA, T);
coordinates_ += (pos - centre) & T/detA;
}
}
@ -1231,6 +1243,7 @@ void Foam::particle::correctAfterInteractionListReferral(const label celli)
Foam::label Foam::particle::procTetPt
(
const polyMesh& mesh,
const polyMesh& procMesh,
const label procCell,
const label procTetFace
@ -1242,7 +1255,7 @@ Foam::label Foam::particle::procTetPt
if
(
(mesh_.faceOwner()[tetFacei_] == celli_)
(mesh.faceOwner()[tetFacei_] == celli_)
== (procMesh.faceOwner()[procTetFace] == procCell)
)
{
@ -1257,12 +1270,14 @@ Foam::label Foam::particle::procTetPt
void Foam::particle::autoMap
(
const polyMesh& mesh,
const vector& position,
const polyTopoChangeMap& map
)
{
locate
(
mesh,
position,
map.reverseCellMap()[celli_],
true,

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "particle.H"
#include "polyMesh.H"
#include "Time.H"
@ -30,15 +31,16 @@ License
void Foam::particle::stationaryTetGeometry
(
const polyMesh& mesh,
vector& centre,
vector& base,
vector& vertex1,
vector& vertex2
) const
{
const triFace triIs(currentTetIndices().faceTriIs(mesh_));
const vectorField& ccs = mesh_.cellCentres();
const pointField& pts = mesh_.points();
const triFace triIs(currentTetIndices(mesh).faceTriIs(mesh));
const vectorField& ccs = mesh.cellCentres();
const pointField& pts = mesh.points();
centre = ccs[celli_];
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;
stationaryTetGeometry(centre, base, vertex1, vertex2);
stationaryTetGeometry(mesh, 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
(
const polyMesh& mesh,
const scalar fraction,
Pair<vector>& centre,
Pair<vector>& base,
@ -65,16 +71,16 @@ inline void Foam::particle::movingTetGeometry
Pair<vector>& vertex2
) const
{
const triFace triIs(currentTetIndices().faceTriIs(mesh_));
const pointField& ptsOld = mesh_.oldPoints();
const pointField& ptsNew = mesh_.points();
const vector ccOld = mesh_.oldCellCentres()[celli_];
const vector ccNew = mesh_.cellCentres()[celli_];
const triFace triIs(currentTetIndices(mesh).faceTriIs(mesh));
const pointField& ptsOld = mesh.oldPoints();
const pointField& ptsNew = mesh.points();
const vector ccOld = mesh.oldCellCentres()[celli_];
const vector ccNew = mesh.cellCentres()[celli_];
// 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
// 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];
centre[0] = ccOld + f0*(ccNew - ccOld);
@ -91,11 +97,12 @@ inline void Foam::particle::movingTetGeometry
inline Foam::Pair<Foam::barycentricTensor> Foam::particle::movingTetTransform
(
const polyMesh& mesh,
const scalar fraction
) const
{
Pair<vector> centre, base, vertex1, vertex2;
movingTetGeometry(fraction, centre, base, vertex1, vertex2);
movingTetGeometry(mesh, fraction, centre, base, vertex1, vertex2);
return
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
{
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& tsOld = mesh_.time().prevTimeState();
const TimeState& tsNew = mesh.time();
const TimeState& tsOld = mesh.time().prevTimeState();
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];
}
inline Foam::tetIndices Foam::particle::currentTetIndices() const
inline Foam::tetIndices Foam::particle::currentTetIndices
(
const polyMesh& mesh
) const
{
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
{
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
<< "Patch data was requested for a particle that isn't on a patch"
<< exit(FatalError);
}
if (mesh_.moving() && stepFraction_ != 1)
if (mesh.moving() && stepFraction_ != 1)
{
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();
@ -315,7 +333,7 @@ void Foam::particle::patchData(vector& normal, vector& displacement) const
else
{
vector centre, base, vertex1, vertex2;
stationaryTetGeometry(centre, base, vertex1, vertex2);
stationaryTetGeometry(mesh, centre, base, vertex1, vertex2);
normal = triPointRef(base, vertex1, vertex2).normal();

View File

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

View File

@ -126,13 +126,13 @@ void Foam::particle::hitFace
{
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
(
@ -140,7 +140,7 @@ void Foam::particle::hitFace
(
displacement,
fraction,
cloud.patchNonConformalCyclicPatches()[p.patch()][i],
cloud.patchNonConformalCyclicPatches()[p.patch(td.mesh)][i],
cloud,
ttd
)
@ -152,7 +152,7 @@ void Foam::particle::hitFace
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))
{
@ -205,7 +205,7 @@ Foam::scalar Foam::particle::trackToAndHitFace
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);
@ -243,26 +243,29 @@ void Foam::particle::hitSymmetryPlanePatch
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));
}
template<class TrackCloudType>
void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&)
void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData& td)
{
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();
// Set the topology
facei_ = tetFacei_ = cpp.transformGlobalFace(facei_);
celli_ = mesh_.faceOwner()[facei_];
celli_ = td.mesh.faceOwner()[facei_];
// 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();
@ -285,7 +288,10 @@ void Foam::particle::hitCyclicAMIPatch
)
{
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();
if (debug)
@ -296,9 +302,9 @@ void Foam::particle::hitCyclicAMIPatch
// Get the send patch data
vector sendNormal, sendDisplacement;
patchData(sendNormal, sendDisplacement);
patchData(td.mesh, sendNormal, sendDisplacement);
vector pos = position();
vector pos = position(td.mesh);
const labelPair receiveIs =
cpp.pointAMIAndFace
@ -331,8 +337,9 @@ void Foam::particle::hitCyclicAMIPatch
// Locate the particle on the receiving side
locate
(
td.mesh,
pos,
mesh_.faceOwner()[facei_],
td.mesh.faceOwner()[facei_],
false,
"Particle crossed between " + cyclicAMIPolyPatch::typeName +
" 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
// then issue a warning and remove the particle
if (onBoundaryFace())
if (onBoundaryFace(td.mesh))
{
vector receiveNormal, receiveDisplacement;
patchData(receiveNormal, receiveDisplacement);
patchData(td.mesh, receiveNormal, receiveDisplacement);
if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
{
@ -399,20 +406,21 @@ bool Foam::particle::hitNonConformalCyclicPatch
{
const nonConformalCyclicPolyPatch& nccpp =
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
vector sendNormal, sendDisplacement;
patchData(sendNormal, sendDisplacement);
patchData(td.mesh, sendNormal, sendDisplacement);
// Project the particle through the non-conformal patch
point receivePos;
const patchToPatch::procFace receiveProcFace =
nccpp.ray
(
stepFractionSpan()[0] + stepFraction_*stepFractionSpan()[1],
stepFractionSpan(td.mesh)[0]
+ stepFraction_*stepFractionSpan(td.mesh)[1],
nccpp.origPatch().whichFace(facei_),
sendPos,
displacement - fraction*sendDisplacement,
@ -439,11 +447,13 @@ bool Foam::particle::hitNonConformalCyclicPatch
// If both sides are on the same process, then do the local transfer
prepareForNonConformalCyclicTransfer
(
td.mesh,
nccpp.index(),
receiveProcFace.facei
);
correctAfterNonConformalCyclicTransfer
(
td.mesh,
nccpp.nbrPatchID()
);
@ -454,10 +464,11 @@ bool Foam::particle::hitNonConformalCyclicPatch
template<class TrackCloudType>
void Foam::particle::hitProcessorPatch(TrackCloudType& cloud, trackingData& td)
{
td.sendToProc = cloud.patchNbrProc()[patch()];
td.sendFromPatch = patch();
td.sendToPatch = cloud.patchNbrProcPatch()[patch()];
td.sendToPatchFace = mesh().boundaryMesh()[patch()].whichFace(face());
td.sendToProc = cloud.patchNbrProc()[patch(td.mesh)];
td.sendFromPatch = patch(td.mesh);
td.sendToPatch = cloud.patchNbrProcPatch()[patch(td.mesh)];
td.sendToPatchFace =
td.mesh.boundaryMesh()[patch(td.mesh)].whichFace(face());
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -709,8 +709,8 @@ void Foam::MomentumCloud<CloudType>::patchData
vector& Up
) const
{
p.patchData(nw, Up);
Up /= p.mesh().time().deltaTValue();
p.patchData(this->mesh(), nw, Up);
Up /= this->mesh().time().deltaTValue();
// 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
@ -731,7 +731,7 @@ void Foam::MomentumCloud<CloudType>::patchData
const vector& Uw0 =
U_.oldTime().boundaryField()[patchi][patchFacei];
const scalar f = p.currentTimeFraction();
const scalar f = p.currentTimeFraction(this->mesh());
const vector Uw = Uw0 + f*(Uw1 - Uw0);

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -232,53 +232,23 @@ public:
);
//- Construct from Istream
CollidingParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
CollidingParcel(Istream& is, bool readFields = true);
//- Construct as a copy
CollidingParcel(const CollidingParcel& p);
//- Construct as a copy
CollidingParcel(const CollidingParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
//- Construct and return a clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new CollidingParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
//- Construct from Istream and return
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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -204,53 +204,23 @@ public:
);
//- Construct from Istream
MPPICParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
MPPICParcel(Istream& is, bool readFields = true);
//- Construct as a copy
MPPICParcel(const MPPICParcel& p);
//- Construct as a copy
MPPICParcel(const MPPICParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
//- Construct and return a clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new MPPICParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
//- Construct from Istream and return
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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ void Foam::MomentumParcel<ParcelType>::setCellValues
trackingData& td
)
{
tetIndices tetIs = this->currentTetIndices();
tetIndices tetIs = this->currentTetIndices(td.mesh);
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 * * * * * * * * * * * * * //
template<class ParcelType>
@ -296,7 +275,7 @@ bool Foam::MomentumParcel<ParcelType>::move
while (ttd.keepParticle && ttd.sendToProc == -1 && p.stepFraction() < 1)
{
// 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();
// Total displacement over the time-step
@ -306,7 +285,7 @@ bool Foam::MomentumParcel<ParcelType>::move
const scalar l = cellLengthScale[p.cell()];
// 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
// 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())
{
// Track to the next face
p.trackToFace(f*s - d, f);
p.trackToFace(td.mesh, f*s - d, f);
}
else
{
@ -377,7 +356,7 @@ bool Foam::MomentumParcel<ParcelType>::hitPatch
typename TrackCloudType::parcelType& p =
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
cloud.functions().postPatch(p, pp, td.keepParticle);
@ -406,14 +385,14 @@ template<class TrackCloudType>
void Foam::MomentumParcel<ParcelType>::hitWallPatch
(
TrackCloudType&,
trackingData&
trackingData& td
)
{
const polyPatch& pp = this->mesh().boundaryMesh()[this->patch()];
const polyPatch& pp = td.mesh.boundaryMesh()[this->patch(td.mesh)];
FatalErrorInFunction
<< "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"
<< exit(FatalError);
}

View File

@ -336,53 +336,23 @@ public:
);
//- Construct from Istream
MomentumParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
MomentumParcel(Istream& is, bool readFields = true);
//- Construct as a copy
MomentumParcel(const MomentumParcel& p);
//- Construct as a copy
MomentumParcel(const MomentumParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
//- Construct and return a clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new MomentumParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
//- Construct from Istream and return
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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "MomentumParcel.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
@ -72,14 +73,14 @@ inline Foam::MomentumParcel<ParcelType>::constantProperties::constantProperties
template<class ParcelType>
inline Foam::MomentumParcel<ParcelType>::MomentumParcel
(
const polyMesh& owner,
const polyMesh& mesh,
const barycentric& coordinates,
const label celli,
const label tetFacei,
const label tetPti
)
:
ParcelType(owner, coordinates, celli, tetFacei, tetPti),
ParcelType(mesh, coordinates, celli, tetFacei, tetPti),
moving_(true),
typeId_(-1),
nParticle_(0),
@ -305,7 +306,7 @@ inline Foam::scalar Foam::MomentumParcel<ParcelType>::massCell
const trackingData& td
) 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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,14 +45,9 @@ const std::size_t Foam::MomentumParcel<ParcelType>::sizeofFields_
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::MomentumParcel<ParcelType>::MomentumParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
Foam::MomentumParcel<ParcelType>::MomentumParcel(Istream& is, bool readFields)
:
ParcelType(mesh, is, readFields),
ParcelType(is, readFields),
moving_(false),
typeId_(0),
nParticle_(0.0),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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 * * * * * * * * * * * * * //
#include "ReactingMultiphaseParcelIO.C"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -282,7 +282,7 @@ public:
// Constructors
//- Construct from mesh, position and topology
//- Construct from mesh, coordinates and topology
// Other properties initialised as null
inline ReactingMultiphaseParcel
(
@ -303,59 +303,26 @@ public:
);
//- Construct from Istream
ReactingMultiphaseParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
ReactingMultiphaseParcel(Istream& is, bool readFields = true);
//- Construct as a copy
ReactingMultiphaseParcel(const ReactingMultiphaseParcel& p);
//- Construct as a copy
ReactingMultiphaseParcel
(
const ReactingMultiphaseParcel& p,
const polyMesh& mesh
);
//- Construct and return a (basic particle) clone
//- Construct and return a clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new ReactingMultiphaseParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
//- Construct from Istream and return
static autoPtr<ReactingMultiphaseParcel> New(Istream& is)
{
return autoPtr<particle>(new ReactingMultiphaseParcel(*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<ReactingMultiphaseParcel<ParcelType>> operator()
return
autoPtr<ReactingMultiphaseParcel>
(
Istream& is
) const
{
return autoPtr<ReactingMultiphaseParcel<ParcelType>>
(
new ReactingMultiphaseParcel<ParcelType>(mesh_, is, true)
new ReactingMultiphaseParcel(is)
);
}
};
// Member Functions

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -44,12 +44,11 @@ const std::size_t Foam::ReactingMultiphaseParcel<ParcelType>::sizeofFields_
template<class ParcelType>
Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
ParcelType(is, readFields),
YGas_(0),
YLiquid_(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 * * * * * * * * * * * * * * * //
template<class ParcelType>
@ -217,7 +204,7 @@ void Foam::ReactingParcel<ParcelType>::setCellValues
td.pc() = td.pInterp().interpolate
(
this->coordinates(),
this->currentTetIndices()
this->currentTetIndices(td.mesh)
);
if (td.pc() < cloud.constProps().pMin())

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -171,7 +171,7 @@ void Foam::SprayParcel<ParcelType>::calcAtomisation
scalar soi = cloud.injectors().timeStart();
scalar currentTime = cloud.db().time().value();
const vector& pos = this->position();
const vector& pos = this->position(td.mesh);
const vector& injectionPos = this->position0();
// 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 * * * * * * * * * * * * * //
#include "SprayParcelIO.C"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -212,60 +212,23 @@ public:
);
//- Construct from Istream
SprayParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy
SprayParcel
(
const SprayParcel& p,
const polyMesh& mesh
);
SprayParcel(Istream& is, bool readFields = true);
//- Construct as a copy
SprayParcel(const SprayParcel& p);
//- Construct and return a (basic particle) clone
//- Construct and return a clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new SprayParcel<ParcelType>(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
//- Construct from Istream and return
static autoPtr<SprayParcel> New(Istream& is)
{
return autoPtr<particle>
(
new SprayParcel<ParcelType>(*this, mesh)
);
return autoPtr<SprayParcel>(new SprayParcel(is));
}
//- 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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "SprayParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
@ -115,7 +117,7 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel
:
ParcelType(mesh, coordinates, celli, tetFacei, tetPti),
d0_(this->d()),
position0_(this->position()),
position0_(this->position(mesh)),
sigma_(0.0),
mu_(0.0),
liquidCore_(0.0),
@ -140,7 +142,7 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel
:
ParcelType(mesh, position, celli),
d0_(this->d()),
position0_(this->position()),
position0_(this->position(mesh)),
sigma_(0.0),
mu_(0.0),
liquidCore_(0.0),

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ void Foam::ThermoParcel<ParcelType>::setCellValues
{
ParcelType::setCellValues(cloud, td);
tetIndices tetIs = this->currentTetIndices();
tetIndices tetIs = this->currentTetIndices(td.mesh);
td.Cpc() = td.CpInterp().interpolate(this->coordinates(), tetIs);
@ -123,7 +123,7 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
rhos = td.rhoc()*TRatio;
tetIndices tetIs = this->currentTetIndices();
tetIndices tetIs = this->currentTetIndices(td.mesh);
mus = td.muInterp().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;
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 sigma = physicoChemical::sigma.value();
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 * * * * * * * * * * * * * //
#include "ThermoParcelIO.C"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -327,53 +327,23 @@ public:
);
//- Construct from Istream
ThermoParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
ThermoParcel(Istream& is, bool readFields = true);
//- Construct as a copy
ThermoParcel(const ThermoParcel& p);
//- Construct as a copy
ThermoParcel(const ThermoParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
//- Construct and return a clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new ThermoParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
//- Construct from Istream and return
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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -644,12 +644,20 @@ void Foam::ParticleCollector<CloudType>::postMove
{
case mtPolygon:
{
collectParcelPolygon(position0, p.position());
collectParcelPolygon
(
position0,
p.position(this->owner().mesh())
);
break;
}
case mtConcentricCircle:
{
collectParcelConcentricCircles(position0, p.position());
collectParcelConcentricCircles
(
position0,
p.position(this->owner().mesh())
);
break;
}
default:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -142,7 +142,7 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
{
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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,7 +53,7 @@ void Foam::RelativeVelocity<CloudType>::write()
- UcInterp->interpolate
(
iter().coordinates(),
iter().currentTetIndices()
iter().currentTetIndices(this->owner().mesh())
);
++ i;
}

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -166,7 +166,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), 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);
@ -201,7 +201,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), 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.average(massAverage);
@ -224,7 +224,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), 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);
uTildeSqrAverage.add
(
@ -239,7 +239,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
forAllIter(typename CloudType, this->owner(), 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 scalar uRms =

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "PairSpringSliderDashpot.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -172,7 +173,9 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
typename CloudType::parcelType& pB
) 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();
@ -232,7 +235,7 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
U_AB - (U_AB & rHat_AB)*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 =
pA.collisionRecords().matchPairRecord

View File

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

View File

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

View File

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

View File

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

View File

@ -378,6 +378,8 @@ void Foam::ConeInjection<CloudType>::setProperties
typename CloudType::parcelType& parcel
)
{
const polyMesh& mesh = this->owner().mesh();
Random& rndGen = this->owner().rndGen();
const scalar t = time - this->SOI_;
@ -412,9 +414,9 @@ void Foam::ConeInjection<CloudType>::setProperties
}
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_);
tanVec = normalised(parcel.position() - position_.value(t));
tanVec = normalised(parcel.position(mesh) - position_.value(t));
theta =
degToRad
(

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,10 +138,14 @@ Foam::forceSuSp Foam::LiftForce<CloudType>::calcCoupled
{
forceSuSp value(Zero, 0.0);
vector curlUc =
curlUcInterp().interpolate(p.coordinates(), p.currentTetIndices());
const vector curlUc =
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);

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,8 +50,8 @@ bool Foam::TrajectoryCollision<CloudType>::collideParcels
{
bool coalescence = false;
const vector& pos1 = p1.position();
const vector& pos2 = p2.position();
const point pos1 = p1.position(this->owner().mesh());
const point pos2 = p2.position(this->owner().mesh());
const vector& U1 = p1.U();
const vector& U2 = p2.U();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -456,7 +456,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
}
// 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];

View File

@ -49,7 +49,7 @@ bool Foam::solidParticle::move
{
if (debug)
{
Info<< "Time = " << mesh().time().timeName()
Info<< "Time = " << td.mesh.time().timeName()
<< " trackTime = " << trackTime
<< " stepFraction() = " << stepFraction() << endl;
}
@ -62,7 +62,7 @@ bool Foam::solidParticle::move
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);
vector Uc = td.UInterp().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 vector Ut = U_ - Un*nw;

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