ENH: additional read guards for dimensionedType. input consistency (#762, #1148)

- provide a lookupOrDefault constructor form, since this is a fairly
  commonly used requirement and simplifies the calling sequence.

  Before

      dimensionedScalar rhoMax
      (
          dimensionedScalar::lookupOrDefault
          (
              "rhoMax",
              pimple.dict(),
              dimDensity,
              GREAT
          )
     );

  After

      dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());

- read, readIfPresent methods with alternative lookup names.

- Mark the Istream related constructors with compile-time deprecated
  warnings.

BUG: read, readIfPresent methods not handling optional dimensions (#1148)
This commit is contained in:
Mark Olesen
2019-01-03 13:34:11 +01:00
parent af310075a0
commit 6a448016aa
58 changed files with 443 additions and 688 deletions

View File

@ -98,26 +98,7 @@ volScalarField Qdot
#include "createMRF.H"
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
pimple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
pimple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, pimple.dict());
#include "createFvOptions.H"

View File

@ -180,7 +180,6 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
"Pr",
dimless,
thermophysicalProperties.subDict("mixture").subDict("transport")
.lookup("Pr")
);
Field<scalar> C2

View File

@ -62,27 +62,7 @@ autoPtr<compressible::turbulenceModel> turbulence
#include "createMRF.H"
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
pimple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
pimple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, pimple.dict());
#include "createFvOptions.H"

View File

@ -41,27 +41,8 @@ volVectorField U
pressureControl pressureControl(p, rho, pimple.dict(), false);
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
pimple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
pimple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, pimple.dict());
mesh.setFluxRequired(p.name());

View File

@ -89,26 +89,7 @@ dimensionedScalar totalVolume = sum(mesh.V());
#include "createMRF.H"
#include "createRadiationModel.H"
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
simple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
simple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, simple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, simple.dict());
#include "createFvOptions.H"

View File

@ -199,31 +199,13 @@ forAll(fluidRegions, i)
rhoMax.set
(
i,
new dimensionedScalar
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
simpleDict,
dimDensity,
GREAT
)
)
new dimensionedScalar("rhoMax", dimDensity, GREAT, simpleDict)
);
rhoMin.set
(
i,
new dimensionedScalar
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
simpleDict,
dimDensity,
0
)
)
new dimensionedScalar("rhoMin", dimDensity, Zero, simpleDict)
);
Info<< " Adding MRF\n" << endl;

View File

@ -52,27 +52,8 @@ volVectorField U
mesh.setFluxRequired(p.name());
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
simple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
simple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, simple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, simple.dict());
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence

View File

@ -53,27 +53,8 @@ volVectorField U
mesh.setFluxRequired(p.name());
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
simple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
simple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, simple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, simple.dict());
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence

View File

@ -52,27 +52,8 @@ volVectorField U
mesh.setFluxRequired(p.name());
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
pimple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
pimple.dict(),
dimDensity,
0
)
);
const dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());
const dimensionedScalar rhoMin("rhoMin", dimDensity, Zero, pimple.dict());
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence

View File

@ -12,41 +12,16 @@ IOdictionary thermodynamicProperties
)
);
dimensionedScalar psil
(
"psil",
dimCompressibility,
thermodynamicProperties
);
dimensionedScalar psil("psil", dimCompressibility, thermodynamicProperties);
dimensionedScalar rholSat
(
"rholSat",
dimDensity,
thermodynamicProperties
);
dimensionedScalar rholSat("rholSat", dimDensity, thermodynamicProperties);
dimensionedScalar psiv
(
"psiv",
dimCompressibility,
thermodynamicProperties
);
dimensionedScalar psiv("psiv", dimCompressibility, thermodynamicProperties);
dimensionedScalar pSat
(
"pSat",
dimPressure,
thermodynamicProperties
);
dimensionedScalar pSat("pSat", dimPressure, thermodynamicProperties);
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
dimensionedScalar rhoMin
(
"rhoMin",
dimDensity,
thermodynamicProperties
);
const dimensionedScalar rhoMin("rhoMin", dimDensity, thermodynamicProperties);

View File

@ -57,24 +57,9 @@ Foam::mixtureViscosityModels::plastic::plastic
:
mixtureViscosityModel(name, viscosityProperties, U, phi),
plasticCoeffs_(viscosityProperties.optionalSubDict(modelName + "Coeffs")),
plasticViscosityCoeff_
(
"coeff",
dimensionSet(1, -1, -1, 0, 0),
plasticCoeffs_.lookup("coeff")
),
plasticViscosityExponent_
(
"exponent",
dimless,
plasticCoeffs_.lookup("exponent")
),
muMax_
(
"muMax",
dimensionSet(1, -1, -1, 0, 0),
plasticCoeffs_.lookup("muMax")
),
plasticViscosityCoeff_("coeff", dimDynamicViscosity, plasticCoeffs_),
plasticViscosityExponent_("exponent", dimless, plasticCoeffs_),
muMax_("muMax", dimDynamicViscosity, plasticCoeffs_),
alpha_
(
U.mesh().lookupObject<volScalarField>

View File

@ -204,7 +204,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::InterfaceCompositionModel
)
)
),
Le_("Le", dimless, dict.lookupOrDefault<scalar>("Le", 1.0))
Le_("Le", dimless, 1.0, dict)
{}

View File

@ -37,9 +37,9 @@ Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Lee
)
:
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
C_("C", inv(dimTime), dict.lookup("C")),
Tactivate_("Tactivate", dimTemperature, dict.lookup("Tactivate")),
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0.0))
C_("C", inv(dimTime), dict),
Tactivate_("Tactivate", dimTemperature, dict),
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0))
{}

View File

@ -46,19 +46,9 @@ Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
)
:
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
C_("C", dimless, dict.lookup("C")),
Tactivate_
(
"Tactivate",
dimTemperature,
dict.lookup("Tactivate")
),
Mv_
(
"Mv",
dimMass/dimMoles,
dict.lookupOrDefault<scalar>("Mv", -1)
),
C_("C", dimless, dict),
Tactivate_("Tactivate", dimTemperature, dict),
Mv_("Mv", dimMass/dimMoles, -1, dict),
alphaMax_(dict.lookupOrDefault<scalar>("alphaMax", 1.0)),
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0.5)),
alphaRestMax_(dict.lookupOrDefault<scalar>("alphaRestMax", 0.01))

View File

@ -237,7 +237,7 @@ Foam::phaseSystem::phaseSystem
totalPhasePairs_(),
Prt_
(
dimensioned<scalar>::lookupOrAddToDict
dimensionedScalar::lookupOrAddToDict
(
"Prt", *this, 1.0
)

View File

@ -48,54 +48,62 @@ Foam::thermoIncompressibleTwoPhaseMixture::thermoIncompressibleTwoPhaseMixture
(
"kappa1",
dimEnergy/dimTime/dimLength/dimTemperature,
subDict(phase1Name_).lookup("kappa")
subDict(phase1Name_),
"kappa"
),
kappa2_
(
"kappa2",
kappa1_.dimensions(),
subDict(phase2Name_).lookup("kappa")
subDict(phase2Name_),
"kappa"
),
Cp1_
(
"Cp1",
dimEnergy/dimTemperature/dimMass,
subDict(phase1Name_).lookup("Cp")
subDict(phase1Name_),
"Cp"
),
Cp2_
(
"Cp2",
dimEnergy/dimTemperature/dimMass,
subDict(phase2Name_).lookup("Cp")
subDict(phase2Name_),
"Cp"
),
Cv1_
(
"Cv1",
dimEnergy/dimTemperature/dimMass,
subDict(phase1Name_).lookup("Cv")
subDict(phase1Name_),
"Cv"
),
Cv2_
(
"Cv2",
dimEnergy/dimTemperature/dimMass,
subDict(phase2Name_).lookup("Cv")
subDict(phase2Name_),
"Cv"
),
Hf1_
(
"Hf1",
dimEnergy/dimMass,
subDict(phase1Name_).lookup("hf")
subDict(phase1Name_),
"hf"
),
Hf2_
(
"Hf2",
dimEnergy/dimMass,
subDict(phase2Name_).lookup("hf")
subDict(phase2Name_),
"hf"
)
{

View File

@ -105,12 +105,7 @@ Foam::twoPhaseMixtureEThermo::twoPhaseMixtureEThermo
)
),
TSat_
(
"TSat",
dimTemperature,
basicThermo::lookup("TSat")
),
TSat_("TSat", dimTemperature, static_cast<const basicThermo&>(*this)),
pDivU_(basicThermo::lookupOrDefault<Switch>("pDivU", true))

View File

@ -44,7 +44,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
:
incompressibleTwoPhaseMixture(U, phi),
phaseChangeTwoPhaseMixtureCoeffs_(optionalSubDict(type + "Coeffs")),
pSat_("pSat", dimPressure, lookup("pSat"))
pSat_("pSat", dimPressure, *this)
{}

View File

@ -46,18 +46,8 @@ Foam::dragModel::dragModel
interfaceDict_(interfaceDict),
phase1_(phase1),
phase2_(phase2),
residualPhaseFraction_
(
"residualPhaseFraction",
dimless,
interfaceDict.lookup("residualPhaseFraction")
),
residualSlip_
(
"residualSlip",
dimVelocity,
interfaceDict.lookup("residualSlip")
)
residualPhaseFraction_("residualPhaseFraction", dimless, interfaceDict),
residualSlip_("residualSlip", dimVelocity, interfaceDict)
{}

View File

@ -77,7 +77,8 @@ int main(int argc, char *argv[])
(
"maxSlamVelocity",
dimVelocity,
fluid.lookupOrDefault<scalar>("maxSlamVelocity", GREAT)
GREAT,
fluid
);
turbulence->validate();

View File

@ -57,7 +57,7 @@ Foam::phaseModel::phaseModel
nu_
(
"nu",
dimensionSet(0, 2, -1, 0, 0),
dimViscosity,
phaseDict_
),
kappa_
@ -69,7 +69,7 @@ Foam::phaseModel::phaseModel
Cp_
(
"Cp",
dimensionSet(0, 2, -2, -1, 0),
dimSpecificHeatCapacity,
phaseDict_
),
rho_

View File

@ -58,8 +58,10 @@ NonRandomTwoLiquid
pair.phase1().mesh(),
dimensionedScalar("one", dimless, 1)
),
beta12_("", dimless/dimTemperature, 0),
beta21_("", dimless/dimTemperature, 0)
alpha12_("alpha12", dimless, Zero),
alpha21_("alpha21", dimless, Zero),
beta12_("beta12", dimless/dimTemperature, Zero),
beta21_("beta21", dimless/dimTemperature, Zero)
{
if (this->speciesNames_.size() != 2)
{
@ -74,31 +76,10 @@ NonRandomTwoLiquid
species1Index_ = this->thermo_.composition().species()[species1Name_];
species2Index_ = this->thermo_.composition().species()[species2Name_];
alpha12_ = dimensionedScalar
(
"alpha12",
dimless,
dict.subDict(species1Name_).lookup("alpha")
);
alpha21_ = dimensionedScalar
(
"alpha21",
dimless,
dict.subDict(species2Name_).lookup("alpha")
);
beta12_ = dimensionedScalar
(
"beta12",
dimless/dimTemperature,
dict.subDict(species1Name_).lookup("beta")
);
beta21_ = dimensionedScalar
(
"beta21",
dimless/dimTemperature,
dict.subDict(species2Name_).lookup("beta")
);
alpha12_.read("alpha", dict.subDict(species1Name_));
alpha21_.read("alpha", dict.subDict(species2Name_));
beta12_.read("beta", dict.subDict(species1Name_));
beta21_.read("beta", dict.subDict(species2Name_));
saturationModel12_.reset
(

View File

@ -49,7 +49,7 @@ Foam::dragModels::Beetstra::Beetstra
)
:
dragModel(dict, pair, registerObject),
residualRe_("residualRe", dimless, dict.lookup("residualRe"))
residualRe_("residualRe", dimless, dict)
{}

View File

@ -50,7 +50,7 @@ Foam::dragModels::Tenneti::Tenneti
)
:
dragModel(dict, pair, registerObject),
residualRe_("residualRe", dimless, dict.lookup("residualRe"))
residualRe_("residualRe", dimless, dict)
{}

View File

@ -50,11 +50,8 @@ Foam::heatTransferModel::heatTransferModel
(
"residualAlpha",
dimless,
dict.lookupOrDefault<scalar>
(
"residualAlpha",
pair_.dispersed().residualAlpha().value()
)
pair_.dispersed().residualAlpha().value(),
dict
)
{}

View File

@ -57,11 +57,8 @@ Foam::swarmCorrections::TomiyamaSwarm::TomiyamaSwarm
(
"residualAlpha",
dimless,
dict.lookupOrDefault<scalar>
(
"residualAlpha",
pair_.dispersed().residualAlpha().value()
)
pair_.dispersed().residualAlpha().value(),
dict
),
l_("l", dimless, dict)
{}

View File

@ -61,11 +61,8 @@ Foam::turbulentDispersionModels::Burns::Burns
(
"residualAlpha",
dimless,
dict.lookupOrDefault<scalar>
(
"residualAlpha",
pair_.dispersed().residualAlpha().value()
)
pair_.dispersed().residualAlpha().value(),
dict
)
{}

View File

@ -52,12 +52,7 @@ Foam::blendingMethods::hyperbolic::hyperbolic
)
:
blendingMethod(dict),
transitionAlphaScale_
(
"transitionAlphaScale",
dimless,
dict.lookup("transitionAlphaScale")
)
transitionAlphaScale_("transitionAlphaScale", dimless, dict)
{
forAllConstIter(wordList, phaseNames, iter)
{
@ -66,12 +61,7 @@ Foam::blendingMethods::hyperbolic::hyperbolic
minContinuousAlpha_.insert
(
*iter,
dimensionedScalar
(
name,
dimless,
dict.lookup(name)
)
dimensionedScalar(name, dimless, dict)
);
}
}

View File

@ -63,12 +63,7 @@ Foam::blendingMethods::linear::linear
minFullyContinuousAlpha_.insert
(
*iter,
dimensionedScalar
(
nameFull,
dimless,
dict.lookup(nameFull)
)
dimensionedScalar(nameFull, dimless, dict)
);
const word namePart
@ -79,12 +74,7 @@ Foam::blendingMethods::linear::linear
minPartlyContinuousAlpha_.insert
(
*iter,
dimensionedScalar
(
namePart,
dimless,
dict.lookup(namePart)
)
dimensionedScalar(namePart, dimless, dict)
);
if

View File

@ -66,9 +66,9 @@ Foam::phaseModel::phaseModel
(
"residualAlpha",
dimless,
fluid.subDict(phaseName).lookup("residualAlpha")
fluid.subDict(phaseName)
),
alphaMax_(fluid.subDict(phaseName).lookupOrDefault("alphaMax", 1.0))
alphaMax_(fluid.subDict(phaseName).lookupOrDefault<scalar>("alphaMax", 1))
{
diameterModel_ = diameterModel::New(fluid.subDict(phaseName), *this);
}

View File

@ -68,7 +68,7 @@ class phaseModel
//- Index of phase
label index_;
//- Return the residual phase-fraction for given phase
//- The residual phase-fraction for given phase
// Used to stabilize the phase momentum as the phase-fraction -> 0
dimensionedScalar residualAlpha_;

View File

@ -49,7 +49,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField
)
:
partialSlipFvPatchVectorField(p, iF),
specularityCoefficient_("specularityCoefficient", dimless, 0)
specularityCoefficient_("specularityCoefficient", dimless, Zero)
{}
@ -76,12 +76,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField
)
:
partialSlipFvPatchVectorField(p, iF),
specularityCoefficient_
(
"specularityCoefficient",
dimless,
dict.lookup("specularityCoefficient")
)
specularityCoefficient_("specularityCoefficient", dimless, dict)
{
if
(
@ -219,7 +214,6 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
)
.subDict("RAS")
.subDict("kineticTheoryCoeffs")
.lookup("alphaMax")
);
// calculate the slip value fraction

View File

@ -48,8 +48,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
restitutionCoefficient_("restitutionCoefficient", dimless, 0),
specularityCoefficient_("specularityCoefficient", dimless, 0)
restitutionCoefficient_("restitutionCoefficient", dimless, Zero),
specularityCoefficient_("specularityCoefficient", dimless, Zero)
{}
@ -78,18 +78,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
restitutionCoefficient_
(
"restitutionCoefficient",
dimless,
dict.lookup("restitutionCoefficient")
),
specularityCoefficient_
(
"specularityCoefficient",
dimless,
dict.lookup("specularityCoefficient")
)
restitutionCoefficient_("restitutionCoefficient", dimless, dict),
specularityCoefficient_("specularityCoefficient", dimless, dict)
{
if
(
@ -233,7 +223,6 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
)
.subDict("RAS")
.subDict("kineticTheoryCoeffs")
.lookup("alphaMax")
);
// calculate the reference value and the value fraction

View File

@ -98,25 +98,9 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
equilibrium_(coeffDict_.lookup("equilibrium")),
e_("e", dimless, coeffDict_),
alphaMax_("alphaMax", dimless, coeffDict_),
alphaMinFriction_
(
"alphaMinFriction",
dimless,
coeffDict_
),
residualAlpha_
(
"residualAlpha",
dimless,
coeffDict_
),
maxNut_
(
"maxNut",
dimensionSet(0,2,-1,0,0),
coeffDict_.lookupOrDefault<scalar>("maxNut",1000)
),
alphaMinFriction_("alphaMinFriction", dimless, coeffDict_),
residualAlpha_("residualAlpha", dimless, coeffDict_),
maxNut_("maxNut", dimViscosity, 1000, coeffDict_),
Theta_
(
@ -142,7 +126,7 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
IOobject::NO_WRITE
),
U.mesh(),
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero)
dimensionedScalar(dimViscosity, Zero)
),
gs0_
@ -156,7 +140,7 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
IOobject::NO_WRITE
),
U.mesh(),
dimensionedScalar(dimensionSet(0, 0, 0, 0, 0), Zero)
dimensionedScalar(dimless, Zero)
),
kappa_
@ -170,7 +154,7 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
IOobject::NO_WRITE
),
U.mesh(),
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero)
dimensionedScalar(dimDynamicViscosity, Zero)
),
nuFric_
@ -184,7 +168,7 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
IOobject::AUTO_WRITE
),
U.mesh(),
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero)
dimensionedScalar(dimViscosity, Zero)
)
{
if (type == typeName)

View File

@ -77,12 +77,7 @@ Foam::diameterModels::IATE::IATE
),
dMax_("dMax", dimLength, diameterProperties_),
dMin_("dMin", dimLength, diameterProperties_),
residualAlpha_
(
"residualAlpha",
dimless,
diameterProperties_
),
residualAlpha_("residualAlpha", dimless, diameterProperties_),
d_
(
IOobject

View File

@ -50,11 +50,8 @@ Foam::heatTransferModel::heatTransferModel
(
"residualAlpha",
dimless,
dict.lookupOrDefault<scalar>
(
"residualAlpha",
pair_.dispersed().residualAlpha().value()
)
pair_.dispersed().residualAlpha().value(),
dict
)
{}

View File

@ -57,11 +57,8 @@ Foam::swarmCorrections::TomiyamaSwarm::TomiyamaSwarm
(
"residualAlpha",
dimless,
dict.lookupOrDefault<scalar>
(
"residualAlpha",
pair_.dispersed().residualAlpha().value()
)
pair_.dispersed().residualAlpha().value(),
dict
),
l_("l", dimless, dict)
{}

View File

@ -61,11 +61,8 @@ Foam::turbulentDispersionModels::Burns::Burns
(
"residualAlpha",
dimless,
dict.lookupOrDefault<scalar>
(
"residualAlpha",
pair_.dispersed().residualAlpha().value()
)
pair_.dispersed().residualAlpha().value(),
dict
)
{}

View File

@ -76,12 +76,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField
)
:
partialSlipFvPatchVectorField(p, iF),
specularityCoefficient_
(
"specularityCoefficient",
dimless,
dict.lookup("specularityCoefficient")
)
specularityCoefficient_("specularityCoefficient", dimless, dict)
{
if
(
@ -219,7 +214,6 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
)
.subDict("RAS")
.subDict("kineticTheoryCoeffs")
.lookup("alphaMax")
);
// calculate the slip value fraction

View File

@ -48,8 +48,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
restitutionCoefficient_("restitutionCoefficient", dimless, 0),
specularityCoefficient_("specularityCoefficient", dimless, 0)
restitutionCoefficient_("restitutionCoefficient", dimless, Zero),
specularityCoefficient_("specularityCoefficient", dimless, Zero)
{}
@ -78,18 +78,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
restitutionCoefficient_
(
"restitutionCoefficient",
dimless,
dict.lookup("restitutionCoefficient")
),
specularityCoefficient_
(
"specularityCoefficient",
dimless,
dict.lookup("specularityCoefficient")
)
restitutionCoefficient_("restitutionCoefficient", dimless, dict),
specularityCoefficient_("specularityCoefficient", dimless, dict)
{
if
(
@ -233,7 +223,6 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
)
.subDict("RAS")
.subDict("kineticTheoryCoeffs")
.lookup("alphaMax")
);
// calculate the reference value and the value fraction

View File

@ -98,25 +98,9 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
equilibrium_(coeffDict_.lookup("equilibrium")),
e_("e", dimless, coeffDict_),
alphaMax_("alphaMax", dimless, coeffDict_),
alphaMinFriction_
(
"alphaMinFriction",
dimless,
coeffDict_
),
residualAlpha_
(
"residualAlpha",
dimless,
coeffDict_
),
maxNut_
(
"maxNut",
dimViscosity,
coeffDict_.lookupOrDefault<scalar>("maxNut",1000)
),
alphaMinFriction_("alphaMinFriction", dimless, coeffDict_),
residualAlpha_("residualAlpha", dimless, coeffDict_),
maxNut_("maxNut", dimViscosity, 1000, coeffDict_),
Theta_
(

View File

@ -52,12 +52,7 @@ Foam::blendingMethods::hyperbolic::hyperbolic
)
:
blendingMethod(dict),
transitionAlphaScale_
(
"transitionAlphaScale",
dimless,
dict.lookup("transitionAlphaScale")
)
transitionAlphaScale_("transitionAlphaScale", dimless, dict)
{
forAllConstIter(wordList, phaseNames, iter)
{
@ -66,12 +61,7 @@ Foam::blendingMethods::hyperbolic::hyperbolic
maxDispersedAlpha_.insert
(
*iter,
dimensionedScalar
(
name,
dimless,
dict.lookup(name)
)
dimensionedScalar(name, dimless, dict)
);
}
}

View File

@ -63,12 +63,7 @@ Foam::blendingMethods::linear::linear
maxFullyDispersedAlpha_.insert
(
*iter,
dimensionedScalar
(
nameFull,
dimless,
dict.lookup(nameFull)
)
dimensionedScalar(nameFull, dimless, dict)
);
const word namePart
@ -79,12 +74,7 @@ Foam::blendingMethods::linear::linear
maxPartlyDispersedAlpha_.insert
(
*iter,
dimensionedScalar
(
namePart,
dimless,
dict.lookup(namePart)
)
dimensionedScalar(namePart, dimless, dict)
);
if

View File

@ -78,12 +78,7 @@ Foam::diameterModels::IATE::IATE
),
dMax_("dMax", dimLength, diameterProperties_),
dMin_("dMin", dimLength, diameterProperties_),
residualAlpha_
(
"residualAlpha",
dimless,
diameterProperties_
),
residualAlpha_("residualAlpha", dimless, diameterProperties_),
d_
(
IOobject

View File

@ -70,9 +70,9 @@ Foam::phaseModel::phaseModel
(
"residualAlpha",
dimless,
fluid.subDict(phaseName).lookup("residualAlpha")
fluid.subDict(phaseName)
),
alphaMax_(phaseDict_.lookupOrDefault("alphaMax", 1.0)),
alphaMax_(phaseDict_.lookupOrDefault<scalar>("alphaMax", 1)),
thermo_(rhoThermo::New(fluid.mesh(), name_)),
U_
(

View File

@ -108,6 +108,7 @@ int main(int argc, char *argv[])
dict.add("test1", scalar(10));
dict.add("test2a", scalar(21));
dict.add("test5", dimensionedScalar("", 50));
dict.add("carp1", dimensionedScalar("test1", 11));
// This will fail to tokenize:
// dict.add("test5", dimensionedScalar(50));
}
@ -126,6 +127,36 @@ int main(int argc, char *argv[])
Info<< "test5 : "
<< dimensionedScalar::lookupOrAddToDict("test5", dict, -50) << nl;
// Deprecated
Info<< "Deprecated constructors" << nl;
Info<< "carp : "
<< dimensionedScalar(dict.lookup("carp1")) << nl;
Info<< "carp : "
<< dimensionedScalar("other", dict.lookup("test5")) << nl;
Info<< "carp : "
<< dimensionedScalar("carp", dimless, dict.lookup("carp1")) << nl;
Info<< "alt : "
<< dimensionedScalar("myName", dimless, dict, "carp1") << nl;
Info<< "alt : "
<< dimensionedScalar("myName", dimless, dict, "test5") << nl;
{
dimensionedScalar scalar1("myName", dimless, Zero);
scalar1.read("test5", dict);
Info<< "read in : " << scalar1 << nl;
scalar1.readIfPresent("test4", dict);
Info<< "read in : " << scalar1 << nl;
scalar1.readIfPresent("test5", dict);
Info<< "read in : " << scalar1 << nl;
}
Info<< nl << "Dictionary is now: " << dict << nl;
Info<< "End\n" << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,10 +27,10 @@ License
#include "pTraits.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::dimensioned<Type>::initialize(Istream& is, bool checkDims)
void Foam::dimensioned<Type>::initialize(Istream& is, const bool checkDims)
{
token nextToken(is);
is.putBack(nextToken);
@ -67,13 +67,50 @@ void Foam::dimensioned<Type>::initialize(Istream& is, bool checkDims)
}
template<class Type>
bool Foam::dimensioned<Type>::readEntry
(
const word& key,
const dictionary& dict,
const bool mandatory,
const bool checkDims,
enum keyType::option matchOpt
)
{
// Largely identical to dictionary::readEntry(),
// but with optional handling of checkDims
const auto finder(dict.csearch(key, matchOpt));
if (finder.found())
{
ITstream& is = finder.ptr()->stream();
initialize(is, checkDims);
dict.checkITstream(is, key);
return true;
}
else if (mandatory)
{
FatalIOErrorInFunction(dict)
<< "Entry '" << key << "' not found in dictionary "
<< dict.name()
<< exit(FatalIOError);
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::dimensioned<Type>::dimensioned()
:
name_("0"),
dimensions_(dimless),
dimensions_(),
value_(Zero)
{}
@ -123,10 +160,79 @@ Foam::dimensioned<Type>::dimensioned
{}
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
const word& name,
const dictionary& dict
)
:
name_(name),
dimensions_(),
value_(Zero)
{
// mandatory, no checkDims
readEntry(name, dict, true, false);
}
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
const word& name,
const dimensionSet& dims,
const dictionary& dict
)
:
name_(name),
dimensions_(dims),
value_(Zero)
{
// mandatory, checkDims
readEntry(name, dict);
}
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
const word& name,
const dimensionSet& dims,
const dictionary& dict,
const word& entryName
)
:
name_(name),
dimensions_(dims),
value_(Zero)
{
// mandatory, checkDims
readEntry(entryName, dict);
}
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
const word& name,
const dimensionSet& dims,
const Type& val,
const dictionary& dict
)
:
name_(name),
dimensions_(dims),
value_(val)
{
// non-mandatory, checkDims
readEntry(name, dict, false);
}
template<class Type>
Foam::dimensioned<Type>::dimensioned(Istream& is)
:
dimensions_(dimless)
dimensions_()
{
read(is);
}
@ -140,15 +246,9 @@ Foam::dimensioned<Type>::dimensioned
)
:
name_(name),
dimensions_(dimless)
dimensions_()
{
// Read dimensionSet + multiplier
scalar mult(1.0);
dimensions_.read(is, mult);
// Read value
is >> value_;
value_ *= mult;
read(is, false); // Don't read name. Read dimensionSet + multiplier only.
}
@ -164,40 +264,8 @@ Foam::dimensioned<Type>::dimensioned
dimensions_(dims),
value_(Zero)
{
initialize(is, true); // checkDims
}
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
const word& name,
const dictionary& dict
)
:
dimensioned<Type>(name, dimless, dict, false) // no checkDims
{}
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
const word& name,
const dimensionSet& dims,
const dictionary& dict,
const bool checkDims
)
:
name_(name),
dimensions_(dims),
value_(Zero)
{
// Like dictionary::lookup(), but in two stages to detect input errors
const entry& e = dict.lookupEntry(name, keyType::REGEX);
ITstream& is = e.stream();
initialize(is, checkDims);
e.checkITstream(is);
// checkDims
initialize(is, true);
}
@ -212,14 +280,8 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
const Type& defaultValue
)
{
if (dict.found(name))
{
return dimensioned<Type>(name, dims, dict);
}
else
{
return dimensioned<Type>(name, dims, defaultValue);
}
// checkDims = true
return dimensioned<Type>(name, dims, defaultValue, dict);
}
@ -231,7 +293,7 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
const Type& defaultValue
)
{
return lookupOrDefault(name, dict, dimless, defaultValue);
return dimensioned<Type>(name, dimless, defaultValue, dict);
}
@ -244,12 +306,13 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrAddToDict
const Type& defaultValue
)
{
if (!dict.found(name))
if (dict.found(name))
{
(void) dict.add(name, defaultValue);
return dimensioned<Type>(name, dims, dict);
}
return dimensioned<Type>(name, dims, dict);
(void) dict.add(name, defaultValue);
return dimensioned<Type>(name, dims, defaultValue);
}
@ -273,6 +336,7 @@ const Foam::word& Foam::dimensioned<Type>::name() const
return name_;
}
template<class Type>
Foam::word& Foam::dimensioned<Type>::name()
{
@ -286,6 +350,7 @@ const Foam::dimensionSet& Foam::dimensioned<Type>::dimensions() const
return dimensions_;
}
template<class Type>
Foam::dimensionSet& Foam::dimensioned<Type>::dimensions()
{
@ -299,6 +364,7 @@ const Type& Foam::dimensioned<Type>::value() const
return value_;
}
template<class Type>
Type& Foam::dimensioned<Type>::value()
{
@ -335,24 +401,51 @@ void Foam::dimensioned<Type>::replace
template<class Type>
void Foam::dimensioned<Type>::read(const dictionary& dict)
bool Foam::dimensioned<Type>::read(const dictionary& dict)
{
dict.readEntry(name_, value_);
return read(name_, dict);
}
template<class Type>
bool Foam::dimensioned<Type>::readIfPresent(const dictionary& dict)
{
return dict.readIfPresent(name_, value_);
return readIfPresent(name_, dict);
}
template<class Type>
Foam::Istream& Foam::dimensioned<Type>::read(Istream& is)
bool Foam::dimensioned<Type>::read
(
const word& entryName,
const dictionary& dict
)
{
// mandatory, checkDims
return readEntry(entryName, dict);
}
template<class Type>
bool Foam::dimensioned<Type>::readIfPresent
(
const word& entryName,
const dictionary& dict
)
{
// non-mandatory, checkDims
return readEntry(entryName, dict, false);
}
template<class Type>
Foam::Istream& Foam::dimensioned<Type>::read(Istream& is, const bool readName)
{
if (readName)
{
// Read name
is >> name_;
}
// Read dimensionSet + multiplier
scalar mult(1.0);
@ -632,17 +725,15 @@ Foam::Istream& Foam::operator>>(Istream& is, dimensioned<Type>& dt)
template<class Type>
Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
{
// Write the name
// The name
os << dt.name() << token::SPACE;
// Write the dimensions
// The dimensions
scalar mult(1.0);
dt.dimensions().write(os, mult);
os << token::SPACE;
// Write the value
os << dt.value()/mult;
// The value
os << token::SPACE << dt.value()/mult;
os.check(FUNCTION_NAME);
return os;
@ -743,8 +834,8 @@ Foam::dimensioned<Type> Foam::operator/
return dimensioned<Type>
(
'(' + dt.name() + '|' + ds.name() + ')',
dt.dimensions()/ds.dimensions(),
dt.value()/ds.value()
dt.dimensions() / ds.dimensions(),
dt.value() / ds.value()
);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,10 +52,7 @@ class dictionary;
template<class Type> class dimensioned;
template<class Type>
Istream& operator>>(Istream&, dimensioned<Type>&);
template<class Type>
Ostream& operator<<(Ostream&, const dimensioned<Type>&);
Istream& operator>>(Istream& is, dimensioned<Type>& dt);
/*---------------------------------------------------------------------------*\
@ -65,9 +62,9 @@ Ostream& operator<<(Ostream&, const dimensioned<Type>&);
template<class Type>
class dimensioned
{
// Private data
// Private Data
//- Variable name
//- The variable name
word name_;
//- The dimension set
@ -77,9 +74,9 @@ class dimensioned
Type value_;
// Private member functions
// Private Member Functions
//- Constructor helper.
//- Read helper.
// Requires a value, optional preceded with name and/or dimensions.
// \verbatim
// [name] [dims] value
@ -88,8 +85,28 @@ class dimensioned
// If dimensions are present, they are read.
// With checkDims = true, the dimensions read are verified
// against the current (expected) dimensions.
void initialize(Istream& is, bool checkDims);
void initialize(Istream& is, const bool checkDims);
//- Find entry and assign to dimensioned Type
//- FatalIOError if it is found and the number of tokens is incorrect,
//- or it is mandatory and not found.
//
// Requires a value, optional preceded with name and/or dimensions.
// \verbatim
// [name] [dims] value
// \endverbatim
// If the name is present, it is used to rename.
// If dimensions are present, they are read.
// With checkDims = true, the dimensions read are verified
// against the current (expected) dimensions.
bool readEntry
(
const word& key,
const dictionary& dict,
const bool mandatory = true, //!< entry is mandatory
const bool checkDims = true, //!< verify dimensions read
enum keyType::option matchOpt = keyType::REGEX
);
public:
@ -99,7 +116,7 @@ public:
// Constructors
//- Construct null: a dimensionless Zero, named "0"
//- A dimensionless Zero, named "0"
dimensioned();
//- A dimensioned Zero, named "0"
@ -119,7 +136,7 @@ public:
//- Copy construct dimensioned Type with a new name
dimensioned(const word& name, const dimensioned<Type>& dt);
//- Construct from components: name, dimensionSet and a value.
//- Construct from components (name, dimensions, value).
dimensioned
(
const word& name,
@ -145,19 +162,48 @@ public:
// \endverbatim
// If the optional name is found, it is used for renaming.
// If the optional dimensions are present, they are read and
// normally verified against the expected dimensions.
// verified against the expected dimensions.
dimensioned
(
const word& name,
const dimensionSet& dims,
const dictionary& dict
);
//- Construct from dictionary lookup with a given name and dimensions.
// The dictionary entry may contain optional name and dimensions.
// \verbatim
// [name] [dims] value
// \endverbatim
// If the optional name is found, it is used for renaming.
// If the optional dimensions are present, they are read and
// verified against the expected dimensions.
dimensioned
(
const word& name,
const dimensionSet& dims,
const dictionary& dict,
const bool checkDims = true //!< verify dimensions read
const word& entryName //!< dictionary lookup name
);
//- Construct from components (name, dimensions, value) with
//- optional dictionary override.
// The dictionary entry may contain optional name and dimensions.
// \verbatim
// [name] [dims] value
// \endverbatim
dimensioned
(
const word& name,
const dimensionSet& dims,
const Type& val,
const dictionary& dict
);
// Static member functions
// Static Member Functions
//- Construct from dictionary, with default dimensions and value.
//- Construct dimensioned from dictionary, with default value.
//- FatalIOError if there are excess tokens.
static dimensioned<Type> lookupOrDefault
(
@ -167,7 +213,7 @@ public:
const Type& defaultValue = Type(Zero)
);
//- Construct from dictionary, dimensionless and with a value.
//- Construct dimensionless from dictionary, with default value.
// FatalIOError if it is found and there are excess tokens.
static dimensioned<Type> lookupOrDefault
(
@ -176,7 +222,7 @@ public:
const Type& defaultValue = Type(Zero)
);
//- Construct from dictionary, with default value.
//- Construct dimensioned from dictionary, with default value.
// If the value is not found, it is added into the dictionary.
// FatalIOError if it is found and there are excess tokens.
static dimensioned<Type> lookupOrAddToDict
@ -187,7 +233,7 @@ public:
const Type& defaultValue = Type(Zero)
);
//- Construct from dictionary, dimensionless with default value.
//- Construct dimensionless from dictionary, with default value.
// If the value is not found, it is added into the dictionary.
// FatalIOError if it is found and there are excess tokens.
static dimensioned<Type> lookupOrAddToDict
@ -227,24 +273,35 @@ public:
//- Return transpose.
dimensioned<Type> T() const;
//- Update the value of dimensioned\<Type\>
void read(const dictionary& dict);
//- Update the value of dimensioned\<Type\>,
//- lookup in dictionary with the name().
bool read(const dictionary& dict);
//- Update the value of dimensioned\<Type\> if found in the dictionary.
//- Update the value of dimensioned\<Type\> if found in the dictionary,
//- lookup in dictionary with the name().
bool readIfPresent(const dictionary& dict);
//- Update the value of dimensioned\<Type\>,
//- using an alternative entry name
bool read(const word& entryName, const dictionary& dict);
//- Update the value of dimensioned\<Type\> if found in the dictionary,
//- using an alternative entry name
bool readIfPresent(const word& entryName, const dictionary& dict);
// IO
//- Read name, dimensions, value from stream,
//- using units from system table
Istream& read(Istream& is);
//- Read (name, dimensions, value) from stream,
//- using units from system table.
// Optionally skip reading the name
Istream& read(Istream& is, const bool readName = true);
//- Read name, dimensions, value from stream,
//- Read (name, dimensions, value) from stream,
//- using units from dictionary
Istream& read(Istream& is, const dictionary& readSet);
//- Read name, dimensions, value from stream,
//- Read (name, dimensions, value) from stream,
//- using units from table
Istream& read(Istream& is, const HashTable<dimensionedScalar>& readSet);
@ -265,54 +322,52 @@ public:
void operator/=(const scalar s);
// IOstream operators
// IOstream Operators
//- Read from stream. The name and dimensions are optional.
// If the optional dimensions are present, they are used
// used without further verification.
// If the optional dimensions are present,
// they are used without further verification.
friend Istream& operator>> <Type>
(
Istream& is,
dimensioned<Type>& dt
);
friend Ostream& operator<< <Type>
(
Ostream& os,
const dimensioned<Type>& dt
);
// Housekeeping
//- Deprecated(2018-11) Construct from Istream
//- (expects name, dimensions, value)
// \deprecated(2018-11) - should generally use one of the construct
// from dictionary constructors instead. They provide additional
// checks on the input stream.
explicit dimensioned(Istream& is);
// \deprecated(2018-11) - should generally use construct from
// dictionary instead (additional checks on the input stream).
explicit dimensioned(Istream& is)
FOAM_DEPRECATED(2018-11);
//- Deprecated(2018-11) Construct from Istream with given name
//- (expects dimensions, value)
// \deprecated(2018-11) - should generally use one of the construct
// from dictionary constructors instead. They provide additional
// checks on the input stream.
dimensioned(const word& name, Istream& is);
// \deprecated(2018-11) - should generally use construct from
// dictionary instead (additional checks on the input stream).
dimensioned(const word& name, Istream& is)
FOAM_DEPRECATED(2018-11);
//- Deprecated(2018-11) Construct from Istream with given name
//- and expected dimensions.
// Expects value, but supports optional name and dimensions.
// If the optional dimensions are present, they are read and
// verified against the expected dimensions.
// \deprecated(2018-11) - should generally use one of the construct
// from dictionary constructors instead. They provide additional
// checks on the input stream.
dimensioned(const word& name, const dimensionSet& dims, Istream& is);
// \deprecated(2018-11) - should generally use construct from
// dictionary instead (additional checks on the input stream).
dimensioned(const word& name, const dimensionSet& dims, Istream& is)
FOAM_DEPRECATED(2018-11);
};
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
//- Output operator
template<class Type>
Ostream& operator<<(Ostream& os, const dimensioned<Type>& dt);
template<class Type, direction r>
dimensioned<typename powProduct<Type, r>::type>
pow

View File

@ -31,13 +31,7 @@ template<class BasicTurbulenceModel>
void Foam::EddyDiffusivity<BasicTurbulenceModel>::correctNut()
{
// Read Prt if provided
Prt_ = dimensioned<scalar>::lookupOrDefault
(
"Prt",
this->coeffDict(),
1.0
);
Prt_ = dimensionedScalar("Prt", dimless, 1.0, this->coeffDict());
alphat_ = this->rho_*this->nut()/Prt_;
alphat_.correctBoundaryConditions();
}

View File

@ -248,12 +248,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
// Molecular Prandtl number
const scalar Pr
(
dimensionedScalar
(
"Pr",
dimless,
transportProperties.lookup("Pr")
).value()
dimensionedScalar("Pr", dimless, transportProperties).value()
);
// Populate boundary values

View File

@ -61,25 +61,9 @@ Maxwell<BasicTurbulenceModel>::Maxwell
propertiesName
),
nuM_
(
dimensioned<scalar>
(
"nuM",
dimViscosity,
this->coeffDict_.lookup("nuM")
)
),
nuM_("nuM", dimViscosity, this->coeffDict_),
lambda_
(
dimensioned<scalar>
(
"lambda",
dimTime,
this->coeffDict_.lookup("lambda")
)
),
lambda_("lambda", dimTime, this->coeffDict_),
sigma_
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,16 +36,7 @@ bool Foam::functionObjects::reference::calcType()
{
const VolFieldType& vf = *vfPtr;
dimensioned<Type> offset
(
dimensioned<Type>::lookupOrDefault
(
"offset",
localDict_,
vf.dimensions(),
Zero
)
);
dimensioned<Type> offset("offset", vf.dimensions(), Zero, localDict_);
dimensioned<Type> cellValue("value", vf.dimensions(), Zero);

View File

@ -385,12 +385,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::mu() const
const dictionary& transportProperties =
lookupObject<dictionary>("transportProperties");
dimensionedScalar nu
(
"nu",
dimViscosity,
transportProperties.lookup("nu")
);
dimensionedScalar nu("nu", dimViscosity, transportProperties);
return rho()*nu;
}

View File

@ -208,32 +208,16 @@ Foam::functionObjects::energyTransport::energyTransport
schemesField_("unknown-schemesField"),
fvOptions_(mesh_),
multiphaseThermo_(dict.subOrEmptyDict("phaseThermos")),
Cp_
(
dict.lookupOrDefault
(
"Cp",
dimensionedScalar("Cp", dimEnergy/dimMass/dimTemperature, 0)
)
),
Cp_("Cp", dimEnergy/dimMass/dimTemperature, 0, dict),
kappa_
(
dict.lookupOrDefault
(
"kappa",
dimensionedScalar
(
"kappa",
dimEnergy/dimTime/dimLength/dimTemperature,
0
)
)
0,
dict
),
rho_
(
dict.lookupOrDefault("rhoInf", dimensionedScalar("rho", dimDensity, 0))
),
Prt_(dict.lookupOrDefault("Prt", dimensionedScalar("Prt", dimless, 1))),
rho_("rhoInf", dimDensity, 0, dict),
Prt_("Prt", dimless, 1, dict),
rhoCp_
(
IOobject
@ -281,7 +265,7 @@ Foam::functionObjects::energyTransport::energyTransport
(
"Cp",
dimEnergy/dimMass/dimTemperature,
dict.lookup("Cp")
dict
)
);
@ -292,7 +276,7 @@ Foam::functionObjects::energyTransport::energyTransport
(
"kappa",
dimEnergy/dimTime/dimLength/dimTemperature,
dict.lookup("kappa")
dict
)
);

View File

@ -62,14 +62,11 @@ solidification::solidification
coeffDict_.lookupOrDefault("maxSolidificationFrac", 0.2)
),
maxSolidificationRate_
(
dimensioned<scalar>::lookupOrDefault
(
"maxSolidificationRate",
coeffDict_,
dimless/dimTime,
GREAT
)
GREAT,
coeffDict_
),
mass_
(

View File

@ -56,25 +56,25 @@ Foam::compressibilityModels::Chung::Chung
(
"psiv",
dimCompressibility,
compressibilityProperties_.lookup("psiv")
compressibilityProperties_
),
psil_
(
"psil",
dimCompressibility,
compressibilityProperties_.lookup("psil")
compressibilityProperties_
),
rhovSat_
(
"rhovSat",
dimDensity,
compressibilityProperties_.lookup("rhovSat")
compressibilityProperties_
),
rholSat_
(
"rholSat",
dimDensity,
compressibilityProperties_.lookup("rholSat")
compressibilityProperties_
)
{
correct();

View File

@ -56,25 +56,25 @@ Foam::compressibilityModels::Wallis::Wallis
(
"psiv",
dimCompressibility,
compressibilityProperties_.lookup("psiv")
compressibilityProperties_
),
psil_
(
"psil",
dimCompressibility,
compressibilityProperties_.lookup("psil")
compressibilityProperties_
),
rhovSat_
(
"rhovSat",
dimDensity,
compressibilityProperties_.lookup("rhovSat")
compressibilityProperties_
),
rholSat_
(
"rholSat",
dimDensity,
compressibilityProperties_.lookup("rholSat")
compressibilityProperties_
)
{
correct();

View File

@ -56,13 +56,13 @@ Foam::compressibilityModels::linear::linear
(
"psiv",
dimCompressibility,
compressibilityProperties_.lookup("psiv")
compressibilityProperties_
),
psil_
(
"psil",
dimCompressibility,
compressibilityProperties_.lookup("psil")
compressibilityProperties_
)
{
correct();