diff --git a/applications/test/objectRegistry/Test-objectRegistry.C b/applications/test/objectRegistry/Test-objectRegistry.C index c807ba9c047d254f42aa023977e5f61e3fd08c65..5ccdb3fe91b924171add0905f5550ae4d044bcdc 100644 --- a/applications/test/objectRegistry/Test-objectRegistry.C +++ b/applications/test/objectRegistry/Test-objectRegistry.C @@ -76,9 +76,8 @@ void printRegistry Foam::label indent ) { - hashedWordList regs = obr.names<objectRegistry>(); - regs.sort(); wordList names = obr.sortedNames(); + hashedWordList regs = obr.sortedNames<objectRegistry>(); std::string prefix; for (label i=indent; i; --i) @@ -121,7 +120,8 @@ void printRegistry const word& name = regs[i]; const objectRegistry& next = obr.lookupObject<objectRegistry> ( - name + name, + recursive ); os << prefix.c_str() @@ -158,13 +158,13 @@ int main(int argc, char *argv[]) "skip", "skip some parts" ); - // argList::validArgs.append("recursive (true|false)"); + argList::validArgs.append("recursive (true|false)"); #include "setRootCase.H" #include "createTime.H" #include "createPolyMesh.H" - // recursive = Switch(args[1]); + recursive = Switch(args[1]); const bool optMesh = args.optionFound("mesh"); const bool optSkip = args.optionFound("skip"); @@ -183,7 +183,8 @@ int main(int argc, char *argv[]) db.subRegistry ( entryName, - true + true, + recursive ); } @@ -200,7 +201,8 @@ int main(int argc, char *argv[]) const objectRegistry& subreg = db.subRegistry ( regName, - true + true, + recursive ); for (label j = 0; j < 3; ++j) @@ -210,12 +212,14 @@ int main(int argc, char *argv[]) subreg.subRegistry ( entryName, - true + true, + recursive ); subreg.subRegistry ( "$" + entryName, // qualified to avoid collisions - true + true, + recursive ); } } @@ -231,7 +235,8 @@ int main(int argc, char *argv[]) db.subRegistry ( entryName, - true + true, + recursive ); } @@ -249,7 +254,8 @@ int main(int argc, char *argv[]) const objectRegistry& subreg = db.subRegistry ( regName, - false + false, + recursive ); if (!optSkip) @@ -261,7 +267,8 @@ int main(int argc, char *argv[]) subreg.subRegistry ( entryName, - true + true, + recursive ); } } diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index 007b56dc0bfbde9fbcb24598d4cf1e3d5cd8f6fd..f58bab42140d96864c9a0eae8b0e1b2648e547a8 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.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 | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ License #include "Time.H" #include "OSspecific.H" #include "IOList.H" +#include "stringListOps.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -228,7 +229,10 @@ Foam::wordList Foam::IOobjectList::sortedNames() const } -Foam::wordList Foam::IOobjectList::names(const word& ClassName) const +Foam::wordList Foam::IOobjectList::names +( + const word& ClassName +) const { wordList objectNames(size()); @@ -247,7 +251,34 @@ Foam::wordList Foam::IOobjectList::names(const word& ClassName) const } -Foam::wordList Foam::IOobjectList::sortedNames(const word& ClassName) const +Foam::wordList Foam::IOobjectList::names +( + const word& ClassName, + const wordRe& matcher +) const +{ + wordList objNames = names(ClassName); + + return wordList(objNames, findStrings(matcher, objNames)); +} + + +Foam::wordList Foam::IOobjectList::names +( + const word& ClassName, + const wordReList& matcher +) const +{ + wordList objNames = names(ClassName); + + return wordList(objNames, findStrings(matcher, objNames)); +} + + +Foam::wordList Foam::IOobjectList::sortedNames +( + const word& ClassName +) const { wordList sortedLst = names(ClassName); sort(sortedLst); @@ -256,4 +287,30 @@ Foam::wordList Foam::IOobjectList::sortedNames(const word& ClassName) const } +Foam::wordList Foam::IOobjectList::sortedNames +( + const word& ClassName, + const wordRe& matcher +) const +{ + wordList sortedLst = names(ClassName, matcher); + sort(sortedLst); + + return sortedLst; +} + + +Foam::wordList Foam::IOobjectList::sortedNames +( + const word& ClassName, + const wordReList& matcher +) const +{ + wordList sortedLst = names(ClassName, matcher); + sort(sortedLst); + + return sortedLst; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.H b/src/OpenFOAM/db/IOobjectList/IOobjectList.H index 5a0177d197d5c2e2bcb1ab15c08c9b6bbff9b0e6..926135222fd8686869c881496c1537da01b13592 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.H +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.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 | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,7 +55,7 @@ class IOobjectList // Private Member Functions //- Disallow default bitwise assignment - void operator=(const IOobjectList&); + void operator=(const IOobjectList&) = delete; public: @@ -104,17 +104,35 @@ public: //- Return the list for all IOobjects of a given class IOobjectList lookupClass(const word& className) const; - //- Return the list of names of the IOobjects - wordList names() const; - //- Return the sorted list of names of the IOobjects - wordList sortedNames() const; + //- A list of names of the IOobjects + wordList names() const; - //- Return the list of names of the IOobjects of given class + //- A list of names of IOobjects of the given class wordList names(const word& className) const; - //- Return the sorted list of names of the IOobjects of given class + //- A list of names of IOobjects of the given class, + // and that also satisfy the input matcher + wordList names(const word& className, const wordRe&) const; + + //- A list of names of IOobjects of the given class, + // and that also satisfy the input matchers + wordList names(const word& className, const wordReList&) const; + + + //- A sorted list of names of the IOobjects + wordList sortedNames() const; + + //- A sorted list of names of IOobjects of given class wordList sortedNames(const word& className) const; + + //- A sorted list of names of IOobjects of the given class, + // and that also satisfy the input matcher + wordList sortedNames(const word& className, const wordRe&) const; + + //- A sorted list of names of IOobjects of the given class, + // and that also satisfy the input matchers + wordList sortedNames(const word& className, const wordReList&) const; }; diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 84df1a647023255b17fb86b0d6a5f819390cc19a..d72efda11cab30f7eecb11dbc88e7b807150af8a 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.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) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -155,12 +155,13 @@ Foam::wordList Foam::objectRegistry::sortedNames(const word& ClassName) const const Foam::objectRegistry& Foam::objectRegistry::subRegistry ( const word& name, - const bool forceCreate + const bool forceCreate, + const bool recursive ) const { - if (forceCreate && !foundObject<objectRegistry>(name)) + if (forceCreate && !foundObject<objectRegistry>(name, recursive)) { - objectRegistry* fieldsCachePtr = new objectRegistry + objectRegistry* subObr = new objectRegistry ( IOobject ( @@ -171,9 +172,10 @@ const Foam::objectRegistry& Foam::objectRegistry::subRegistry IOobject::NO_WRITE ) ); - fieldsCachePtr->store(); + subObr->store(); } - return lookupObject<objectRegistry>(name); + + return lookupObject<objectRegistry>(name, recursive); } diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index bae145b04196885c76a128cdffa3e4a4cd77fe10..16dc0e17780da30f9381c0e8035b73d0e99125b5 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.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 | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +29,7 @@ Description SourceFiles objectRegistry.C + objectRegistryTemplates.C \*---------------------------------------------------------------------------*/ @@ -75,10 +76,10 @@ class objectRegistry bool parentNotTime() const; //- Disallow Copy constructor - objectRegistry(const objectRegistry&); + objectRegistry(const objectRegistry&) = delete; //- Disallow default bitwise copy construct and assignment - void operator=(const objectRegistry&); + void operator=(const objectRegistry&) = delete; public: @@ -132,38 +133,58 @@ public: return dbDir_; } - //- Return the list of names of the IOobjects + //- A list of names of the objects wordList names() const; - //- Return the sorted list of names of the IOobjects + //- A sorted list of names of the objects wordList sortedNames() const; - //- Return the list of names of IOobjects of given class name + //- A list of names of objects that have the given class name wordList names(const word& className) const; - //- Return the sorted list of names of IOobjects of given class name + //- A sorted list of names of objects that have the given class name wordList sortedNames(const word& className) const; - //- Return the list of names of the IOobjects of given type + //- A list of names of objects that have the given type template<class Type> wordList names() const; - //- Return the list of objects whose name matches the input regExp + //- A list of names of objects that have the given type, + // and that also satisfy the input matcher template<class Type> - wordList names(const wordRe& name) const; + wordList names(const wordRe&) const; - //- Return the list of objects whose name matches the input regExp + //- A list of names for objects that have the given type, + // and that also satisfy the input matchers template<class Type> - wordList names(const wordReList& name) const; + wordList names(const wordReList&) const; - //- Lookup and return a const sub-objectRegistry. Optionally create - // it if it does not exist. + //- A sorted list of names of objects that have the given type + template<class Type> + wordList sortedNames() const; + + //- A sorted list of names of objects that have the given type, + // and that also satisfy the input matcher + template<class Type> + wordList sortedNames(const wordRe&) const; + + //- A sorted list of names of objects that have the given type, + // and that also satisfy the input matchers + template<class Type> + wordList sortedNames(const wordReList&) const; + + + //- Lookup and return a const sub-objectRegistry. + // Optionally create it if it does not exist. + // If recursive, search parent registries. const objectRegistry& subRegistry ( const word& name, - const bool forceCreate = false + const bool forceCreate = false, + const bool recursive = false ) const; + //- Lookup and return all objects of the given Type template<class Type> HashTable<const Type*> lookupClass(const bool strict = false) const; @@ -173,12 +194,56 @@ public: HashTable<Type*> lookupClass(const bool strict = false); //- Is the named Type found? + // If recursive, search parent registries. template<class Type> - bool foundObject(const word& name) const; + bool foundObject + ( + const word& name, + const bool recursive = false + ) const; - //- Lookup and return the object of the given Type + //- Lookup and return the object of the given Type. + // If recursive, search parent registries. template<class Type> - const Type& lookupObject(const word& name) const; + const Type& lookupObject + ( + const word& name, + const bool recursive = false + ) const; + + //- Lookup and return the object of the given Type. + // If recursive, search parent registries. + template<class Type> + Type& lookupObjectRef + ( + const word& name, + const bool recursive = false + ) const; + + //- Lookup and return pointer to the object of the given Type, + // otherwise nullptr if the object was not found, + // or had the incorrect type. + // If recursive, search parent registries. + template<class Type> + const Type* lookupObjectPtr + ( + const word& name, + const bool recursive = false + ) const; + + + //- Lookup and return non-const pointer to the object + // of the given Type, + // otherwise nullptr if the object was not found, + // or had the incorrect type. + // If recursive, search parent registries. + template<class Type> + Type* lookupObjectRefPtr + ( + const word& name, + const bool recursive = false + ) const; + //- Return new event number. label getEvent() const; @@ -195,6 +260,7 @@ public: //- Remove an regIOobject from registry bool checkOut(regIOobject&) const; + // Reading //- Return true if any of the object's files have been modified diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index 0c26009482ef8adad9d3bd3eb5e7f0f3fc29cdf2..c5c583ad2666e24f3b6f37f5415c79d65e3923a8 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,7 +49,7 @@ Foam::wordList Foam::objectRegistry::names() const template<class Type> -Foam::wordList Foam::objectRegistry::names(const wordRe& name) const +Foam::wordList Foam::objectRegistry::names(const wordRe& matcher) const { wordList objectNames(size()); @@ -60,7 +60,7 @@ Foam::wordList Foam::objectRegistry::names(const wordRe& name) const { const word& objectName = iter()->name(); - if (name.match(objectName)) + if (matcher.match(objectName)) { objectNames[count++] = objectName; } @@ -74,11 +74,46 @@ Foam::wordList Foam::objectRegistry::names(const wordRe& name) const template<class Type> -Foam::wordList Foam::objectRegistry::names(const wordReList& patterns) const +Foam::wordList Foam::objectRegistry::names(const wordReList& matcher) const { wordList names(this->names<Type>()); - return wordList(names, findStrings(patterns, names)); + return wordList(names, findStrings(matcher, names)); +} + + +template<class Type> +Foam::wordList Foam::objectRegistry::sortedNames() const +{ + wordList sorted(this->names<Type>()); + sort(sorted); + + return sorted; +} + +template<class Type> +Foam::wordList Foam::objectRegistry::sortedNames +( + const wordRe& match +) const +{ + wordList sorted(this->names<Type>(match)); + sort(sorted); + + return sorted; +} + + +template<class Type> +Foam::wordList Foam::objectRegistry::sortedNames +( + const wordReList& matcher +) const +{ + wordList sorted(this->names<Type>(matcher)); + sort(sorted); + + return sorted; } @@ -92,11 +127,7 @@ Foam::HashTable<const Type*> Foam::objectRegistry::lookupClass forAllConstIter(HashTable<regIOobject*>, *this, iter) { - if - ( - (strict && isType<Type>(*iter())) - || (!strict && isA<Type>(*iter())) - ) + if (strict ? isType<Type>(*iter()) : isA<Type>(*iter())) { objectsOfClass.insert ( @@ -120,11 +151,7 @@ Foam::HashTable<Type*> Foam::objectRegistry::lookupClass forAllIter(HashTable<regIOobject*>, *this, iter) { - if - ( - (strict && isType<Type>(*iter())) - || (!strict && isA<Type>(*iter())) - ) + if (strict ? isType<Type>(*iter()) : isA<Type>(*iter())) { objectsOfClass.insert ( @@ -139,40 +166,41 @@ Foam::HashTable<Type*> Foam::objectRegistry::lookupClass template<class Type> -bool Foam::objectRegistry::foundObject(const word& name) const +bool Foam::objectRegistry::foundObject +( + const word& name, + const bool recursive +) const { - const_iterator iter = find(name); + const Type* ptr = this->lookupObjectPtr<Type>(name, recursive); - if (iter != end()) + if (ptr) { - const Type* vpsiPtr_ = dynamic_cast<const Type*>(iter()); - - if (vpsiPtr_) - { - return true; - } + return true; } - else if (this->parentNotTime()) + else { - return parent_.foundObject<Type>(name); + return false; } - - return false; } template<class Type> -const Type& Foam::objectRegistry::lookupObject(const word& name) const +const Type& Foam::objectRegistry::lookupObject +( + const word& name, + const bool recursive +) const { const_iterator iter = find(name); if (iter != end()) { - const Type* vpsiPtr_ = dynamic_cast<const Type*>(iter()); + const Type* ptr = dynamic_cast<const Type*>(iter()); - if (vpsiPtr_) + if (ptr) { - return *vpsiPtr_; + return *ptr; } FatalErrorInFunction @@ -183,24 +211,75 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const << ", it is a " << iter()->type() << abort(FatalError); } - else + else if (recursive && this->parentNotTime()) + { + return parent_.lookupObject<Type>(name, recursive); + } + + FatalErrorInFunction + << nl + << " request for " << Type::typeName + << " " << name << " from objectRegistry " << this->name() + << " failed\n available objects of type " << Type::typeName + << " are" << nl + << names<Type>() + << abort(FatalError); + + return NullObjectRef<Type>(); +} + + +template<class Type> +Type& Foam::objectRegistry::lookupObjectRef +( + const word& name, + const bool recursive +) const +{ + const Type& ref = this->lookupObject<Type>(name, recursive); + // The above will already fail if things didn't work + + return const_cast<Type&>(ref); +} + + +template<class Type> +const Type* Foam::objectRegistry::lookupObjectPtr +( + const word& name, + const bool recursive +) const +{ + const_iterator iter = find(name); + + if (iter != end()) { - if (this->parentNotTime()) + const Type* ptr = dynamic_cast<const Type*>(iter()); + + if (ptr) { - return parent_.lookupObject<Type>(name); + return ptr; } - - FatalErrorInFunction - << nl - << " request for " << Type::typeName - << " " << name << " from objectRegistry " << this->name() - << " failed\n available objects of type " << Type::typeName - << " are" << nl - << names<Type>() - << abort(FatalError); + } + else if (recursive && this->parentNotTime()) + { + return parent_.lookupObjectPtr<Type>(name, recursive); } - return NullObjectRef<Type>(); + return nullptr; +} + + +template<class Type> +Type* Foam::objectRegistry::lookupObjectRefPtr +( + const word& name, + const bool recursive +) const +{ + const Type* ptr = this->lookupObjectPtr<Type>(name, recursive); + + return const_cast<Type*>(ptr); } diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/outletMappedUniformInletHeatAddition/outletMappedUniformInletHeatAdditionFvPatchField.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/outletMappedUniformInletHeatAddition/outletMappedUniformInletHeatAdditionFvPatchField.H index 4dcd68855558e700609db1481f81b92f74c171fb..b80efdd5233f34b924f4b2d2fa620d8152e2e9dc 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/outletMappedUniformInletHeatAddition/outletMappedUniformInletHeatAdditionFvPatchField.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/outletMappedUniformInletHeatAddition/outletMappedUniformInletHeatAdditionFvPatchField.H @@ -28,8 +28,9 @@ Group grpInletBoundaryConditions Description - This temperature boundary conditon averages the temperature over the - "outlet" patch specified by name "outletPatch" and applies an extra + + This temperature boundary condition averages the temperature over the + "outlet" patch specified by name "outletPatchName" and applies an extra heat source. This is set as a uniform temperature value on this patch. Additionally minTempLimit/maxTempLimit limits can be applied diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.H index d0238d8dfd9e126037961c1a86a0528888819f5c..916049ea462cecb2950a8bbc2ae1896ff5b88b15 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/cubeRootVolDelta/cubeRootVolDelta.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 | + \\/ M anipulation | Copyright (C) 2016 OpenCFD ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,9 +63,6 @@ class cubeRootVolDelta cubeRootVolDelta(const cubeRootVolDelta&); void operator=(const cubeRootVolDelta&); - // Calculate the delta values - void calcDelta(); - public: @@ -91,6 +88,10 @@ public: // Member Functions + + //- Calculate the delta values + void calcDelta(); + //- Read the LESdelta dictionary virtual void read(const dictionary&); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.H index 8fd626654728db6006e53f642c56d2bad2861cc6..de439813221efc3f63d1f5793a3a761fcf942d8f 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.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 | + \\/ M anipulation | Copyright (C) 2016 OpenCFD ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,9 +67,6 @@ class maxDeltaxyz maxDeltaxyz(const maxDeltaxyz&); void operator=(const maxDeltaxyz&); - // Calculate the delta values - void calcDelta(); - public: @@ -95,6 +92,9 @@ public: // Member Functions + //- Calculate the delta values + void calcDelta(); + //- Read the LESdelta dictionary virtual void read(const dictionary&); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C new file mode 100644 index 0000000000000000000000000000000000000000..fdf70f10af3bb162df76ed692866870f85dacf6d --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "maxDeltaxyzCubeRootLESDelta.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + defineTypeNameAndDebug(maxDeltaxyzCubeRootLESDelta, 0); + addToRunTimeSelectionTable + ( + LESdelta, + maxDeltaxyzCubeRootLESDelta, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::LESModels::maxDeltaxyzCubeRootLESDelta::calcDelta() +{ + maxDeltaxyz_.calcDelta(); + cubeRootVolDelta_.calcDelta(); + + delta_ = + max + ( + static_cast<const volScalarField&>(maxDeltaxyz_), + static_cast<const volScalarField&>(cubeRootVolDelta_) + ); + + // Handle coupled boundaries + delta_.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::LESModels::maxDeltaxyzCubeRootLESDelta::maxDeltaxyzCubeRootLESDelta +( + const word& name, + const turbulenceModel& turbulence, + const dictionary& dict +) +: + LESdelta(name, turbulence), + maxDeltaxyz_(name, turbulence, dict.subDict(typeName + "Coeffs")), + cubeRootVolDelta_(name, turbulence, dict.subDict(typeName + "Coeffs")) +{ + calcDelta(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::LESModels::maxDeltaxyzCubeRootLESDelta::read(const dictionary& dict) +{ + maxDeltaxyz_.read(dict.subDict(typeName + "Coeffs")); + cubeRootVolDelta_.read(dict.subDict(typeName + "Coeffs")); + + calcDelta(); +} + + +void Foam::LESModels::maxDeltaxyzCubeRootLESDelta::correct() +{ + if (turbulenceModel_.mesh().changing()) + { + calcDelta(); + } +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.H new file mode 100644 index 0000000000000000000000000000000000000000..a52fe7b78fd641675503f95b281fd200e888ea01 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::maxDeltaxyzCubeRootLESDelta + +Description + Maximum delta between maxDeltaxyz and cubeRootVolDelta. + +SourceFiles + maxDeltaxyzCubeRootLESDelta.C + +\*---------------------------------------------------------------------------*/ + +#ifndef maxDeltaxyzCubeRootLESDelta_H +#define maxDeltaxyzCubeRootLESDelta_H + +#include "LESdelta.H" +#include "maxDeltaxyz.H" +#include "cubeRootVolDelta.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +/*---------------------------------------------------------------------------*\ + Class maxDeltaxyzCubeRootLESDelta Declaration +\*---------------------------------------------------------------------------*/ + +class maxDeltaxyzCubeRootLESDelta +: + public LESdelta +{ + + // Private Member Functions + + //- Disallow default bitwise copy construct and assignment + maxDeltaxyzCubeRootLESDelta(const maxDeltaxyzCubeRootLESDelta&); + void operator=(const maxDeltaxyzCubeRootLESDelta&); + + // Calculate the delta values + void calcDelta(); + + //- maxDeltaxyz model + maxDeltaxyz maxDeltaxyz_; + + //- cubeRootVolDelta model + cubeRootVolDelta cubeRootVolDelta_; + + +public: + + //- Runtime type information + TypeName("maxDeltaxyzCubeRoot"); + + + // Constructors + + //- Construct from name, turbulenceModel and dictionary + maxDeltaxyzCubeRootLESDelta + ( + const word& name, + const turbulenceModel& turbulence, + const dictionary& + ); + + + //- Destructor + virtual ~maxDeltaxyzCubeRootLESDelta() + {} + + + // Member Functions + + //- Read the LESdelta dictionary + virtual void read(const dictionary&); + + // Correct values + virtual void correct(); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/Make/files b/src/TurbulenceModels/turbulenceModels/Make/files index 4afb141beac6534cabe4eb184629d63923c7a79e..2123e373e8887e0485320cabfce4ccf11a644468 100644 --- a/src/TurbulenceModels/turbulenceModels/Make/files +++ b/src/TurbulenceModels/turbulenceModels/Make/files @@ -10,6 +10,7 @@ $(LESdelta)/vanDriestDelta/vanDriestDelta.C $(LESdelta)/smoothDelta/smoothDelta.C $(LESdelta)/maxDeltaxyz/maxDeltaxyz.C $(LESdelta)/IDDESDelta/IDDESDelta.C +$(LESdelta)/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C LESfilters = LES/LESfilters diff --git a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H index 46b84fd38b1278bd1ce090be2a70eb1d4af7a31c..6a1a6525f6508f3829d507b80ef91f49d2f3ffde 100644 --- a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H +++ b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H @@ -114,8 +114,16 @@ Usage minDiameter | minimum region equivalent diameter | no | 0 setFormat | writing format | yes | origin | origin of local co-ordinate system | yes | - coordinateRoation | orientation of local co-ordinate system | no | + coordinateRoation | orientation of local co-ordinate system | no log | Log to standard output | no | yes + isoPlanes | switch for isoPlanes | no | false + origin | origin of the plane when isoPlanes is used | no | none + direction | direction of the plane when isoPlanes is used | no | none + maxDiameter | maximum diameter of the sampling cylinder when + isoPlanes is used | no | none + nDownstreamBins | number of bins when isoPlanes is used | no | none + maxDownstream | maximum distance from origin when isoPlanes is used + | no | none \endtable See also diff --git a/src/functionObjects/graphics/runTimePostProcessing/scene.C b/src/functionObjects/graphics/runTimePostProcessing/scene.C index 43cd38be48301312e69ed0c4fe4892a2c1831fff..4af8b0d0e83f119a19afdc3ac68df3a1546c6209 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/scene.C +++ b/src/functionObjects/graphics/runTimePostProcessing/scene.C @@ -38,28 +38,6 @@ License #include "vtkRenderWindow.h" #include "vtkWindowToImageFilter.h" -// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // - -namespace Foam -{ - template<> - const char* NamedEnum - < - functionObjects::runTimePostPro::scene::modeType, - 2 - >::names[] = - { - "static", - "flightPath" - }; -} - -const Foam::NamedEnum -< - Foam::functionObjects::runTimePostPro::scene::modeType, - 2 -> modeTypeNames_; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -92,9 +70,6 @@ void Foam::functionObjects::runTimePostPro::scene::readCamera } } - - dict.lookup("parallelProjection") >> parallelProjection_; - if (nFrameTotal_ > 1) { scalar endPosition = dict.lookupOrDefault<scalar>("endPosition", 1); @@ -107,60 +82,36 @@ void Foam::functionObjects::runTimePostPro::scene::readCamera dPosition_ = (endPosition - startPosition_)/scalar(nFrameTotal_ - 1); } - mode_ = modeTypeNames_.read(dict.lookup("mode")); - - word coeffsName = modeTypeNames_[mode_] + word("Coeffs"); - const dictionary& coeffs = dict.subDict(coeffsName); + cameraPosition_ = Function1<vector>::New("position", dict); + cameraFocalPoint_ = Function1<point>::New("focalPoint", dict); + cameraUp_ = Function1<vector>::New("up", dict); - switch (mode_) + dict.readIfPresent("clipBox", clipBox_); + dict.lookup("parallelProjection") >> parallelProjection_; + if (!parallelProjection_) { - case mtStatic: + if (dict.found("viewAngle")) { - clipBox_ = boundBox(coeffs.lookup("clipBox")); - const vector lookDir(vector(coeffs.lookup("lookDir"))); - cameraPosition_.reset - ( - new Function1Types::Constant<point>("position", -lookDir) - ); - const vector focalPoint(coeffs.lookup("focalPoint")); - cameraFocalPoint_.reset - ( - new Function1Types::Constant<point>("focalPoint", focalPoint) - ); - const vector up(coeffs.lookup("up")); - cameraUp_.reset(new Function1Types::Constant<point>("up", up)); - break; + cameraViewAngle_ = Function1<scalar>::New("viewAngle", dict); } - case mtFlightPath: + else { - cameraPosition_.reset - ( - Function1<vector>::New("position", coeffs).ptr() - ); - cameraFocalPoint_.reset + cameraViewAngle_.reset ( - Function1<point>::New("focalPoint", coeffs).ptr() + new Function1Types::Constant<scalar>("viewAngle", 35.0) ); - cameraUp_.reset(Function1<vector>::New("up", coeffs).ptr()); - break; - } - default: - { - FatalErrorInFunction - << "Unhandled enumeration " << modeTypeNames_[mode_] - << abort(FatalError); } } - if (dict.found("viewAngle")) + if (dict.found("zoom")) { - cameraViewAngle_.reset(Function1<scalar>::New("viewAngle", dict).ptr()); + cameraZoom_ = Function1<scalar>::New("zoom", dict); } else { - cameraViewAngle_.reset + cameraZoom_.reset ( - new Function1Types::Constant<scalar>("viewAngle", 35.0) + new Function1Types::Constant<scalar>("zoom", 1.0) ); } } @@ -224,25 +175,11 @@ void Foam::functionObjects::runTimePostPro::scene::initialise camera->SetParallelProjection(parallelProjection_); renderer->SetActiveCamera(camera); - - // Initialise the camera - const vector up = cameraUp_->value(position_); - const vector pos = cameraPosition_->value(position_); - const point focalPoint = cameraFocalPoint_->value(position_); - - camera->SetViewUp(up.x(), up.y(), up.z()); - camera->SetPosition(pos.x(), pos.y(), pos.z()); - camera->SetFocalPoint(focalPoint.x(), focalPoint.y(), focalPoint.z()); - camera->Modified(); - - // Add the lights vtkSmartPointer<vtkLightKit> lightKit = vtkSmartPointer<vtkLightKit>::New(); lightKit->AddLightsToRenderer(renderer); - - // For static mode initialise the clip box - if (mode_ == mtStatic) + if (clipBox_ != boundBox::greatBox) { const point& min = clipBox_.min(); const point& max = clipBox_.max(); @@ -261,15 +198,10 @@ void Foam::functionObjects::runTimePostPro::scene::initialise vtkSmartPointer<vtkPolyDataMapper>::New(); clipMapper->SetInputConnection(clipBox->GetOutputPort()); - vtkSmartPointer<vtkActor> clipActor = vtkSmartPointer<vtkActor>::New(); - clipActor->SetMapper(clipMapper); - clipActor->VisibilityOff(); - renderer->AddActor(clipActor); - - // Call resetCamera to fit clip box in view - clipActor->VisibilityOn(); - renderer->ResetCamera(); - clipActor->VisibilityOff(); + clipBoxActor_ = vtkSmartPointer<vtkActor>::New(); + clipBoxActor_->SetMapper(clipMapper); + clipBoxActor_->VisibilityOff(); + renderer->AddActor(clipBoxActor_); } } @@ -279,26 +211,44 @@ void Foam::functionObjects::runTimePostPro::scene::setCamera vtkRenderer* renderer ) const { - if (mode_ == mtFlightPath) + vtkCamera* camera = renderer->GetActiveCamera(); + + if (parallelProjection_) { - const vector up = cameraUp_->value(position_); - const vector pos = cameraPosition_->value(position_); - const point focalPoint = cameraFocalPoint_->value(position_); - - vtkCamera* camera = renderer->GetActiveCamera(); - camera->SetViewUp(up.x(), up.y(), up.z()); - camera->SetPosition(pos.x(), pos.y(), pos.z()); - camera->SetFocalPoint(focalPoint.x(), focalPoint.y(), focalPoint.z()); - camera->Modified(); + // Restore parallel scale to allow application of zoom (later) + camera->SetParallelScale(1); } - - if (!parallelProjection_) + else { // Restore viewAngle (it might be reset by clipping) - vtkCamera* camera = renderer->GetActiveCamera(); camera->SetViewAngle(cameraViewAngle_->value(position_)); - camera->Modified(); } + + const vector up = cameraUp_->value(position_); + const vector pos = cameraPosition_->value(position_); + const point focalPoint = cameraFocalPoint_->value(position_); + const scalar zoom = cameraZoom_->value(position_); + + camera->SetViewUp(up.x(), up.y(), up.z()); + camera->SetPosition(pos.x(), pos.y(), pos.z()); + camera->SetFocalPoint(focalPoint.x(), focalPoint.y(), focalPoint.z()); + + + // Apply clipping if required + // Note: possible optimisation - if the camera is static, this only needs + // to be done once on initialisation + if (clipBox_ != boundBox::greatBox) + { + // Call ResetCamera() to fit clip box in view + clipBoxActor_->VisibilityOn(); + renderer->ResetCamera(); + clipBoxActor_->VisibilityOff(); + } + + // Zoom applied after all other operations + camera->Zoom(zoom); + + camera->Modified(); } @@ -323,12 +273,13 @@ Foam::functionObjects::runTimePostPro::scene::scene obr_(obr), name_(name), colours_(), - mode_(mtStatic), cameraPosition_(nullptr), cameraFocalPoint_(nullptr), cameraUp_(nullptr), cameraViewAngle_(nullptr), - clipBox_(), + cameraZoom_(nullptr), + clipBox_(boundBox::greatBox), + clipBoxActor_(), parallelProjection_(true), nFrameTotal_(1), startPosition_(0), @@ -366,7 +317,10 @@ Foam::scalar Foam::functionObjects::runTimePostPro::scene::position() const } -void Foam::functionObjects::runTimePostPro::scene::read(const dictionary& dict) +void Foam::functionObjects::runTimePostPro::scene::read +( + const dictionary& dict +) { readCamera(dict.subDict("camera")); readColours(dict.subDict("colours")); diff --git a/src/functionObjects/graphics/runTimePostProcessing/scene.H b/src/functionObjects/graphics/runTimePostProcessing/scene.H index 9fd4ab8ebc7f6ee10e5c288150d176d69e48ffab..e2f5d87e1226d88ec02a8ca140b289eee98178df 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/scene.H +++ b/src/functionObjects/graphics/runTimePostProcessing/scene.H @@ -25,6 +25,28 @@ Class Foam::functionObjects::runTimePostPro::scene Description + Class to control scene construction and provide main rendering loop + +Usage + \verbatim + camera + { + // Total number of frames to generate + nFrameTotal 1; + + // Parallel projection flag + parallelProjection no; + + focalPoint (0 0 0); + up (0 1 0); + position (0 0 1); + + // Optional entries + clipBox (-0.0206 -0.0254 -0.0005) (0.29 0.0254 0.0005); + viewAngle 20; + zoom 1.1; + } + \endverbatim SourceFiles scene.C @@ -49,6 +71,7 @@ SourceFiles // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +class vtkActor; class vtkRenderer; class vtkRenderWindow; @@ -58,22 +81,12 @@ namespace functionObjects { namespace runTimePostPro { - /*---------------------------------------------------------------------------*\ Class scene Declaration \*---------------------------------------------------------------------------*/ class scene { -public: - - enum modeType{mtStatic, mtFlightPath}; - - NamedEnum<modeType, 2> modeTypeNames_; - - -private: - // Private data //- Reference to the object registry @@ -88,7 +101,7 @@ private: //- Read camera properties void readCamera(const dictionary& dict); - //- Read solour properties + //- Read colour properties void readColours(const dictionary& dict); //- Disallow default bitwise copy construct @@ -108,9 +121,6 @@ protected: // Camera settings - //- Mode - modeType mode_; - //- Position autoPtr<Function1<point>> cameraPosition_; @@ -123,12 +133,20 @@ protected: //- View angle autoPtr<Function1<scalar>> cameraViewAngle_; + //- Zoom: 1 = do nothing, >1 = zoom in, <1 = zoom out + // - perspective mode: reduces view angle + // - parallel mode: manipulate parallel scale + autoPtr<Function1<scalar>> cameraZoom_; + // Scene management //- Clipping box boundBox clipBox_; + //- Clipping box actor + vtkSmartPointer<vtkActor> clipBoxActor_; + //- Parallel projection flag bool parallelProjection_; diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T new file mode 100644 index 0000000000000000000000000000000000000000..821c92211e6cb1ff077d9a48d3c3400ccc726802 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + inlet + { + type outletMappedUniformInletHeatAddition; + outletPatchName outlet1; + Q 5; // Heat addition in W + minTempLimit 300; + maxTempLimit 500; + value $internalField; + } + + outlet1 + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + outlet2 + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + defaultFaces + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/U b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/U new file mode 100644 index 0000000000000000000000000000000000000000..d0660ba682331fc94650ae9ede9288bc0a6d4d0c --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/U @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } + + outlet1 + { + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + + outlet2 + { + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + + defaultFaces + { + type noSlip; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/alphat b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/alphat new file mode 100644 index 0000000000000000000000000000000000000000..258a1a4dcd1df05ed15abbd40776e551f55a3f55 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/alphat @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 1e-3; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + + outlet1 + { + type calculated; + value uniform 0; + } + + outlet2 + { + type calculated; + value uniform 0; + } + + defaultFaces + { + type compressible::alphatWallFunction; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/epsilon b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..d50e8356fef4f67487ef183ffd6300a0765cebbb --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/epsilon @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 200; + +boundaryField +{ + inlet + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.01; // 1cm - half channel height + value $internalField; + } + + outlet1 + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + outlet2 + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + defaultFaces + { + type epsilonWallFunction; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/k b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/k new file mode 100644 index 0000000000000000000000000000000000000000..ba131054459d9c8f70c94f070888d0d93e520a1a --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/k @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 1; + +boundaryField +{ + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; // 5% turbulent intensity + value $internalField; + } + + outlet1 + { + type inletOutlet; + inletValue $internalField; + } + + outlet2 + { + type inletOutlet; + inletValue $internalField; + } + + defaultFaces + { + type kqRWallFunction; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/nuTilda b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/nuTilda new file mode 100644 index 0000000000000000000000000000000000000000..2cc97ce1f31ecd5acbdf16ca7f81d7b7f17ee14a --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/nuTilda @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet1 + { + type zeroGradient; + } + + outlet2 + { + type zeroGradient; + } + + defaultFaces + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/nut b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/nut new file mode 100644 index 0000000000000000000000000000000000000000..aeab4d5ca21e56de7315c4fcff6336fe86d01005 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/nut @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + + outlet1 + { + type calculated; + value uniform 0; + } + + outlet2 + { + type calculated; + value uniform 0; + } + + defaultFaces + { + type nutkWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/p b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/p new file mode 100644 index 0000000000000000000000000000000000000000..a50bfa5bfc8b0f5851f6811865271579c621ee95 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/p @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + inlet + { + type uniformTotalPressure; + gamma 1.2; + + p0 table + ( + (0 1e5) + (1 1.4e5) + ); + } + + outlet1 + { + type fixedValue; + value $internalField; + } + + outlet2 + { + type fixedValue; + value $internalField; + } + + defaultFaces + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/README.txt b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..0905f8784d3f59c9372dcbf858c093d8c4477ee7 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/README.txt @@ -0,0 +1,2 @@ +15/8/8 Simple T-junction. Inlet on left, one outlet at bottom, one at top. +To test multiple outlets. diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/constant/thermophysicalProperties b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..bc9014c4fa5ff5bca7b17c51228c2ab220e5213e --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/constant/thermophysicalProperties @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type hePsiThermo; + mixture pureMixture; + transport sutherland; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + thermodynamics + { + Cp 1007; + Hf 0; + } + transport + { + As 1.4792e-06; + Ts 116; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/constant/turbulenceProperties b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..a5a2bbf76a0d3fb215816f97fffd28bf44055500 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/constant/turbulenceProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kEpsilon; + + turbulence off; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/blockMeshDict b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..60af047d0414ddbcd35b7dc40819d9a3192b6ff6 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/blockMeshDict @@ -0,0 +1,127 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// outlet1 +// +-+ +// | | +// | | +// | | +// | | +// +-----------+ | +// |inlet | +// +-----------+ | +// | | +// | | +// | | +// | | +// +-+ +// outlet2 + +convertToMeters 1; + +vertices +( + (0.0 -0.01 0) //0 + (0.2 -0.01 0) + (0.2 0.01 0) //2 + (0.0 0.01 0) + + (0.22 -0.01 0) //4 + (0.22 0.01 0) + + (0.2 -0.21 0) //6 + (0.22 -0.21 0) + + (0.2 0.21 0) //8 + (0.22 0.21 0) + + // Z + (0.0 -0.01 0.02) //0 + (0.2 -0.01 0.02) + (0.2 0.01 0.02) //2 + (0.0 0.01 0.02) + + (0.22 -0.01 0.02) //4 + (0.22 0.01 0.02) + + (0.2 -0.21 0.02) //6 + (0.22 -0.21 0.02) + + (0.2 0.21 0.02) //8 + (0.22 0.21 0.02) + +); + +blocks +( + // inlet block + hex (0 1 2 3 10 11 12 13) (50 5 5) simpleGrading (1 1 1) + + // central block + hex (1 4 5 2 11 14 15 12) (5 5 5) simpleGrading (1 1 1) + + // bottom block + hex (6 7 4 1 16 17 14 11) (5 50 5) simpleGrading (1 1 1) + + // top block + hex (2 5 9 8 12 15 19 18) (5 50 5) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 10 13 3) + ); + } + + outlet1 + { + type patch; + faces + ( + (6 7 17 16) + ); + } + + outlet2 + { + type patch; + faces + ( + (8 18 19 9) + ); + } + + defaultFaces + { + type wall; + faces (); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/controlDict b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..1dfa50fe5cff54bc94c3ba8a892db741f32a077c --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/controlDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application rhpPimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1.0; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 3; + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/fvSchemes b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..29b92d6e082d531bba78085564c0b720e8eb647c --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/fvSchemes @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,h) Gauss limitedLinear 1; + div(phi,R) Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,K) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/fvSolution b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..360a17e88f02748ae247b57b3175c1157a0fd64e --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/system/fvSolution @@ -0,0 +1,69 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + tolerance 1e-06; + relTol 0.01; + smoother GaussSeidel; + } + + pFinal + { + solver GAMG; + tolerance 1e-06; + relTol 0; + smoother GaussSeidel; + } + + "(rho|U|k|epsilon|h)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-05; + relTol 0.1; + } + + "(rho|U|k|epsilon|h)Final" + { + $U; + tolerance 1e-05; + relTol 0; + } +} + +PIMPLE +{ + transonic no; + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + equations + { + ".*" 1; + } +} + + +// ************************************************************************* //