diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C index c5cc7ebdb70fc625cd9e5604035ae4dd83030b6a..0ff62667376fb3ca531868269d617997899ed684 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ void Foam::LESModel<BasicTurbulenceModel>::printCoeffs(const word& type) { if (printCoeffs_) { - Info<< type << "Coeffs" << coeffDict_ << endl; + Info<< coeffDict_.dictName() << coeffDict_ << endl; } } @@ -67,7 +67,7 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel LESDict_(this->subOrEmptyDict("LES")), turbulence_(LESDict_.lookup("turbulence")), printCoeffs_(LESDict_.lookupOrDefault<Switch>("printCoeffs", false)), - coeffDict_(LESDict_.subOrEmptyDict(type + "Coeffs")), + coeffDict_(LESDict_.optionalSubDict(type + "Coeffs")), kMin_ ( @@ -183,10 +183,7 @@ bool Foam::LESModel<BasicTurbulenceModel>::read() LESDict_ <<= this->subDict("LES"); LESDict_.lookup("turbulence") >> turbulence_; - if (const dictionary* dictPtr = LESDict_.subDictPtr(type() + "Coeffs")) - { - coeffDict_ <<= *dictPtr; - } + coeffDict_ <<= LESDict_.optionalSubDict(type() + "Coeffs"); delta_().read(LESDict_); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C index af812a6f464ba95c1192fca1b790c7fbe6049ac3..8c7396c14fc8d00899e665908ce14a5035af2f0d 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,7 +148,11 @@ Foam::LESModels::IDDESDelta::IDDESDelta ), Cw_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cw", 0.15) + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> + ( + "Cw", + 0.15 + ) ) { calcDelta(); @@ -159,7 +163,7 @@ Foam::LESModels::IDDESDelta::IDDESDelta void Foam::LESModels::IDDESDelta::read(const dictionary& dict) { - const dictionary& coeffsDict(dict.subDict(type() + "Coeffs")); + const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); coeffsDict.readIfPresent<scalar>("Cw", Cw_); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C index d2b9f762b4a2589ed6c8f1038945ccb4783112d5..f09e9c240bb38c3640ff77581efe50e07bbae88b 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,13 +67,17 @@ Foam::LESModels::PrandtlDelta::PrandtlDelta ( name, turbulence, - dict.subDict(type() + "Coeffs") + dict.optionalSubDict(type() + "Coeffs") ) ), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), Cdelta_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cdelta", 0.158) + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> + ( + "Cdelta", + 0.158 + ) ) { calcDelta(); @@ -84,7 +88,7 @@ Foam::LESModels::PrandtlDelta::PrandtlDelta void Foam::LESModels::PrandtlDelta::read(const dictionary& dict) { - const dictionary& coeffDict(dict.subDict(type() + "Coeffs")); + const dictionary& coeffDict(dict.optionalSubDict(type() + "Coeffs")); geometricDelta_().read(coeffDict); dict.readIfPresent<scalar>("kappa", kappa_); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.C index 053c365a2fa979e7fcca9d17d877603e58d4505d..ce13cbad1fb328f52753b5d74f48cebbcb0890eb 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,7 +91,11 @@ Foam::LESModels::cubeRootVolDelta::cubeRootVolDelta LESdelta(name, turbulence), deltaCoeff_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("deltaCoeff", 1) + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> + ( + "deltaCoeff", + 1 + ) ) { calcDelta(); @@ -102,7 +106,7 @@ Foam::LESModels::cubeRootVolDelta::cubeRootVolDelta void Foam::LESModels::cubeRootVolDelta::read(const dictionary& dict) { - dict.subDict(type() + "Coeffs").readIfPresent<scalar> + dict.optionalSubDict(type() + "Coeffs").readIfPresent<scalar> ( "deltaCoeff", deltaCoeff_ diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C index 2163a3201c5f892e9770650347d79ca36fade1e1..ab6dddafcc44253c0c5edab4ed94835d13ae5c0f 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,7 +102,11 @@ Foam::LESModels::maxDeltaxyz::maxDeltaxyz LESdelta(name, turbulence), deltaCoeff_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("deltaCoeff", 1) + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> + ( + "deltaCoeff", + 1 + ) ) { calcDelta(); @@ -113,7 +117,7 @@ Foam::LESModels::maxDeltaxyz::maxDeltaxyz void Foam::LESModels::maxDeltaxyz::read(const dictionary& dict) { - const dictionary& coeffsDict(dict.subDict(type() + "Coeffs")); + const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); coeffsDict.readIfPresent<scalar>("deltaCoeff", deltaCoeff_); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C index c8a95cc048c48d4b9b260bb24dcd89cf22be362d..306ea663b0011fba12a04ccd2989feb3cc379fd6 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -153,12 +153,15 @@ Foam::LESModels::smoothDelta::smoothDelta ( "geometricDelta", turbulence, - dict.subDict(type() + "Coeffs") + dict.optionalSubDict(type() + "Coeffs") ) ), maxDeltaRatio_ ( - readScalar(dict.subDict(type() + "Coeffs").lookup("maxDeltaRatio")) + readScalar + ( + dict.optionalSubDict(type() + "Coeffs").lookup("maxDeltaRatio") + ) ) { calcDelta(); @@ -169,7 +172,7 @@ Foam::LESModels::smoothDelta::smoothDelta void Foam::LESModels::smoothDelta::read(const dictionary& dict) { - const dictionary& coeffsDict(dict.subDict(type() + "Coeffs")); + const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); geometricDelta_().read(coeffsDict); coeffsDict.lookup("maxDeltaRatio") >> maxDeltaRatio_; diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C index 97effadd45a44facdba30df40364a88ffb11a801..05b1774c2f6c3a4af8c358c0067b325339c51cec 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,21 +108,29 @@ Foam::LESModels::vanDriestDelta::vanDriestDelta ( IOobject::groupName("geometricDelta", turbulence.U().group()), turbulence, - dict.subDict(type() + "Coeffs") + dict.optionalSubDict(type() + "Coeffs") ) ), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), Aplus_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Aplus", 26.0) + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> + ( + "Aplus", + 26.0 + ) ), Cdelta_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cdelta", 0.158) + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> + ( + "Cdelta", + 0.158 + ) ), calcInterval_ ( - dict.subDict(type() + "Coeffs").lookupOrDefault<label> + dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<label> ( "calcInterval", 1 @@ -137,7 +145,7 @@ Foam::LESModels::vanDriestDelta::vanDriestDelta void Foam::LESModels::vanDriestDelta::read(const dictionary& dict) { - const dictionary& coeffsDict(dict.subDict(type() + "Coeffs")); + const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); geometricDelta_().read(coeffsDict); dict.readIfPresent<scalar>("kappa", kappa_); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C index 467949de78a36f5ee7521382dc6e2b10efbc9bc5..f988138fe3ef6b65b73940bd1baf00c535c9ec12 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,10 @@ Foam::anisotropicFilter::anisotropicFilter ) : LESfilter(mesh), - widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))), + widthCoeff_ + ( + readScalar(bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff")) + ), coeff_ ( IOobject @@ -118,7 +121,7 @@ Foam::anisotropicFilter::anisotropicFilter void Foam::anisotropicFilter::read(const dictionary& bd) { - bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_; + bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_; } diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C index 11fea8654316d9f30947c3ac63df91f0d7a550d8..61934975af14fce6da0f1452fded9888ae9ac125 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,7 +64,10 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff) Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd) : LESfilter(mesh), - widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))), + widthCoeff_ + ( + readScalar(bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff")) + ), coeff_ ( IOobject @@ -86,7 +89,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd) void Foam::laplaceFilter::read(const dictionary& bd) { - bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_; + bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_; } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C index d95f2bffb3f3f0e0d9d101d89a029b537aef2809..cc22f4d64cc2cdcdc5aff0ccd5ae2f55888c6626 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ void Foam::RASModel<BasicTurbulenceModel>::printCoeffs(const word& type) { if (printCoeffs_) { - Info<< type << "Coeffs" << coeffDict_ << endl; + Info<< coeffDict_.dictName() << coeffDict_ << endl; } } @@ -67,7 +67,7 @@ Foam::RASModel<BasicTurbulenceModel>::RASModel RASDict_(this->subOrEmptyDict("RAS")), turbulence_(RASDict_.lookup("turbulence")), printCoeffs_(RASDict_.lookupOrDefault<Switch>("printCoeffs", false)), - coeffDict_(RASDict_.subOrEmptyDict(type + "Coeffs")), + coeffDict_(RASDict_.optionalSubDict(type + "Coeffs")), kMin_ ( @@ -173,10 +173,7 @@ bool Foam::RASModel<BasicTurbulenceModel>::read() RASDict_ <<= this->subDict("RAS"); RASDict_.lookup("turbulence") >> turbulence_; - if (const dictionary* dictPtr = RASDict_.subDictPtr(type() + "Coeffs")) - { - coeffDict_ <<= *dictPtr; - } + coeffDict_ <<= RASDict_.optionalSubDict(type() + "Coeffs"); kMin_.readIfPresent(RASDict_); epsilonMin_.readIfPresent(RASDict_); diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C index 0bd0bb49e3a536ff441a93aed0b00b59b153d384..b91406d464a6cd75c6e6d8559e6b5789bd9bc385 100644 --- a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C +++ b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,7 @@ void Foam::laminarModel<BasicTurbulenceModel>::printCoeffs(const word& type) { if (printCoeffs_) { - Info<< type << "Coeffs" << coeffDict_ << endl; + Info<< coeffDict_.dictName() << coeffDict_ << endl; } } @@ -67,7 +67,7 @@ Foam::laminarModel<BasicTurbulenceModel>::laminarModel laminarDict_(this->subOrEmptyDict("laminar")), printCoeffs_(laminarDict_.lookupOrDefault<Switch>("printCoeffs", false)), - coeffDict_(laminarDict_.subOrEmptyDict(type + "Coeffs")) + coeffDict_(laminarDict_.optionalSubDict(type + "Coeffs")) { // Force the construction of the mesh deltaCoeffs which may be needed // for the construction of the derived models and BCs @@ -170,14 +170,7 @@ bool Foam::laminarModel<BasicTurbulenceModel>::read() { laminarDict_ <<= this->subDict("laminar"); - if - ( - const dictionary* dictPtr = - laminarDict_.subDictPtr(type() + "Coeffs") - ) - { - coeffDict_ <<= *dictPtr; - } + coeffDict_ <<= laminarDict_.optionalSubDict(type() + "Coeffs"); return true; }