for consistency with fvModels and fvConstraints, to simplify code and case maintenance and to avoid the potentially complex functions entries being unnecessarily parsed by utilities for which functionObject evaluation is disabled. The functions entry in controlDict is still read if the functions file is not present for backward-compatibility, but it is advisable to migrate cases to use the new functions file.
112 lines
3.2 KiB
C++
112 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",
|
|
dictionary
|
|
(
|
|
"format", "foam",
|
|
"file", initialDistributionFileName
|
|
)
|
|
);
|
|
|
|
const volScalarField fDefault
|
|
(
|
|
IOobject
|
|
(
|
|
IOobject::groupName("fDefault", phaseName),
|
|
mesh().time().timeName(),
|
|
mesh(),
|
|
IOobject::MUST_READ
|
|
),
|
|
mesh()
|
|
);
|
|
|
|
forAll(sizeGroupDicts, i)
|
|
{
|
|
volScalarField
|
|
(
|
|
IOobject
|
|
(
|
|
IOobject::groupName("f" + Foam::name(i), phaseName),
|
|
mesh().time().timeName(),
|
|
mesh(),
|
|
IOobject::READ_IF_PRESENT
|
|
),
|
|
mesh(),
|
|
dimensionedScalar
|
|
(
|
|
dimless,
|
|
initialDistribution.value
|
|
(
|
|
dimensionedScalar
|
|
(
|
|
"dSph",
|
|
dimLength,
|
|
sizeGroupDicts[i]
|
|
).value()
|
|
)
|
|
),
|
|
fDefault.boundaryField().types()
|
|
).write();
|
|
}
|
|
#};
|
|
|
|
// ************************************************************************* //
|