diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C index c7e478ebce54e79e485a50be77f05ac393255667..575434e8f2fff4b89d03d184a0fe2f29a3aeeed4 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,6 +26,7 @@ License #include "IDDESDelta.H" #include "addToRunTimeSelectionTable.H" #include "wallDist.H" +#include "maxDeltaxyz.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -43,7 +44,7 @@ namespace LESModels void Foam::LESModels::IDDESDelta::calcDelta() { - const volScalarField& hmax = hmax_; + const volScalarField& hmax = hmaxPtr_(); const fvMesh& mesh = turbulenceModel_.mesh(); // Wall-normal vectors @@ -143,12 +144,7 @@ Foam::LESModels::IDDESDelta::IDDESDelta ) : LESdelta(name, turbulence), - hmax_ - ( - IOobject::groupName("hmax", turbulence.U().group()), - turbulence, - dict - ), + hmaxPtr_(nullptr), Cw_ ( dict.optionalSubDict(type() + "Coeffs").lookupOrDefault<scalar> @@ -158,6 +154,33 @@ Foam::LESModels::IDDESDelta::IDDESDelta ) ) { + if (dict.optionalSubDict(type() + "Coeffs").found("hmax")) + { + // User-defined hmax + hmaxPtr_ = + LESdelta::New + ( + IOobject::groupName("hmax", turbulence.U().group()), + turbulence, + dict.optionalSubDict(type() + "Coeffs"), + "hmax" + ); + } + else + { + Info<< "Employing " << maxDeltaxyz::typeName << " for hmax" << endl; + + hmaxPtr_.reset + ( + new maxDeltaxyz + ( + IOobject::groupName("hmax", turbulence.U().group()), + turbulence, + dict.optionalSubDict(type() + "Coeffs") + ) + ); + } + calcDelta(); } @@ -178,7 +201,7 @@ void Foam::LESModels::IDDESDelta::correct() { if (turbulenceModel_.mesh().changing()) { - hmax_.correct(); + hmaxPtr_->correct(); calcDelta(); } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H index 55b0332e84a892c3f6c90a7c22804bcb804a01c7..82acfff3a62628ceab9bf8b4b391a55a1d95d704 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/IDDESDelta/IDDESDelta.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,7 +37,7 @@ SourceFiles #ifndef LESModels_IDDESDelta_H #define LESModels_IDDESDelta_H -#include "maxDeltaxyz.H" +#include "LESdelta.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,7 +56,9 @@ class IDDESDelta { // Private data - maxDeltaxyz hmax_; + //- Run-time selectable delta for hmax + // Defaults to the maxDeltaXYZ model if not supplied + autoPtr<LESdelta> hmaxPtr_; scalar Cw_; @@ -102,7 +104,7 @@ public: //- Return the hmax delta field const volScalarField& hmax() const { - return hmax_; + return hmaxPtr_(); } // Correct values diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.C index 1cdb6fd53bb12e4b14d289c2a2676d4e391fc5d5..de82407e4639bd1afb547f24217a9d5359a9f300 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.C @@ -66,12 +66,13 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New ( const word& name, const turbulenceModel& turbulence, - const dictionary& dict + const dictionary& dict, + const word& lookupName ) { - const word deltaType(dict.lookup("delta")); + const word deltaType(dict.lookup(lookupName)); - Info<< "Selecting LES delta type " << deltaType << endl; + Info<< "Selecting LES " << lookupName << " type " << deltaType << endl; auto cstrIter = dictionaryConstructorTablePtr_->cfind(deltaType); @@ -94,12 +95,13 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New const word& name, const turbulenceModel& turbulence, const dictionary& dict, - const dictionaryConstructorTable& additionalConstructors + const dictionaryConstructorTable& additionalConstructors, + const word& lookupName ) { - const word deltaType(dict.lookup("delta")); + const word deltaType(dict.lookup(lookupName)); - Info<< "Selecting LES delta type " << deltaType << endl; + Info<< "Selecting LES " << lookupName << " type " << deltaType << endl; // First any additional ones { diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.H index 35aea4620add75e1abc292ce238367c5f2915426..b4cef870732f27cf800c7d523052ed4771be256b 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/LESdelta/LESdelta.H @@ -108,7 +108,8 @@ public: ( const word& name, const turbulenceModel& turbulence, - const dictionary& dict + const dictionary& dict, + const word& lookupName = "delta" ); //- Return a reference to the selected LES delta @@ -117,7 +118,8 @@ public: const word& name, const turbulenceModel& turbulence, const dictionary& dict, - const dictionaryConstructorTable& + const dictionaryConstructorTable& additionalConstructors, + const word& lookupName = "delta" );