lagrangian/parcel: Added sizeDistribution cloud function
This function outputs a graph of a cloud's particle and parcel size
distributions. It can be enabled by putting the following settings in
the 'cloudFunctions' section of the cloud's properties file:
sizeDistribution1
{
type sizeDistribution;
nPoints 40;
setFormat raw;
}
This commit is contained in:
@ -505,6 +505,9 @@ public:
|
||||
//- Mean diameter Dij
|
||||
inline scalar Dij(const label i, const label j) const;
|
||||
|
||||
//- Min diameter
|
||||
inline scalar Dmin() const;
|
||||
|
||||
//- Max diameter
|
||||
inline scalar Dmax() const;
|
||||
|
||||
|
||||
@ -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-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -332,18 +332,30 @@ inline Foam::scalar Foam::MomentumCloud<CloudType>::Dij
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline Foam::scalar Foam::MomentumCloud<CloudType>::Dmax() const
|
||||
inline Foam::scalar Foam::MomentumCloud<CloudType>::Dmin() const
|
||||
{
|
||||
scalar d = -great;
|
||||
scalar d = vGreat;
|
||||
|
||||
forAllConstIter(typename MomentumCloud<CloudType>, *this, iter)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
d = max(d, p.d());
|
||||
d = min(d, iter().d());
|
||||
}
|
||||
|
||||
reduce(d, maxOp<scalar>());
|
||||
return returnReduce(d, minOp<scalar>());
|
||||
}
|
||||
|
||||
return max(0.0, d);
|
||||
|
||||
template<class CloudType>
|
||||
inline Foam::scalar Foam::MomentumCloud<CloudType>::Dmax() const
|
||||
{
|
||||
scalar d = -vGreat;
|
||||
|
||||
forAllConstIter(typename MomentumCloud<CloudType>, *this, iter)
|
||||
{
|
||||
d = max(d, iter().d());
|
||||
}
|
||||
|
||||
return returnReduce(d, maxOp<scalar>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ void Foam::SprayCloud<CloudType>::info()
|
||||
CloudType::info();
|
||||
scalar d32 = 1.0e+6*this->Dij(3, 2);
|
||||
scalar d10 = 1.0e+6*this->Dij(1, 0);
|
||||
scalar dMax = 1.0e+6*this->Dmax();
|
||||
scalar dMax = 1.0e+6*max(scalar(0), this->Dmax());
|
||||
scalar pen = this->penetration(0.95);
|
||||
|
||||
Info<< " D10, D32, Dmax (mu) = " << d10 << ", " << d32
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,6 +37,7 @@ License
|
||||
#include "PatchCollisionDensity.H"
|
||||
#include "PatchPostProcessing.H"
|
||||
#include "RelativeVelocity.H"
|
||||
#include "SizeDistribution.H"
|
||||
#include "VoidFraction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,6 +57,7 @@ License
|
||||
makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \
|
||||
makeCloudFunctionObjectType(RelativeVelocity, CloudType); \
|
||||
makeCloudFunctionObjectType(VoidFraction, CloudType); \
|
||||
makeCloudFunctionObjectType(SizeDistribution, CloudType); \
|
||||
makeCloudFunctionObjectType(VolumeFlux, CloudType);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -51,6 +51,7 @@ void Foam::Flux<CloudType, Derived>::write()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType, class Derived>
|
||||
void Foam::Flux<CloudType, Derived>::accumulate
|
||||
(
|
||||
@ -80,6 +81,7 @@ void Foam::Flux<CloudType, Derived>::accumulate
|
||||
phif += sign*Derived::dPhiDeltaT(p)/mesh.time().deltaTValue();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType, class Derived>
|
||||
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 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 "SizeDistribution.H"
|
||||
#include "OSspecific.H"
|
||||
#include "setWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::SizeDistribution<CloudType>::write()
|
||||
{
|
||||
const scalar d0 = this->owner().Dmin(), d1 = this->owner().Dmax();
|
||||
|
||||
// Quit if there is no distribution of diameters
|
||||
if (d1 == d0) return;
|
||||
|
||||
// The x-axis is linearly spaced between the limiting diameters
|
||||
scalarField ds(nPoints_);
|
||||
forAll(ds, i)
|
||||
{
|
||||
const scalar f = scalar(i)/(nPoints_ - 1);
|
||||
ds[i] = (1 - f)*d0 + f*d1;
|
||||
}
|
||||
|
||||
// Calculate the distribution
|
||||
scalarField particlePDF(nPoints_, 0), parcelPDF(nPoints_, 0);
|
||||
forAllConstIter(typename CloudType, this->owner(), iter)
|
||||
{
|
||||
const scalar nParticle = iter().nParticle();
|
||||
const scalar d = iter().d();
|
||||
|
||||
const scalar f = (d - d0)/(d1 - d0);
|
||||
const label i = min(floor(f*(nPoints_ - 1)), nPoints_ - 2);
|
||||
const scalar g = f*(nPoints_ - 1) - scalar(i);
|
||||
|
||||
particlePDF[i] += nParticle*(1 - g);
|
||||
particlePDF[i + 1] += nParticle*g;
|
||||
|
||||
parcelPDF[i] += 1 - g;
|
||||
parcelPDF[i + 1] += g;
|
||||
}
|
||||
|
||||
Pstream::listCombineGather(particlePDF, plusEqOp<scalar>());
|
||||
Pstream::listCombineScatter(particlePDF);
|
||||
|
||||
Pstream::listCombineGather(parcelPDF, plusEqOp<scalar>());
|
||||
Pstream::listCombineScatter(parcelPDF);
|
||||
|
||||
particlePDF.first() *= 2;
|
||||
particlePDF.last() *= 2;
|
||||
particlePDF /= sum(particlePDF)*(d1 - d0)/(nPoints_ - 1);
|
||||
|
||||
parcelPDF.first() *= 2;
|
||||
parcelPDF.last() *= 2;
|
||||
parcelPDF /= sum(parcelPDF)*(d1 - d0)/(nPoints_ - 1);
|
||||
|
||||
// Write
|
||||
if (Pstream::master())
|
||||
{
|
||||
mkDir(this->writeTimeDir());
|
||||
|
||||
formatter_->write
|
||||
(
|
||||
this->writeTimeDir(),
|
||||
"distribution",
|
||||
coordSet(true, "d", ds),
|
||||
"particle-PDF",
|
||||
particlePDF,
|
||||
"parcel-PDF",
|
||||
parcelPDF
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::SizeDistribution<CloudType>::SizeDistribution
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
|
||||
nPoints_(dict.lookup<label>("nPoints")),
|
||||
formatter_(setWriter::New(dict.lookup("setFormat"), dict))
|
||||
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::SizeDistribution<CloudType>::SizeDistribution
|
||||
(
|
||||
const SizeDistribution<CloudType>& vf
|
||||
)
|
||||
:
|
||||
CloudFunctionObject<CloudType>(vf),
|
||||
nPoints_(vf.nPoints_),
|
||||
formatter_(vf.formatter_, false)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::SizeDistribution<CloudType>::~SizeDistribution()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 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/>.
|
||||
|
||||
Class
|
||||
Foam::SizeDistribution
|
||||
|
||||
Description
|
||||
Creates graphs of a cloud's size distribution
|
||||
|
||||
Example usage:
|
||||
\verbatim
|
||||
massFlux1
|
||||
{
|
||||
type sizeDistribution;
|
||||
nPoints 40;
|
||||
setFormat raw;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
SizeDistribution.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SizeDistribution_H
|
||||
#define SizeDistribution_H
|
||||
|
||||
#include "CloudFunctionObject.H"
|
||||
#include "setWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SizeDistribution Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class SizeDistribution
|
||||
:
|
||||
public CloudFunctionObject<CloudType>
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Number of points to plot
|
||||
const label nPoints_;
|
||||
|
||||
//- Set formatter
|
||||
autoPtr<setWriter> formatter_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Write post-processing info
|
||||
virtual void write();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sizeDistribution");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
SizeDistribution
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner,
|
||||
const word& modelName
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
SizeDistribution(const SizeDistribution<CloudType>& vf);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<CloudFunctionObject<CloudType>> clone() const
|
||||
{
|
||||
return autoPtr<CloudFunctionObject<CloudType>>
|
||||
(
|
||||
new SizeDistribution<CloudType>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SizeDistribution();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "SizeDistribution.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user