Commit 5c518365 authored by Henry Weller's avatar Henry Weller
Browse files

The "<type>Coeffs" sub-dictionary is now optional for most model parameters

except turbulence and lagrangian which will also be updated shortly.

For example in the nonNewtonianIcoFoam offsetCylinder tutorial the viscosity
model coefficients may be specified in the corresponding "<type>Coeffs"
sub-dictionary:

transportModel  CrossPowerLaw;

CrossPowerLawCoeffs
{
    nu0         [0 2 -1 0 0 0 0]  0.01;
    nuInf       [0 2 -1 0 0 0 0]  10;
    m           [0 0 1 0 0 0 0]   0.4;
    n           [0 0 0 0 0 0 0]   3;
}

BirdCarreauCoeffs
{
    nu0         [0 2 -1 0 0 0 0]  1e-06;
    nuInf       [0 2 -1 0 0 0 0]  1e-06;
    k           [0 0 1 0 0 0 0]   0;
    n           [0 0 0 0 0 0 0]   1;
}

which allows a quick change between models, or using the simpler

transportModel  CrossPowerLaw;

nu0         [0 2 -1 0 0 0 0]  0.01;
nuInf       [0 2 -1 0 0 0 0]  10;
m           [0 0 1 0 0 0 0]   0.4;
n           [0 0 0 0 0 0 0]   3;

if quick switching between models is not required.

To support this more convenient parameter specification the inconsistent
specification of seedSampleSet in the streamLine and wallBoundedStreamLine
functionObjects had to be corrected from

    // Seeding method.
    seedSampleSet   uniform;  //cloud; //triSurfaceMeshPointSet;

    uniformCoeffs
    {
        type        uniform;
        axis        x;  //distance;

        // Note: tracks slightly offset so as not to be on a face
        start       (-1.001 -0.05 0.0011);
        end         (-1.001 -0.05 1.0011);
        nPoints     20;
    }

to the simpler

    // Seeding method.
    seedSampleSet
    {
        type        uniform;
        axis        x;  //distance;

        // Note: tracks slightly offset so as not to be on a face
        start       (-1.001 -0.05 0.0011);
        end         (-1.001 -0.05 1.0011);
        nPoints     20;
    }

which also support the "<type>Coeffs" form

    // Seeding method.
    seedSampleSet
    {
        type        uniform;

        uniformCoeffs
        {
            axis        x;  //distance;

            // Note: tracks slightly offset so as not to be on a face
            start       (-1.001 -0.05 0.0011);
            end         (-1.001 -0.05 1.0011);
            nPoints     20;
        }
    }
parent ea257737
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -79,7 +79,7 @@ Foam::PDRDragModel::~PDRDragModel()
bool Foam::PDRDragModel::read(const dictionary& PDRProperties)
{
PDRDragModelCoeffs_ = PDRProperties.subDict(type() + "Coeffs");
PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs");
PDRDragModelCoeffs_.lookup("drag") >> on_;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -67,7 +67,7 @@ Foam::XiEqModel::~XiEqModel()
bool Foam::XiEqModel::read(const dictionary& XiEqProperties)
{
XiEqModelCoeffs_ = XiEqProperties.subDict(type() + "Coeffs");
XiEqModelCoeffs_ = XiEqProperties.optionalSubDict(type() + "Coeffs");
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -67,7 +67,7 @@ Foam::XiGModel::~XiGModel()
bool Foam::XiGModel::read(const dictionary& XiGProperties)
{
XiGModelCoeffs_ = XiGProperties.subDict(type() + "Coeffs");
XiGModelCoeffs_ = XiGProperties.optionalSubDict(type() + "Coeffs");
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -85,7 +85,7 @@ Foam::XiModel::~XiModel()
bool Foam::XiModel::read(const dictionary& XiProperties)
{
XiModelCoeffs_ = XiProperties.subDict(type() + "Coeffs");
XiModelCoeffs_ = XiProperties.optionalSubDict(type() + "Coeffs");
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -80,7 +80,7 @@ Foam::laminarFlameSpeedModels::SCOPE::SCOPE
dict.lookup("fuelFile")
)
)()
).subDict(typeName + "Coeffs")
).optionalSubDict(typeName + "Coeffs")
),
LFL_(readScalar(coeffsDict_.lookup("lowerFlamabilityLimit"))),
UFL_(readScalar(coeffsDict_.lookup("upperFlamabilityLimit"))),
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,7 @@ Foam::mixtureViscosityModels::plastic::plastic
)
:
mixtureViscosityModel(name, viscosityProperties, U, phi),
plasticCoeffs_(viscosityProperties.subDict(modelName + "Coeffs")),
plasticCoeffs_(viscosityProperties.optionalSubDict(modelName + "Coeffs")),
plasticViscosityCoeff_
(
"coeff",
......@@ -117,7 +117,7 @@ bool Foam::mixtureViscosityModels::plastic::read
{
mixtureViscosityModel::read(viscosityProperties);
plasticCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
plasticCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs");
plasticCoeffs_.lookup("k") >> plasticViscosityCoeff_;
plasticCoeffs_.lookup("n") >> plasticViscosityExponent_;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -126,7 +126,7 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
(
cstrIter()
(
dict.subDict(modelType + "Coeffs"),
dict.optionalSubDict(modelType + "Coeffs"),
mixture
)
);
......
......@@ -102,7 +102,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read()
{
if (phaseChangeTwoPhaseMixture::read())
{
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
......
......@@ -97,7 +97,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
{
if (phaseChangeTwoPhaseMixture::read())
{
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
......
......@@ -151,7 +151,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
{
if (phaseChangeTwoPhaseMixture::read())
{
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,7 +43,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
)
:
incompressibleTwoPhaseMixture(U, phi),
phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")),
phaseChangeTwoPhaseMixtureCoeffs_(optionalSubDict(type + "Coeffs")),
pSat_("pSat", dimPressure, lookup("pSat"))
{}
......@@ -77,7 +77,7 @@ bool Foam::phaseChangeTwoPhaseMixture::read()
{
if (incompressibleTwoPhaseMixture::read())
{
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
lookup("pSat") >> pSat_;
return true;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,11 @@ Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New
<< exit(FatalError);
}
return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase);
return cstrIter()
(
dict.optionalSubDict(diameterModelType + "Coeffs"),
phase
);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -61,7 +61,7 @@ void Foam::diameterModel::correct()
bool Foam::diameterModel::read(const dictionary& phaseProperties)
{
diameterProperties_ = phaseProperties.subDict(type() + "Coeffs");
diameterProperties_ = phaseProperties.optionalSubDict(type() + "Coeffs");
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,11 @@ Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New
<< exit(FatalError);
}
return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase);
return cstrIter()
(
dict.optionalSubDict(diameterModelType + "Coeffs"),
phase
);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair
)
:
conductivityModel(dict),
coeffDict_(dict.subDict(typeName + "Coeffs")),
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_)
{}
......@@ -103,7 +103,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa
bool Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::read()
{
coeffDict_ <<= dict_.subDict(typeName + "Coeffs");
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
L_.readIfPresent(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -57,7 +57,7 @@ JohnsonJackson
)
:
frictionalStressModel(dict),
coeffDict_(dict.subDict(typeName + "Coeffs")),
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_),
eta_("eta", dimless, coeffDict_),
p_("p", dimless, coeffDict_),
......@@ -130,7 +130,7 @@ Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::nu
bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read()
{
coeffDict_ <<= dict_.subDict(typeName + "Coeffs");
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
Fr_.read(coeffDict_);
eta_.read(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -57,7 +57,7 @@ JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer
)
:
frictionalStressModel(dict),
coeffDict_(dict.subDict(typeName + "Coeffs")),
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_),
eta_("eta", dimless, coeffDict_),
p_("p", dimless, coeffDict_),
......@@ -190,7 +190,7 @@ JohnsonJacksonSchaeffer::nu
bool Foam::kineticTheoryModels::frictionalStressModels::
JohnsonJacksonSchaeffer::read()
{
coeffDict_ <<= dict_.subDict(typeName + "Coeffs");
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
Fr_.read(coeffDict_);
eta_.read(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -55,7 +55,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer
)
:
frictionalStressModel(dict),
coeffDict_(dict.subDict(typeName + "Coeffs")),
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
phi_("phi", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
......@@ -178,7 +178,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu
bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read()
{
coeffDict_ <<= dict_.subDict(typeName + "Coeffs");
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::HrenyaSinclair
)
:
viscosityModel(dict),
coeffDict_(dict.subDict(typeName + "Coeffs")),
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_)
{}
......@@ -100,7 +100,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::nu
bool Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::read()
{
coeffDict_ <<= dict_.subDict(typeName + "Coeffs");
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
L_.readIfPresent(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair
)
:
conductivityModel(dict),
coeffDict_(dict.subDict(typeName + "Coeffs")),
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_)
{}
......@@ -103,7 +103,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa
bool Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::read()
{
coeffDict_ <<= dict_.subDict(typeName + "Coeffs");
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
L_.readIfPresent(coeffDict_);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment