Commit 423df61f authored by sergio's avatar sergio
Browse files
parents a038c90f 38189883
......@@ -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>
(
......
......@@ -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 * * * * * * * * * * * * * * * //
......
......@@ -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_;
......
......@@ -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.
......
......@@ -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))
......
......@@ -63,6 +63,9 @@ class dlLibraryTable
public:
// Declare name of the class and its debug switch
ClassName("dlLibraryTable");
// Constructors
//- Construct null
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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*/
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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.