Files
OpenFOAM-12/src/lagrangian/solidParticle/solidParticleCloud.C
Will Bainbridge 06e29c44ab 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.
2022-12-13 14:32:24 +00:00

92 lines
2.9 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "solidParticleCloud.H"
#include "fvMesh.H"
#include "volFields.H"
#include "interpolationCellPoint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(solidParticleCloud, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidParticleCloud::solidParticleCloud
(
const fvMesh& mesh,
const word& cloudName,
bool readFields
)
:
Cloud<solidParticle>(mesh, cloudName, false),
mesh_(mesh),
particleProperties_
(
IOobject
(
"particleProperties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
rhop_(dimensionedScalar(particleProperties_.lookup("rhop")).value()),
e_(dimensionedScalar(particleProperties_.lookup("e")).value()),
mu_(dimensionedScalar(particleProperties_.lookup("mu")).value())
{
if (readFields)
{
solidParticle::readFields(*this);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::solidParticleCloud::move(const dimensionedVector& g)
{
const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho");
const volVectorField& U = mesh_.lookupObject<const volVectorField>("U");
const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu");
interpolationCellPoint<scalar> rhoInterp(rho);
interpolationCellPoint<vector> UInterp(U);
interpolationCellPoint<scalar> nuInterp(nu);
solidParticle::trackingData
td(*this, rhoInterp, UInterp, nuInterp, g.value());
Cloud<solidParticle>::move(*this, td);
}
// ************************************************************************* //