mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- 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:
@ -160,10 +160,9 @@ basicKinematicMPPICCloud kinematicCloud
|
||||
scalar alphacMin
|
||||
(
|
||||
1.0
|
||||
- readScalar
|
||||
(
|
||||
- (
|
||||
kinematicCloud.particleProperties().subDict("constantProperties")
|
||||
.lookup("alphaMax")
|
||||
.get<scalar>("alphaMax")
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
|
||||
scalar maxAlphaCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
|
||||
runTime.controlDict().get<scalar>("maxAlphaCo")
|
||||
);
|
||||
|
||||
scalar alphaCoNum = 0.0;
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
|
||||
scalar maxAcousticCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
|
||||
runTime.controlDict().get<scalar>("maxAcousticCo")
|
||||
);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
|
||||
scalar maxAcousticCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
|
||||
runTime.controlDict().get<scalar>("maxAcousticCo")
|
||||
);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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));
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
|
||||
scalar maxAlphaCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
|
||||
runTime.controlDict().get<scalar>("maxAlphaCo")
|
||||
);
|
||||
|
||||
scalar maxAlphaDdt
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -53,7 +53,7 @@ Foam::radiation::FresnelLaser::FresnelLaser
|
||||
)
|
||||
:
|
||||
reflectionModel(dict, mesh),
|
||||
epsilon_(readScalar(dict.lookup("epsilon")))
|
||||
epsilon_(dict.get<scalar>("epsilon"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -50,10 +50,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
|
||||
|
||||
const word modelType
|
||||
(
|
||||
phaseChangePropertiesDict.lookup
|
||||
(
|
||||
"phaseChangeTwoPhaseModel"
|
||||
)
|
||||
phaseChangePropertiesDict.get<word>("phaseChangeTwoPhaseModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting phaseChange model " << modelType << endl;
|
||||
|
||||
@ -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"));
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
|
||||
scalar maxAlphaCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
|
||||
runTime.controlDict().get<scalar>("maxAlphaCo")
|
||||
);
|
||||
|
||||
scalar alphaCoNum = 0.0;
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
|
||||
|
||||
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
|
||||
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
|
||||
scalar maxAlphaCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
|
||||
runTime.controlDict().get<scalar>("maxAlphaCo")
|
||||
);
|
||||
|
||||
scalar alphaCoNum = 0.0;
|
||||
|
||||
@ -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));
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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_);
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ KocamustafaogullariIshii::KocamustafaogullariIshii
|
||||
)
|
||||
:
|
||||
departureDiameterModel(),
|
||||
phi_(readScalar(dict.lookup("phi")))
|
||||
phi_(dict.get<scalar>("phi"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ Foam::wallBoilingModels::partitioningModels::
|
||||
Lavieville::Lavieville(const dictionary& dict)
|
||||
:
|
||||
partitioningModel(),
|
||||
alphaCrit_(readScalar(dict.lookup("alphaCrit")))
|
||||
alphaCrit_(dict.get<scalar>("alphaCrit"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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_);
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
|
||||
|
||||
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
|
||||
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
|
||||
scalar maxAlphaCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
|
||||
runTime.controlDict().get<scalar>("maxAlphaCo")
|
||||
);
|
||||
|
||||
scalar alphaCoNum = 0.0;
|
||||
|
||||
@ -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"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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() + ')');
|
||||
|
||||
Reference in New Issue
Block a user