ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)

- use the dictionary 'get' methods instead of readScalar for
  additional checking

     Unchecked:  readScalar(dict.lookup("key"));
     Checked:    dict.get<scalar>("key");

- In templated classes that also inherit from a dictionary, an additional
  'template' keyword will be required. Eg,

     this->coeffsDict().template get<scalar>("key");

  For this common use case, the predefined getXXX shortcuts may be
  useful. Eg,

     this->coeffsDict().getScalar("key");
This commit is contained in:
Mark Olesen
2018-10-12 08:14:47 +02:00
parent 990d00d40d
commit 8eddcc072a
335 changed files with 1007 additions and 1127 deletions

View File

@ -49,7 +49,7 @@ Foam::XiGModels::basicSubGrid::basicSubGrid
)
:
XiGModel(XiGProperties, thermo, turbulence, Su),
k1(readScalar(XiGModelCoeffs_.lookup("k1"))),
k1(XiGModelCoeffs_.get<scalar>("k1")),
XiGModel_(XiGModel::New(XiGModelCoeffs_, thermo, turbulence, Su))
{}

View File

@ -49,13 +49,10 @@ Foam::XiEqModels::Gulder::Gulder
)
:
XiEqModel(XiEqProperties, thermo, turbulence, Su),
XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))),
XiEqCoef_(XiEqModelCoeffs_.get<scalar>("XiEqCoef")),
SuMin_(0.01*Su.average()),
uPrimeCoef_(readScalar(XiEqModelCoeffs_.lookup("uPrimeCoef"))),
subGridSchelkin_
(
readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
)
uPrimeCoef_(XiEqModelCoeffs_.get<scalar>("uPrimeCoef")),
subGridSchelkin_(XiEqModelCoeffs_.get<bool>("subGridSchelkin"))
{}

View File

@ -49,15 +49,12 @@ Foam::XiEqModels::SCOPEXiEq::SCOPEXiEq
)
:
XiEqModel(XiEqProperties, thermo, turbulence, Su),
XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))),
XiEqExp_(readScalar(XiEqModelCoeffs_.lookup("XiEqExp"))),
lCoef_(readScalar(XiEqModelCoeffs_.lookup("lCoef"))),
XiEqCoef_(XiEqModelCoeffs_.get<scalar>("XiEqCoef")),
XiEqExp_(XiEqModelCoeffs_.get<scalar>("XiEqExp")),
lCoef_(XiEqModelCoeffs_.get<scalar>("lCoef")),
SuMin_(0.01*Su.average()),
uPrimeCoef_(readScalar(XiEqModelCoeffs_.lookup("uPrimeCoef"))),
subGridSchelkin_
(
readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
),
uPrimeCoef_(XiEqModelCoeffs_.get<scalar>("uPrimeCoef")),
subGridSchelkin_(XiEqModelCoeffs_.get<bool>("subGridSchelkin")),
MaModel
(
Su.mesh().lookupObject<IOdictionary>("combustionProperties"),

View File

@ -49,7 +49,7 @@ Foam::XiEqModels::instability::instability
)
:
XiEqModel(XiEqProperties, thermo, turbulence, Su),
XiEqIn(readScalar(XiEqModelCoeffs_.lookup("XiEqIn"))),
XiEqIn(XiEqModelCoeffs_.get<scalar>("XiEqIn")),
XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
{}

View File

@ -49,7 +49,7 @@ Foam::XiGModels::KTS::KTS
)
:
XiGModel(XiGProperties, thermo, turbulence, Su),
GEtaCoef_(readScalar(XiGModelCoeffs_.lookup("GEtaCoef")))
GEtaCoef_(XiGModelCoeffs_.get<scalar>("GEtaCoef"))
{}

View File

@ -52,7 +52,7 @@ Foam::XiModels::algebraic::algebraic
)
:
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))),
XiShapeCoef(XiModelCoeffs_.get<scalar>("XiShapeCoef")),
XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
{}

View File

@ -57,7 +57,7 @@ Foam::XiModels::transport::transport
)
:
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))),
XiShapeCoef(XiModelCoeffs_.get<scalar>("XiShapeCoef")),
XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
{}

View File

@ -53,8 +53,8 @@ Foam::laminarFlameSpeedModels::SCOPE::polynomial::polynomial
)
:
FixedList<scalar, 7>(polyDict.lookup("coefficients")),
ll(readScalar(polyDict.lookup("lowerLimit"))),
ul(readScalar(polyDict.lookup("upperLimit"))),
ll(polyDict.get<scalar>("lowerLimit")),
ul(polyDict.get<scalar>("upperLimit")),
llv(polyPhi(ll, *this)),
ulv(polyPhi(ul, *this)),
lu(0)
@ -75,39 +75,30 @@ Foam::laminarFlameSpeedModels::SCOPE::SCOPE
(
IFstream
(
fileName
(
dict.lookup("fuelFile")
)
dict.get<fileName>("fuelFile")
)()
).optionalSubDict(typeName + "Coeffs")
),
LFL_
(
readScalar
coeffsDict_.getCompat<scalar>
(
coeffsDict_.lookupCompat
(
"lowerFlammabilityLimit",
{{"lowerFlamabilityLimit", 1712}}
)
"lowerFlammabilityLimit",
{{"lowerFlamabilityLimit", 1712}}
)
),
UFL_
(
readScalar
coeffsDict_.getCompat<scalar>
(
coeffsDict_.lookupCompat
(
"upperFlammabilityLimit",
{{"upperFlamabilityLimit", 1712}}
)
"upperFlammabilityLimit",
{{"upperFlamabilityLimit", 1712}}
)
),
SuPolyL_(coeffsDict_.subDict("lowerSuPolynomial")),
SuPolyU_(coeffsDict_.subDict("upperSuPolynomial")),
Texp_(readScalar(coeffsDict_.lookup("Texp"))),
pexp_(readScalar(coeffsDict_.lookup("pexp"))),
Texp_(coeffsDict_.get<scalar>("Texp")),
pexp_(coeffsDict_.get<scalar>("pexp")),
MaPolyL_(coeffsDict_.subDict("lowerMaPolynomial")),
MaPolyU_(coeffsDict_.subDict("upperMaPolynomial"))
{

View File

@ -18,8 +18,8 @@
)
);
scalar p0 = readScalar(initialConditions.lookup("p"));
scalar T0 = readScalar(initialConditions.lookup("T"));
scalar p0 = initialConditions.get<scalar>("p");
scalar T0 = initialConditions.get<scalar>("T");
#include "createBaseFields.H"

View File

@ -40,7 +40,7 @@
const word& name = Y[i].name();
if (fractions.found(name))
{
X0[i] = readScalar(fractions.lookup(name));
X0[i] = fractions.get<scalar>(name);
}
}
@ -64,7 +64,7 @@
const word& name = Y[i].name();
if (fractions.found(name))
{
Y0[i] = readScalar(fractions.lookup(name));
Y0[i] = fractions.get<scalar>(name);
}
}

View File

@ -29,7 +29,7 @@ License
const dictionary& pimpleDict = pimple.dict();
// Maximum flow Courant number
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")));
scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));
@ -118,7 +118,7 @@ License
if (Yref.found(Yi.name()))
{
foundY = true;
scalar Yrefi = readScalar(Yref.lookup(Yi.name()));
const scalar Yrefi = Yref.get<scalar>(Yi.name());
rDeltaTY.field() = max
(

View File

@ -84,7 +84,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")),
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
accommodationCoeff_(dict.get<scalar>("accommodationCoeff")),
Twall_("Twall", dict, p.size()),
gamma_(dict.lookupOrDefault<scalar>("gamma", 1.4))
{

View File

@ -85,7 +85,7 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")),
tauMCName_(dict.lookupOrDefault<word>("tauMC", "tauMC")),
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
accommodationCoeff_(dict.get<scalar>("accommodationCoeff")),
Uwall_("Uwall", dict, p.size()),
thermalCreep_(dict.lookupOrDefault("thermalCreep", true)),
curvature_(dict.lookupOrDefault("curvature", true))

View File

@ -25,8 +25,8 @@
if (!local)
{
const scalar T0 = readScalar(eosDict.lookup("T0"));
const scalar p0 = readScalar(eosDict.lookup("p0"));
const scalar T0 = eosDict.get<scalar>("T0");
const scalar p0 = eosDict.get<scalar>("p0");
he = thermo.he(p, pow(p/p0, (gamma - scalar(1))/gamma)*T0);
}

View File

@ -12,7 +12,7 @@ IOdictionary mdEquilibrationDict
)
);
scalar targetTemperature = readScalar
scalar targetTemperature
(
mdEquilibrationDict.lookup("targetTemperature")
mdEquilibrationDict.get<scalar>("targetTemperature")
);

View File

@ -139,10 +139,9 @@ basicKinematicTypeCloud kinematicCloud
scalar alphacMin
(
1.0
- readScalar
(
- (
kinematicCloud.particleProperties().subDict("constantProperties")
.lookup("alphaMax")
.get<scalar>("alphaMax")
)
);

View File

@ -29,7 +29,7 @@ License
const dictionary& pimpleDict = pimple.dict();
// Maximum flow Courant number
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")));
scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));

View File

@ -29,7 +29,7 @@ License
const dictionary& pimpleDict = pimple.dict();
// Maximum flow Courant number
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")));
scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));

View File

@ -160,10 +160,9 @@ basicKinematicMPPICCloud kinematicCloud
scalar alphacMin
(
1.0
- readScalar
(
- (
kinematicCloud.particleProperties().subDict("constantProperties")
.lookup("alphaMax")
.get<scalar>("alphaMax")
)
);

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo
(
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
runTime.controlDict().get<scalar>("maxAlphaCo")
);
scalar alphaCoNum = 0.0;

View File

@ -2,5 +2,5 @@
scalar maxAcousticCo
(
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
runTime.controlDict().get<scalar>("maxAcousticCo")
);

View File

@ -70,10 +70,10 @@
// Remove the swirl component of velocity for "wedge" cases
if (pimple.dict().found("removeSwirl"))
{
label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl")));
label swirlCmpt(pimple.dict().get<label>("removeSwirl"));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0);
U.field().replace(swirlCmpt, Zero);
}
U.correctBoundaryConditions();

View File

@ -2,5 +2,5 @@
scalar maxAcousticCo
(
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
runTime.controlDict().get<scalar>("maxAcousticCo")
);

View File

@ -73,10 +73,10 @@
// Remove the swirl component of velocity for "wedge" cases
if (pimple.dict().found("removeSwirl"))
{
label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl")));
label swirlCmpt(pimple.dict().get<label>("removeSwirl"));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0);
U.field().replace(swirlCmpt, Zero);
}
U.correctBoundaryConditions();

View File

@ -763,8 +763,8 @@ void Foam::multiphaseMixtureThermo::solve()
const Time& runTime = mesh_.time();
const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
scalar cAlpha(readScalar(alphaControls.lookup("cAlpha")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
scalar cAlpha(alphaControls.get<scalar>("cAlpha"));
volScalarField& alpha = phases_.first();

View File

@ -1,8 +1,8 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo
(
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
runTime.controlDict().get<scalar>("maxAlphaCo")
);
scalar maxAlphaDdt

View File

@ -198,7 +198,7 @@ void Foam::radiation::laserDTRM::initialise()
{
case pdGaussian:
{
sigma_ = readScalar(lookup("sigma"));
sigma_ = get<scalar>("sigma");
break;
}
case pdManual:
@ -325,8 +325,8 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
mode_(powerDistNames_.lookup("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
nParticles_(0),
ndTheta_(readLabel(lookup("nTheta"))),
ndr_(readLabel(lookup("nr"))),
ndTheta_(get<label>("nTheta")),
ndr_(get<label>("nr")),
maxTrackLength_(mesh_.bounds().mag()),
focalLaserPosition_
@ -339,7 +339,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
Function1<vector>::New("laserDirection", *this)
),
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))),
focalLaserRadius_(get<scalar>("focalLaserRadius")),
qualityBeamLaser_
(
lookupOrDefault<scalar>("qualityBeamLaser", 0.0)
@ -435,8 +435,8 @@ Foam::radiation::laserDTRM::laserDTRM
mode_(powerDistNames_.lookup("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
nParticles_(0),
ndTheta_(readLabel(lookup("nTheta"))),
ndr_(readLabel(lookup("nr"))),
ndTheta_(get<label>("nTheta")),
ndr_(get<label>("nr")),
maxTrackLength_(mesh_.bounds().mag()),
focalLaserPosition_
@ -448,7 +448,7 @@ Foam::radiation::laserDTRM::laserDTRM
Function1<vector>::New("laserDirection", *this)
),
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))),
focalLaserRadius_(get<scalar>("focalLaserRadius")),
qualityBeamLaser_
(
lookupOrDefault<scalar>("qualityBeamLaser", 0.0)

View File

@ -53,7 +53,7 @@ Foam::radiation::FresnelLaser::FresnelLaser
)
:
reflectionModel(dict, mesh),
epsilon_(readScalar(dict.lookup("epsilon")))
epsilon_(dict.get<scalar>("epsilon"))
{}

View File

@ -53,8 +53,8 @@ Foam::porousModels::VollerPrakash::VollerPrakash
)
:
porousModel(dict, mesh),
Cu_(readScalar(dict.lookup("Cu"))),
solidPhase_(dict.lookup("solidPhase"))
Cu_(dict.get<scalar>("Cu")),
solidPhase_(dict.get<word>("solidPhase"))
{}

View File

@ -191,7 +191,7 @@ void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
const dictionary& MULEScontrols = mesh.solverDict(alpha1.name());
scalar cAlpha(readScalar(MULEScontrols.lookup("cYi")));
scalar cAlpha(MULEScontrols.get<scalar>("cYi"));
PtrList<surfaceScalarField> phiYiCorrs(species_.size());
const surfaceScalarField& phi = this->fluid().phi();

View File

@ -269,8 +269,8 @@ void Foam::multiphaseSystem::solve()
const fvMesh& mesh = this->mesh();
const dictionary& alphaControls = mesh.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_);
// Reset ddtAlphaMax

View File

@ -50,10 +50,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
const word modelType
(
phaseChangePropertiesDict.lookup
(
"phaseChangeTwoPhaseModel"
)
phaseChangePropertiesDict.get<word>("phaseChangeTwoPhaseModel")
);
Info<< "Selecting phaseChange model " << modelType << endl;

View File

@ -1,5 +1,5 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));

View File

@ -155,13 +155,10 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties
mixture_(mixture),
cAlpha_
(
readScalar
mixture.U().mesh().solverDict
(
mixture.U().mesh().solverDict
(
mixture_.alpha1().name()
).lookup("cAlpha")
)
mixture_.alpha1().name()
).get<scalar>("cAlpha")
),
sigma12_("sigma12", dimensionSet(1, 0, -2, 0, 0), mixture),
sigma13_("sigma13", dimensionSet(1, 0, -2, 0, 0), mixture),

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo
(
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
runTime.controlDict().get<scalar>("maxAlphaCo")
);
scalar alphaCoNum = 0.0;

View File

@ -1,3 +1,3 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo
(
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
runTime.controlDict().get<scalar>("maxAlphaCo")
);
scalar alphaCoNum = 0.0;

View File

@ -1,8 +1,8 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));

View File

@ -844,7 +844,7 @@ void Foam::multiphaseSystem::solve()
const Time& runTime = mesh_.time();
const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
if (nAlphaSubCycles > 1)
{

View File

@ -311,8 +311,8 @@ void Foam::multiphaseMixture::solve()
volScalarField& alpha = phases_.first();
const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
scalar cAlpha(readScalar(alphaControls.lookup("cAlpha")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
scalar cAlpha(alphaControls.get<scalar>("cAlpha"));
if (nAlphaSubCycles > 1)
{

View File

@ -55,7 +55,7 @@ Foam::wallLubricationModels::Frank::Frank
wallLubricationModel(dict, pair),
Cwd_("Cwd", dimless, dict),
Cwc_("Cwc", dimless, dict),
p_(readScalar(dict.lookup("p")))
p_(dict.get<scalar>("p"))
{}

View File

@ -606,7 +606,7 @@ void Foam::multiphaseSystem::solve()
const Time& runTime = mesh_.time();
const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool LTS = fv::localEulerDdt::enabled(mesh_);

View File

@ -60,7 +60,7 @@ KocamustafaogullariIshii::KocamustafaogullariIshii
)
:
departureDiameterModel(),
phi_(readScalar(dict.lookup("phi")))
phi_(dict.get<scalar>("phi"))
{}

View File

@ -52,7 +52,7 @@ Foam::wallBoilingModels::partitioningModels::
Lavieville::Lavieville(const dictionary& dict)
:
partitioningModel(),
alphaCrit_(readScalar(dict.lookup("alphaCrit")))
alphaCrit_(dict.get<scalar>("alphaCrit"))
{}

View File

@ -52,8 +52,8 @@ Foam::wallBoilingModels::partitioningModels::
cosine::cosine(const dictionary& dict)
:
partitioningModel(),
alphaLiquid1_(readScalar(dict.lookup("alphaLiquid1"))),
alphaLiquid0_(readScalar(dict.lookup("alphaLiquid0")))
alphaLiquid1_(dict.get<scalar>("alphaLiquid1")),
alphaLiquid0_(dict.get<scalar>("alphaLiquid0"))
{}

View File

@ -52,8 +52,8 @@ Foam::wallBoilingModels::partitioningModels::
linear::linear(const dictionary& dict)
:
partitioningModel(),
alphaLiquid1_(readScalar(dict.lookup("alphaLiquid1"))),
alphaLiquid0_(readScalar(dict.lookup("alphaLiquid0")))
alphaLiquid1_(dict.get<scalar>("alphaLiquid1")),
alphaLiquid0_(dict.get<scalar>("alphaLiquid0"))
{}

View File

@ -57,9 +57,9 @@ Foam::RASModels::phasePressureModel::phasePressureModel
phase_(phase),
alphaMax_(readScalar(coeffDict_.lookup("alphaMax"))),
preAlphaExp_(readScalar(coeffDict_.lookup("preAlphaExp"))),
expMax_(readScalar(coeffDict_.lookup("expMax"))),
alphaMax_(coeffDict_.get<scalar>("alphaMax")),
preAlphaExp_(coeffDict_.get<scalar>("preAlphaExp")),
expMax_(coeffDict_.get<scalar>("expMax")),
g0_
(
"g0",

View File

@ -193,8 +193,8 @@ void Foam::twoPhaseSystem::solve()
const dictionary& alphaControls = mesh_.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
bool LTS = fv::localEulerDdt::enabled(mesh_);

View File

@ -1,3 +1,3 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo
(
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
runTime.controlDict().get<scalar>("maxAlphaCo")
);
scalar alphaCoNum = 0.0;

View File

@ -55,7 +55,7 @@ Foam::wallLubricationModels::Frank::Frank
wallLubricationModel(dict, pair),
Cwd_("Cwd", dimless, dict),
Cwc_("Cwc", dimless, dict),
p_(readScalar(dict.lookup("p")))
p_(dict.get<scalar>("p"))
{}

View File

@ -60,9 +60,9 @@ Foam::RASModels::phasePressureModel::phasePressureModel
phase_(phase),
alphaMax_(readScalar(coeffDict_.lookup("alphaMax"))),
preAlphaExp_(readScalar(coeffDict_.lookup("preAlphaExp"))),
expMax_(readScalar(coeffDict_.lookup("expMax"))),
alphaMax_(coeffDict_.get<scalar>("alphaMax")),
preAlphaExp_(coeffDict_.get<scalar>("preAlphaExp")),
expMax_(coeffDict_.get<scalar>("expMax")),
g0_
(
"g0",

View File

@ -360,8 +360,8 @@ void Foam::twoPhaseSystem::solve()
alpha1.name()
);
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
word alphaScheme("div(phi," + alpha1.name() + ')');
word alpharScheme("div(phir," + alpha1.name() + ')');

View File

@ -13,7 +13,7 @@
);
const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
word rhoType(rhoDict.lookup("type"));
word rhoType(rhoDict.get<word>("type"));
autoPtr<volScalarField> rhoPtr;
@ -28,7 +28,7 @@
if (rhoType == "uniform")
{
scalar rhoValue(readScalar(rhoDict.lookup("value")));
scalar rhoValue(rhoDict.get<scalar>("value"));
rhoPtr.reset
(
@ -68,7 +68,7 @@
volScalarField& rho = rhoPtr();
const dictionary& EDict(mechanicalProperties.subDict("E"));
word EType(EDict.lookup("type"));
word EType(EDict.get<word>("type"));
autoPtr<volScalarField> EPtr;
@ -83,7 +83,7 @@
if (EType == "uniform")
{
scalar rhoEValue(readScalar(EDict.lookup("value")));
scalar rhoEValue(EDict.get<scalar>("value"));
EPtr.reset
(
@ -134,11 +134,11 @@
);
const dictionary& nuDict(mechanicalProperties.subDict("nu"));
word nuType(nuDict.lookup("type"));
word nuType(nuDict.get<word>("type"));
if (nuType == "uniform")
{
scalar nuValue(readScalar(nuDict.lookup("value")));
scalar nuValue(nuDict.get<scalar>("value"));
nuPtr.reset
(
new volScalarField

View File

@ -58,10 +58,10 @@ if (thermalStress)
);
const dictionary& CDict(thermalProperties.subDict("C"));
word CType(CDict.lookup("type"));
word CType(CDict.get<word>("type"));
if (CType == "uniform")
{
scalar CValue(readScalar(CDict.lookup("value")));
scalar CValue(CDict.get<scalar>("value"));
CPtr.reset
(
@ -113,10 +113,10 @@ if (thermalStress)
);
const dictionary& kDict(thermalProperties.subDict("k"));
word kType(kDict.lookup("type"));
word kType(kDict.get<word>("type"));
if (kType == "uniform")
{
scalar rhoKValue(readScalar(kDict.lookup("value")));
scalar rhoKValue(kDict.get<scalar>("value"));
rhoKPtr.reset
(
@ -169,11 +169,11 @@ if (thermalStress)
const dictionary& alphaDict(thermalProperties.subDict("alpha"));
word alphaType(alphaDict.lookup("type"));
word alphaType(alphaDict.get<word>("type"));
if (alphaType == "uniform")
{
scalar alphaValue(readScalar(alphaDict.lookup("value")));
scalar alphaValue(alphaDict.get<scalar>("value"));
alphaPtr.reset
(
new volScalarField

View File

@ -1 +1 @@
scalar accFac(readScalar(stressControl.lookup("accelerationFactor")));
scalar accFac(stressControl.get<scalar>("accelerationFactor"));