diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C index 7f4e344c1813054c978d8e2b31d05085c4443f4d..aa1a5cf9bc6a766b45ba65a4c8790f162c04f7cf 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2015-2016 OpenCFD Ltd. + Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -93,17 +93,18 @@ Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates const dictionary fieldModels(solverDict.subDict("fluidModels")); - word turbulenceModel("laminar"); // default to laminar - word turbulenceType("none"); + word turbModel("laminar"); // default to laminar + word turbType("none"); - if (fieldModels.readIfPresent("turbulenceModel", turbulenceType)) + if (fieldModels.readIfPresent("turbulenceModel", turbType)) { - if (turbulenceType == "turbulenceModel") + if (turbType == "turbulenceModel") { IOdictionary turbPropDict ( IOobject ( + // turbulenceModel::propertiesName "turbulenceProperties", runTime.constant(), regionName, @@ -118,17 +119,19 @@ Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates if (modelType == "laminar") { - // Leave turbulenceModel as laminar + // Leave as laminar } else if (modelType == "RAS") { + // "RASModel" for v2006 and earlier turbPropDict.subDict(modelType) - .readEntry("RASModel", turbulenceModel); + .readCompat("model", {{"RASModel", -2006}}, turbModel); } else if (modelType == "LES") { + // "LESModel" for v2006 and earlier turbPropDict.subDict(modelType) - .readEntry("LESModel", turbulenceModel); + .readCompat("model", {{"LESModel", -2006}}, turbModel); } else { @@ -141,20 +144,19 @@ Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates else { FatalErrorInFunction - << "Unhandled turbulence model option " << turbulenceType + << "Unhandled turbulence model option " << turbType << ". Valid options are turbulenceModel" << exit(FatalError); } } - Info<< " Selecting " << turbulenceType << ": " << turbulenceModel - << endl; + Info<< " Selecting " << turbType << ": " << turbModel << endl; IOdictionary turbModelDict ( IOobject ( - fileName(turbModelDir/turbulenceModel), + fileName(turbModelDir/turbModel), runTime, IOobject::MUST_READ ) diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C index 25dba0baa637c42a27ccda7447f86bae32da181a..0ce675aad75f7022e0c3db53524163b0baab579f 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C @@ -151,7 +151,11 @@ Foam::LESModel<BasicTurbulenceModel>::New const dictionary& dict = modelDict.subDict("LES"); - const word modelType(dict.get<word>("LESModel")); + const word modelType + ( + // "LESModel" for v2006 and earlier + dict.getCompat<word>("model", {{"LESModel", -2006}}) + ); Info<< "Selecting LES turbulence model " << modelType << endl; @@ -162,7 +166,7 @@ Foam::LESModel<BasicTurbulenceModel>::New FatalIOErrorInLookup ( dict, - "LESModel", + "LES model", modelType, *dictionaryConstructorTablePtr_ ) << exit(FatalIOError); diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C index 2e463479c24e3ee6d1f913b6645f9644b3d96ed4..a0231a02d572c6cce4b13b360e0edfa2232b1719 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C @@ -141,7 +141,11 @@ Foam::RASModel<BasicTurbulenceModel>::New const dictionary& dict = modelDict.subDict("RAS"); - const word modelType(dict.get<word>("RASModel")); + const word modelType + ( + // "RASModel" for v2006 and earlier + dict.getCompat<word>("model", {{"RASModel", -2006}}) + ); Info<< "Selecting RAS turbulence model " << modelType << endl; @@ -152,7 +156,7 @@ Foam::RASModel<BasicTurbulenceModel>::New FatalIOErrorInLookup ( dict, - "RASModel", + "RAS model", modelType, *dictionaryConstructorTablePtr_ ) << exit(FatalIOError); diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C index 17f679cf8b9f4d0c0ad2293da2d8097ac78c9905..3b2b179b366ed6fa9fa5a11d4fcd81f055984b27 100644 --- a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C +++ b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C @@ -112,7 +112,11 @@ Foam::laminarModel<BasicTurbulenceModel>::New { const dictionary& dict = *dictptr; - const word modelType(dict.get<word>("laminarModel")); + const word modelType + ( + // laminarModel -> model (after v2006) + dict.getCompat<word>("model", {{"laminarModel", -2006}}) + ); Info<< "Selecting laminar stress model " << modelType << endl; @@ -123,7 +127,7 @@ Foam::laminarModel<BasicTurbulenceModel>::New FatalIOErrorInLookup ( dict, - "laminarModel", + "laminar model", modelType, *dictionaryConstructorTablePtr_ ) << exit(FatalIOError); diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/turbulenceModelVariables/RAS/RASModelVariables/RASModelVariables.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/turbulenceModelVariables/RAS/RASModelVariables/RASModelVariables.C index 4394e4884be2b9def1bf03c3aa8475763a2fe3d2..b460f784baf21ffe26a72658861a131d17bfbcc9 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/turbulenceModelVariables/RAS/RASModelVariables/RASModelVariables.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/turbulenceModelVariables/RAS/RASModelVariables/RASModelVariables.C @@ -272,9 +272,19 @@ autoPtr<RASModelVariables> RASModelVariables::New ) ); - const dictionary dict(modelDict.subOrEmptyDict("RAS")); + word modelType("laminar"); // default to laminar - const word modelType(dict.getOrDefault<word>("RASModel", "laminar")); + const dictionary* dictptr = modelDict.findDict("RAS"); + + if (dictptr) + { + // "RASModel" for v2006 and earlier + dictptr->readCompat("model", {{"RASModel", -2006}}, modelType); + } + else + { + dictptr = &dictionary::null; + } Info<< "Creating references for RASModel variables : " << modelType << endl; @@ -284,7 +294,7 @@ autoPtr<RASModelVariables> RASModelVariables::New { FatalIOErrorInLookup ( - dict, + *dictptr, "RASModelVariables", modelType, *dictionaryConstructorTablePtr_