Lagrangian: Removed sub-cycling and improved injection behaviour

Support for mesh sub-cycling has been removed from Lagrangian. Various
Lagrangian processes already support sub-dividing the time-step. It is
easier and more efficient to extend that support all the way to the
high-level cloud objects, rather than to sub-cycle the mesh.

This has additional benefits. The cloud now no longer needs to reset the
step fraction at the start of every sub-motion. Injection can take
advantage of this by modifying particles' step fractions in order to
distribute them uniformly through the time-step. This is a simple and
efficient method. Previously, injection would track the particles some
distance after injection. This was more expensive to do, it resulted in
spatial artefacts in the injected Lagrangian field, and it did not
correctly handle interactions with patches or parallel transfers.

The lack of injection tracking also means that particles injected
through patches now start their simulation topologically connected to
the face on which they are created. This means that they correctly
trigger cloud functions associated with that face and/or patch.

The injection models now also return barycentric coordinates directly,
rather than the global position of injected particles. For methods that
initially generate locations naturally in terms of barycentric
coordinates, this prevents unnecessary and potentially fragile
conversion from barycentric to Cartesian and back again. These are
typically the methods that "fill" some sort of space; e.g., patch or
cell-zone injections.
This commit is contained in:
Will Bainbridge
2022-11-25 12:04:08 +00:00
parent d020df456c
commit 06e29c44ab
108 changed files with 819 additions and 1111 deletions

View File

@ -27,23 +27,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::findCellParticle::findCellParticle
(
const polyMesh& mesh,
const barycentric& coordinates,
const label celli,
const label tetFacei,
const label tetPtI,
const vector& displacement,
const label data
)
:
particle(mesh, coordinates, celli, tetFacei, tetPtI),
displacement_(displacement),
data_(data)
{}
Foam::findCellParticle::findCellParticle
(
const polyMesh& mesh,
@ -94,8 +77,7 @@ Foam::findCellParticle::findCellParticle(Istream& is, bool readFields)
bool Foam::findCellParticle::move
(
Cloud<findCellParticle>& cloud,
trackingData& td,
const scalar maxTrackLen
trackingData& td
)
{
td.keepParticle = true;

View File

@ -116,18 +116,6 @@ public:
// Constructors
//- Construct from components
findCellParticle
(
const polyMesh& mesh,
const barycentric& coordinates,
const label celli,
const label tetFacei,
const label tetPtI,
const vector& displacement,
const label data
);
//- Construct from a position and a cell, searching for the rest of the
// required topology
findCellParticle
@ -185,7 +173,7 @@ public:
// Tracking
//- Track all particles to their end point
bool move(Cloud<findCellParticle>&, trackingData&, const scalar);
bool move(Cloud<findCellParticle>&, trackingData&);
//- Overridable function to handle the particle hitting a wedge
void hitWedgePatch(Cloud<findCellParticle>&, trackingData&);

View File

@ -86,7 +86,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
mesh_,
patch.Cf()[patchFacei],
patch.faceCells()[patchFacei],
- distance_*nf[patchFacei],
- distance_*nf[patchFacei],
globalWalls.toGlobal(nPatchFaces) // passive data
)
);
@ -123,10 +123,6 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
// Database to pass into findCellParticle::move
findCellParticle::trackingData td(cloud, cellToWalls_, cellToSamples_);
// Track all particles to their end position.
scalar maxTrackLen = 2.0*mesh_.bounds().mag();
// Debug: collect start points
pointField start;
if (debug)
@ -141,7 +137,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
}
cloud.move(cloud, td, maxTrackLen);
// Track
cloud.move(cloud, td);
// Rework cell-to-globalpatchface into a map

View File

@ -334,13 +334,13 @@ bool Foam::functionObjects::streamlines::write()
initialParticles = particles;
}
particles.move(particles, td, rootGreat);
particles.move(particles, td);
if (trackDirection_ == trackDirection::both)
{
particles.IDLList<streamlinesParticle>::operator=(initialParticles);
td.trackForward_ = !td.trackForward_;
particles.move(particles, td, rootGreat);
particles.move(particles, td);
}
}

View File

@ -200,8 +200,7 @@ Foam::streamlinesParticle::streamlinesParticle
bool Foam::streamlinesParticle::move
(
streamlinesCloud& cloud,
trackingData& td,
const scalar
trackingData& td
)
{
td.keepParticle = true;

View File

@ -236,7 +236,7 @@ public:
// Tracking
//- Track all particles to their end point
bool move(streamlinesCloud&, trackingData&, const scalar);
bool move(streamlinesCloud&, trackingData&);
//- Overridable function to handle the particle hitting a wedge
void hitWedgePatch(streamlinesCloud&, trackingData&);