diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H index edd528174b80840286d6043182ace524fbc7db49..2e830f7bcbe60acd5ad5f27c1e4f28de7ac259ae 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H @@ -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" diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index e3565ca63c2eee2b39fbb3b80b72c4ac7f4241d2..7a8dbf219572f367dc7375ca25483b3196844f56 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -180,7 +180,6 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs() "Pr", dimless, thermophysicalProperties.subDict("mixture").subDict("transport") - .lookup("Pr") ); Field<scalar> C2 diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index 33987a11a3997b20d279bf85244b46655c5bf288..d9fa4879908a6e1e992a04010110eccd671e50ca 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -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" diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H index 8b99b2343979e1d7f04db8f5fb5d5cdea93684be..979dfa7763a48e5a56da6d00ce79de090aa6da93 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H @@ -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()); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index 6e801a15fadb1f0554fa5dc7800392c19957bf06..33605471f11e778182aa98eea93cfbe7d2ffe477 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -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" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index 06567b8b5be63542553e145d92eec5eb8593d8d2..f414d0eab2956e36831a74f99019462d86fc18a5 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -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; diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H index 0e2ba2f1c0ae79451aa69d6013c2f960f017de8d..49f8a1fc42c01e5603067890cb1c86d9651ef5f8 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H @@ -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 diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H b/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H index 108d78556fbeb1145d046a8f03b4eab90f42dff5..581a52d28537fb4de03eb893f9be84536d831ece 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H @@ -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 diff --git a/applications/solvers/lagrangian/sprayFoam/createFields.H b/applications/solvers/lagrangian/sprayFoam/createFields.H index 6b34aacab83890fc36a762ddd8152b5f9b329355..9eb279fe55b158bd10bc117e29890f3b27ce7fca 100644 --- a/applications/solvers/lagrangian/sprayFoam/createFields.H +++ b/applications/solvers/lagrangian/sprayFoam/createFields.H @@ -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 diff --git a/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H b/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H index d97f7f242187e2da695c3819a3107e4455f09230..87125a33a1f26f7a120e1079633bfcf4d32d7130 100644 --- a/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H +++ b/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H @@ -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); diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C index a11032ff1334f1205f22381590863c5cbb9c86e5..94753bf8cbe1a5f299899a2dbb93e0f2ef56383b 100644 --- a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C @@ -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> diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/InterfaceCompositionModel/InterfaceCompositionModel.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/InterfaceCompositionModel/InterfaceCompositionModel.C index 788ed2d49f7daf4b8bea103a65473047eaa7c411..88804e5d85c928ddd89972bb355efd1cd7189519 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/InterfaceCompositionModel/InterfaceCompositionModel.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/InterfaceCompositionModel/InterfaceCompositionModel.C @@ -204,7 +204,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::InterfaceCompositionModel ) ) ), - Le_("Le", dimless, dict.lookupOrDefault<scalar>("Le", 1.0)) + Le_("Le", dimless, 1.0, dict) {} diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.C index 8ee0018656eb004dbb92af6d1912a46b5065f334..868d18bf811dcd817db24865ee3b0cccf2801057 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.C @@ -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)) {} diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.C index 02c4ec21080c3432eccfbbc86263f3863b700f9b..39d907ae99c718449000581fb5c030ed5e298906 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.C @@ -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)) diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/phaseSystem.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/phaseSystem.C index 8b3850b23dedee390ec4a7a11066745383d6da1c..b3a007d2241e8da12bc59e5e0cf64c80f4834fa3 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/phaseSystem.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/phaseSystem.C @@ -237,7 +237,7 @@ Foam::phaseSystem::phaseSystem totalPhasePairs_(), Prt_ ( - dimensioned<scalar>::lookupOrAddToDict + dimensionedScalar::lookupOrAddToDict ( "Prt", *this, 1.0 ) diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C index 2cfcbdbe7c527296035b5c2ecb5b3cbfd481fe32..3da54ffc15505569b26f9d5d58d78fd9d10c7c4d 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C @@ -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" ) { diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C index 8ef64f38c9b0ed975a57c34f8b6af992009bb27d..0782d26f727388d5da8e79ecec41cf973530f569 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C @@ -84,7 +84,7 @@ Foam::twoPhaseMixtureEThermo::twoPhaseMixtureEThermo const surfaceScalarField& phi ) : - basicThermo(U.mesh(), word::null), + basicThermo(U.mesh(), word::null), thermoIncompressibleTwoPhaseMixture(U, phi), e_ @@ -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)) diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C index e8abc554f4262ae130b0d7bc8a59eeaa6443d0a1..faced8b533c7f5e58c2a69c702d6e84bdcd7e3cc 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C @@ -44,7 +44,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture : incompressibleTwoPhaseMixture(U, phi), phaseChangeTwoPhaseMixtureCoeffs_(optionalSubDict(type + "Coeffs")), - pSat_("pSat", dimPressure, lookup("pSat")) + pSat_("pSat", dimPressure, *this) {} diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C index acab521e2009511a9098a879f060eb9765d96aa5..5a22a1aeeed5917bcfcbfc0d8ba62d812a7c23cb 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C @@ -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) {} diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C index 793a30d4d4cc178dc26171a92fb4c099182de21b..29f67d8d8fede05697ec1a79eb1f4478ad706ba8 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C @@ -77,7 +77,8 @@ int main(int argc, char *argv[]) ( "maxSlamVelocity", dimVelocity, - fluid.lookupOrDefault<scalar>("maxSlamVelocity", GREAT) + GREAT, + fluid ); turbulence->validate(); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index d50c2b34c3b02f8419be5e21294f349b8c3ed47e..b94cb287e6a371977dec751f42f63443cbbe50f9 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -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_ diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/NonRandomTwoLiquid/NonRandomTwoLiquid.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/NonRandomTwoLiquid/NonRandomTwoLiquid.C index 6818c243f1678dcab42510d066408185f6edb738..26a6c592e310b113f22d0d84fabfb0505610eb8d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/NonRandomTwoLiquid/NonRandomTwoLiquid.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/NonRandomTwoLiquid/NonRandomTwoLiquid.C @@ -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 ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.C index a76814e7112238e12387c9bd95643aa88251cc44..02b8f8c070c4886eacab6e55e2e8541f4dab1edf 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.C @@ -49,7 +49,7 @@ Foam::dragModels::Beetstra::Beetstra ) : dragModel(dict, pair, registerObject), - residualRe_("residualRe", dimless, dict.lookup("residualRe")) + residualRe_("residualRe", dimless, dict) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.C index dcd0bba00ecfbd4ef12bbe825ab9d931162c7da9..fb59b70b0dfa5e838a51d1887ac3863938e888f2 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.C @@ -50,7 +50,7 @@ Foam::dragModels::Tenneti::Tenneti ) : dragModel(dict, pair, registerObject), - residualRe_("residualRe", dimless, dict.lookup("residualRe")) + residualRe_("residualRe", dimless, dict) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C index 3a75fbf3d1f809cc99dfd57b1eab34c487466176..980c81f5c85f57eb4a9fc7525e24111e0018cda8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C @@ -50,11 +50,8 @@ Foam::heatTransferModel::heatTransferModel ( "residualAlpha", dimless, - dict.lookupOrDefault<scalar> - ( - "residualAlpha", - pair_.dispersed().residualAlpha().value() - ) + pair_.dispersed().residualAlpha().value(), + dict ) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C index 8252f4d754feb0650c6a6b9641cf116c745bfbdf..46effeace06887e55eda7a3b77830d2eb7fcc720 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C @@ -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) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C index d06a7929f26ad9f049f32b04f4779aca2e2c27be..9fd46163236f02acb91bf9f7b4e073d5365e81b5 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C @@ -61,11 +61,8 @@ Foam::turbulentDispersionModels::Burns::Burns ( "residualAlpha", dimless, - dict.lookupOrDefault<scalar> - ( - "residualAlpha", - pair_.dispersed().residualAlpha().value() - ) + pair_.dispersed().residualAlpha().value(), + dict ) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C index 664841d08282013a4a31d2f58d03b363da1a823f..930e483d9acc4dc82d56b2f823f1e0a60c3ba32e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C @@ -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) ); } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C index 510665353500a83075633073ec9f2b261b9f430d..5fc159420df0c4f52e9d8e5da494e75e920a7644 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C @@ -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 diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index 68e85badefde2c0ea4f42fc1244d531a77449457..f0f5daabdeb8f464ee33dd20d0e206442ef492d7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -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); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index 41fb67e715d1ffcca69f53704e61a4b21d609b84..9cf258b4c1886ddafcbbd12fc6e681765c8c5547 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -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_; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index a64155e4a0c512e131de1f031da364a25f2d31c4..2addc9f0c46462169fa21fd2be2b096449a1decf 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -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 diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index 53431117d5584da10a78fca929c044d726a6bd60..ea5688ee02ec7a9d1acb0fae73ab4165c8121a52 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -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 diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 71fdca8d880a63095d7a1852afd1ebcab994fe40..b1201fd905ac90ba4920781af89741d196024568 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -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) diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C index b2d0547f5c52762f6eed5c6153ed5f8eb817f039..a59b6564606baa7075e2ed6c7ad4e007e8a91521 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C @@ -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 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C index 1621b6be19dbeb3fdcaee31f379d0569c8a201cd..e8f50deae2188fd02a173eedf5413575436811ab 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C @@ -50,11 +50,8 @@ Foam::heatTransferModel::heatTransferModel ( "residualAlpha", dimless, - dict.lookupOrDefault<scalar> - ( - "residualAlpha", - pair_.dispersed().residualAlpha().value() - ) + pair_.dispersed().residualAlpha().value(), + dict ) {} diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C index 8252f4d754feb0650c6a6b9641cf116c745bfbdf..46effeace06887e55eda7a3b77830d2eb7fcc720 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C @@ -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) {} diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C index 33db7656cb1f70df80dab92b8144bf21699f125c..fbe1c823fbdd64c0ebe7e904175862de48f01bba 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/turbulentDispersionModels/Burns/Burns.C @@ -61,11 +61,8 @@ Foam::turbulentDispersionModels::Burns::Burns ( "residualAlpha", dimless, - dict.lookupOrDefault<scalar> - ( - "residualAlpha", - pair_.dispersed().residualAlpha().value() - ) + pair_.dispersed().residualAlpha().value(), + dict ) {} diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index a64155e4a0c512e131de1f031da364a25f2d31c4..19afbeecc69f9253f0b807190f20c94f4662cacb 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -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 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index 53431117d5584da10a78fca929c044d726a6bd60..ea5688ee02ec7a9d1acb0fae73ab4165c8121a52 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -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 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index e5e7f8bf97d308b37047603fca17e5519b9c2d24..fc024d7215f7559dc0834da40d0de5f0c90d783f 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -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_ ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C index f799dae0c2deb917f3e96855da31df55588234e7..9305f85c101dc5a3da0591e7af4fc54cd7ca7908 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C @@ -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) ); } } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C index cb8b54a8b82a950312a6a360a2dcbe4a8ed767b2..1880e2be15b82287be05d13c8c13cb68d28d8d01 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C @@ -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 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C index 00f8188f78f7ed365be9f0641e1887e668fd1b08..df126635d126313a67c8faf6187582741af911d9 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C @@ -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 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index 9d96736585899c927c373f4160e203f5294f3735..815963e4e950ca664773d32ba28e432f29048f61 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -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_ ( diff --git a/applications/test/dimensionedType/Test-dimensionedType.C b/applications/test/dimensionedType/Test-dimensionedType.C index c8e69786d2691b4a22ab4ed24021fd9c136e43bd..d8bbfbe72b0637b05c9c8876fed60a8b7fa59fec 100644 --- a/applications/test/dimensionedType/Test-dimensionedType.C +++ b/applications/test/dimensionedType/Test-dimensionedType.C @@ -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; diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C index 652c9bd58d784d46b9d9df8f40480b70468f7804..5914638de5e67a2d2523306050ee1bdc3d407042 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C @@ -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) {} @@ -124,11 +161,18 @@ Foam::dimensioned<Type>::dimensioned template<class Type> -Foam::dimensioned<Type>::dimensioned(Istream& is) +Foam::dimensioned<Type>::dimensioned +( + const word& name, + const dictionary& dict +) : - dimensions_(dimless) + name_(name), + dimensions_(), + value_(Zero) { - read(is); + // mandatory, no checkDims + readEntry(name, dict, true, false); } @@ -136,19 +180,16 @@ template<class Type> Foam::dimensioned<Type>::dimensioned ( const word& name, - Istream& is + const dimensionSet& dims, + const dictionary& dict ) : name_(name), - dimensions_(dimless) + dimensions_(dims), + value_(Zero) { - // Read dimensionSet + multiplier - scalar mult(1.0); - dimensions_.read(is, mult); - - // Read value - is >> value_; - value_ *= mult; + // mandatory, checkDims + readEntry(name, dict); } @@ -157,14 +198,16 @@ Foam::dimensioned<Type>::dimensioned ( const word& name, const dimensionSet& dims, - Istream& is + const dictionary& dict, + const word& entryName ) : name_(name), dimensions_(dims), value_(Zero) { - initialize(is, true); // checkDims + // mandatory, checkDims + readEntry(entryName, dict); } @@ -172,11 +215,41 @@ template<class Type> Foam::dimensioned<Type>::dimensioned ( const word& name, + const dimensionSet& dims, + const Type& val, const dictionary& dict ) : - dimensioned<Type>(name, dimless, dict, false) // no checkDims -{} + name_(name), + dimensions_(dims), + value_(val) +{ + // non-mandatory, checkDims + readEntry(name, dict, false); +} + + +template<class Type> +Foam::dimensioned<Type>::dimensioned(Istream& is) +: + dimensions_() +{ + read(is); +} + + +template<class Type> +Foam::dimensioned<Type>::dimensioned +( + const word& name, + Istream& is +) +: + name_(name), + dimensions_() +{ + read(is, false); // Don't read name. Read dimensionSet + multiplier only. +} template<class Type> @@ -184,20 +257,15 @@ Foam::dimensioned<Type>::dimensioned ( const word& name, const dimensionSet& dims, - const dictionary& dict, - const bool checkDims + Istream& is ) : 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 +) { - // Read name - is >> name_; + // 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() ); } diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H index 472dbc71eef783736177a82576c83526d1e59a10..8c1ea0b68abfe08d52b41483765523be7965586e 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H @@ -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 diff --git a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C index f983d60aa63ae5ad3c1ce245f31399079bb3e838..c5a00d6c6074c8f01c286021642bd47f20ba3967 100644 --- a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C +++ b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C @@ -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(); } diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index cb337c1d0bd0492e4ea5dc4178a12de3b86466b7..c2ef162b1d29a457e168c59838641e54cb7bc92e 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/laminar/Maxwell/Maxwell.C b/src/TurbulenceModels/turbulenceModels/laminar/Maxwell/Maxwell.C index f81c22b327e128e185865eaa3ff181b67a5dbd71..9ee8700d7c4cf86db861b699fd6538ccf3cbb123 100644 --- a/src/TurbulenceModels/turbulenceModels/laminar/Maxwell/Maxwell.C +++ b/src/TurbulenceModels/turbulenceModels/laminar/Maxwell/Maxwell.C @@ -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_ ( diff --git a/src/functionObjects/field/reference/referenceTemplates.C b/src/functionObjects/field/reference/referenceTemplates.C index e09713337df7e08ab182507fea5f14033200b000..000e62dd2c53bcfc874d188905d997836ef06e90 100644 --- a/src/functionObjects/field/reference/referenceTemplates.C +++ b/src/functionObjects/field/reference/referenceTemplates.C @@ -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); diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index 1fea138af46525847b53a51616f693bde2b15462..5f053c3666e1754e7ad80ec3749a60bd649aee9c 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -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; } diff --git a/src/functionObjects/solvers/energyTransport/energyTransport.C b/src/functionObjects/solvers/energyTransport/energyTransport.C index 931d15e77b72750757354ea20e57228ba7d76768..ed665056156dd6364bc951c03c04ed3b6489054f 100644 --- a/src/functionObjects/solvers/energyTransport/energyTransport.C +++ b/src/functionObjects/solvers/energyTransport/energyTransport.C @@ -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 - ) - ) - ), - rho_ - ( - dict.lookupOrDefault("rhoInf", dimensionedScalar("rho", dimDensity, 0)) + "kappa", + dimEnergy/dimTime/dimLength/dimTemperature, + 0, + dict ), - 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 ) ); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C index 60b18c7ca6dab70dc23ab7d727040355d51c552a..f4b5c138eb7fe14db92305cdb646093e67feba1d 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C @@ -63,13 +63,10 @@ solidification::solidification ), maxSolidificationRate_ ( - dimensioned<scalar>::lookupOrDefault - ( - "maxSolidificationRate", - coeffDict_, - dimless/dimTime, - GREAT - ) + "maxSolidificationRate", + dimless/dimTime, + GREAT, + coeffDict_ ), mass_ ( diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C index 3864dd14e4f336d02a85480a12207c3897cebf27..d6d405c28617e3cf765c692802c54108459fdb63 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C @@ -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(); diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C index eb81370c435b62d040c9ae58b9543d88010f7b79..bea67c6f049db788a6d24b5a0b6e0c5ffeb77522 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C @@ -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(); diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C index 1ea3f47aacaf0d71905f8a28eaa5d3f4b58ab4c9..dc9bea6dc77c3129463b0a90fc8a05bd3e3068e1 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C @@ -56,13 +56,13 @@ Foam::compressibilityModels::linear::linear ( "psiv", dimCompressibility, - compressibilityProperties_.lookup("psiv") + compressibilityProperties_ ), psil_ ( "psil", dimCompressibility, - compressibilityProperties_.lookup("psil") + compressibilityProperties_ ) { correct();