114 lines
3.2 KiB
C++
114 lines
3.2 KiB
C++
/*--------------------------------*- C++ -*----------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration | Website: https://openfoam.org
|
|
\\ / A nd | Version: dev
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
Description
|
|
Generates initial size group fractions given a distribution. Uses the
|
|
fDefault.<phase> field file as a reference from which to construct boundary
|
|
conditions. All boundary conditions in this file must be default
|
|
constructable, or this will not work.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
type coded;
|
|
libs ("libutilityFunctionObjects.so");
|
|
|
|
phase <phaseName>; // The phase to write
|
|
// size-group fractions
|
|
// for
|
|
|
|
initialDistributionFile <initialDistributionFileName>; // The file containing
|
|
// the distribution. In
|
|
// foam format.
|
|
|
|
codeInclude
|
|
#{
|
|
#include "stringOps.H"
|
|
#include "Table.H"
|
|
#include "volFields.H"
|
|
#};
|
|
|
|
codeRead
|
|
#{
|
|
const word phaseName = dict.lookup<word>("phase");
|
|
|
|
const fileName initialDistributionFileName =
|
|
dict.lookup<fileName>("initialDistributionFile");
|
|
|
|
const List<dictionary> sizeGroupDicts
|
|
(
|
|
IOdictionary
|
|
(
|
|
IOobject
|
|
(
|
|
"phaseProperties",
|
|
mesh().time().constant(),
|
|
mesh(),
|
|
IOobject::MUST_READ,
|
|
IOobject::NO_WRITE
|
|
)
|
|
)
|
|
.subDict(phaseName)
|
|
.subDict("velocityGroupCoeffs")
|
|
.lookup("sizeGroups")
|
|
);
|
|
|
|
const Function1s::Table<scalar> initialDistribution
|
|
(
|
|
"initialDistribution",
|
|
dimLength,
|
|
dimless,
|
|
dictionary
|
|
(
|
|
"format", "foam",
|
|
"file", initialDistributionFileName
|
|
)
|
|
);
|
|
|
|
const volScalarField fDefault
|
|
(
|
|
IOobject
|
|
(
|
|
IOobject::groupName("fDefault", phaseName),
|
|
mesh().time().name(),
|
|
mesh(),
|
|
IOobject::MUST_READ
|
|
),
|
|
mesh()
|
|
);
|
|
|
|
forAll(sizeGroupDicts, i)
|
|
{
|
|
volScalarField
|
|
(
|
|
IOobject
|
|
(
|
|
IOobject::groupName("f" + Foam::name(i), phaseName),
|
|
mesh().time().name(),
|
|
mesh(),
|
|
IOobject::READ_IF_PRESENT
|
|
),
|
|
mesh(),
|
|
dimensionedScalar
|
|
(
|
|
dimless,
|
|
initialDistribution.value
|
|
(
|
|
dimensionedScalar
|
|
(
|
|
"dSph",
|
|
dimLength,
|
|
sizeGroupDicts[i]
|
|
).value()
|
|
)
|
|
),
|
|
fDefault.boundaryField().types()
|
|
).write();
|
|
}
|
|
#};
|
|
|
|
// ************************************************************************* //
|