Commit 3e43edf0 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: unify use of dictionary method names

- previously introduced `getOrDefault` as a dictionary _get_ method,
  now complete the transition and use it everywhere instead of
  `lookupOrDefault`. This avoids mixed usage of the two methods that
  are identical in behaviour, makes for shorter names, and promotes
  the distinction between "lookup" access (ie, return a token stream,
  locate and return an entry) and "get" access (ie, the above with
  conversion to concrete types such as scalar, label etc).
parent f721b534
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -68,7 +69,7 @@ Foam::mixtureViscosityModels::plastic::plastic
(
IOobject::groupName
(
viscosityProperties.lookupOrDefault<word>("alpha", "alpha"),
viscosityProperties.getOrDefault<word>("alpha", "alpha"),
viscosityProperties.dictName()
)
)
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -64,7 +65,7 @@ Foam::mixtureViscosityModels::slurry::slurry
(
IOobject::groupName
(
viscosityProperties.lookupOrDefault<word>("alpha", "alpha"),
viscosityProperties.getOrDefault<word>("alpha", "alpha"),
viscosityProperties.dictName()
)
)
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -38,12 +39,12 @@ scalar maxAlphaCo
scalar maxAlphaDdt
(
runTime.controlDict().lookupOrDefault("maxAlphaDdt", GREAT)
runTime.controlDict().getOrDefault("maxAlphaDdt", GREAT)
);
scalar maxDi
(
runTime.controlDict().lookupOrDefault<scalar>("maxDi", GREAT)
runTime.controlDict().getOrDefault<scalar>("maxDi", GREAT)
);
scalar alphaCoNum = 0.0;
......
......@@ -354,7 +354,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
focalLaserRadius_(get<scalar>("focalLaserRadius")),
qualityBeamLaser_
(
lookupOrDefault<scalar>("qualityBeamLaser", 0.0)
getOrDefault<scalar>("qualityBeamLaser", 0)
),
sigma_(0),
......@@ -364,7 +364,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
reflectionSwitch_(false),
alphaCut_(lookupOrDefault<scalar>("alphaCut", 0.5)),
alphaCut_(getOrDefault<scalar>("alphaCut", 0.5)),
a_
(
......@@ -451,7 +451,7 @@ Foam::radiation::laserDTRM::laserDTRM
focalLaserRadius_(get<scalar>("focalLaserRadius")),
qualityBeamLaser_
(
lookupOrDefault<scalar>("qualityBeamLaser", 0.0)
getOrDefault<scalar>("qualityBeamLaser", 0)
),
sigma_(0),
......@@ -461,7 +461,7 @@ Foam::radiation::laserDTRM::laserDTRM
reflectionSwitch_(false),
alphaCut_(lookupOrDefault<scalar>("alphaCut", 0.5)),
alphaCut_(getOrDefault<scalar>("alphaCut", 0.5)),
a_
(
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -41,7 +41,7 @@ Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Lee
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
C_("C", inv(dimTime), dict),
Tactivate_("Tactivate", dimTemperature, dict),
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0))
alphaMin_(dict.getOrDefault<scalar>("alphaMin", 0))
{}
......
......@@ -58,16 +58,16 @@ Foam::interfaceCompositionModel::interfaceCompositionModel
:
modelVariable_
(
modelVariableNames.lookupOrDefault
modelVariableNames.getOrDefault
(
"variable",
dict,
modelVariable::T
)
),
includeVolChange_(dict.lookupOrDefault("includeVolChange", true)),
includeVolChange_(dict.getOrDefault("includeVolChange", true)),
pair_(pair),
speciesName_(dict.lookupOrDefault<word>("species", "none")),
speciesName_(dict.getOrDefault<word>("species", "none")),
mesh_(pair_.from().mesh())
{}
......
......@@ -178,8 +178,8 @@ Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
this->mesh_,
dimensionedScalar(dimMass/dimArea/dimTemperature/dimTime, Zero)
),
isoAlpha_(dict.lookupOrDefault<scalar>("isoAlpha", 0.5)),
spread_(dict.lookupOrDefault<scalar>("spread", 3))
isoAlpha_(dict.getOrDefault<scalar>("isoAlpha", 0.5)),
spread_(dict.getOrDefault<scalar>("spread", 3))
{}
......
......@@ -161,7 +161,7 @@ Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
this->mesh_,
dimensionedScalar(dimDensity/dimTime, Zero)
),
isoAlpha_(dict.lookupOrDefault<scalar>("isoAlpha", 0.5))
isoAlpha_(dict.getOrDefault<scalar>("isoAlpha", 0.5))
{
word speciesName = IOobject::member(this->transferSpecie());
......
......@@ -313,7 +313,7 @@ void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
scalar nYiSubCycles
(
MULEScontrols.lookupOrDefault<scalar>("nYiSubCycles", 1)
MULEScontrols.getOrDefault<scalar>("nYiSubCycles", 1)
);
forAll(X_, i)
......
......@@ -250,7 +250,7 @@ Foam::phaseSystem::phaseSystem
totalPhasePairs_(),
Prt_
(
dimensionedScalar::lookupOrAddToDict
dimensionedScalar::getOrAddToDict
(
"Prt", *this, 1.0
)
......
bool correctPhi
(
pimple.dict().lookupOrDefault("correctPhi", true)
pimple.dict().getOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
pimple.dict().getOrDefault("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
pimple.dict().getOrDefault("moveMeshOuterCorrectors", false)
);
bool massFluxInterpolation
(
pimple.dict().lookupOrDefault("massFluxInterpolation", false)
pimple.dict().getOrDefault("massFluxInterpolation", false)
);
bool adjustFringe
(
pimple.dict().lookupOrDefault("oversetAdjustPhi", false)
pimple.dict().getOrDefault("oversetAdjustPhi", false)
);
bool ddtCorr
(
pimple.dict().lookupOrDefault("ddtCorr", true)
pimple.dict().getOrDefault("ddtCorr", true)
);
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
checkMeshCourantNo =
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
pimple.dict().getOrDefault("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false);
pimple.dict().getOrDefault("moveMeshOuterCorrectors", false);
massFluxInterpolation =
pimple.dict().lookupOrDefault("massFluxInterpolation", false);
pimple.dict().getOrDefault("massFluxInterpolation", false);
ddtCorr = pimple.dict().lookupOrDefault("ddtCorr", true);
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
adjustFringe = pimple.dict().lookupOrDefault("oversetAdjustPhi", false);
adjustFringe = pimple.dict().getOrDefault("oversetAdjustPhi", false);
......@@ -4,18 +4,18 @@ label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));
bool MULESCorr(alphaControls.getOrDefault("MULESCorr", false));
// Apply the compression correction from the previous iteration
// Improves efficiency for steady-simulations but can only be applied
// once the alpha field is reasonably steady, i.e. fully developed
//bool alphaApplyPrevCorr
//(
// alphaControls.lookupOrDefault("alphaApplyPrevCorr", false)
// alphaControls.getOrDefault("alphaApplyPrevCorr", false)
//);
// Isotropic compression coefficient
scalar icAlpha
(
alphaControls.lookupOrDefault<scalar>("icAlpha", 0)
alphaControls.getOrDefault<scalar>("icAlpha", 0)
);
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -72,7 +73,7 @@ int main(int argc, char *argv[])
scalar slamDampCoeff
(
fluid.lookupOrDefault<scalar>("slamDampCoeff", 1)
fluid.getOrDefault<scalar>("slamDampCoeff", 1)
);
dimensionedScalar maxSlamVelocity
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -362,7 +362,7 @@ Foam::functionObjects::sizeDistribution::sizeDistribution
nCells_(0),
cellId_(),
volume_(0.0),
writeVolume_(dict.lookupOrDefault("writeVolume", false)),
writeVolume_(dict.getOrDefault("writeVolume", false)),
popBal_
(
obr_.lookupObject<Foam::diameterModels::populationBalanceModel>
......@@ -371,8 +371,8 @@ Foam::functionObjects::sizeDistribution::sizeDistribution
)
),
N_(popBal_.sizeGroups().size()),
momentOrder_(dict.lookupOrDefault<label>("momentOrder", 0)),
normalize_(dict.lookupOrDefault("normalize", false)),
momentOrder_(dict.getOrDefault<label>("momentOrder", 0)),
normalize_(dict.getOrDefault("normalize", false)),
sumN_(0.0),
sumV_(0.0)
{
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -65,11 +66,11 @@ int main(int argc, char *argv[])
Switch faceMomentum
(
pimple.dict().lookupOrDefault<Switch>("faceMomentum", false)
pimple.dict().getOrDefault<Switch>("faceMomentum", false)
);
Switch partialElimination
(
pimple.dict().lookupOrDefault<Switch>("partialElimination", false)
pimple.dict().getOrDefault<Switch>("partialElimination", false)
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -82,7 +83,7 @@ int main(int argc, char *argv[])
int nEnergyCorrectors
(
pimple.dict().lookupOrDefault<int>("nEnergyCorrectors", 1)
pimple.dict().getOrDefault<int>("nEnergyCorrectors", 1)
);
if (LTS)
......
......@@ -5,17 +5,17 @@
scalar maxCo
(
pimpleDict.lookupOrDefault<scalar>("maxCo", 0.2)
pimpleDict.getOrDefault<scalar>("maxCo", 0.2)
);
scalar maxDeltaT
(
pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)
pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
);
scalar rDeltaTSmoothingCoeff
(
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
);
surfaceScalarField maxPhi("maxPhi", phi);
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -75,7 +76,7 @@ int main(int argc, char *argv[])
bool faceMomentum
(
pimple.dict().lookupOrDefault("faceMomentum", false)
pimple.dict().getOrDefault("faceMomentum", false)
);
#include "pUf/createRDeltaTf.H"
......@@ -90,7 +91,7 @@ int main(int argc, char *argv[])
int nEnergyCorrectors
(
pimple.dict().lookupOrDefault<int>("nEnergyCorrectors", 1)
pimple.dict().getOrDefault<int>("nEnergyCorrectors", 1)
);
if (LTS)
......
......@@ -5,17 +5,17 @@
scalar maxCo
(
pimpleDict.lookupOrDefault<scalar>("maxCo", 0.2)
pimpleDict.getOrDefault<scalar>("maxCo", 0.2)
);
scalar maxDeltaT
(
pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)
pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
);
scalar rDeltaTSmoothingCoeff
(
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
);
// Set the reciprocal time-step from the local Courant number
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -68,12 +69,12 @@ int main(int argc, char *argv[])
bool faceMomentum
(
pimple.dict().lookupOrDefault("faceMomentum", false)
pimple.dict().getOrDefault("faceMomentum", false)
);
bool implicitPhasePressure
(
mesh.solverDict(alpha1.name()).lookupOrDefault
mesh.solverDict(alpha1.name()).getOrDefault
(
"implicitPhasePressure", false
)
......
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