diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C index 7f4e344c18..aa1a5cf9bc 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 25dba0baa6..0ce675aad7 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C @@ -151,7 +151,11 @@ Foam::LESModel::New const dictionary& dict = modelDict.subDict("LES"); - const word modelType(dict.get("LESModel")); + const word modelType + ( + // "LESModel" for v2006 and earlier + dict.getCompat("model", {{"LESModel", -2006}}) + ); Info<< "Selecting LES turbulence model " << modelType << endl; @@ -162,7 +166,7 @@ Foam::LESModel::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 2e463479c2..a0231a02d5 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C @@ -141,7 +141,11 @@ Foam::RASModel::New const dictionary& dict = modelDict.subDict("RAS"); - const word modelType(dict.get("RASModel")); + const word modelType + ( + // "RASModel" for v2006 and earlier + dict.getCompat("model", {{"RASModel", -2006}}) + ); Info<< "Selecting RAS turbulence model " << modelType << endl; @@ -152,7 +156,7 @@ Foam::RASModel::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 17f679cf8b..3b2b179b36 100644 --- a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C +++ b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C @@ -112,7 +112,11 @@ Foam::laminarModel::New { const dictionary& dict = *dictptr; - const word modelType(dict.get("laminarModel")); + const word modelType + ( + // laminarModel -> model (after v2006) + dict.getCompat("model", {{"laminarModel", -2006}}) + ); Info<< "Selecting laminar stress model " << modelType << endl; @@ -123,7 +127,7 @@ Foam::laminarModel::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 4394e4884b..b460f784ba 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::New ) ); - const dictionary dict(modelDict.subOrEmptyDict("RAS")); + word modelType("laminar"); // default to laminar - const word modelType(dict.getOrDefault("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::New { FatalIOErrorInLookup ( - dict, + *dictptr, "RASModelVariables", modelType, *dictionaryConstructorTablePtr_