Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
sergio
2011-04-21 10:01:16 +01:00
17 changed files with 103 additions and 354 deletions

View File

@ -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<emptyPolyPatch>
(

View File

@ -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 * * * * * * * * * * * * * * * //

View File

@ -75,6 +75,10 @@ class Time
//- file-change monitor for all registered files
mutable autoPtr<fileMonitor> 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_;

View File

@ -131,11 +131,7 @@ bool Foam::functionEntries::codeStream::execute
// see if library is loaded
void* lib = NULL;
if
(
isA<IOdictionary>(topDict(parentDict))
&& parentDict.dictName() != Time::controlDictName
)
if (isA<IOdictionary>(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<IOdictionary>(topDict(parentDict))
&& parentDict.dictName() != Time::controlDictName
)
if (isA<IOdictionary>(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<bool>());
if
(
isA<IOdictionary>(topDict(parentDict))
&& parentDict.dictName() != Time::controlDictName
)
if (isA<IOdictionary>(topDict(parentDict)))
{
// Cached access to dl libs. Guarantees clean up upon destruction
// of Time.

View File

@ -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))

View File

@ -63,6 +63,9 @@ class dlLibraryTable
public:
// Declare name of the class and its debug switch
ClassName("dlLibraryTable");
// Constructors
//- Construct null

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -367,7 +367,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
d0,
U0,
rho0,
0.5*(mass0 + mass1),
mass0,
Su,
dUTrans,
Spu
@ -384,16 +384,18 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::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<ParcelType>::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;
}

View File

@ -389,7 +389,7 @@ void Foam::ReactingParcel<ParcelType>::calc
d0,
U0,
rho0,
0.5*(mass0 + mass1),
mass0,
Su,
dUTrans,
Spu
@ -405,9 +405,10 @@ void Foam::ReactingParcel<ParcelType>::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;
}

View File

@ -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*/

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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<volScalarField> dynMixedSmagorinsky::k() const
{
return
(
scaleSimilarity::k()
+ dynSmagorinsky::k()
);
}
tmp<volScalarField> dynMixedSmagorinsky::epsilon() const
{
return
(
scaleSimilarity::epsilon()
+ dynSmagorinsky::epsilon()
);
}
tmp<volSymmTensorField> dynMixedSmagorinsky::B() const
{
return
(
scaleSimilarity::B()
+ dynSmagorinsky::B()
);
}
tmp<volSymmTensorField> dynMixedSmagorinsky::devBeff() const
{
return
(
scaleSimilarity::devBeff()
+ dynSmagorinsky::devBeff()
);
}
tmp<fvVectorMatrix> dynMixedSmagorinsky::divDevBeff(volVectorField& U) const
{
return
(
scaleSimilarity::divDevBeff(U)
+ dynSmagorinsky::divDevBeff(U)
);
}
void dynMixedSmagorinsky::correct(const tmp<volTensorField>& 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
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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<volScalarField> k() const;
//- Return sub-grid disipation rate
tmp<volScalarField> epsilon() const;
//- Return the sub-grid stress tensor.
tmp<volSymmTensorField> B() const;
//- Return the effective sub-grid turbulence stress tensor
// including the laminar stress
tmp<volSymmTensorField> devBeff() const;
//- Returns div(B).
// This is the additional term due to the filtering of the NSE.
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read LESProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "dynSmagorinsky.H"
#include "homogeneousDynSmagorinsky.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,19 +37,25 @@ 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 +78,10 @@ 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 +106,7 @@ dimensionedScalar dynSmagorinsky::cI(const volSymmTensorField& D) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
dynSmagorinsky::dynSmagorinsky
homogeneousDynSmagorinsky::homogeneousDynSmagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
@ -135,7 +144,7 @@ dynSmagorinsky::dynSmagorinsky
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void dynSmagorinsky::correct(const tmp<volTensorField>& gradU)
void homogeneousDynSmagorinsky::correct(const tmp<volTensorField>& gradU)
{
LESModel::correct(gradU);
@ -148,7 +157,7 @@ void dynSmagorinsky::correct(const tmp<volTensorField>& gradU)
}
bool dynSmagorinsky::read()
bool homogeneousDynSmagorinsky::read()
{
if (GenEddyVisc::read())
{

View File

@ -22,10 +22,11 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
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 +56,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 +82,10 @@ namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class dynSmagorinsky Declaration
Class homogeneousDynSmagorinsky Declaration
\*---------------------------------------------------------------------------*/
class dynSmagorinsky
class homogeneousDynSmagorinsky
:
public GenEddyVisc
{
@ -103,19 +107,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 +130,7 @@ public:
//- Destructor
virtual ~dynSmagorinsky()
virtual ~homogeneousDynSmagorinsky()
{}

View File

@ -63,7 +63,7 @@ PIMPLE
"(U|k|epsilon)"
{
relTol 0;
absTol 0.0001;
tolerance 0.0001;
}
}
}