From 784e9f444de7bd80aa0ea0320bcb404c5d1e5f4b Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 20 Apr 2011 11:07:14 +0100 Subject: [PATCH 1/7] ENH: extrudeToRegionMesh: extrude into single empty patch --- .../extrude/extrudeToRegionMesh/extrudeToRegionMesh.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 16ef1e517b..46c0171e5a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1210,12 +1210,13 @@ int main(int argc, char *argv[]) << endl; label nSide = 0; + forAll(zoneSidePatch, zoneI) { if (oneD) { - // Always add empty patches, one per zone. - word patchName = faceZones[zoneI].name() + "_" + "side"; + // Reuse single empty patch. + word patchName = "oneDEmptPatch"; zoneSidePatch[zoneI] = addPatch ( From f79aeb94027c4d9e72f15f43532ef9491a3e9aef Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 20 Apr 2011 11:52:24 +0100 Subject: [PATCH 2/7] ENH: Time: construct dlLibraryTable before reading dictionary so controlDict can have e.g. #codeStream --- src/OpenFOAM/db/Time/Time.C | 18 ++++++++++---- src/OpenFOAM/db/Time/Time.H | 7 +++--- .../functionEntries/codeStream/codeStream.C | 18 +++----------- .../dlLibraryTable/dlLibraryTable.C | 24 ++++++++++++++++++- .../dlLibraryTable/dlLibraryTable.H | 3 +++ 5 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index d276de95ce..8e509a738b 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -228,6 +228,8 @@ Foam::Time::Time objectRegistry(*this), + libs_(), + controlDict_ ( IOobject @@ -257,9 +259,10 @@ Foam::Time::Time graphFormat_("raw"), runTimeModifiable_(true), - libs_(controlDict_, "libs"), functionObjects_(*this) { + libs_.open(controlDict_, "libs"); + // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). readOpt() = IOobject::MUST_READ_IF_MODIFIED; @@ -313,6 +316,8 @@ Foam::Time::Time objectRegistry(*this), + libs_(), + controlDict_ ( IOobject @@ -343,9 +348,11 @@ Foam::Time::Time graphFormat_("raw"), runTimeModifiable_(true), - libs_(controlDict_, "libs"), functionObjects_(*this) { + libs_.open(controlDict_, "libs"); + + // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). readOpt() = IOobject::MUST_READ_IF_MODIFIED; @@ -401,6 +408,8 @@ Foam::Time::Time objectRegistry(*this), + libs_(), + controlDict_ ( IOobject @@ -430,9 +439,10 @@ Foam::Time::Time graphFormat_("raw"), runTimeModifiable_(true), - libs_(controlDict_, "libs"), functionObjects_(*this) -{} +{ + libs_.open(controlDict_, "libs"); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 28ff775a68..b9da549895 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -75,6 +75,10 @@ class Time //- file-change monitor for all registered files mutable autoPtr monitorPtr_; + //- Any loaded dynamic libraries. Make sure to construct before + // reading controlDict. + dlLibraryTable libs_; + //- The controlDict IOdictionary controlDict_; @@ -166,9 +170,6 @@ private: //- Is runtime modification of dictionaries allowed? Switch runTimeModifiable_; - //- Any loaded dynamic libraries - dlLibraryTable libs_; - //- Function objects executed at start and on ++, += mutable functionObjectList functionObjects_; diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index e0a1bbbdd4..8eefcb86d9 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -131,11 +131,7 @@ bool Foam::functionEntries::codeStream::execute // see if library is loaded void* lib = NULL; - if - ( - isA(topDict(parentDict)) - && parentDict.dictName() != Time::controlDictName - ) + if (isA(topDict(parentDict))) { lib = libs(parentDict).findLibrary(libPath); } @@ -150,11 +146,7 @@ bool Foam::functionEntries::codeStream::execute // avoid compilation if possible by loading an existing library if (!lib) { - if - ( - isA(topDict(parentDict)) - && parentDict.dictName() != Time::controlDictName - ) + if (isA(topDict(parentDict))) { // Cached access to dl libs. Guarantees clean up upon destruction // of Time. @@ -223,11 +215,7 @@ bool Foam::functionEntries::codeStream::execute // all processes must wait for compile to finish reduce(create, orOp()); - if - ( - isA(topDict(parentDict)) - && parentDict.dictName() != Time::controlDictName - ) + if (isA(topDict(parentDict))) { // Cached access to dl libs. Guarantees clean up upon destruction // of Time. diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index deca23890d..93d934a1b5 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -25,6 +25,12 @@ License #include "dlLibraryTable.H" #include "OSspecific.H" +#include "long.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::dlLibraryTable, 0); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -55,7 +61,11 @@ Foam::dlLibraryTable::~dlLibraryTable() // bug in dlclose - does not call static destructors of // loaded library when actually unloading the library. // See https://bugzilla.novell.com/show_bug.cgi?id=680125 and 657627. - // Seems related to using a non-system compiler! + if (debug) + { + Info<< "dlLibraryTable::~dlLibraryTable() : closing " << iter() + << " with handle " << long(iter.key()) << endl; + } dlClose(iter.key()); } } @@ -73,6 +83,12 @@ bool Foam::dlLibraryTable::open { void* functionLibPtr = dlOpen(functionLibName); + if (debug) + { + Info<< "dlLibraryTable::open : opened " << functionLibName + << " resulting in handle " << long(functionLibPtr) << endl; + } + if (!functionLibPtr) { if (verbose) @@ -107,6 +123,12 @@ bool Foam::dlLibraryTable::close void* libPtr = findLibrary(functionLibName); if (libPtr) { + if (debug) + { + Info<< "dlLibraryTable::close : closing " << functionLibName + << " with handle " << long(libPtr) << endl; + } + erase(libPtr); if (!dlClose(libPtr)) diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H index c3388907d1..f2925fe511 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H @@ -63,6 +63,9 @@ class dlLibraryTable public: + // Declare name of the class and its debug switch + ClassName("dlLibraryTable"); + // Constructors //- Construct null From 237326e29f4f29d44840ea780c1fa9dcccf493ef Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Apr 2011 12:54:35 +0100 Subject: [PATCH 3/7] ENH: Further updating of cloud coupling terms from commit fd09412 --- .../ReactingMultiphaseParcel.C | 14 +++++++++----- .../Templates/ReactingParcel/ReactingParcel.C | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 5972bd73ae..664fac9781 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -367,7 +367,7 @@ void Foam::ReactingMultiphaseParcel::calc d0, U0, rho0, - 0.5*(mass0 + mass1), + mass0, Su, dUTrans, Spu @@ -384,16 +384,18 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassGas[i]; label gid = composition.localToGlobalCarrierId(GAS, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } forAll(YLiquid_, i) { scalar dm = np0*dMassLiquid[i]; label gid = composition.localToGlobalCarrierId(LIQ, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } /* @@ -402,16 +404,18 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassSolid[i]; label gid = composition.localToGlobalCarrierId(SLD, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } */ forAll(dMassSRCarrier, i) { scalar dm = np0*dMassSRCarrier[i]; - scalar hs = composition.carrier().Hs(i, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(i, T0); td.cloud().rhoTrans(i)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index c330254867..7133014464 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -389,7 +389,7 @@ void Foam::ReactingParcel::calc d0, U0, rho0, - 0.5*(mass0 + mass1), + mass0, Su, dUTrans, Spu @@ -405,9 +405,10 @@ void Foam::ReactingParcel::calc { scalar dm = np0*dMass[i]; label gid = composition.localToGlobalCarrierId(0, i); - scalar hs = composition.carrier().Hs(gid, 0.5*(T0 + T1)); + scalar hs = composition.carrier().Hs(gid, T0); td.cloud().rhoTrans(gid)[cellI] += dm; + td.cloud().UTrans()[cellI] += dm*U0; td.cloud().hsTrans()[cellI] += dm*hs; } From 335da20074348d7c0181b23dc2dc9d68f0cce4af Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Apr 2011 12:59:08 +0100 Subject: [PATCH 4/7] ENH: changed absTol->tolerance for consistency with solvers --- .../general/solutionControl/pimpleControl/pimpleControl.C | 2 +- .../general/solutionControl/simpleControl/simpleControl.C | 4 ++-- .../general/solutionControl/solutionControl/solutionControl.C | 2 +- .../rhoPimpleFoam/ras/angledDuct/system/fvSolution | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C index cd5d46c824..3402992f46 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C @@ -137,7 +137,7 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh) { Info<< " field " << residualControl_[i].name << token::TAB << ": relTol " << residualControl_[i].relTol - << ", absTol " << residualControl_[i].absTol + << ", tolerance " << residualControl_[i].absTol << nl; } Info<< endl; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C index b0cb59e927..e6104de03d 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C @@ -68,7 +68,7 @@ bool Foam::simpleControl::criteriaSatisfied() { Info<< algorithmName_ << " solution statistics:" << endl; - Info<< " " << variableName << ": abs tol = " << residual + Info<< " " << variableName << ": tolerance = " << residual << " (" << residualControl_[fieldI].absTol << ")" << endl; } @@ -96,7 +96,7 @@ Foam::simpleControl::simpleControl(fvMesh& mesh) forAll(residualControl_, i) { Info<< " field " << residualControl_[i].name << token::TAB - << " absTol " << residualControl_[i].absTol + << " tolerance " << residualControl_[i].absTol << nl; } Info<< endl; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index 55fa22435b..e68c6a2d4d 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -68,7 +68,7 @@ void Foam::solutionControl::read(const bool absTolOnly) if (iter().isDict()) { const dictionary& fieldDict(iter().dict()); - fd.absTol = readScalar(fieldDict.lookup("absTol")); + fd.absTol = readScalar(fieldDict.lookup("tolerance")); fd.relTol = readScalar(fieldDict.lookup("relTol")); fd.initialResidual = 0.0; } diff --git a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution index 5fdb36dac6..e39ae484a2 100644 --- a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution +++ b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution @@ -63,7 +63,7 @@ PIMPLE "(U|k|epsilon)" { relTol 0; - absTol 0.0001; + tolerance 0.0001; } } } From 119f1fdc625fd72cdacebb9dccff906a7363dabb Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2011 18:30:45 +0100 Subject: [PATCH 5/7] dynSmagorinsky renamed homogeneousDynSmagorinsky to avoid the continuing confusion about this model --- .../incompressible/LES/Make/files | 3 +- .../dynMixedSmagorinsky/dynMixedSmagorinsky.C | 143 ----------------- .../dynMixedSmagorinsky/dynMixedSmagorinsky.H | 150 ------------------ .../homogeneousDynSmagorinsky.C} | 18 +-- .../homogeneousDynSmagorinsky.H} | 27 ++-- 5 files changed, 25 insertions(+), 316 deletions(-) delete mode 100644 src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C delete mode 100644 src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H rename src/turbulenceModels/incompressible/LES/{dynSmagorinsky/dynSmagorinsky.C => homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C} (86%) rename src/turbulenceModels/incompressible/LES/{dynSmagorinsky/dynSmagorinsky.H => homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H} (84%) diff --git a/src/turbulenceModels/incompressible/LES/Make/files b/src/turbulenceModels/incompressible/LES/Make/files index 70c95e3b59..02a58fff0b 100644 --- a/src/turbulenceModels/incompressible/LES/Make/files +++ b/src/turbulenceModels/incompressible/LES/Make/files @@ -15,7 +15,7 @@ oneEqEddy/oneEqEddy.C dynOneEqEddy/dynOneEqEddy.C locDynOneEqEddy/locDynOneEqEddy.C Smagorinsky/Smagorinsky.C -dynSmagorinsky/dynSmagorinsky.C +homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C LRRDiffStress/LRRDiffStress.C DeardorffDiffStress/DeardorffDiffStress.C spectEddyVisc/spectEddyVisc.C @@ -23,7 +23,6 @@ dynLagrangian/dynLagrangian.C scaleSimilarity/scaleSimilarity.C mixedSmagorinsky/mixedSmagorinsky.C -dynMixedSmagorinsky/dynMixedSmagorinsky.C /*Smagorinsky2/Smagorinsky2.C*/ diff --git a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C b/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C deleted file mode 100644 index 02ef17b44f..0000000000 --- a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.C +++ /dev/null @@ -1,143 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 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 . - -\*---------------------------------------------------------------------------*/ - -#include "dynMixedSmagorinsky.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace LESModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(dynMixedSmagorinsky, 0); -addToRunTimeSelectionTable(LESModel, dynMixedSmagorinsky, dictionary); - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -dynMixedSmagorinsky::dynMixedSmagorinsky -( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport, - const word& turbulenceModelName, - const word& modelName -) -: - LESModel(modelName, U, phi, transport, turbulenceModelName), - scaleSimilarity(U, phi, transport), - dynSmagorinsky(U, phi, transport) -{ - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp dynMixedSmagorinsky::k() const -{ - return - ( - scaleSimilarity::k() - + dynSmagorinsky::k() - ); -} - - -tmp dynMixedSmagorinsky::epsilon() const -{ - return - ( - scaleSimilarity::epsilon() - + dynSmagorinsky::epsilon() - ); -} - - -tmp dynMixedSmagorinsky::B() const -{ - return - ( - scaleSimilarity::B() - + dynSmagorinsky::B() - ); -} - - -tmp dynMixedSmagorinsky::devBeff() const -{ - return - ( - scaleSimilarity::devBeff() - + dynSmagorinsky::devBeff() - ); -} - - -tmp dynMixedSmagorinsky::divDevBeff(volVectorField& U) const -{ - return - ( - scaleSimilarity::divDevBeff(U) - + dynSmagorinsky::divDevBeff(U) - ); -} - - -void dynMixedSmagorinsky::correct(const tmp& gradU) -{ - scaleSimilarity::correct(gradU); - dynSmagorinsky::correct(gradU()); -} - - -bool dynMixedSmagorinsky::read() -{ - if (LESModel::read()) - { - scaleSimilarity::read(); - dynSmagorinsky::read(); - - return true; - } - else - { - return false; - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H b/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H deleted file mode 100644 index 8083ef6660..0000000000 --- a/src/turbulenceModels/incompressible/LES/dynMixedSmagorinsky/dynMixedSmagorinsky.H +++ /dev/null @@ -1,150 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 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 . - -Class - Foam::incompressible::LESModels::dynMixedSmagorinsky - -Description - The Mixed Isochoric Smagorinsky Model for incompressible flows. - - The mixed model is a linear combination of an eddy viscosity model - with a scale similarity model. - \verbatim - B = (L + C) + R = (F(v*v) - F(v)*F(v)) + R - \endverbatim - - The algebraic eddy viscosity SGS model is founded on the assumption - that local equilibrium prevails, hence - \verbatim - R = 2/3*rho*k*I - 2*nuEff*dev(D) - where - k = cI*delta^2*||D||^2 - nuEff = ck*sqrt(k)*delta + nu - \endverbatim - - The Leonard and cross contributions are incorporated - by adding, - \verbatim - + div(((filter(U*U) - filter(U)*filter(U)) - - 0.333*I*tr(filter(U*U) - filter(U)*filter(U)))) - + div((filter(U*epsilon) - filter(U)*filter(epsilon))) - \endverbatim - to the rhs. of the equations. This version implements filtering to - evaluate the coefficients in the model. - -SourceFiles - dynMixedSmagorinsky.C - -\*---------------------------------------------------------------------------*/ - -#ifndef dynMixedSmagorinsky_H -#define dynMixedSmagorinsky_H - -#include "dynSmagorinsky.H" -#include "scaleSimilarity.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace LESModels -{ - -/*---------------------------------------------------------------------------*\ - Class dynMixedSmagorinsky Declaration -\*---------------------------------------------------------------------------*/ - -class dynMixedSmagorinsky -: - public scaleSimilarity, - public dynSmagorinsky -{ - // Private Member Functions - - // Disallow default bitwise copy construct and assignment - dynMixedSmagorinsky(const dynMixedSmagorinsky&); - dynMixedSmagorinsky& operator=(const dynMixedSmagorinsky&); - -public: - - //- Runtime type information - TypeName("dynMixedSmagorinsky"); - - // Constructors - - //- Constructors from components - dynMixedSmagorinsky - ( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport, - const word& turbulenceModelName = turbulenceModel::typeName, - const word& modelName = typeName - ); - - - //- Destructor - ~dynMixedSmagorinsky() - {} - - - // Member Functions - - //- Return SGS kinetic energy - tmp k() const; - - //- Return sub-grid disipation rate - tmp epsilon() const; - - //- Return the sub-grid stress tensor. - tmp B() const; - - //- Return the effective sub-grid turbulence stress tensor - // including the laminar stress - tmp devBeff() const; - - //- Returns div(B). - // This is the additional term due to the filtering of the NSE. - tmp divDevBeff(volVectorField& U) const; - - //- Correct Eddy-Viscosity and related properties - void correct(const tmp& gradU); - - //- Read LESProperties dictionary - bool read(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C similarity index 86% rename from src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C rename to src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C index e43781200f..a6d6d19280 100644 --- a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "dynSmagorinsky.H" +#include "homogeneousDynSmagorinsky.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,19 +37,19 @@ namespace LESModels // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(dynSmagorinsky, 0); -addToRunTimeSelectionTable(LESModel, dynSmagorinsky, dictionary); +defineTypeNameAndDebug(homogeneousDynSmagorinsky, 0); +addToRunTimeSelectionTable(LESModel, homogeneousDynSmagorinsky, dictionary); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void dynSmagorinsky::updateSubGridScaleFields(const volSymmTensorField& D) +void homogeneousDynSmagorinsky::updateSubGridScaleFields(const volSymmTensorField& D) { nuSgs_ = cD(D)*sqr(delta())*sqrt(magSqr(D)); nuSgs_.correctBoundaryConditions(); } -dimensionedScalar dynSmagorinsky::cD(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cD(const volSymmTensorField& D) const { const volSymmTensorField MM ( @@ -72,7 +72,7 @@ dimensionedScalar dynSmagorinsky::cD(const volSymmTensorField& D) const } -dimensionedScalar dynSmagorinsky::cI(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cI(const volSymmTensorField& D) const { const volScalarField mm ( @@ -97,7 +97,7 @@ dimensionedScalar dynSmagorinsky::cI(const volSymmTensorField& D) const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -dynSmagorinsky::dynSmagorinsky +homogeneousDynSmagorinsky::homogeneousDynSmagorinsky ( const volVectorField& U, const surfaceScalarField& phi, @@ -135,7 +135,7 @@ dynSmagorinsky::dynSmagorinsky // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void dynSmagorinsky::correct(const tmp& gradU) +void homogeneousDynSmagorinsky::correct(const tmp& gradU) { LESModel::correct(gradU); @@ -148,7 +148,7 @@ void dynSmagorinsky::correct(const tmp& gradU) } -bool dynSmagorinsky::read() +bool homogeneousDynSmagorinsky::read() { if (GenEddyVisc::read()) { diff --git a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.H b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H similarity index 84% rename from src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.H rename to src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H index 8415cfefee..2ce757e6c3 100644 --- a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.H +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H @@ -22,10 +22,10 @@ License along with OpenFOAM. If not, see . Class - Foam::incompressible::LESModels::dynSmagorinsky + Foam::incompressible::LESModels::homogeneousDynSmagorinsky Description - The Isochoric dynamic Smagorinsky Model for incompressible flows. + The Isochoric homogeneous dynamic Smagorinsky Model for incompressible flows. Algebraic eddy viscosity SGS model founded on the assumption that local equilibrium prevails. @@ -55,15 +55,18 @@ Description m = delta^2*(4*||F(D)||^2 - F(||D||^2)) L = dev(F(U*U) - F(U)*F(U)) M = delta^2*(F(||D||*dev(D)) - 4*||F(D)||*F(dev(D))) + + The averaging <...> is over the whole domain, i.e. homogeneous turbulence + is assumed \endverbatim SourceFiles - dynSmagorinsky.C + homogeneousDynSmagorinsky.C \*---------------------------------------------------------------------------*/ -#ifndef dynSmagorinsky_H -#define dynSmagorinsky_H +#ifndef homogeneousDynSmagorinsky_H +#define homogeneousDynSmagorinsky_H #include "Smagorinsky.H" #include "LESfilter.H" @@ -78,10 +81,10 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class dynSmagorinsky Declaration + Class homogeneousDynSmagorinsky Declaration \*---------------------------------------------------------------------------*/ -class dynSmagorinsky +class homogeneousDynSmagorinsky : public GenEddyVisc { @@ -103,19 +106,19 @@ class dynSmagorinsky dimensionedScalar cI(const volSymmTensorField& D) const; // Disallow default bitwise copy construct and assignment - dynSmagorinsky(const dynSmagorinsky&); - dynSmagorinsky& operator=(const dynSmagorinsky&); + homogeneousDynSmagorinsky(const homogeneousDynSmagorinsky&); + homogeneousDynSmagorinsky& operator=(const homogeneousDynSmagorinsky&); public: //- Runtime type information - TypeName("dynSmagorinsky"); + TypeName("homogeneousDynSmagorinsky"); // Constructors //- Construct from components - dynSmagorinsky + homogeneousDynSmagorinsky ( const volVectorField& U, const surfaceScalarField& phi, @@ -126,7 +129,7 @@ public: //- Destructor - virtual ~dynSmagorinsky() + virtual ~homogeneousDynSmagorinsky() {} From 53cb06171b08985d9419dbce72af9ca5e2906ce6 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2011 18:31:49 +0100 Subject: [PATCH 6/7] Updated header --- .../LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C index a6d6d19280..322df227dd 100644 --- a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 38189883de0d240a043b633486aae53baaca0db3 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2011 18:33:39 +0100 Subject: [PATCH 7/7] Corrected line lengths --- .../homogeneousDynSmagorinsky.C | 15 ++++++++++++--- .../homogeneousDynSmagorinsky.H | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C index 322df227dd..e62de890f9 100644 --- a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.C @@ -42,14 +42,20 @@ addToRunTimeSelectionTable(LESModel, homogeneousDynSmagorinsky, dictionary); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void homogeneousDynSmagorinsky::updateSubGridScaleFields(const volSymmTensorField& D) +void homogeneousDynSmagorinsky::updateSubGridScaleFields +( + const volSymmTensorField& D +) { nuSgs_ = cD(D)*sqr(delta())*sqrt(magSqr(D)); nuSgs_.correctBoundaryConditions(); } -dimensionedScalar homogeneousDynSmagorinsky::cD(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cD +( + const volSymmTensorField& D +) const { const volSymmTensorField MM ( @@ -72,7 +78,10 @@ dimensionedScalar homogeneousDynSmagorinsky::cD(const volSymmTensorField& D) con } -dimensionedScalar homogeneousDynSmagorinsky::cI(const volSymmTensorField& D) const +dimensionedScalar homogeneousDynSmagorinsky::cI +( + const volSymmTensorField& D +) const { const volScalarField mm ( diff --git a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H index 2ce757e6c3..2a25f48fe0 100644 --- a/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H +++ b/src/turbulenceModels/incompressible/LES/homogeneousDynSmagorinsky/homogeneousDynSmagorinsky.H @@ -25,7 +25,8 @@ Class Foam::incompressible::LESModels::homogeneousDynSmagorinsky Description - The Isochoric homogeneous dynamic Smagorinsky Model for incompressible flows. + The Isochoric homogeneous dynamic Smagorinsky Model for + incompressible flows. Algebraic eddy viscosity SGS model founded on the assumption that local equilibrium prevails.