Creation of OpenFOAM-dev repository 15/04/2008

This commit is contained in:
OpenFOAM-admin
2008-04-15 18:56:58 +01:00
commit 3170c7c0c9
9896 changed files with 4016171 additions and 0 deletions

47
src/Allwmake Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
set -x
( cd $FOAM_SRC/other && ./Allwmake )
( cd $FOAM_SRC/OpenFOAM && wmakeLnInclude . )
( cd Pstream && ./Allwmake )
wmake libo OSspecific/$WM_OS
wmake libso OpenFOAM
wmake libso lagrangian/basic
wmake libso triSurface
wmake libso edgeMesh
wmake libso meshTools
wmake libso finiteVolume
( cd MGridGenGamgAgglomeration && ./Allwmake )
wmake libso sampling
wmake libso dynamicMesh
wmake libso dynamicFvMesh
wmake libso topoChangerFvMesh
wmake libso fvMotionSolver
wmake libso engine
wmake libso ODE
wmake libso randomProcesses
( cd thermophysicalModels && ./Allwmake )
( cd transportModels && ./Allwmake )
( cd turbulenceModels && ./Allwmake )
( cd LESmodels && ./Allwmake )
( cd lagrangian && ./Allwmake )
( cd postProcessing && ./Allwmake )
wmake libso errorEstimation
# ----------------------------------------------------------------- end-of-file

8
src/LESmodels/Allwmake Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
set -x
wmake libso LESfilters
wmakeLnInclude incompressible
wmake libso LESdeltas
wmake libso incompressible
wmake libso compressible

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESdelta.H"
#include "calculatedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(LESdelta, 0);
defineRunTimeSelectionTable(LESdelta, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
LESdelta::LESdelta(const word& name, const fvMesh& mesh)
:
mesh_(mesh),
delta_
(
IOobject
(
name,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(name, dimLength, SMALL),
calculatedFvPatchScalarField::typeName
)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESdelta
Description
Abstract base class for LES deltas
SourceFiles
LESdelta.C
newDelta.C
\*---------------------------------------------------------------------------*/
#ifndef LESdelta_H
#define LESdelta_H
#include "volFields.H"
#include "typeInfo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class LESdelta Declaration
\*---------------------------------------------------------------------------*/
class LESdelta
{
protected:
// Protected data
const fvMesh& mesh_;
volScalarField delta_;
private:
// Private Member Functions
// Disallow default bitwise copy construct and assignment
LESdelta(const LESdelta&);
void operator=(const LESdelta&);
public:
//- Runtime type information
TypeName("LESdelta");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
LESdelta,
dictionary,
(
const word& name,
const fvMesh& mesh,
const dictionary& LESdeltaDict
),
(name, mesh, LESdeltaDict)
);
// Constructors
//- Construct from name and mesh
LESdelta(const word& name, const fvMesh& mesh);
// Selectors
//- Return a reference to the selected LES delta
static autoPtr<LESdelta> New
(
const word& name,
const fvMesh& mesh,
const dictionary& LESdeltaDict
);
// Destructor
virtual ~LESdelta()
{}
// Member Functions
//- Return mesh reference
const fvMesh& mesh() const
{
return mesh_;
}
//- Read the LESdelta dictionary
virtual void read(const dictionary&) = 0;
// Correct values
virtual void correct() = 0;
// Member Operators
virtual operator const volScalarField&() const
{
return delta_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<LESdelta> LESdelta::New
(
const word& name,
const fvMesh& mesh,
const dictionary& LESdeltaDict
)
{
word LESdeltaType
(
LESdeltaDict.lookup("delta")
);
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(LESdeltaType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESdelta::New(const fvMesh& mesh, dictionary LESdeltaDict)"
) << "Unknown LESdelta type " << LESdeltaType << endl << endl
<< "Valid LESdelta types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESdelta>(cstrIter()(name, mesh, LESdeltaDict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,7 @@
LESdelta/LESdelta.C
LESdelta/newDelta.C
cubeRootVolDelta/cubeRootVolDelta.C
PrandtlDelta/PrandtlDelta.C
smoothDelta/smoothDelta.C
LIB = $(FOAM_LIBBIN)/libLESdeltas

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/LESmodels/isoLESmodels/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,104 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "PrandtlDelta.H"
#include "wallDist.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(PrandtlDelta, 0);
addToRunTimeSelectionTable(LESdelta, PrandtlDelta, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void PrandtlDelta::calcDelta()
{
delta_ = min
(
static_cast<const volScalarField&>(geometricDelta_()),
(kappa_/Cdelta_)*wallDist(mesh_).y()
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
PrandtlDelta::PrandtlDelta
(
const word& name,
const fvMesh& mesh,
const dictionary& dd
)
:
LESdelta(name, mesh),
geometricDelta_(LESdelta::New(name, mesh, dd.subDict(type() + "Coeffs"))),
kappa_(dimensionedScalar(dd.lookup("kappa")).value()),
Cdelta_
(
dimensionedScalar(dd.subDict(type() + "Coeffs").lookup("Cdelta"))
.value()
)
{
calcDelta();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void PrandtlDelta::read(const dictionary& d)
{
const dictionary& dd(d.subDict(type() + "Coeffs"));
geometricDelta_().read(dd);
kappa_ = dimensionedScalar(d.lookup("kappa")).value();
Cdelta_ = dimensionedScalar(dd.lookup("Cdelta")).value();
calcDelta();
}
void PrandtlDelta::correct()
{
geometricDelta_().correct();
if (mesh_.changing())
{
calcDelta();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::PrandtlDelta
Description
Simple cube-root of cell volume delta used in LES models.
SourceFiles
PrandtlDelta.C
\*---------------------------------------------------------------------------*/
#ifndef PrandtlDelta_H
#define PrandtlDelta_H
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class PrandtlDelta Declaration
\*---------------------------------------------------------------------------*/
class PrandtlDelta
:
public LESdelta
{
// Private data
autoPtr<LESdelta> geometricDelta_;
scalar kappa_;
scalar Cdelta_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
PrandtlDelta(const PrandtlDelta&);
void operator=(const PrandtlDelta&);
// Calculate the delta values
void calcDelta();
public:
//- Runtime type information
TypeName("Prandtl");
// Constructors
//- Construct from name, mesh and IOdictionary
PrandtlDelta
(
const word& name,
const fvMesh& mesh,
const dictionary&
);
// Destructor
~PrandtlDelta()
{}
// Member Functions
//- Read the LESdelta dictionary
void read(const dictionary&);
// Correct values
void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "cubeRootVolDelta.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(cubeRootVolDelta, 0);
addToRunTimeSelectionTable(LESdelta, cubeRootVolDelta, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void cubeRootVolDelta::calcDelta()
{
const Vector<label>& directions = mesh().directions();
label nD = (directions.nComponents + cmptSum(directions))/2;
if (nD == 3)
{
delta_.internalField() = deltaCoeff_*pow(mesh().V(), 1.0/3.0);
}
else if (nD == 2)
{
WarningIn("cubeRootVolDelta::calcDelta()")
<< "Case is 2D, LES is not strictly applicable\n"
<< endl;
scalar thickness = 0.0;
for (direction dir=0; dir<directions.nComponents; dir++)
{
if (directions[dir] == -1)
{
boundBox bb(mesh().points(), false);
thickness = (bb.max() - bb.min())[dir];
}
}
delta_.internalField() = deltaCoeff_*sqrt(mesh().V()/thickness);
}
else
{
FatalErrorIn("cubeRootVolDelta::calcDelta()")
<< "Case is not 3D or 2D, LES is not applicable"
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cubeRootVolDelta::cubeRootVolDelta
(
const word& name,
const fvMesh& mesh,
const dictionary& dd
)
:
LESdelta(name, mesh),
deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff")))
{
calcDelta();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void cubeRootVolDelta::read(const dictionary& dd)
{
dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
calcDelta();
}
void cubeRootVolDelta::correct()
{
if (mesh_.changing())
{
calcDelta();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cubeRootVolDelta
Description
Simple cube-root of cell volume delta used in LES models.
SourceFiles
cubeRootVolDelta.C
\*---------------------------------------------------------------------------*/
#ifndef cubeRootVolDelta_H
#define cubeRootVolDelta_H
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cubeRootVolDelta Declaration
\*---------------------------------------------------------------------------*/
class cubeRootVolDelta
:
public LESdelta
{
// Private data
scalar deltaCoeff_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
cubeRootVolDelta(const cubeRootVolDelta&);
void operator=(const cubeRootVolDelta&);
// Calculate the delta values
void calcDelta();
public:
//- Runtime type information
TypeName("cubeRootVol");
// Constructors
//- Construct from name, mesh and IOdictionary
cubeRootVolDelta
(
const word& name,
const fvMesh& mesh,
const dictionary&
);
// Destructor
~cubeRootVolDelta()
{}
// Member Functions
//- Read the LESdelta dictionary
void read(const dictionary&);
// Correct values
void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "smoothDelta.H"
#include "addToRunTimeSelectionTable.H"
#include "FaceCellWave.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(smoothDelta, 0);
addToRunTimeSelectionTable(LESdelta, smoothDelta, dictionary);
scalar smoothDelta::deltaData::maxDeltaRatio = 1.2;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Fill changedFaces (with face labels) and changedFacesInfo (with delta)
// This is the initial set of faces from which to start the waves.
// Since there might be lots of places with delta jumps we can follow various
// strategies for this initial 'seed'.
// - start from single cell/face and let FaceCellWave pick up all others
// from there. might be quite a few waves before everything settles.
// - start from all faces. Lots of initial transfers.
// We do something inbetween:
// - start from all faces where there is a jump. Since we cannot easily
// determine this across coupled patches (cyclic, processor) introduce
// all faces of these and let FaceCellWave sort it out.
void smoothDelta::setChangedFaces
(
const polyMesh& mesh,
const volScalarField& delta,
DynamicList<label>& changedFaces,
DynamicList<deltaData>& changedFacesInfo
)
{
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
scalar ownDelta = delta[mesh.faceOwner()[faceI]];
scalar neiDelta = delta[mesh.faceNeighbour()[faceI]];
// Check if owner delta much larger than neighbour delta or vice versa
if (ownDelta > deltaData::maxDeltaRatio * neiDelta)
{
changedFaces.append(faceI);
changedFacesInfo.append(deltaData(ownDelta));
}
else if (neiDelta > deltaData::maxDeltaRatio * ownDelta)
{
changedFaces.append(faceI);
changedFacesInfo.append(deltaData(neiDelta));
}
}
// Insert all faces of coupled patches no matter what. Let FaceCellWave
// sort it out.
forAll(mesh.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh.boundaryMesh()[patchI];
if (patch.coupled())
{
forAll(patch, patchFaceI)
{
label meshFaceI = patch.start() + patchFaceI;
scalar ownDelta = delta[mesh.faceOwner()[meshFaceI]];
changedFaces.append(meshFaceI);
changedFacesInfo.append(deltaData(ownDelta));
}
}
}
changedFaces.shrink();
changedFacesInfo.shrink();
}
void smoothDelta::calcDelta()
{
deltaData::maxDeltaRatio = maxDeltaRatio_;
const volScalarField& geometricDelta = geometricDelta_();
// Fill changed faces with info
DynamicList<label> changedFaces(mesh_.nFaces()/100 + 100);
DynamicList<deltaData> changedFacesInfo(changedFaces.size());
setChangedFaces(mesh_, geometricDelta, changedFaces, changedFacesInfo);
// Set initial field on cells.
List<deltaData> cellDeltaData(mesh_.nCells());
forAll(geometricDelta, cellI)
{
cellDeltaData[cellI] = geometricDelta[cellI];
}
// Set initial field on faces.
List<deltaData> faceDeltaData(mesh_.nFaces());
// Propagate information over whole domain.
FaceCellWave<deltaData> deltaCalc
(
mesh_,
changedFaces,
changedFacesInfo,
faceDeltaData,
cellDeltaData,
mesh_.nCells() // max iterations
);
forAll(delta_, cellI)
{
delta_[cellI] = cellDeltaData[cellI].delta();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
smoothDelta::smoothDelta
(
const word& name,
const fvMesh& mesh,
const dictionary& dd
)
:
LESdelta(name, mesh),
geometricDelta_
(
LESdelta::New("geometricDelta", mesh, dd.subDict(type() + "Coeffs"))
),
maxDeltaRatio_
(
readScalar(dd.subDict(type() + "Coeffs").lookup("maxDeltaRatio"))
)
{
calcDelta();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void smoothDelta::read(const dictionary& d)
{
const dictionary& dd(d.subDict(type() + "Coeffs"));
geometricDelta_().read(dd);
dd.lookup("maxDeltaRatio") >> maxDeltaRatio_;
calcDelta();
}
void smoothDelta::correct()
{
geometricDelta_().correct();
if (mesh_.changing())
{
calcDelta();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,264 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::smoothDelta
Description
Smoothed delta which takes a given simple geometric delta and applies
smoothing to it such that the ratio of deltas between two cells is no
larger than a specified amount, typically 1.15.
SourceFiles
smoothDelta.C
\*---------------------------------------------------------------------------*/
#ifndef smoothDelta_H
#define smoothDelta_H
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class smoothDelta Declaration
\*---------------------------------------------------------------------------*/
class smoothDelta
:
public LESdelta
{
// Private data
autoPtr<LESdelta> geometricDelta_;
scalar maxDeltaRatio_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
smoothDelta(const smoothDelta&);
void operator=(const smoothDelta&);
// Calculate the delta values
void calcDelta();
//- Private member class used by mesh-wave to propagate the delta-ratio
class deltaData
{
scalar delta_;
// Private Member Functions
//- Update. Gets information from neighbouring face/cell and
// uses this to update itself (if nessecary) and return true.
inline bool update
(
const deltaData& w2,
const scalar scale,
const scalar tol
);
public:
// Static data members
//- delta fraction
static scalar maxDeltaRatio;
// Constructors
//- Construct null
inline deltaData();
//- Construct from origin, yStar, distance
inline deltaData(const scalar delta);
// Member Functions
// Access
scalar delta() const
{
return delta_;
}
// Needed by FaceCellWave
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
inline bool valid() const;
//- Check for identical geometrical data.
// Used for cyclics checking.
inline bool sameGeometry
(
const polyMesh&,
const deltaData&,
const scalar
) const;
//- Convert any absolute coordinates into relative to
// (patch)face centre
inline void leaveDomain
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const point& faceCentre
);
//- Reverse of leaveDomain
inline void enterDomain
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const point& faceCentre
);
//- Apply rotation matrix to any coordinates
inline void transform
(
const polyMesh&,
const tensor&
);
//- Influence of neighbouring face.
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const deltaData& neighbourInfo,
const scalar tol
);
//- Influence of neighbouring cell.
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const deltaData& neighbourInfo,
const scalar tol
);
//- Influence of different value on same face.
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const deltaData& neighbourInfo,
const scalar tol
);
// Member Operators
// Needed for List IO
inline bool operator==(const deltaData&) const;
inline bool operator!=(const deltaData&) const;
// IOstream Operators
friend Ostream& operator<<
(
Ostream& os,
const deltaData& wDist
)
{
return os << wDist.delta_;
}
friend Istream& operator>>(Istream& is, deltaData& wDist)
{
return is >> wDist.delta_;
}
};
void setChangedFaces
(
const polyMesh& mesh,
const volScalarField& delta,
DynamicList<label>& changedFaces,
DynamicList<deltaData>& changedFacesInfo
);
public:
//- Runtime type information
TypeName("smooth");
// Constructors
//- Construct from name, mesh and IOdictionary
smoothDelta
(
const word& name,
const fvMesh& mesh,
const dictionary&
);
// Destructor
~smoothDelta()
{}
// Member Functions
//- Read the LESdelta dictionary
void read(const dictionary&);
// Correct values
void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "smoothDeltaDeltaDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Update this with w2 if applicable
inline bool smoothDelta::deltaData::update
(
const smoothDelta::deltaData& w2,
const scalar scale,
const scalar tol
)
{
if (!valid() || (delta_ < VSMALL))
{
// My delta not set. Take over neighbour.
delta_ = w2.delta()/scale;
// Something changed. Let caller know.
return true;
}
else if (w2.delta() > (1 + tol)*scale*delta_)
{
// Neighbour is too big for me. Up my delta.
delta_ = w2.delta()/scale;
// Something changed. Let caller know.
return true;
}
else
{
// Neighbour is not too big for me or change is too small
// Nothing changed.
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline smoothDelta::deltaData::deltaData()
:
delta_(-GREAT)
{}
// Construct from components
inline smoothDelta::deltaData::deltaData(const scalar delta)
:
delta_(delta)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool smoothDelta::deltaData::valid() const
{
return delta_ > -SMALL;
}
// Checks for cyclic faces
inline bool smoothDelta::deltaData::sameGeometry
(
const polyMesh&,
const deltaData&,
const scalar
) const
{
return true;
}
inline void smoothDelta::deltaData::leaveDomain
(
const polyMesh&,
const polyPatch&,
const label,
const point&
)
{}
inline void smoothDelta::deltaData::transform
(
const polyMesh&,
const tensor&
)
{}
// Update absolute geometric quantities.
inline void smoothDelta::deltaData::enterDomain
(
const polyMesh&,
const polyPatch&,
const label,
const point&
)
{}
// Update this (cellI) with face information.
inline bool smoothDelta::deltaData::updateCell
(
const polyMesh&,
const label,
const label,
const deltaData& neighbourWallInfo,
const scalar tol
)
{
// Take over info from face if more than deltaRatio larger.
return update(neighbourWallInfo, maxDeltaRatio, tol);
}
// Update this (face) with cell information.
inline bool smoothDelta::deltaData::updateFace
(
const polyMesh&,
const label,
const label,
const deltaData& neighbourWallInfo,
const scalar tol
)
{
// Take over information from cell without any scaling (scale = 1.0)
return update(neighbourWallInfo, 1.0, tol);
}
// Update this (face) with coupled face information.
inline bool smoothDelta::deltaData::updateFace
(
const polyMesh&,
const label,
const deltaData& neighbourWallInfo,
const scalar tol
)
{
// Take over information from coupled face without any scaling (scale = 1.0)
return update(neighbourWallInfo, 1.0, tol);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool smoothDelta::deltaData::operator==
(
const deltaData& rhs
) const
{
return delta_ == rhs.delta();
}
inline bool smoothDelta::deltaData::operator!=
(
const deltaData& rhs
) const
{
return !(*this == rhs);
}
// ************************************************************************* //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(LESfilter, 0);
defineRunTimeSelectionTable(LESfilter, dictionary);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESfilter
Description
Abstract class for LES filters
SourceFiles
LESfilter.C
newFilter.C
\*---------------------------------------------------------------------------*/
#ifndef LESfilter_H
#define LESfilter_H
#include "volFields.H"
#include "typeInfo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class LESfilter Declaration
\*---------------------------------------------------------------------------*/
class LESfilter
{
// Private data
const fvMesh& mesh_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
LESfilter(const LESfilter&);
void operator=(const LESfilter&);
public:
//- Runtime type information
TypeName("LESfilter");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
LESfilter,
dictionary,
(
const fvMesh& mesh,
const dictionary& LESfilterDict
),
(mesh, LESfilterDict)
);
// Constructors
//- Construct from components
LESfilter(const fvMesh& mesh)
:
mesh_(mesh)
{}
// Selectors
//- Return a reference to the selected LES filter
static autoPtr<LESfilter> New
(
const fvMesh& mesh,
const dictionary& LESfilterDict
);
// Destructor
virtual ~LESfilter()
{}
// Member Functions
//- Return mesh reference
const fvMesh& mesh() const
{
return mesh_;
}
//- Read the LESfilter dictionary
virtual void read(const dictionary&) = 0;
// Member Operators
virtual tmp<volScalarField> operator()
(
const tmp<volScalarField>&
) const = 0;
virtual tmp<volVectorField> operator()
(
const tmp<volVectorField>&
) const = 0;
virtual tmp<volSymmTensorField> operator()
(
const tmp<volSymmTensorField>&
) const = 0;
virtual tmp<volTensorField> operator()
(
const tmp<volTensorField>&
) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<LESfilter> LESfilter::New
(
const fvMesh& mesh,
const dictionary& LESfilterDict
)
{
word LESfilterType
(
LESfilterDict.lookup("filter")
);
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(LESfilterType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESfilter::New(const fvMesh& mesh, dictionary LESfilterDict)"
) << "Unknown LESfilter type " << LESfilterType << endl << endl
<< "Valid LESfilter types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESfilter>(cstrIter()(mesh, LESfilterDict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,7 @@
LESfilter/LESfilter.C
LESfilter/newFilter.C
simpleFilter/simpleFilter.C
laplaceFilter/laplaceFilter.C
anisotropicFilter/anisotropicFilter.C
LIB = $(FOAM_LIBBIN)/libLESfilters

View File

@ -0,0 +1,4 @@
EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume

View File

@ -0,0 +1,236 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "anisotropicFilter.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
#include "wallFvPatch.H"
#include "fvc.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(anisotropicFilter, 0);
addToRunTimeSelectionTable(LESfilter, anisotropicFilter, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::anisotropicFilter::anisotropicFilter
(
const fvMesh& mesh,
scalar widthCoeff
)
:
LESfilter(mesh),
widthCoeff_(widthCoeff),
coeff_
(
IOobject
(
"anisotropicFilterCoeff",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedVector("zero", dimLength*dimLength, vector::zero),
calculatedFvPatchVectorField::typeName
)
{
for (direction d=0; d<vector::nComponents; d++)
{
coeff_.internalField().replace
(
d,
(2.0/widthCoeff_)*mesh.V()
/fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
);
}
}
Foam::anisotropicFilter::anisotropicFilter
(
const fvMesh& mesh,
const dictionary& bd
)
:
LESfilter(mesh),
widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))),
coeff_
(
IOobject
(
"anisotropicFilterCoeff",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedVector("zero", dimLength*dimLength, vector::zero),
calculatedFvPatchScalarField::typeName
)
{
for (direction d=0; d<vector::nComponents; d++)
{
coeff_.internalField().replace
(
d,
(2.0/widthCoeff_)*mesh.V()
/fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::anisotropicFilter::read(const dictionary& bd)
{
bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::anisotropicFilter::operator()
(
const tmp<volScalarField>& unFilteredField
) const
{
tmp<volScalarField> tmpFilteredField =
unFilteredField
+ (
coeff_
& fvc::surfaceIntegrate
(
mesh().Sf()
*fvc::snGrad(unFilteredField())
)
);
unFilteredField.clear();
return tmpFilteredField;
}
Foam::tmp<Foam::volVectorField> Foam::anisotropicFilter::operator()
(
const tmp<volVectorField>& unFilteredField
) const
{
tmp<volVectorField> tmpFilteredField =
unFilteredField
+ (
coeff_
& fvc::surfaceIntegrate
(
mesh().Sf()
*fvc::snGrad(unFilteredField())
)
);
unFilteredField.clear();
return tmpFilteredField;
}
Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator()
(
const tmp<volSymmTensorField>& unFilteredField
) const
{
tmp<volSymmTensorField> tmpFilteredField
(
new volSymmTensorField
(
IOobject
(
"anisotropicFilteredSymmTensorField",
mesh().time().timeName(),
mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh(),
unFilteredField().dimensions()
)
);
for (direction d=0; d<symmTensor::nComponents; d++)
{
tmpFilteredField().replace
(
d, anisotropicFilter::operator()(unFilteredField().component(d))
);
}
unFilteredField.clear();
return tmpFilteredField;
}
Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator()
(
const tmp<volTensorField>& unFilteredField
) const
{
tmp<volTensorField> tmpFilteredField
(
new volTensorField
(
IOobject
(
"anisotropicFilteredTensorField",
mesh().time().timeName(),
mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh(),
unFilteredField().dimensions()
)
);
for (direction d=0; d<tensor::nComponents; d++)
{
tmpFilteredField().replace
(
d, anisotropicFilter::operator()(unFilteredField().component(d))
);
}
unFilteredField.clear();
return tmpFilteredField;
}
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::anisotropicFilter
Description
anisotropic filter
@verbatim
Kernel as filter as Test filter with ratio 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Box filter: g = delta2/24 -> g = delta2/6
Spherical box filter: g = delta2/64 -> g = delta2/16
Gaussian filter: g = delta2/24 -> g = delta2/6
@endverbatim
SourceFiles
anisotropicFilter.C
\*---------------------------------------------------------------------------*/
#ifndef anisotropicFilter_H
#define anisotropicFilter_H
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class anisotropicFilter Declaration
\*---------------------------------------------------------------------------*/
class anisotropicFilter
:
public LESfilter
{
// Private data
scalar widthCoeff_;
volVectorField coeff_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
anisotropicFilter(const anisotropicFilter&);
void operator=(const anisotropicFilter&);
public:
//- Runtime type information
TypeName("anisotropic");
// Constructors
//- from components
anisotropicFilter(const fvMesh& mesh, scalar widthCoeff);
//- from IOdictionary
anisotropicFilter(const fvMesh& mesh, const dictionary&);
// Destructor
~anisotropicFilter()
{}
// Member Functions
//- Read the LESfilter dictionary
void read(const dictionary&);
// Member Operators
tmp<volScalarField> operator()(const tmp<volScalarField>&) const;
tmp<volVectorField> operator()(const tmp<volVectorField>&) const;
tmp<volSymmTensorField> operator()
(
const tmp<volSymmTensorField>&
) const;
tmp<volTensorField> operator()(const tmp<volTensorField>&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "laplaceFilter.H"
#include "addToRunTimeSelectionTable.H"
#include "calculatedFvPatchFields.H"
#include "fvm.H"
#include "fvc.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(laplaceFilter, 0);
addToRunTimeSelectionTable(LESfilter, laplaceFilter, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff)
:
LESfilter(mesh),
widthCoeff_(widthCoeff),
coeff_
(
IOobject
(
"anisotropicFilterCoeff",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar("zero", dimLength*dimLength, 0),
calculatedFvPatchScalarField::typeName
)
{
coeff_.internalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
}
Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd)
:
LESfilter(mesh),
widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))),
coeff_
(
IOobject
(
"anisotropicFilterCoeff",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar("zero", dimLength*dimLength, 0),
calculatedFvPatchScalarField::typeName
)
{
coeff_.internalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::laplaceFilter::read(const dictionary& bd)
{
bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::laplaceFilter::operator()
(
const tmp<volScalarField>& unFilteredField
) const
{
tmp<volScalarField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
unFilteredField.clear();
return filteredField;
}
Foam::tmp<Foam::volVectorField> Foam::laplaceFilter::operator()
(
const tmp<volVectorField>& unFilteredField
) const
{
tmp<volVectorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
unFilteredField.clear();
return filteredField;
}
Foam::tmp<Foam::volSymmTensorField> Foam::laplaceFilter::operator()
(
const tmp<volSymmTensorField>& unFilteredField
) const
{
tmp<volSymmTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
unFilteredField.clear();
return filteredField;
}
Foam::tmp<Foam::volTensorField> Foam::laplaceFilter::operator()
(
const tmp<volTensorField>& unFilteredField
) const
{
tmp<volTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
unFilteredField.clear();
return filteredField;
}
// ************************************************************************* //

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::laplaceFilter
Description
Laplace filter for LES
@verbatim
Kernel as filter as Test filter with ratio 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Box filter: g = delta2/24 -> g = delta2/6
Spherical box filter: g = delta2/64 -> g = delta2/16
Gaussian filter: g = delta2/24 -> g = delta2/6
@endverbatim
SourceFiles
laplaceFilter.C
\*---------------------------------------------------------------------------*/
#ifndef laplaceFilter_H
#define laplaceFilter_H
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class laplaceFilter Declaration
\*---------------------------------------------------------------------------*/
class laplaceFilter
:
public LESfilter
{
// Private data
scalar widthCoeff_;
volScalarField coeff_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
laplaceFilter(const laplaceFilter&);
void operator=(const laplaceFilter&);
public:
//- Runtime type information
TypeName("laplace");
// Constructors
//- from components
laplaceFilter(const fvMesh& mesh, scalar widthCoeff);
//- from IOdictionary
laplaceFilter(const fvMesh& mesh, const dictionary&);
// Destructor
~laplaceFilter()
{}
// Member Functions
//- Read the LESfilter dictionary
void read(const dictionary&);
// Member Operators
tmp<volScalarField> operator()(const tmp<volScalarField>&) const;
tmp<volVectorField> operator()(const tmp<volVectorField>&) const;
tmp<volSymmTensorField> operator()
(
const tmp<volSymmTensorField>&
) const;
tmp<volTensorField> operator()(const tmp<volTensorField>&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "simpleFilter.H"
#include "addToRunTimeSelectionTable.H"
#include "fvc.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(simpleFilter, 0);
addToRunTimeSelectionTable(LESfilter, simpleFilter, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::simpleFilter::simpleFilter
(
const fvMesh& mesh
)
:
LESfilter(mesh)
{}
Foam::simpleFilter::simpleFilter(const fvMesh& mesh, const dictionary&)
:
LESfilter(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::simpleFilter::read(const dictionary&)
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::simpleFilter::operator()
(
const tmp<volScalarField>& unFilteredField
) const
{
tmp<volScalarField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf());
unFilteredField.clear();
return filteredField;
}
Foam::tmp<Foam::volVectorField> Foam::simpleFilter::operator()
(
const tmp<volVectorField>& unFilteredField
) const
{
tmp<volVectorField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf());
unFilteredField.clear();
return filteredField;
}
Foam::tmp<Foam::volSymmTensorField> Foam::simpleFilter::operator()
(
const tmp<volSymmTensorField>& unFilteredField
) const
{
tmp<volSymmTensorField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf());
unFilteredField.clear();
return filteredField;
}
Foam::tmp<Foam::volTensorField> Foam::simpleFilter::operator()
(
const tmp<volTensorField>& unFilteredField
) const
{
tmp<volTensorField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf());
unFilteredField.clear();
return filteredField;
}
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::simpleFilter
Description
Simple top-hat filter used in dynamic LES models.
Implemented as a surface integral of the face interpolate of the field.
SourceFiles
simpleFilter.C
\*---------------------------------------------------------------------------*/
#ifndef simpleFilter_H
#define simpleFilter_H
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class simpleFilter Declaration
\*---------------------------------------------------------------------------*/
class simpleFilter
:
public LESfilter
{
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
simpleFilter(const simpleFilter&);
void operator=(const simpleFilter&);
public:
//- Runtime type information
TypeName("simple");
// Constructors
//- from components
simpleFilter(const fvMesh& mesh);
//- from IOdictionary
simpleFilter(const fvMesh& mesh, const dictionary&);
// Destructor
~simpleFilter()
{}
// Member Functions
//- Read the LESfilter dictionary
void read(const dictionary&);
// Member Operators
tmp<volScalarField> operator()(const tmp<volScalarField>&) const;
tmp<volVectorField> operator()(const tmp<volVectorField>&) const;
tmp<volSymmTensorField> operator()
(
const tmp<volSymmTensorField>&
) const;
tmp<volTensorField> operator()(const tmp<volTensorField>&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DeardorffDiffStress.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(DeardorffDiffStress, 0);
addToRunTimeSelectionTable(LESmodel, DeardorffDiffStress, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
DeardorffDiffStress::DeardorffDiffStress
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel(typeName, rho, U, phi, thermoPhysicalModel),
GenSGSStress(rho, U, phi, thermoPhysicalModel),
ck_(LESmodelProperties().lookup("ck")),
cm_(LESmodelProperties().lookup("cm"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
GenSGSStress::correct(gradU);
volSymmTensorField D = symm(gradU);
volSymmTensorField P = -rho()*twoSymm(B_ & gradU);
volScalarField K = 0.5*tr(B_);
solve
(
fvm::ddt(rho(), B_)
+ fvm::div(phi(), B_)
- fvm::laplacian(DBEff(), B_)
+ fvm::Sp(cm_*rho()*sqrt(K)/delta(), B_)
==
P
+ 0.8*rho()*K*D
- (2*ce_ - 0.667*cm_)*I*rho()*epsilon()
);
// Bounding the component kinetic energies
forAll(B_, celli)
{
B_[celli].component(symmTensor::XX) =
max(B_[celli].component(symmTensor::XX), 1.0e-10);
B_[celli].component(symmTensor::YY) =
max(B_[celli].component(symmTensor::YY), 1.0e-10);
B_[celli].component(symmTensor::ZZ) =
max(B_[celli].component(symmTensor::ZZ), 1.0e-10);
}
K = 0.5*tr(B_);
bound(K, k0());
muSgs_ = ck_*rho()*sqrt(K)*delta();
muSgs_.correctBoundaryConditions();
}
bool DeardorffDiffStress::read()
{
if (GenSGSStress::read())
{
LESmodelProperties().lookup("ck") >> ck_;
LESmodelProperties().lookup("cm") >> cm_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::DeardorffDiffStress
Description
Differential SGS Stress Equation Model for compressible flows
The DSEM uses a model version of the full balance equation for the SGS
stress tensor to simulate the behaviour of B.
Thus,
@verbatim
d/dt(rho*B) + div(rho*U*B) - div(muSgs*grad(B))
=
P - c1*rho*epsilon/k*B - 0.667*(1 - c1)*rho*epsilon*I - c2*(P - 0.333*trP*I)
where
k = 0.5*trB,
epsilon = ce*k^3/2/delta,
epsilon/k = ce*k^1/2/delta
P = -rho*(B'L + L'B)
muSgs = ck*rho*sqrt(k)*delta
muEff = muSgs + mu
@endverbatim
SourceFiles
DeardorffDiffStress.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleDeardorffDiffStress_H
#define compressibleDeardorffDiffStress_H
#include "GenSGSStress.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class DeardorffDiffStress Declaration
\*---------------------------------------------------------------------------*/
class DeardorffDiffStress
:
public GenSGSStress
{
// Private data
dimensionedScalar ck_;
dimensionedScalar cm_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
DeardorffDiffStress(const DeardorffDiffStress&);
DeardorffDiffStress& operator=(const DeardorffDiffStress&);
public:
//- Runtime type information
TypeName("DeardorffDiffStress");
// Constructors
//- Constructor from components
DeardorffDiffStress
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
~DeardorffDiffStress()
{}
// Member Functions
//- Return the effective diffusivity for B
tmp<volScalarField> DBEff() const
{
return tmp<volScalarField>
(
new volScalarField("DBEff", muSgs_ + mu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
GenEddyVisc::GenEddyVisc
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel
(
word("GenEddyVisc"), rho, U, phi, thermoPhysicalModel
),
ce_(LESmodelProperties().lookup("ce")),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
muSgs_
(
IOobject
(
"muSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> GenEddyVisc::B() const
{
return ((2.0/3.0)*I)*k_ - (muSgs_/rho())*dev(twoSymm(fvc::grad(U())));
}
tmp<volSymmTensorField> GenEddyVisc::devRhoBeff() const
{
return -muEff()*dev(twoSymm(fvc::grad(U())));
}
tmp<fvVectorMatrix> GenEddyVisc::divDevRhoBeff(volVectorField& U) const
{
return
(
- fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
);
}
void GenEddyVisc::correct(const tmp<volTensorField>& gradU)
{
LESmodel::correct(gradU);
}
bool GenEddyVisc::read()
{
if (LESmodel::read())
{
LESmodelProperties().lookup("ce") >> ce_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::GenEddyVisc
Description
General base class for all compressible models that can be implemented as
an eddy viscosity, i.e. algebraic and one-equation models.
Contains fields for k (SGS turbulent kinetic energy), gamma
(modelled viscosity) and epsilon (SGS dissipation).
SourceFiles
GenEddyVisc.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleGenEddyVisc_H
#define compressibleGenEddyVisc_H
#include "LESmodel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class GenEddyVisc Declaration
\*---------------------------------------------------------------------------*/
class GenEddyVisc
:
virtual public LESmodel
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
GenEddyVisc(const GenEddyVisc&);
GenEddyVisc& operator=(const GenEddyVisc&);
protected:
dimensionedScalar ce_;
volScalarField k_;
volScalarField muSgs_;
public:
// Constructors
//- Construct from components
GenEddyVisc
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
virtual ~GenEddyVisc()
{}
// Member Functions
//- Return SGS kinetic energy
virtual tmp<volScalarField> k() const
{
return k_;
}
//- Return sub-grid disipation rate
virtual tmp<volScalarField> epsilon() const
{
return ce_*k_*sqrt(k_)/delta();
}
//- Return viscosity
virtual tmp<volScalarField> muSgs() const
{
return muSgs_;
}
//- Return thermal conductivity
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", muSgs_ + alpha())
);
}
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoBeff() const;
//- Returns div(rho*dev(B)).
// This is the additional term due to the filtering of the NSE.
virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "GenSGSStress.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
GenSGSStress::GenSGSStress
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel
(
word("GenSGSStress"),
rho,
U,
phi,
thermoPhysicalModel
),
ce_(LESmodelProperties().lookup("ce")),
B_
(
IOobject
(
"B",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
muSgs_
(
IOobject
(
"muSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> GenSGSStress::devRhoBeff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho()*B_ - mu()*dev(twoSymm(fvc::grad(U())))
)
);
}
tmp<fvVectorMatrix> GenSGSStress::divDevRhoBeff(volVectorField& U) const
{
return
(
fvc::div(rho()*B_ + 0.05*muSgs_*fvc::grad(U))
+ fvc::laplacian(0.95*muSgs_, U, "laplacian(muEff,U)")
- fvm::laplacian(muEff(), U)
- fvc::div(mu()*dev2(fvc::grad(U)().T()))
);
}
void GenSGSStress::correct(const tmp<volTensorField>& gradU)
{
LESmodel::correct(gradU);
}
bool GenSGSStress::read()
{
if (LESmodel::read())
{
LESmodelProperties().lookup("ce") >> ce_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::GenSGSStress
Description
General base class for all compressible models that directly
solve for the SGS stress tensor B.
Contains tensor fields B (the SGS stress tensor) as well as scalar
fields for k (SGS turbulent energy) gamma (SGS viscosity) and epsilon
(SGS dissipation).
SourceFiles
GenSGSStress.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleGenSGSStress_H
#define compressibleGenSGSStress_H
#include "LESmodel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class GenSGSStress Declaration
\*---------------------------------------------------------------------------*/
class GenSGSStress
:
virtual public LESmodel
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
GenSGSStress(const GenSGSStress&);
GenSGSStress& operator=(const GenSGSStress&);
protected:
dimensionedScalar ce_;
volSymmTensorField B_;
volScalarField muSgs_;
public:
// Constructors
//- Constructor from components
GenSGSStress
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
virtual ~GenSGSStress()
{}
// Member Functions
//- Return the SGS turbulent kinetic energy.
virtual tmp<volScalarField> k() const
{
return 0.5*tr(B_);
}
//- Return the SGS turbulent dissipation.
virtual tmp<volScalarField> epsilon() const
{
volScalarField K = k();
return ce_*K*sqrt(K)/delta();
}
//- Return the SGS viscosity.
virtual tmp<volScalarField> muSgs() const
{
return muSgs_;
}
//- Return thermal conductivity
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", muSgs_ + alpha())
);
}
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const
{
return B_;
}
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoBeff() const;
//- Returns divergence of B : i.e. the additional term in the
// filtered NSE.
virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESmodel.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(LESmodel, 0);
defineRunTimeSelectionTable(LESmodel, dictionary);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
LESmodel::LESmodel
(
const word& type,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
IOdictionary
(
IOobject
(
"turbulenceProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
runTime_(U.time()),
mesh_(U.mesh()),
rho_(rho),
U_(U),
phi_(phi),
thermoPhysicalModel_(thermoPhysicalModel),
LESmodelProperties_(subDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this))
{
if (found("k0"))
{
lookup("k0") >> k0_;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void LESmodel::correct(const tmp<volTensorField>&)
{
delta_().correct();
}
void LESmodel::correct()
{
correct(fvc::grad(U_));
}
bool LESmodel::read()
{
if (regIOobject::read())
{
LESmodelProperties_ = subDict(type() + "Coeffs");
delta_().read(*this);
if (found("k0"))
{
lookup("k0") >> k0_;
}
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,284 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::compressible::LESmodels
Description
Namespace for compressible LES models.
Class
Foam::compressible::LESmodel
Description
Class for all compressible flow LES SGS models.
This class defines the basic interface for a compressible flow SGS model,
and encapsulates data of value to all possible models. In particular
this includes references to all the dependent fields (rho, U, phi),
the physical viscosity mu, and the turbulenceProperties dictionary
which contains the model selection and model coefficients.
SourceFiles
LESmodel.C
newLESmodel.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleLESmodel_H
#define compressibleLESmodel_H
#include "LESdelta.H"
#include "fvm.H"
#include "fvc.H"
#include "fvMatrices.H"
#include "basicThermo.H"
#include "bound.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class LESmodel Declaration
\*---------------------------------------------------------------------------*/
class LESmodel
:
public IOdictionary
{
protected:
// Protected data
const Time& runTime_;
const fvMesh& mesh_;
private:
// Private data
const volScalarField& rho_;
const volVectorField& U_;
const surfaceScalarField& phi_;
const basicThermo& thermoPhysicalModel_;
dictionary LESmodelProperties_;
dimensionedScalar k0_;
autoPtr<LESdelta> delta_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
LESmodel(const LESmodel&);
LESmodel& operator=(const LESmodel&);
public:
//- Runtime type information
TypeName("LESmodel");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
LESmodel,
dictionary,
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
),
(rho, U, phi, thermoPhysicalModel)
);
// Constructors
//- Construct from components
LESmodel
(
const word& type,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Selectors
//- Return a reference to the selected LES model
static autoPtr<LESmodel> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
virtual ~LESmodel()
{}
// Member Functions
// Access
//- Access function to the density field
inline const volScalarField& rho() const
{
return rho_;
}
//- Access function to velocity field
inline const volVectorField& U() const
{
return U_;
}
//- Access function to flux field
inline const surfaceScalarField& phi() const
{
return phi_;
}
//- Access function to the thermophysical properties model
inline const basicThermo& thermo() const
{
return thermoPhysicalModel_;
}
//- Access the dictionary which provides info. about choice of
// models, and all related data (particularly model coefficients).
inline const dictionary& LESmodelProperties()
{
return LESmodelProperties_;
}
//- Access function to filter width
inline const volScalarField& delta() const
{
return delta_();
}
//- Return the value of k0 which k is not allowed to be less than
const dimensionedScalar& k0() const
{
return k0_;
}
//- Allow k0 to be changed
dimensionedScalar& k0()
{
return k0_;
}
//- Access function to laminar viscosity
tmp<volScalarField> mu() const
{
return thermoPhysicalModel_.mu();
}
//- Access function to laminar thermal conductivity
tmp<volScalarField> alpha() const
{
return thermoPhysicalModel_.alpha();
}
//- Return the SGS turbulent kinetic energy.
virtual tmp<volScalarField> k() const = 0;
//- Return the SGS turbulent dissipation.
virtual tmp<volScalarField> epsilon() const = 0;
//- Return the effective viscosity
virtual tmp<volScalarField> muSgs() const = 0;
//- Return the effective viscosity
virtual tmp<volScalarField> muEff() const
{
return tmp<volScalarField>
(
new volScalarField("muEff", muSgs() + mu())
);
}
//- Return the SGS thermal conductivity.
virtual tmp<volScalarField> alphaEff() const = 0;
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const = 0;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoBeff() const = 0;
//- Returns div(rho*dev(B)).
// This is the additional term due to the filtering of the NSE.
virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const = 0;
//- Correct Eddy-Viscosity and related properties.
// This calls correct(const tmp<volTensorField>& gradU) by supplying
// gradU calculated locally.
void correct();
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
virtual bool read() = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESmodel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<LESmodel> LESmodel::New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
{
word LESmodelTypeName;
// Enclose the creation of the turbulencePropertiesDict to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary turbulencePropertiesDict
(
IOobject
(
"turbulenceProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
turbulencePropertiesDict.lookup("LESmodel") >> LESmodelTypeName;
}
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(LESmodelTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESmodel::New(const volVectorField& U, const "
"surfaceScalarField& phi, const basicThermo&)"
) << "Unknown LESmodel type " << LESmodelTypeName
<< endl << endl
<< "Valid LESmodel types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESmodel>(cstrIter()(rho, U, phi, thermoPhysicalModel));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,15 @@
wallFunc/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C
LESmodel/LESmodel.C
LESmodel/newLESmodel.C
GenEddyVisc/GenEddyVisc.C
GenSGSStress/GenSGSStress.C
Smagorinsky/Smagorinsky.C
oneEqEddy/oneEqEddy.C
lowReOneEqEddy/lowReOneEqEddy.C
dynOneEqEddy/dynOneEqEddy.C
DeardorffDiffStress/DeardorffDiffStress.C
SpalartAllmaras/SpalartAllmaras.C
LIB = $(FOAM_LIBBIN)/libcompressibleLESmodels

View File

@ -0,0 +1,11 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \
-I$(LIB_SRC)/LESmodels/LESfilters/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
LIB_LIBS = \
-lLESdeltas \
-lLESfilters \
-lmeshTools

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "Smagorinsky.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Smagorinsky, 0);
addToRunTimeSelectionTable(LESmodel, Smagorinsky, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
Smagorinsky::Smagorinsky
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel(typeName, rho, U, phi, thermoPhysicalModel),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_(LESmodelProperties().lookup("ck"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Smagorinsky::correct(const tmp<volTensorField>& gradU)
{
GenEddyVisc::correct(gradU);
volSymmTensorField D = symm(gradU);
volScalarField a = ce_/delta();
volScalarField b = (2.0/3.0)*tr(D);
volScalarField c = 2*ck_*delta()*(dev(D) && D);
k_ = sqr((2*b + sqrt(sqr(b) + 4*a*c))/(2*a));
muSgs_ = ck_*rho()*delta()*sqrt(k_);
muSgs_.correctBoundaryConditions();
}
bool Smagorinsky::read()
{
if (GenEddyVisc::read())
{
LESmodelProperties().lookup("ck") >> ck_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::Smagorinsky
Description
The choric Smagorinsky Model for compressible flows.
Algebraic eddy viscosity SGS model founded on the assumption that
local equilibrium prevails.
Thus,
@verbatim
B = 2/3*k*I - 2*nuSgs*dev(D)
where
D = symm(grad(U));
k = (2*ck/ce)*delta^2*grad(U):dev(D)
nuSgs = ck*sqrt(k)*delta
@endverbatim
SourceFiles
Smagorinsky.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleSmagorinsky_H
#define compressibleSmagorinsky_H
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class Smagorinsky Declaration
\*---------------------------------------------------------------------------*/
class Smagorinsky
:
public GenEddyVisc
{
// Private data
dimensionedScalar ck_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
Smagorinsky(const Smagorinsky&);
Smagorinsky& operator=(const Smagorinsky&);
public:
//- Runtime type information
TypeName("Smagorinsky");
// Constructors
//- Construct from components
Smagorinsky
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
~Smagorinsky()
{}
// Member Functions
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "SpalartAllmaras.H"
#include "addToRunTimeSelectionTable.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(SpalartAllmaras, 0);
addToRunTimeSelectionTable(LESmodel, SpalartAllmaras, dictionary);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
tmp<volScalarField> SpalartAllmaras::fv1() const
{
volScalarField chi3 = pow3(nuTilda_/(mu()/rho()));
return chi3/(chi3 + pow3(Cv1_));
}
tmp<volScalarField> SpalartAllmaras::fv2() const
{
volScalarField chi = nuTilda_/(mu()/rho());
//return scalar(1) - chi/(scalar(1) + chi*fv1());
return 1.0/pow3(scalar(1) + chi/Cv2_);
}
tmp<volScalarField> SpalartAllmaras::fv3() const
{
volScalarField chi = nuTilda_/(mu()/rho());
volScalarField chiByCv2 = (1/Cv2_)*chi;
return
(scalar(1) + chi*fv1())
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
}
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
{
volScalarField r = min
(
nuTilda_
/(
max(Stilda, dimensionedScalar("SMALL", Stilda.dimensions(), SMALL))
*sqr(kappa_*dTilda_)
),
scalar(10.0)
);
r.boundaryField() == 0.0;
volScalarField g = r + Cw2_*(pow6(r) - r);
return g*pow((1.0 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
SpalartAllmaras::SpalartAllmaras
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel(typeName, rho, U, phi, thermoPhysicalModel),
alphaNut_(LESmodelProperties().lookup("alphaNut")),
Cb1_(LESmodelProperties().lookup("Cb1")),
Cb2_(LESmodelProperties().lookup("Cb2")),
Cv1_(LESmodelProperties().lookup("Cv1")),
Cv2_(LESmodelProperties().lookup("Cv2")),
CDES_(LESmodelProperties().lookup("CDES")),
ck_(LESmodelProperties().lookup("ck")),
kappa_(lookup("kappa")),
Cw1_(Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_)),
Cw2_(LESmodelProperties().lookup("Cw2")),
Cw3_(LESmodelProperties().lookup("Cw3")),
nuTilda_
(
IOobject
(
"nuTilda",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
dTilda_(min(CDES_*delta(), wallDist(mesh_).y())),
muSgs_
(
IOobject
(
"muSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> SpalartAllmaras::B() const
{
return ((2.0/3.0)*I)*k() - (muSgs_/rho())*dev(twoSymm(fvc::grad(U())));
}
tmp<volSymmTensorField> SpalartAllmaras::devRhoBeff() const
{
return -muEff()*dev(twoSymm(fvc::grad(U())));
}
tmp<volScalarField> SpalartAllmaras::epsilon() const
{
return 2*muEff()/rho()*magSqr(symm(fvc::grad(U())));
}
tmp<fvVectorMatrix> SpalartAllmaras::divDevRhoBeff(volVectorField& U) const
{
return
(
- fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
);
}
void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
LESmodel::correct(gradU);
if (mesh_.changing())
{
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
}
volScalarField Stilda =
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
solve
(
fvm::ddt(rho(), nuTilda_)
+ fvm::div(phi(), nuTilda_)
- fvm::laplacian
(
alphaNut_*(nuTilda_*rho() + mu()),
nuTilda_,
"laplacian(DnuTildaEff,nuTilda)"
)
- alphaNut_*rho()*Cb2_*magSqr(fvc::grad(nuTilda_))
==
rho()*Cb1_*Stilda*nuTilda_
- fvm::Sp(rho()*Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_)
);
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions();
muSgs_.internalField() = rho()*fv1()*nuTilda_.internalField();
muSgs_.correctBoundaryConditions();
}
bool SpalartAllmaras::read()
{
if (LESmodel::read())
{
LESmodelProperties().lookup("alphaNut") >> alphaNut_;
LESmodelProperties().lookup("Cb1") >> Cb1_;
LESmodelProperties().lookup("Cb2") >> Cb2_;
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
LESmodelProperties().lookup("Cw2") >> Cw2_;
LESmodelProperties().lookup("Cw3") >> Cw3_;
LESmodelProperties().lookup("Cv1") >> Cv1_;
LESmodelProperties().lookup("Cv2") >> Cv2_;
LESmodelProperties().lookup("CDES") >> CDES_;
LESmodelProperties().lookup("ck") >> ck_;
lookup("kappa") >> kappa_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::SpalartAllmaras
Description
SpalartAllmaras for compressible flows
SourceFiles
SpalartAllmaras.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleSpalartAllmaras_H
#define compressibleSpalartAllmaras_H
#include "LESmodel.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class SpalartAllmaras Declaration
\*---------------------------------------------------------------------------*/
class SpalartAllmaras
:
public LESmodel
{
// Private data
dimensionedScalar alphaNut_;
dimensionedScalar Cb1_;
dimensionedScalar Cb2_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
dimensionedScalar CDES_;
dimensionedScalar ck_;
dimensionedScalar kappa_;
dimensionedScalar Cw1_;
dimensionedScalar Cw2_;
dimensionedScalar Cw3_;
// Private member functions
tmp<volScalarField> fv1() const;
tmp<volScalarField> fv2() const;
tmp<volScalarField> fv3() const;
tmp<volScalarField> fw(const volScalarField& Stilda) const;
// Disallow default bitwise copy construct and assignment
SpalartAllmaras(const SpalartAllmaras&);
SpalartAllmaras& operator=(const SpalartAllmaras&);
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField muSgs_;
public:
//- Runtime type information
TypeName("SpalartAllmaras");
// Constructors
//- Constructor from components
SpalartAllmaras
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
~SpalartAllmaras()
{}
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return sqr(muSgs()/rho()/ck_/dTilda_);
}
//- Return sub-grid disipation rate
tmp<volScalarField> epsilon() const;
tmp<volScalarField> nuTilda() const
{
return nuTilda_;
}
//- Return SGS viscosity
tmp<volScalarField> muSgs() const
{
return muSgs_;
}
//- Return thermal conductivity
tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", muSgs_ + alpha())
);
}
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoBeff() const;
//- Returns div(rho*dev(B)).
// This is the additional term due to the filtering of the NSE.
tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const;
//- Correct nuTilda and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,153 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "dynOneEqEddy.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(dynOneEqEddy, 0);
addToRunTimeSelectionTable(LESmodel, dynOneEqEddy, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
dimensionedScalar dynOneEqEddy::ck_(const volSymmTensorField& D) const
{
volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
volSymmTensorField LL = dev(filter_(sqr(U())) - (sqr(filter_(U()))));
volSymmTensorField MM =
delta()*(filter_(sqrt(k_)*D) - 2*sqrt(KK + filter_(k_))*filter_(D));
return average(LL && MM)/average(magSqr(MM));
}
dimensionedScalar dynOneEqEddy::ce_(const volSymmTensorField& D) const
{
volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
volScalarField mm =
pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta();
volScalarField ee =
2*delta()*ck_(D)*
(
filter_(sqrt(k_)*magSqr(D))
- 2*sqrt(KK + filter_(k_))*magSqr(filter_(D))
);
return average(ee*mm)/average(mm*mm);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
dynOneEqEddy::dynOneEqEddy
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel(typeName, rho, U, phi, thermoPhysicalModel),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
filterPtr_(LESfilter::New(U.mesh(), LESmodelProperties())),
filter_(filterPtr_())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
dynOneEqEddy::~dynOneEqEddy()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
GenEddyVisc::correct(gradU);
volSymmTensorField D = dev(symm(gradU));
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && D);
solve
(
fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_)
- fvm::laplacian(DkEff(), k_)
==
G
- fvm::SuSp(2.0/3.0*rho()*divU, k_)
- fvm::Sp(ce_(D)*rho()*sqrt(k_)/delta(), k_)
);
bound(k_, dimensionedScalar("0", k_.dimensions(), 1.0e-10));
muSgs_ = ck_(D)*rho()*sqrt(k_)*delta();
muSgs_.correctBoundaryConditions();
}
bool dynOneEqEddy::read()
{
if (GenEddyVisc::read())
{
filter_.read(LESmodelProperties());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::dynOneEqEddy
Description
One Equation Eddy Viscosity Model for compressible flows.
Eddy viscosity SGS model using a modeled balance equation to simulate
the behaviour of k.
Thus
@verbatim
d/dt(k) + div(U*k) - div(nuSgs*grad(k))
=
-rho*B*L - ce*rho*k^3/2/delta
and
B = 2/3*k*I - 2*nuSgs*dev(D)
where
D = symm(grad(U));
nuSgs = ck*sqrt(k)*delta
@endverbatim
SourceFiles
dynOneEqEddy.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleDynOneEqEddy_H
#define compressibleDynOneEqEddy_H
#include "GenEddyVisc.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class dynOneEqEddy Declaration
\*---------------------------------------------------------------------------*/
class dynOneEqEddy
:
public GenEddyVisc
{
// Private data
autoPtr<LESfilter> filterPtr_;
LESfilter& filter_;
// Private Member Functions
//- Calculate ck, ce by filtering the velocity field U.
dimensionedScalar ck_(const volSymmTensorField& D) const;
dimensionedScalar ce_(const volSymmTensorField& D) const;
// Disallow default bitwise copy construct and assignment
dynOneEqEddy(const dynOneEqEddy&);
dynOneEqEddy& operator=(const dynOneEqEddy&);
public:
//- Runtime type information
TypeName("dynOneEqEddy");
// Constructors
//- Constructor from components
dynOneEqEddy
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
~dynOneEqEddy();
// Member Functions
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", muSgs_ + mu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "lowReOneEqEddy.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(lowReOneEqEddy, 0);
addToRunTimeSelectionTable(LESmodel, lowReOneEqEddy, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
lowReOneEqEddy::lowReOneEqEddy
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel(typeName, rho, U, phi, thermoPhysicalModel),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_(LESmodelProperties().lookup("ck")),
beta_(LESmodelProperties().lookup("beta"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
GenEddyVisc::correct(gradU);
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
solve
(
fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_)
- fvm::laplacian(DkEff(), k_)
==
G
- fvm::SuSp(2.0/3.0*rho()*divU, k_)
- fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
);
bound(k_, k0());
// High Re eddy viscosity
muSgs_ = ck_*rho()*sqrt(k_)*delta();
// low Re no corrected eddy viscosity
muSgs_ -= (mu()/beta_)*(scalar(1) - exp(-beta_*muSgs_/mu()));
muSgs_.correctBoundaryConditions();
}
bool lowReOneEqEddy::read()
{
if (GenEddyVisc::read())
{
LESmodelProperties().lookup("ck") >> ck_;
LESmodelProperties().lookup("beta") >> beta_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::lowReOneEqEddy
Description
One Equation Eddy Viscosity Model for compressible flow
@verbatim
d/dt(rho*k) + div(rho*U*k) - div(muEff*grad(k))
=
-rho*B*L - ce*rho*k^3/2/delta
and
B = 2/3*k*I - 2*nuSgs*dev(D)
where
nuSgsHiRe = ck*sqrt(k)*delta
nuSgs = (nu/beta)*(1 - exp(-beta*nuSgsHiRe/nu));
@endverbatim
SourceFiles
lowReOneEqEddy.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleLowReOneEqEddy_H
#define compressibleLowReOneEqEddy_H
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class lowReOneEqEddy Declaration
\*---------------------------------------------------------------------------*/
class lowReOneEqEddy
:
public GenEddyVisc
{
// Private data
dimensionedScalar ck_;
dimensionedScalar beta_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
lowReOneEqEddy(const lowReOneEqEddy&);
lowReOneEqEddy& operator=(const lowReOneEqEddy&);
public:
//- Runtime type information
TypeName("lowReOneEqEddy");
// Constructors
//- Constructor from components
lowReOneEqEddy
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
~lowReOneEqEddy()
{}
// Member Functions
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", muSgs_ + mu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "oneEqEddy.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(oneEqEddy, 0);
addToRunTimeSelectionTable(LESmodel, oneEqEddy, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
oneEqEddy::oneEqEddy
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
)
:
LESmodel(typeName, rho, U, phi, thermoPhysicalModel),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_(LESmodelProperties().lookup("ck"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
GenEddyVisc::correct(gradU);
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
fvScalarMatrix kEqn
(
fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_)
- fvm::laplacian(DkEff(), k_)
==
G
- fvm::SuSp(2.0/3.0*rho()*divU, k_)
- fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
);
kEqn.relax();
kEqn.solve();
bound(k_, k0());
muSgs_ = ck_*rho()*sqrt(k_)*delta();
muSgs_.correctBoundaryConditions();
}
bool oneEqEddy::read()
{
if (GenEddyVisc::read())
{
LESmodelProperties().lookup("ck") >> ck_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::oneEqEddy
Description
One Equation Eddy Viscosity Model for incompressible flows
Eddy viscosity SGS model using a modeled balance equation to simulate the
behaviour of k, hence,
@verbatim
d/dt(rho*k) + div(rho*U*k) - div(muEff*grad(k))
=
-rho*B*L - ce*rho*k^3/2/delta
and
B = 2/3*k*I - 2*nuSgs*dev(D)
where
D = symm(grad(U));
nuSgs = ck*sqrt(k)*delta
@endverbatim
SourceFiles
oneEqEddy.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleOneEqEddy_H
#define compressibleOneEqEddy_H
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class oneEqEddy Declaration
\*---------------------------------------------------------------------------*/
class oneEqEddy
:
public GenEddyVisc
{
// Private data
dimensionedScalar ck_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
oneEqEddy(const oneEqEddy&);
oneEqEddy& operator=(const oneEqEddy&);
public:
//- Runtime type information
TypeName("oneEqEddy");
// Constructors
//- Constructor from components
oneEqEddy
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
);
// Destructor
~oneEqEddy()
{}
// Member Functions
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", muSgs_ + mu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "muSgsWallFunctionFvPatchScalarField.H"
#include "LESmodel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
(
const muSgsWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
Istream& is
)
:
fixedValueFvPatchScalarField(p, iF, is)
{}
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{}
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
(
const muSgsWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
(
const muSgsWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void muSgsWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const LESmodel& sgsModel
= db().lookupObject<LESmodel>("turbulenceProperties");
scalar kappa = dimensionedScalar(sgsModel.lookup("kappa")).value();
scalar E = dimensionedScalar
(
sgsModel.subDict("wallFunctionCoeffs").lookup("E")
).value();
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField magUp = mag(U.patchInternalField() - U);
const scalarField& muw =
patch().lookupPatchField<volScalarField, scalar>("mu");
const scalarField& rhow =
patch().lookupPatchField<volScalarField, scalar>("rho");
scalarField& muSgsw = *this;
scalarField magFaceGradU = mag(U.snGrad());
forAll(muSgsw, facei)
{
scalar magUpara = magUp[facei];
scalar utau = sqrt
(
(muSgsw[facei] + muw[facei])
*magFaceGradU[facei]/rhow[facei]
);
if(utau > 0)
{
int iter = 0;
scalar err = GREAT;
do
{
scalar kUu = kappa*magUpara/utau;
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
- utau/(ry[facei]*muw[facei]/rhow[facei])
+ magUpara/utau
+ 1/E*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
- 1.0/(ry[facei]*muw[facei]/rhow[facei])
- magUpara/sqr(utau)
- 1/E*kUu*fkUu/utau;
scalar utauNew = utau - f/df;
err = mag((utau - utauNew)/utau);
utau = utauNew;
} while (utau > VSMALL && err > 0.01 && ++iter < 10);
muSgsw[facei] =
max(rhow[facei]*sqr(utau)/magFaceGradU[facei] - muw[facei],0.0);
}
else
{
muSgsw[facei] = 0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, muSgsWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,159 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible::LESmodels::muSgsWallFunctionFvPatchScalarField
Description
wall function boundary condition for compressible flows
SourceFiles
muSgsWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef muSgsWallFunctionFvPatchScalarField_H
#define muSgsWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class muSgsWallFunctionFvPatch Declaration
\*---------------------------------------------------------------------------*/
class muSgsWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
public:
//- Runtime type information
TypeName("muSgsWallFunction");
// Constructors
//- Construct from patch and internal field
muSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and Istream
muSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
Istream&
);
//- Construct from patch, internal field and dictionary
muSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given muSgsWallFunctionFvPatchScalarField
// onto a new patch
muSgsWallFunctionFvPatchScalarField
(
const muSgsWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
muSgsWallFunctionFvPatchScalarField
(
const muSgsWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new muSgsWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
muSgsWallFunctionFvPatchScalarField
(
const muSgsWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new muSgsWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DeardorffDiffStress.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(DeardorffDiffStress, 0);
addToRunTimeSelectionTable(LESmodel, DeardorffDiffStress, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
DeardorffDiffStress::DeardorffDiffStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenSGSStress(U, phi, transport),
ck_(LESmodelProperties().lookup("ck")),
cm_(LESmodelProperties().lookup("cm"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
GenSGSStress::correct(gradU);
volSymmTensorField D = symm(gradU);
volSymmTensorField P = -twoSymm(B_ & gradU);
volScalarField K = 0.5*tr(B_);
volScalarField Epsilon = 2*nuEff()*magSqr(D);
solve
(
fvm::ddt(B_)
+ fvm::div(phi(), B_)
- fvm::laplacian(DBEff(), B_)
+ fvm::Sp(cm_*sqrt(K)/delta(), B_)
==
P
+ 0.8*K*D
- (2*ce_ - 0.667*cm_)*I*Epsilon
);
// Bounding the component kinetic energies
forAll(B_, celli)
{
B_[celli].component(tensor::XX) =
max(B_[celli].component(tensor::XX), k0().value());
B_[celli].component(tensor::YY) =
max(B_[celli].component(tensor::YY), k0().value());
B_[celli].component(tensor::ZZ) =
max(B_[celli].component(tensor::ZZ), k0().value());
}
K = 0.5*tr(B_);
bound(K, k0());
nuSgs_ = ck_*sqrt(K)*delta();
nuSgs_.correctBoundaryConditions();
}
bool DeardorffDiffStress::read()
{
if (GenSGSStress::read())
{
LESmodelProperties().lookup("ck") >> ck_;
LESmodelProperties().lookup("cm") >> cm_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::DeardorffDiffStress
Description
Differential SGS Stress Equation Model for incompressible flows
The DSEM uses a model version of the full balance equation for the SGS
stress tensor to simulate the behaviour of B.
Thus,
@verbatim
d/dt(B) + div(U*B) - div(nuSgs*grad(B))
=
P - c1*epsilon/k*B - 0.667*(1 - c1)*epsilon*I - c2*(P - 0.333*trP*I)
where
k = 0.5*tr(B),
epsilon = ce*k^3/2/delta,
epsilon/k = ce*k^1/2/delta
P = -(B'L + L'B)
nuSgs = ck*sqrt(k)*delta
nuEff = nuSgs + nu
@endverbatim
SourceFiles
DeardorffDiffStress.C
\*---------------------------------------------------------------------------*/
#ifndef DeardorffDiffStress_H
#define DeardorffDiffStress_H
#include "GenSGSStress.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class DeardorffDiffStress Declaration
\*---------------------------------------------------------------------------*/
class DeardorffDiffStress
:
public GenSGSStress
{
// Private data
dimensionedScalar ck_;
dimensionedScalar cm_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
DeardorffDiffStress(const DeardorffDiffStress&);
DeardorffDiffStress& operator=(const DeardorffDiffStress&);
public:
//- Runtime type information
TypeName("DeardorffDiffStress");
// Constructors
//- Constructor from components
DeardorffDiffStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~DeardorffDiffStress()
{}
// Member Functions
//- Return the effective diffusivity for B
tmp<volScalarField> DBEff() const
{
return tmp<volScalarField>
(
new volScalarField("DBEff", nuSgs_ + nu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
GenEddyVisc::GenEddyVisc
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(word("GenEddyVisc"), U, phi, transport),
ce_(LESmodelProperties().lookup("ce")),
nuSgs_
(
IOobject
(
"nuSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> GenEddyVisc::B() const
{
return ((2.0/3.0)*I)*k() - nuSgs_*twoSymm(fvc::grad(U()));
}
tmp<volSymmTensorField> GenEddyVisc::devBeff() const
{
return -nuEff()*dev(twoSymm(fvc::grad(U())));
}
tmp<fvVectorMatrix> GenEddyVisc::divDevBeff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U) - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
);
}
void GenEddyVisc::correct(const tmp<volTensorField>& gradU)
{
LESmodel::correct(gradU);
}
bool GenEddyVisc::read()
{
if (LESmodel::read())
{
LESmodelProperties().lookup("ce") >> ce_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::GenEddyVisc
Description
General base class for all incompressible models that can be implemented
as an eddy viscosity, i.e. algebraic and one-equation models.
Contains fields for k (SGS turbulent kinetic energy), gamma
(modelled viscosity) and epsilon (SGS dissipation).
SourceFiles
GenEddyVisc.C
\*---------------------------------------------------------------------------*/
#ifndef GenEddyVisc_H
#define GenEddyVisc_H
#include "LESmodel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class GenEddyVisc Declaration
\*---------------------------------------------------------------------------*/
class GenEddyVisc
:
virtual public LESmodel
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
GenEddyVisc(const GenEddyVisc&);
GenEddyVisc& operator=(const GenEddyVisc&);
protected:
dimensionedScalar ce_;
volScalarField nuSgs_;
public:
// Constructors
//- Construct from components
GenEddyVisc
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
virtual ~GenEddyVisc()
{}
// Member Functions
//- Return SGS kinetic energy
virtual tmp<volScalarField> k() const = 0;
//- Return sub-grid disipation rate
virtual tmp<volScalarField> epsilon() const
{
return ce_*k()*sqrt(k())/delta();
}
//- Return the SGS viscosity.
virtual tmp<volScalarField> nuSgs() const
{
return nuSgs_;
}
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const;
//- Return the effective sub-grid turbulence stress tensor
// including the laminar stress
virtual tmp<volSymmTensorField> devBeff() const;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "GenSGSStress.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
GenSGSStress::GenSGSStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(word("GenSGSStress"), U, phi, transport),
ce_(LESmodelProperties().lookup("ce")),
couplingFactor_(0.0),
B_
(
IOobject
(
"B",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
nuSgs_
(
IOobject
(
"nuSgs",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
nu(),
B_.boundaryField().types()
)
{
if (LESmodelProperties().found("couplingFactor"))
{
LESmodelProperties().lookup("couplingFactor") >> couplingFactor_;
if (couplingFactor_ < 0.0 || couplingFactor_ > 1.0)
{
FatalErrorIn
(
"GenSGSStress::GenSGSStress"
"(const volVectorField& U, const surfaceScalarField& phi,"
"transportModel& lamTransportModel)"
) << "couplingFactor = " << couplingFactor_
<< " is not in range 0 - 1"
<< exit(FatalError);
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> GenSGSStress::devBeff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
B_ - nu()*dev(twoSymm(fvc::grad(U())))
)
);
}
tmp<fvVectorMatrix> GenSGSStress::divDevBeff
(
volVectorField& U
) const
{
if (couplingFactor_ > 0.0)
{
return
(
fvc::div(B_ + couplingFactor_*nuSgs_*fvc::grad(U))
+ fvc::laplacian
(
(1.0 - couplingFactor_)*nuSgs_, U, "laplacian(nuEff,U)"
)
- fvm::laplacian(nuEff(), U)
);
}
else
{
return
(
fvc::div(B_)
+ fvc::laplacian(nuSgs_, U, "laplacian(nuEff,U)")
- fvm::laplacian(nuEff(), U)
);
}
}
bool GenSGSStress::read()
{
if (LESmodel::read())
{
LESmodelProperties().lookup("ce") >> ce_;
LESmodelProperties().lookup("couplingFactor") >> couplingFactor_;
if (couplingFactor_ < 0.0 || couplingFactor_ > 1.0)
{
FatalErrorIn("GenSGSStress::read()")
<< "couplingFactor = " << couplingFactor_
<< " is not in range 0 - 1"
<< exit(FatalError);
}
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::GenSGSStress
Description
General base class for all incompressible models that directly
solve for the SGS stress tensor B.
Contains tensor fields B (the SGS stress tensor) as well as scalar
fields for k (SGS turbulent energy) gamma (SGS viscosity) and epsilon
(SGS dissipation).
SourceFiles
GenSGSStress.C
\*---------------------------------------------------------------------------*/
#ifndef GenSGSStress_H
#define GenSGSStress_H
#include "LESmodel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class GenSGSStress Declaration
\*---------------------------------------------------------------------------*/
class GenSGSStress
:
virtual public LESmodel
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
GenSGSStress(const GenSGSStress&);
GenSGSStress& operator=(const GenSGSStress&);
protected:
dimensionedScalar ce_;
scalar couplingFactor_;
volSymmTensorField B_;
volScalarField nuSgs_;
public:
// Constructors
//- Constructor from components
GenSGSStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
virtual ~GenSGSStress()
{}
// Member Functions
//- Return the SGS turbulent kinetic energy.
virtual tmp<volScalarField> k() const
{
return 0.5*tr(B_);
}
//- Return the SGS turbulent dissipation.
virtual tmp<volScalarField> epsilon() const
{
volScalarField K = k();
return ce_*K*sqrt(K)/delta();
}
//- Return the SGS viscosity.
virtual tmp<volScalarField> nuSgs() const
{
return nuSgs_;
}
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const
{
return B_;
}
//- Return the effective sub-grid turbulence stress tensor
// including the laminar stress
virtual tmp<volSymmTensorField> devBeff() const;
//- Returns div(B).
// This is the additional term due to the filtering of the NSE.
virtual tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESmodel.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(LESmodel, 0);
defineRunTimeSelectionTable(LESmodel, dictionary);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
LESmodel::LESmodel
(
const word& type,
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
IOdictionary
(
IOobject
(
"turbulenceProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
runTime_(U.time()),
mesh_(U.mesh()),
U_(U),
phi_(phi),
transport_(transport),
LESmodelProperties_(subDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this))
{
if (found("k0"))
{
lookup("k0") >> k0_;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void LESmodel::correct(const tmp<volTensorField>&)
{
delta_().correct();
transport_.correct();
}
void LESmodel::correct()
{
correct(fvc::grad(U_));
}
bool LESmodel::read()
{
if (regIOobject::read())
{
LESmodelProperties_ = subDict(type() + "Coeffs");
delta_().read(*this);
if (found("k0"))
{
lookup("k0") >> k0_;
}
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,263 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::LESmodels
Description
Namespace for incompressible LES models.
Class
Foam::LESmodel
Description
Base class for all incompressible flow LES SGS models.
This class defines the basic interface for an incompressible flow SGS
model, and encapsulates data of value to all possible models. In
particular this includes references to all the dependent fields (U,
phi), the physical viscosity nu, and the turbulenceProperties
dictionary which contains the model selection and model coefficients.
SourceFiles
LESmodel.C
newIsoLESmodel.C
\*---------------------------------------------------------------------------*/
#ifndef LESmodel_H
#define LESmodel_H
#include "LESdelta.H"
#include "fvm.H"
#include "fvc.H"
#include "fvMatrices.H"
#include "incompressible/transportModel/transportModel.H"
#include "wallFvPatch.H"
#include "bound.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class LESmodel Declaration
\*---------------------------------------------------------------------------*/
class LESmodel
:
public IOdictionary
{
protected:
// Protected data
const Time& runTime_;
const fvMesh& mesh_;
private:
// Private data
const volVectorField& U_;
const surfaceScalarField& phi_;
transportModel& transport_;
dictionary LESmodelProperties_;
dimensionedScalar k0_;
autoPtr<LESdelta> delta_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
LESmodel(const LESmodel&);
LESmodel& operator=(const LESmodel&);
public:
//- Runtime type information
TypeName("LESmodel");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
LESmodel,
dictionary,
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
),
(U, phi, transport)
);
// Constructors
//- Construct from components
LESmodel
(
const word& type,
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Selectors
//- Return a reference to the selected LES model
static autoPtr<LESmodel> New
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
virtual ~LESmodel()
{}
// Member Functions
// Access
//- Access function to velocity field
inline const volVectorField& U() const
{
return U_;
}
//- Access function to flux field
inline const surfaceScalarField& phi() const
{
return phi_;
}
//- Access function to incompressible transport model
inline transportModel& transport() const
{
return transport_;
}
//- Access the dictionary which provides info. about choice of
// models, and all related data (particularly model coefficients).
inline const dictionary& LESmodelProperties()
{
return LESmodelProperties_;
}
//- Access function to filter width
inline const volScalarField& delta() const
{
return delta_();
}
//- Access function to incompressible viscosity
inline const volScalarField& nu() const
{
return transport_.nu();
}
//- Return the value of k0 which k is not allowed to be less than
const dimensionedScalar& k0() const
{
return k0_;
}
//- Allow k0 to be changed
dimensionedScalar& k0()
{
return k0_;
}
//- Return the SGS turbulent kinetic energy.
virtual tmp<volScalarField> k() const = 0;
//- Return the SGS turbulent dissipation.
virtual tmp<volScalarField> epsilon() const = 0;
//- Return the SGS viscosity.
virtual tmp<volScalarField> nuSgs() const = 0;
//- Return the effective viscosity
virtual tmp<volScalarField> nuEff() const
{
return tmp<volScalarField>
(
new volScalarField("nuEff", nuSgs() + nu())
);
}
//- Return the sub-grid stress tensor.
virtual tmp<volSymmTensorField> B() const = 0;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devBeff() const = 0;
//- Returns div(dev(Beff)).
// This is the additional term due to the filtering of the NSE.
virtual tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const = 0;
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Correct Eddy-Viscosity and related properties.
// This calls correct(const tmp<volTensorField>& gradU) by supplying
// gradU calculated locally.
void correct();
//- Read turbulenceProperties dictionary
virtual bool read() = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESmodel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<LESmodel> LESmodel::New
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
{
word LESmodelTypeName;
// Enclose the creation of the turbulencePropertiesDict to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary turbulencePropertiesDict
(
IOobject
(
"turbulenceProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
turbulencePropertiesDict.lookup("LESmodel") >> LESmodelTypeName;
}
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(LESmodelTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESmodel::select(const volVectorField&, const "
"surfaceScalarField&, transportModel&)"
) << "Unknown LESmodel type " << LESmodelTypeName
<< endl << endl
<< "Valid LESmodel types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESmodel>(cstrIter()(U, phi, transport));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LRRDiffStress.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(LRRDiffStress, 0);
addToRunTimeSelectionTable(LESmodel, LRRDiffStress, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
LRRDiffStress::LRRDiffStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenSGSStress(U, phi, transport),
ck_(LESmodelProperties().lookup("ck")),
c1_(LESmodelProperties().lookup("c1")),
c2_(LESmodelProperties().lookup("c2"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
{
const volTensorField& gradU = tgradU();
GenSGSStress::correct(gradU);
volSymmTensorField D = symm(gradU);
volSymmTensorField P = -twoSymm(B_ & gradU);
volScalarField K = 0.5*tr(B_);
volScalarField Epsilon = 2*nuEff()*magSqr(D);
solve
(
fvm::ddt(B_)
+ fvm::div(phi(), B_)
- fvm::laplacian(DBEff(), B_)
+ fvm::Sp(c1_*Epsilon/K, B_)
==
P
- (0.667*(1.0 - c1_)*I)*Epsilon
- c2_*(P - 0.333*I*tr(P))
- (0.667 - 2*c1_)*I*pow(K, 1.5)/delta()
);
// Bounding the component kinetic energies
forAll(B_, celli)
{
B_[celli].component(tensor::XX) =
max(B_[celli].component(tensor::XX), k0().value());
B_[celli].component(tensor::YY) =
max(B_[celli].component(tensor::YY), k0().value());
B_[celli].component(tensor::ZZ) =
max(B_[celli].component(tensor::ZZ), k0().value());
}
K = 0.5*tr(B_);
bound(K, k0());
nuSgs_ = ck_*sqrt(K)*delta();
nuSgs_.correctBoundaryConditions();
}
bool LRRDiffStress::read()
{
if (GenSGSStress::read())
{
LESmodelProperties().lookup("ck") >> ck_;
LESmodelProperties().lookup("c1") >> c1_;
LESmodelProperties().lookup("c2") >> c2_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,136 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::LRRDiffStress
Description
Differential SGS Stress Equation Model for incompressible flows.
The DSEM uses a model version of the full balance equation for the SGS
stress tensor to simulate the behaviour of B, hence,
@verbatim
d/dt(B) + div(U*B) - div(nuSgs*grad(B))
=
P - c1*e/k*B - 0.667*(1 - c1)*e*I - c2*(P - 0.333*trP*I)
where
k = 0.5*trB,
epsilon = ce*k^3/2/delta
epsilon/k = ce*k^1/2/delta
P = -(B'L + L'B)
nuEff = ck*sqrt(k)*delta + nu
@endverbatim
This version from Launder, Rece & Rodi 1975
SourceFiles
LRRDiffStress.C
\*---------------------------------------------------------------------------*/
#ifndef LRRDiffStress_H
#define LRRDiffStress_H
#include "GenSGSStress.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class LRRDiffStress Declaration
\*---------------------------------------------------------------------------*/
class LRRDiffStress
:
public GenSGSStress
{
// Private data
dimensionedScalar ck_;
dimensionedScalar c1_;
dimensionedScalar c2_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
LRRDiffStress(const LRRDiffStress&);
LRRDiffStress& operator=(const LRRDiffStress&);
public:
//- Runtime type information
TypeName("LRRDiffStress");
// Constructors
//- Constructors from components
LRRDiffStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~LRRDiffStress()
{}
// Member Functions
//- Return the effective diffusivity for B
tmp<volScalarField> DBEff() const
{
return tmp<volScalarField>
(
new volScalarField("DBEff", nuSgs_ + nu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
vanDriestDelta/vanDriestDelta.C
wallFunc/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C
LESmodel/LESmodel.C
LESmodel/newLESmodel.C
GenEddyVisc/GenEddyVisc.C
GenSGSStress/GenSGSStress.C
laminar/laminar.C
SpalartAllmaras/SpalartAllmaras.C
oneEqEddy/oneEqEddy.C
dynOneEqEddy/dynOneEqEddy.C
locDynOneEqEddy/locDynOneEqEddy.C
Smagorinsky/Smagorinsky.C
dynSmagorinsky/dynSmagorinsky.C
LRRDiffStress/LRRDiffStress.C
DeardorffDiffStress/DeardorffDiffStress.C
spectEddyVisc/spectEddyVisc.C
scaleSimilarity/scaleSimilarity.C
mixedSmagorinsky/mixedSmagorinsky.C
dynMixedSmagorinsky/dynMixedSmagorinsky.C
/*Smagorinsky2/Smagorinsky2.C*/
LIB = $(FOAM_LIBBIN)/libincompressibleLESmodels

View File

@ -0,0 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \
-I$(LIB_SRC)/LESmodels/LESfilters/lnInclude \
-I$(LIB_SRC)/transportModels
LIB_LIBS = \
-lLESdeltas \
-lLESfilters\
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "Smagorinsky.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Smagorinsky, 0);
addToRunTimeSelectionTable(LESmodel, Smagorinsky, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Smagorinsky::Smagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
ck_(LESmodelProperties().lookup("ck"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Smagorinsky::correct(const tmp<volTensorField>& gradU)
{
GenEddyVisc::correct(gradU);
nuSgs_ = ck_*delta()*sqrt(k(gradU));
nuSgs_.correctBoundaryConditions();
}
bool Smagorinsky::read()
{
if (GenEddyVisc::read())
{
LESmodelProperties().lookup("ck") >> ck_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::Smagorinsky
Description
The Isochoric Smagorinsky Model for incompressible flows.
Algebraic eddy viscosity SGS model founded on the assumption that
local equilibrium prevails.
Thus,
@verbatim
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
D = symm(grad(U));
k = (2*ck/ce)*delta^2*||D||^2
nuSgs = ck*sqrt(k)*delta
nuEff = nuSgs + nu
@endverbatim
SourceFiles
Smagorinsky.C
\*---------------------------------------------------------------------------*/
#ifndef Smagorinsky_H
#define Smagorinsky_H
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class Smagorinsky Declaration
\*---------------------------------------------------------------------------*/
class Smagorinsky
:
public GenEddyVisc
{
// Private data
dimensionedScalar ck_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
Smagorinsky(const Smagorinsky&);
Smagorinsky& operator=(const Smagorinsky&);
public:
//- Runtime type information
TypeName("Smagorinsky");
// Constructors
//- Construct from components
Smagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~Smagorinsky()
{}
// Member Functions
//- Return SGS kinetic energy
// calculated from the given velocity gradient
tmp<volScalarField> k(const tmp<volTensorField>& gradU) const
{
return (2.0*ck_/ce_)*sqr(delta())*magSqr(dev(symm(gradU)));
}
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return k(fvc::grad(U()));
}
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "Smagorinsky2.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Smagorinsky2, 0);
addToRunTimeSelectionTable(LESmodel, Smagorinsky2, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Smagorinsky2::Smagorinsky2
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
Smagorinsky(U, phi, transport),
cD2_(LESmodelProperties().lookup("cD2"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Evaluate B (from the definition of an eddy viscosity model) and
// return it.
tmp<volSymmTensorField> Smagorinsky2::B() const
{
volSymmTensorField D = dev(symm(fvc::grad(U())));
return (((2.0/3.0)*I)*k() - 2.0*nuSgs_*D - (2.0*cD2_)*delta()*(D&D));
}
tmp<fvVectorMatrix> Smagorinsky2::divDevBeff
(
volVectorField& U
) const
{
volTensorField gradU = fvc::grad(U);
volSymmTensorField aniNuEff
(
"aniNuEff",
I*nuEff() + cD2_*delta()*symm(gradU)
);
return
(
- fvm::laplacian(aniNuEff, U) - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
);
}
bool Smagorinsky2::read()
{
if (Smagorinsky::read())
{
LESmodelProperties().lookup("cD2") >> cD2_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::Smagorinsky2
Description
The Isochoric Smagorinsky Model for incompressible flows
Algebraic eddy viscosity SGS model founded on the assumption that
local equilibrium prevails, hence
@verbatim
B = 2/3*k*I - 2*nuSgs*dev(D) - 2*cD2*delta*(D.dev(D));
Beff = 2/3*k*I - 2*nuEff*dev(D) - 2*cD2*delta*(D.dev(D));
where
D = symm(grad(U));
k = cI*delta^2*||D||^2
nuSgs = ck*sqrt(k)*delta
nuEff = nuSgs + nu
@endverbatim
SourceFiles
Smagorinsky2.C
\*---------------------------------------------------------------------------*/
#ifndef Smagorinsky2_H
#define Smagorinsky2_H
#include "Smagorinsky.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class Smagorinsky2 Declaration
\*---------------------------------------------------------------------------*/
class Smagorinsky2
:
public Smagorinsky
{
// Private data
dimensionedScalar cD2_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
Smagorinsky2(const Smagorinsky2&);
Smagorinsky2& operator=(const Smagorinsky2&);
public:
//- Runtime type information
TypeName("Smagorinsky2");
// Constructors
//- Construct from components
Smagorinsky2
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~Smagorinsky2()
{}
// Member Functions
//- Return B.
tmp<volSymmTensorField> B() const;
//- Returns div(B).
// This is the additional term due to the filtering of the NSE.
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,241 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "SpalartAllmaras.H"
#include "addToRunTimeSelectionTable.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(SpalartAllmaras, 0);
addToRunTimeSelectionTable(LESmodel, SpalartAllmaras, dictionary);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
tmp<volScalarField> SpalartAllmaras::fv1() const
{
volScalarField chi3 = pow3(nuTilda_/nu());
return chi3/(chi3 + pow3(Cv1_));
}
tmp<volScalarField> SpalartAllmaras::fv2() const
{
volScalarField chi = nuTilda_/nu();
//return scalar(1) - chi/(scalar(1) + chi*fv1());
return 1.0/pow3(scalar(1) + chi/Cv2_);
}
tmp<volScalarField> SpalartAllmaras::fv3() const
{
volScalarField chi = nuTilda_/nu();
volScalarField chiByCv2 = (1/Cv2_)*chi;
return
(scalar(1) + chi*fv1())
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
}
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
{
volScalarField r = min
(
nuTilda_
/(
max(Stilda, dimensionedScalar("SMALL", Stilda.dimensions(), SMALL))
*sqr(kappa_*dTilda_)
),
scalar(10.0)
);
r.boundaryField() == 0.0;
volScalarField g = r + Cw2_*(pow6(r) - r);
return g*pow((1.0 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
SpalartAllmaras::SpalartAllmaras
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
alphaNut_(LESmodelProperties().lookup("alphaNut")),
Cb1_(LESmodelProperties().lookup("Cb1")),
Cb2_(LESmodelProperties().lookup("Cb2")),
Cv1_(LESmodelProperties().lookup("Cv1")),
Cv2_(LESmodelProperties().lookup("Cv2")),
CDES_(LESmodelProperties().lookup("CDES")),
ck_(LESmodelProperties().lookup("ck")),
kappa_(lookup("kappa")),
Cw1_(Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_)),
Cw2_(LESmodelProperties().lookup("Cw2")),
Cw3_(LESmodelProperties().lookup("Cw3")),
nuTilda_
(
IOobject
(
"nuTilda",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
dTilda_(min(CDES_*delta(), wallDist(mesh_).y())),
nuSgs_
(
IOobject
(
"nuSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
{
LESmodel::correct(gradU);
if (mesh_.changing())
{
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
}
volScalarField Stilda =
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
solve
(
fvm::ddt(nuTilda_)
+ fvm::div(phi(), nuTilda_)
- fvm::laplacian
(
alphaNut_*(nuTilda_ + nu()),
nuTilda_,
"laplacian(DnuTildaEff,nuTilda)"
)
- alphaNut_*Cb2_*magSqr(fvc::grad(nuTilda_))
==
Cb1_*Stilda*nuTilda_
- fvm::Sp(Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_)
);
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions();
nuSgs_.internalField() = fv1()*nuTilda_.internalField();
nuSgs_.correctBoundaryConditions();
}
tmp<volScalarField> SpalartAllmaras::epsilon() const
{
return 2*nuEff()*magSqr(symm(fvc::grad(U())));
}
tmp<volSymmTensorField> SpalartAllmaras::B() const
{
return ((2.0/3.0)*I)*k() - nuSgs()*twoSymm(fvc::grad(U()));
}
tmp<volSymmTensorField> SpalartAllmaras::devBeff() const
{
return -nuEff()*dev(twoSymm(fvc::grad(U())));
}
tmp<fvVectorMatrix> SpalartAllmaras::divDevBeff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U) - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
);
}
bool SpalartAllmaras::read()
{
if (LESmodel::read())
{
LESmodelProperties().lookup("alphaNut") >> alphaNut_;
LESmodelProperties().lookup("Cb1") >> Cb1_;
LESmodelProperties().lookup("Cb2") >> Cb2_;
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
LESmodelProperties().lookup("Cw2") >> Cw2_;
LESmodelProperties().lookup("Cw3") >> Cw3_;
LESmodelProperties().lookup("Cv1") >> Cv1_;
LESmodelProperties().lookup("Cv2") >> Cv2_;
LESmodelProperties().lookup("CDES") >> CDES_;
LESmodelProperties().lookup("ck") >> ck_;
lookup("kappa") >> kappa_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::SpalartAllmaras
Description
SpalartAllmaras for incompressible flows
SourceFiles
SpalartAllmaras.C
\*---------------------------------------------------------------------------*/
#ifndef SpalartAllmaras_H
#define SpalartAllmaras_H
#include "LESmodel.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class SpalartAllmaras Declaration
\*---------------------------------------------------------------------------*/
class SpalartAllmaras
:
public LESmodel
{
// Private data
dimensionedScalar alphaNut_;
dimensionedScalar Cb1_;
dimensionedScalar Cb2_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
dimensionedScalar CDES_;
dimensionedScalar ck_;
dimensionedScalar kappa_;
dimensionedScalar Cw1_;
dimensionedScalar Cw2_;
dimensionedScalar Cw3_;
// Private member functions
tmp<volScalarField> fv1() const;
tmp<volScalarField> fv2() const;
tmp<volScalarField> fv3() const;
tmp<volScalarField> fw(const volScalarField& Stilda) const;
// Disallow default bitwise copy construct and assignment
SpalartAllmaras(const SpalartAllmaras&);
SpalartAllmaras& operator=(const SpalartAllmaras&);
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField nuSgs_;
public:
//- Runtime type information
TypeName("SpalartAllmaras");
// Constructors
//- Constructor from components
SpalartAllmaras
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~SpalartAllmaras()
{}
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return sqr(nuSgs()/ck_/dTilda_);
}
//- Return sub-grid disipation rate
tmp<volScalarField> epsilon() const;
tmp<volScalarField> nuTilda() const
{
return nuTilda_;
}
//- Return SGS viscosity
tmp<volScalarField> nuSgs() const
{
return nuSgs_;
}
//- 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;
//- Return the deviatoric part of the divergence of Beff
// i.e. the additional term in the filtered NSE.
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Correct nuTilda and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "dynMixedSmagorinsky.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(dynMixedSmagorinsky, 0);
addToRunTimeSelectionTable(LESmodel, dynMixedSmagorinsky, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
dynMixedSmagorinsky::dynMixedSmagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
scaleSimilarity(U, phi, transport),
dynSmagorinsky(U, phi, transport)
{}
// * * * * * * * * * * * * * * * 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
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::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 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
);
// 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 turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "dynOneEqEddy.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(dynOneEqEddy, 0);
addToRunTimeSelectionTable(LESmodel, dynOneEqEddy, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
dimensionedScalar dynOneEqEddy::ck(const volSymmTensorField& D) const
{
volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
volSymmTensorField LL = dev(filter_(sqr(U())) - sqr(filter_(U())));
volSymmTensorField MM =
delta()*(filter_(sqrt(k_)*D) - 2*sqrt(KK + filter_(k_))*filter_(D));
dimensionedScalar MMMM = average(magSqr(MM));
if (MMMM.value() > VSMALL)
{
return average(LL && MM)/MMMM;
}
else
{
return 0.0;
}
}
dimensionedScalar dynOneEqEddy::ce(const volSymmTensorField& D) const
{
volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
volScalarField mm =
pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta();
volScalarField ee =
2*delta()*ck(D)
*(
filter_(sqrt(k_)*magSqr(D))
- 2*sqrt(KK + filter_(k_))*magSqr(filter_(D))
);
dimensionedScalar mmmm = average(magSqr(mm));
if (mmmm.value() > VSMALL)
{
return average(ee*mm)/mmmm;
}
else
{
return 0.0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
dynOneEqEddy::dynOneEqEddy
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
filterPtr_(LESfilter::New(U.mesh(), LESmodelProperties())),
filter_(filterPtr_())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
dynOneEqEddy::~dynOneEqEddy()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void dynOneEqEddy::correct(const tmp<volTensorField>& gradU)
{
GenEddyVisc::correct(gradU);
volSymmTensorField D = symm(gradU);
volScalarField P = 2.0*nuSgs_*magSqr(D);
solve
(
fvm::ddt(k_)
+ fvm::div(phi(), k_)
- fvm::laplacian(DkEff(), k_)
==
P
- fvm::Sp(ce(D)*sqrt(k_)/delta(), k_)
);
bound(k_, k0());
nuSgs_ = ck(D)*sqrt(k_)*delta();
nuSgs_.correctBoundaryConditions();
}
bool dynOneEqEddy::read()
{
if (GenEddyVisc::read())
{
filter_.read(LESmodelProperties());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::dynOneEqEddy
Description
One Equation Eddy Viscosity Model for incompressible flows.
Eddy viscosity SGS model using a modeled balance equation to simulate
the behaviour of k.
Thus
@verbatim
d/dt(k) + div(U*k) - div(nuSgs*grad(k))
=
-B*L - ce*k^3/2/delta
and
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
D = symm(grad(U));
nuSgs = ck*sqrt(k)*delta
nuEff = nuSgs + nu
@endverabtim
SourceFiles
dynOneEqEddy.C
\*---------------------------------------------------------------------------*/
#ifndef dynOneEqEddy_H
#define dynOneEqEddy_H
#include "GenEddyVisc.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class dynOneEqEddy Declaration
\*---------------------------------------------------------------------------*/
class dynOneEqEddy
:
public GenEddyVisc
{
// Private data
volScalarField k_;
autoPtr<LESfilter> filterPtr_;
LESfilter& filter_;
// Private Member Functions
//- Calculate ck, ce by filtering the velocity field U.
dimensionedScalar ck(const volSymmTensorField& D) const;
dimensionedScalar ce(const volSymmTensorField& D) const;
// Disallow default bitwise copy construct and assignment
dynOneEqEddy(const dynOneEqEddy&);
dynOneEqEddy& operator=(const dynOneEqEddy&);
public:
//- Runtime type information
TypeName("dynOneEqEddy");
// Constructors
//- Constructor from components
dynOneEqEddy
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~dynOneEqEddy();
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return k_;
}
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", nuSgs_ + nu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "dynSmagorinsky.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(dynSmagorinsky, 0);
addToRunTimeSelectionTable(LESmodel, dynSmagorinsky, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
dimensionedScalar dynSmagorinsky::cD(const volSymmTensorField& D) const
{
volSymmTensorField LL = dev(filter_(sqr(U())) - (sqr(filter_(U()))));
volSymmTensorField MM =
sqr(delta())*(filter_(mag(D)*(D)) - 4*mag(filter_(D))*filter_(D));
dimensionedScalar MMMM = average(magSqr(MM));
if (MMMM.value() > VSMALL)
{
return average(LL && MM)/MMMM;
}
else
{
return 0.0;
}
}
dimensionedScalar dynSmagorinsky::cI(const volSymmTensorField& D) const
{
volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
volScalarField mm =
sqr(delta())*(4*sqr(mag(filter_(D))) - filter_(sqr(mag(D))));
dimensionedScalar mmmm = average(magSqr(mm));
if (mmmm.value() > VSMALL)
{
return average(KK*mm)/mmmm;
}
else
{
return 0.0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
dynSmagorinsky::dynSmagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
filterPtr_(LESfilter::New(U.mesh(), LESmodelProperties())),
filter_(filterPtr_())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
dynSmagorinsky::~dynSmagorinsky()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void dynSmagorinsky::correct(const tmp<volTensorField>& gradU)
{
LESmodel::correct(gradU);
volSymmTensorField D = dev(symm(gradU));
volScalarField magSqrD = magSqr(D);
k_ = cI(D)*sqr(delta())*magSqrD;
nuSgs_ = cD(D)*sqr(delta())*sqrt(magSqrD);
nuSgs_.correctBoundaryConditions();
}
bool dynSmagorinsky::read()
{
if (GenEddyVisc::read())
{
filter_.read(LESmodelProperties());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::dynSmagorinsky
Description
The Isochoric dynamic Smagorinsky Model for incompressible flows.
Algebraic eddy viscosity SGS model founded on the assumption that
local equilibrium prevails.
Thus,
@verbatim
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
k = cI*delta^2*||D||^2
nuSgs = cD*delta^2*||D||
nuEff = nuSgs + nu
In the dynamic version of the choric Smagorinsky model
the coefficients cI and cD are calculated during the simulation,
cI=<K*m>/<m*m>
and
cD=<L.M>/<M.M>,
where
K = 0.5*(F(U.U) - F(U).F(U))
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)))
@verbatim
SourceFiles
dynSmagorinsky.C
\*---------------------------------------------------------------------------*/
#ifndef dynSmagorinsky_H
#define dynSmagorinsky_H
#include "Smagorinsky.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class dynSmagorinsky Declaration
\*---------------------------------------------------------------------------*/
class dynSmagorinsky
:
public GenEddyVisc
{
// Private data
volScalarField k_;
autoPtr<LESfilter> filterPtr_;
LESfilter& filter_;
// Private Member Functions
//- Calculate coefficients cD, cI from filtering velocity field
dimensionedScalar cD(const volSymmTensorField& D) const;
dimensionedScalar cI(const volSymmTensorField& D) const;
// Disallow default bitwise copy construct and assignment
dynSmagorinsky(const dynSmagorinsky&);
dynSmagorinsky& operator=(const dynSmagorinsky&);
public:
//- Runtime type information
TypeName("dynSmagorinsky");
// Constructors
//- Constructor from components
dynSmagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~dynSmagorinsky();
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return k_;
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "laminar.H"
#include "addToRunTimeSelectionTable.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(laminar, 0);
addToRunTimeSelectionTable(LESmodel, laminar, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
laminar::laminar
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> laminar::k() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("k", sqr(U().dimensions()), 0.0)
)
);
}
tmp<volScalarField> laminar::epsilon() const
{
return 2*nu()*magSqr(symm(fvc::grad(U())));
}
tmp<volScalarField> laminar::nuSgs() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"nuSgs",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("nuSgs", nu().dimensions(), 0.0)
)
);
}
tmp<volScalarField> laminar::nuEff() const
{
return tmp<volScalarField>
(
new volScalarField("nuEff", nu())
);
}
tmp<volSymmTensorField> laminar::B() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"B",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedSymmTensor
(
"B", sqr(U().dimensions()), symmTensor::zero
)
)
);
}
tmp<volSymmTensorField> laminar::devBeff() const
{
return -nu()*dev(twoSymm(fvc::grad(U())));
}
tmp<fvVectorMatrix> laminar::divDevBeff(volVectorField& U) const
{
return
(
- fvm::laplacian(nu(), U) - fvc::div(nu()*dev(fvc::grad(U)().T()))
);
}
bool laminar::read()
{
return LESmodel::read();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::laminar
Description
LES model for laminar incompressible flow.
It simply returns laminar properties.
SourceFiles
laminar.C
\*---------------------------------------------------------------------------*/
#ifndef laminar_H
#define laminar_H
#include "LESmodel.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class laminar Declaration
\*---------------------------------------------------------------------------*/
class laminar
:
public LESmodel
{
// Private member functions
// Disallow default bitwise copy construct and assignment
laminar(const laminar&);
laminar& operator=(const laminar&);
public:
//- Runtime type information
TypeName("laminar");
// Constructors
//- Constructor from components
laminar
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~laminar()
{}
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const;
//- Return sub-grid disipation rate
tmp<volScalarField> epsilon() const;
//- Return SGS viscosity
tmp<volScalarField> nuSgs() const;
//- Return the effective viscosity
tmp<volScalarField> nuEff() const;
//- Return the sub-grid stress tensor B.
virtual tmp<volSymmTensorField> B() const;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devBeff() const;
//- Return the deviatoric part of the divergence of Beff
// i.e. the additional term in the filtered NSE.
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "locDynOneEqEddy.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(locDynOneEqEddy, 0);
addToRunTimeSelectionTable(LESmodel, locDynOneEqEddy, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
volScalarField locDynOneEqEddy::ck
(
const volSymmTensorField& D,
const volScalarField& KK
) const
{
volSymmTensorField LL =
simpleFilter_(dev(filter_(sqr(U())) - (sqr(filter_(U())))));
volSymmTensorField MM = simpleFilter_(-2.0*delta()*pow(KK, 0.5)*filter_(D));
volScalarField ck =
simpleFilter_(0.5*(LL && MM))
/(
simpleFilter_(magSqr(MM))
+ dimensionedScalar("small", sqr(MM.dimensions()), VSMALL)
);
return 0.5*(mag(ck) + ck);
}
volScalarField locDynOneEqEddy::ce
(
const volSymmTensorField& D,
const volScalarField& KK
) const
{
volScalarField ce =
simpleFilter_(nuEff()*(filter_(magSqr(D)) - magSqr(filter_(D))))
/simpleFilter_(pow(KK, 1.5)/(2.0*delta()));
return 0.5*(mag(ce) + ce);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
locDynOneEqEddy::locDynOneEqEddy
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
simpleFilter_(U.mesh()),
filterPtr_(LESfilter::New(U.mesh(), LESmodelProperties())),
filter_(filterPtr_())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
locDynOneEqEddy::~locDynOneEqEddy()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void locDynOneEqEddy::correct(const tmp<volTensorField>& gradU)
{
LESmodel::correct(gradU);
volSymmTensorField D = symm(gradU);
volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
KK.max(dimensionedScalar("small", KK.dimensions(), SMALL));
volScalarField P = 2.0*nuSgs_*magSqr(D);
solve
(
fvm::ddt(k_)
+ fvm::div(phi(), k_)
- fvm::laplacian(DkEff(), k_)
==
P
- fvm::Sp(ce(D, KK)*sqrt(k_)/delta(), k_)
);
bound(k_, k0());
nuSgs_ = ck(D, KK)*sqrt(k_)*delta();
nuSgs_.correctBoundaryConditions();
}
bool locDynOneEqEddy::read()
{
if (GenEddyVisc::read())
{
filter_.read(LESmodelProperties());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::locDynOneEqEddy
Description
Localised Dynamic One Equation Eddy Viscosity Model for incompressible
flows
Eddy viscosity SGS model using a modeled balance equation to simulate
the behaviour of k, hence
@verbatim
d/dt(k) + div(U*k) - div(nuSgs*grad(k))
=
-B*L - ce*rho*k^3/2/delta
and
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
nuSgs = cD*delta^2*||D||
nuEff = nuSgs + nu
@endverbatim
A dynamic procedure is here applied to evaluate ck and ce
@verbatim
ck=<L.M>/<M.M>
and
ce=<e*m>/<m*m>
where
K = 0.5*(F(U.U) - F(U).F(U))
L = (F(U*U) - F(U)*F(U) - 0.33*K*I)
M = delta*(F(sqrt(k)*D) - 2*sqrt(K + filter(k))*F(D))
m = pow(K + F(k), 3.0/2.0)/(2*delta) - F(pow(k, 3.0/2.0))/delta
e = 2*delta*ck*(F(sqrt(k)*(D && D)) - 2*sqrt(K + F(k))*(F(D) && F(D)))/
@endverbatim
SourceFiles
locDynOneEqEddy.C
\*---------------------------------------------------------------------------*/
#ifndef locDynOneEqEddy_H
#define locDynOneEqEddy_H
#include "GenEddyVisc.H"
#include "simpleFilter.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class locDynOneEqEddy Declaration
\*---------------------------------------------------------------------------*/
class locDynOneEqEddy
:
public GenEddyVisc
{
// Private data
volScalarField k_;
simpleFilter simpleFilter_;
autoPtr<LESfilter> filterPtr_;
LESfilter& filter_;
// Private Member Functions
//- Calculate ck, ce by filtering the velocity field U.
volScalarField ck
(
const volSymmTensorField&,
const volScalarField&
) const;
volScalarField ce
(
const volSymmTensorField&,
const volScalarField&
) const;
// Disallow default bitwise copy construct and assignment
locDynOneEqEddy(const locDynOneEqEddy&);
locDynOneEqEddy& operator=(const locDynOneEqEddy&);
public:
//- Runtime type information
TypeName("locDynOneEqEddy");
// Constructors
//- from components
locDynOneEqEddy
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~locDynOneEqEddy();
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return k_;
}
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", nuSgs_ + nu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,140 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "mixedSmagorinsky.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(mixedSmagorinsky, 0);
addToRunTimeSelectionTable(LESmodel, mixedSmagorinsky, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mixedSmagorinsky::mixedSmagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
scaleSimilarity(U, phi, transport),
Smagorinsky(U, phi, transport)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> mixedSmagorinsky::k() const
{
return
(
scaleSimilarity::k()
+ Smagorinsky::k()
);
}
tmp<volScalarField> mixedSmagorinsky::epsilon() const
{
return
(
scaleSimilarity::epsilon()
+ Smagorinsky::epsilon()
);
}
tmp<volSymmTensorField> mixedSmagorinsky::B() const
{
return
(
scaleSimilarity::B()
+ Smagorinsky::B()
);
}
tmp<volSymmTensorField> mixedSmagorinsky::devBeff() const
{
return
(
scaleSimilarity::devBeff()
+ Smagorinsky::devBeff()
);
}
tmp<fvVectorMatrix> mixedSmagorinsky::divDevBeff
(
volVectorField& U
) const
{
return
(
scaleSimilarity::divDevBeff(U)
+ Smagorinsky::divDevBeff(U)
);
}
void mixedSmagorinsky::correct(const tmp<volTensorField>& gradU)
{
scaleSimilarity::correct(gradU);
Smagorinsky::correct(gradU);
}
bool mixedSmagorinsky::read()
{
if (LESmodel::read())
{
scaleSimilarity::read();
Smagorinsky::read();
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,153 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::mixedSmagorinsky
Description
The mixed Isochoric Smagorinsky Model for incompressible flows.
The mixed model is a linear combination of an eddy viscosity model
(Smagorinsky) with a scale similarity model. Hence
@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*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.
SourceFiles
mixedSmagorinsky.C
\*---------------------------------------------------------------------------*/
#ifndef mixedSmagorinsky_H
#define mixedSmagorinsky_H
#include "scaleSimilarity.H"
#include "Smagorinsky.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class mixedSmagorinsky Declaration
\*---------------------------------------------------------------------------*/
class mixedSmagorinsky
:
public scaleSimilarity,
public Smagorinsky
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
mixedSmagorinsky(const mixedSmagorinsky&);
mixedSmagorinsky& operator=(const mixedSmagorinsky&);
public:
//- Runtime type information
TypeName("mixedSmagorinsky");
// Constructors
//- Constructor from components
mixedSmagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~mixedSmagorinsky()
{}
// Member Functions
//- Return the SGS turbulent kinetic energy.
tmp<volScalarField> k() const;
//- Return the SGS turbulent disipation rate.
tmp<volScalarField> epsilon() const;
//- Return the SGS viscosity.
tmp<volScalarField> nuSgs() const
{
return nuSgs_;
}
//- 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;
//- Implementation of div(B). This is necessary to override
// (and include) the div(B) terms from both the parent classes.
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "oneEqEddy.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(oneEqEddy, 0);
addToRunTimeSelectionTable(LESmodel, oneEqEddy, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
oneEqEddy::oneEqEddy
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
ck_(LESmodelProperties().lookup("ck"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void oneEqEddy::correct(const tmp<volTensorField>& gradU)
{
GenEddyVisc::correct(gradU);
volScalarField G = 2.0*nuSgs_*magSqr(symm(gradU));
solve
(
fvm::ddt(k_)
+ fvm::div(phi(), k_)
- fvm::laplacian(DkEff(), k_)
==
G
- fvm::Sp(ce_*sqrt(k_)/delta(), k_)
);
bound(k_, k0());
nuSgs_ = ck_*sqrt(k_)*delta();
nuSgs_.correctBoundaryConditions();
}
bool oneEqEddy::read()
{
if (GenEddyVisc::read())
{
LESmodelProperties().lookup("ck") >> ck_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,145 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::oneEqEddy
Description
One Equation Eddy Viscosity Model for incompressible flows
Eddy viscosity SGS model using a modeled balance equation to simulate the
behaviour of k, hence,
@verbatim
d/dt(k) + div(U*k) - div(nuEff*grad(k))
=
-B*L - ce*k^3/2/delta
and
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
D = symm(grad(U));
nuSgs = ck*sqrt(k)*delta
nuEff = nuSgs + nu
@endverbatim
SourceFiles
oneEqEddy.C
\*---------------------------------------------------------------------------*/
#ifndef oneEqEddy_H
#define oneEqEddy_H
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class oneEqEddy Declaration
\*---------------------------------------------------------------------------*/
class oneEqEddy
:
public GenEddyVisc
{
// Private data
volScalarField k_;
dimensionedScalar ck_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
oneEqEddy(const oneEqEddy&);
oneEqEddy& operator=(const oneEqEddy&);
public:
//- Runtime type information
TypeName("oneEqEddy");
// Constructors
//- Constructor from components
oneEqEddy
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~oneEqEddy()
{}
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const
{
return k_;
}
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", nuSgs_ + nu())
);
}
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "scaleSimilarity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(scaleSimilarity, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
scaleSimilarity::scaleSimilarity
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
filterPtr_(LESfilter::New(U.mesh(), LESmodelProperties())),
filter_(filterPtr_())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
scaleSimilarity::~scaleSimilarity()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> scaleSimilarity::k() const
{
return(0.5*(filter_(magSqr(U())) - magSqr(filter_(U()))));
}
tmp<volScalarField> scaleSimilarity::epsilon() const
{
volSymmTensorField D = symm(fvc::grad(U()));
return((filter_(sqr(U())) - sqr(filter_(U()))) && D);
}
tmp<volSymmTensorField> scaleSimilarity::B() const
{
return(filter_(sqr(U())) - sqr(filter_(U())));
}
tmp<volSymmTensorField> scaleSimilarity::devBeff() const
{
return dev(B());
}
tmp<fvVectorMatrix> scaleSimilarity::divDevBeff(volVectorField& U) const
{
return fvm::Su(fvc::div(devBeff()), U);
}
void scaleSimilarity::correct(const tmp<volTensorField>&)
{}
bool scaleSimilarity::read()
{
if (LESmodel::read())
{
filter_.read(LESmodelProperties());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,131 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::scaleSimilarity
Description
General base class for all scale similarity models
for incompressible flows.
Since such models do not work without additional eddy viscosity terms,
this class must be combined with an eddy viscosity model of some form.
SourceFiles
scaleSimilarity.C
\*---------------------------------------------------------------------------*/
#ifndef scaleSimilarity_H
#define scaleSimilarity_H
#include "LESmodel.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class scaleSimilarity Declaration
\*---------------------------------------------------------------------------*/
class scaleSimilarity
:
virtual public LESmodel
{
// Private data
autoPtr<LESfilter> filterPtr_;
LESfilter& filter_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
scaleSimilarity(const scaleSimilarity&);
scaleSimilarity& operator=(const scaleSimilarity&);
public:
//- Runtime type information
TypeName("scaleSimilarity");
// Constructors
//- Construct from components
scaleSimilarity
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~scaleSimilarity();
// Member Functions
//- Return the SGS turbulent kinetic energy.
tmp<volScalarField> k() const;
//- Return the SGS turbulent dissipation.
tmp<volScalarField> epsilon() const;
//- Return the sub-grid stress tensor.
tmp<volSymmTensorField> B() const;
//- Return the deviatoric part of the effective sub-grid
// turbulence stress tensor including the laminar stress
tmp<volSymmTensorField> devBeff() const;
//- Return the deviatoric part of the divergence of Beff
// i.e. the additional term in the filtered NSE.
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>&);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "spectEddyVisc.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(spectEddyVisc, 0);
addToRunTimeSelectionTable(LESmodel, spectEddyVisc, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
spectEddyVisc::spectEddyVisc
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESmodel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
cB_(LESmodelProperties().lookup("cB")),
cK1_(LESmodelProperties().lookup("cK1")),
cK2_(LESmodelProperties().lookup("cK2")),
cK3_(LESmodelProperties().lookup("cK3")),
cK4_(LESmodelProperties().lookup("cK4"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> spectEddyVisc::k() const
{
volScalarField Eps = 2*nuEff()*magSqr(symm(fvc::grad(U())));
return
cK1_*pow(delta(), 2.0/3.0)*pow(Eps, 2.0/3.0)
*exp(-cK2_*pow(delta(), -4.0/3.0)*nu()/pow(Eps, 1.0/3.0))
- cK3_*pow(Eps*nu(), 1.0/2.0)
*erfc(cK4_*pow(delta(), -2.0/3.0)*pow(Eps, -1.0/6.0));
}
void spectEddyVisc::correct(const tmp<volTensorField>& gradU)
{
GenEddyVisc::correct(gradU);
volScalarField Re = sqr(delta())*mag(symm(gradU))/nu();
for (label i=0; i<5; i++)
{
nuSgs_ =
nu()
/(
scalar(1)
- exp(-cB_*pow(nu()/(nuSgs_ + nu()), 1.0/3.0)*pow(Re, -2.0/3.0))
);
}
nuSgs_.correctBoundaryConditions();
}
bool spectEddyVisc::read()
{
if (GenEddyVisc::read())
{
LESmodelProperties().lookup("cB") >> cB_;
LESmodelProperties().lookup("cK1") >> cK1_;
LESmodelProperties().lookup("cK2") >> cK2_;
LESmodelProperties().lookup("cK3") >> cK3_;
LESmodelProperties().lookup("cK4") >> cK4_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::spectEddyVisc
Description
The Isochoric spectral Eddy Viscosity Model for incompressible flows.
Algebraic eddy viscosity SGS model founded on the assumption that
local equilibrium prevail and that viscous effects may be of importance.
Thus,
@verbatim
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
k = cK1*delta^(2/3)*eps^(2/3)*exp(-cK2*delta^(4/3)*nu*eps^(-1/3)) -
ck3*sqrt(eps*nu)*erfc(ck4*delta^(-2/3)*sqrt(nu)*eps^(-1/6)))
nuEff = nu/(1 - exp(-cB*pow((nu/nuEff), 1.0/3.0)*pow(Re, -2.0/3.0)))
nuSgs = nuEff - nu
Re = delta^2*mag(D)/nu
@endverbatim
SourceFiles
spectEddyVisc.C
\*---------------------------------------------------------------------------*/
#ifndef spectEddyVisc_H
#define spectEddyVisc_H
#include "GenEddyVisc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class spectEddyVisc Declaration
\*---------------------------------------------------------------------------*/
class spectEddyVisc
:
public GenEddyVisc
{
// Private data
dimensionedScalar cB_;
dimensionedScalar cK1_;
dimensionedScalar cK2_;
dimensionedScalar cK3_;
dimensionedScalar cK4_;
// Private Member Functions
// Disallow default bitwise copy construct and assignment
spectEddyVisc(const spectEddyVisc&);
spectEddyVisc& operator=(const spectEddyVisc&);
public:
//- Runtime type information
TypeName("spectEddyVisc");
// Constructors
// from components
spectEddyVisc
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
// Destructor
~spectEddyVisc()
{}
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k() const;
//- Correct Eddy-Viscosity and related properties
void correct(const tmp<volTensorField>&);
//- Read turbulenceProperties dictionary
bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "vanDriestDelta.H"
#include "LESmodel.H"
#include "wallFvPatch.H"
#include "wallDistData.H"
#include "wallPointYPlus.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(vanDriestDelta, 0);
addToRunTimeSelectionTable(LESdelta, vanDriestDelta, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void vanDriestDelta::calcDelta()
{
const LESmodel& sgsModel
= mesh_.lookupObject<LESmodel>("turbulenceProperties");
const volVectorField& U = sgsModel.U();
const volScalarField& nu = sgsModel.nu();
tmp<volScalarField> nuSgs = sgsModel.nuSgs();
volScalarField ystar
(
IOobject
(
"ystar",
mesh_.time().constant(),
mesh_
),
mesh_,
dimensionedScalar("ystar", dimLength, GREAT)
);
const fvPatchList& patches = mesh_.boundary();
forAll(patches, patchi)
{
if (isType<wallFvPatch>(patches[patchi]))
{
const fvPatchVectorField& Uw = U.boundaryField()[patchi];
const scalarField& nuw = nu.boundaryField()[patchi];
const scalarField& nuSgsw = nuSgs().boundaryField()[patchi];
ystar.boundaryField()[patchi] =
nuw/sqrt((nuw + nuSgsw)*mag(Uw.snGrad()) + VSMALL);
}
}
wallPointYPlus::yPlusCutOff = 500;
wallDistData<wallPointYPlus> y(mesh_, ystar);
delta_ = min
(
static_cast<const volScalarField&>(geometricDelta_()),
(kappa_/Cdelta_)*((scalar(1) + SMALL) - exp(-y/ystar/Aplus_))*y
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
vanDriestDelta::vanDriestDelta
(
const word& name,
const fvMesh& mesh,
const dictionary& dd
)
:
LESdelta(name, mesh),
geometricDelta_
(
LESdelta::New("geometricDelta", mesh, dd.subDict(type() + "Coeffs"))
),
kappa_(dimensionedScalar(dd.lookup("kappa")).value()),
Aplus_
(
dimensionedScalar(dd.subDict(type() + "Coeffs").lookup("Aplus")).value()
),
Cdelta_
(
dimensionedScalar(dd.subDict(type() + "Coeffs").lookup("Cdelta"))
.value()
)
{
delta_ = geometricDelta_();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void vanDriestDelta::read(const dictionary& d)
{
const dictionary& dd(d.subDict(type() + "Coeffs"));
geometricDelta_().read(dd);
kappa_ = dimensionedScalar(d.lookup("kappa")).value();
Aplus_ = dimensionedScalar(dd.lookup("Aplus")).value();
Cdelta_ = dimensionedScalar(dd.lookup("Cdelta")).value();
calcDelta();
}
void vanDriestDelta::correct()
{
geometricDelta_().correct();
calcDelta();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::vanDriestDelta
Description
Simple cube-root of cell volume delta used in incompressible LES models.
SourceFiles
vanDriestDelta.C
\*---------------------------------------------------------------------------*/
#ifndef vanDriestDelta_H
#define vanDriestDelta_H
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class vanDriestDelta Declaration
\*---------------------------------------------------------------------------*/
class vanDriestDelta
:
public LESdelta
{
// Private data
autoPtr<LESdelta> geometricDelta_;
scalar kappa_;
scalar Aplus_;
scalar Cdelta_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
vanDriestDelta(const vanDriestDelta&);
void operator=(const vanDriestDelta&);
// Calculate the delta values
void calcDelta();
public:
//- Runtime type information
TypeName("vanDriest");
// Constructors
//- from name, mesh and IOdictionary
vanDriestDelta(const word& name, const fvMesh& mesh, const dictionary&);
// Destructor
~vanDriestDelta()
{}
// Member Functions
//- Read the LESdelta dictionary
void read(const dictionary&);
// Correct values
void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "nuSgsWallFunctionFvPatchScalarField.H"
#include "LESmodel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{}
nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nuSgsWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const LESmodel& sgsModel
= db().lookupObject<LESmodel>("turbulenceProperties");
scalar kappa = dimensionedScalar(sgsModel.lookup("kappa")).value();
scalar E = dimensionedScalar
(
sgsModel.subDict("wallFunctionCoeffs").lookup("E")
).value();
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField magUp = mag(U.patchInternalField() - U);
const scalarField& nuw =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField& nuSgsw = *this;
scalarField magFaceGradU = mag(U.snGrad());
forAll(nuSgsw, facei)
{
scalar magUpara = magUp[facei];
scalar utau = sqrt((nuSgsw[facei] + nuw[facei])*magFaceGradU[facei]);
if(utau > VSMALL)
{
int iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa*magUpara/utau, 100);
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
- utau/(ry[facei]*nuw[facei])
+ magUpara/utau
+ 1/E*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
- 1.0/(ry[facei]*nuw[facei])
- magUpara/sqr(utau)
- 1/E*kUu*fkUu/utau;
scalar utauNew = utau - f/df;
err = mag((utau - utauNew)/utau);
utau = utauNew;
} while (utau > VSMALL && err > 0.01 && ++iter < 10);
nuSgsw[facei] =
max(sqr(max(utau, 0))/magFaceGradU[facei] - nuw[facei], 0.0);
}
else
{
nuSgsw[facei] = 0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nuSgsWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::LESmodels::nuSgsWallFunctionFvPatchScalarField
Description
wall function boundary condition for incompressible flows
SourceFiles
nuSgsWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nuSgsWallFunctionFvPatchScalarField_H
#define nuSgsWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESmodels
{
/*---------------------------------------------------------------------------*\
Class nuSgsWallFunctionFvPatch Declaration
\*---------------------------------------------------------------------------*/
class nuSgsWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
public:
//- Runtime type information
TypeName("nuSgsWallFunction");
// Constructors
//- Construct from patch and internal field
nuSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nuSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given nuSgsWallFunctionFvPatchScalarField
// onto a new patch
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nuSgsWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new nuSgsWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESmodels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
wmake libso ParMGridGen-1.0/MGridGen/IMlib
wmake libso ParMGridGen-1.0/MGridGen/Lib
wmake libso MGridGenGAMGAgglomeration

View File

@ -0,0 +1,164 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Agglomerate one level using the MGridGen algorithm.
\*---------------------------------------------------------------------------*/
#include "MGridGenGAMGAgglomeration.H"
#include "fvMesh.H"
#include "syncTools.H"
extern "C"
{
# include "mgridgen.h"
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::MGridGenGAMGAgglomeration::
makeCompactCellFaceAddressingAndFaceWeights
(
const lduAddressing& fineAddressing,
labelList& cellCells,
labelList& cellCellOffsets,
const vectorField& Si,
List<scalar>& faceWeights
)
{
const label nFineCells = fineAddressing.size();
const label nFineFaces = fineAddressing.upperAddr().size();
const unallocLabelList& upperAddr = fineAddressing.upperAddr();
const unallocLabelList& lowerAddr = fineAddressing.lowerAddr();
// Number of neighbours for each cell
labelList nNbrs(nFineCells, 0);
forAll (upperAddr, facei)
{
nNbrs[upperAddr[facei]]++;
}
forAll (lowerAddr, facei)
{
nNbrs[lowerAddr[facei]]++;
}
// Set the sizes of the addressing and faceWeights arrays
cellCellOffsets.setSize(nFineCells + 1);
cellCells.setSize(2*nFineFaces);
faceWeights.setSize(2*nFineFaces);
cellCellOffsets[0] = 0;
forAll (nNbrs, celli)
{
cellCellOffsets[celli+1] = cellCellOffsets[celli] + nNbrs[celli];
}
// reset the whole list to use as counter
nNbrs = 0;
forAll (upperAddr, facei)
{
label own = upperAddr[facei];
label nei = lowerAddr[facei];
label l1 = cellCellOffsets[own] + nNbrs[own]++;
label l2 = cellCellOffsets[nei] + nNbrs[nei]++;
cellCells[l1] = nei;
cellCells[l2] = own;
faceWeights[l1] = mag(Si[facei]);
faceWeights[l2] = mag(Si[facei]);
}
}
Foam::tmp<Foam::labelField> Foam::MGridGenGAMGAgglomeration::agglomerate
(
label& nCoarseCells,
const label minSize,
const label maxSize,
const lduAddressing& fineAddressing,
const scalarField& V,
const vectorField& Sf,
const scalarField& Sb
)
{
const label nFineCells = fineAddressing.size();
// Compact addressing for cellCells
labelList cellCells;
labelList cellCellOffsets;
// Face weights = face areas of the internal faces
List<scalar> faceWeights;
// Create the compact addressing for cellCells and faceWeights
makeCompactCellFaceAddressingAndFaceWeights
(
fineAddressing,
cellCells,
cellCellOffsets,
Sf,
faceWeights
);
// agglomeration options.
labelList options(4, 0);
options[0] = 4; // globular agglom
options[1] = 6; // objective F3 and F2
options[2] = 128; // debugging output level
options[3] = fvMesh_.nGeometricD(); // Dimensionality of the grid
// output: cell -> processor addressing
tmp<labelField> tfinalAgglom(new labelField(nFineCells));
label nMoves = -1;
MGridGen
(
nFineCells,
cellCellOffsets.begin(),
const_cast<scalar*>(V.begin()),
const_cast<scalar*>(Sb.begin()),
cellCells.begin(),
faceWeights.begin(),
minSize,
maxSize,
options.begin(),
&nMoves,
&nCoarseCells,
tfinalAgglom->begin()
);
return tfinalAgglom;
}
// ************************************************************************* //

View File

@ -0,0 +1,191 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "MGridGenGAMGAgglomeration.H"
#include "fvMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(MGridGenGAMGAgglomeration, 0);
addToRunTimeSelectionTable
(
GAMGAgglomeration,
MGridGenGAMGAgglomeration,
lduMesh
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
(
const lduMesh& mesh,
const dictionary& controlDict
)
:
GAMGAgglomeration(mesh, controlDict),
fvMesh_(refCast<const fvMesh>(mesh))
{
// Min, max size of agglomerated cells
label minSize(readLabel(controlDict.lookup("minSize")));
label maxSize(readLabel(controlDict.lookup("maxSize")));
// Get the finest-level interfaces from the mesh
interfaceLevels_.set
(
0,
new lduInterfacePtrsList(fvMesh_.boundary().interfaces())
);
// Start geometric agglomeration from the cell volumes and areas of the mesh
scalarField* VPtr = const_cast<scalarField*>(&fvMesh_.cellVolumes());
vectorField* SfPtr = const_cast<vectorField*>(&fvMesh_.faceAreas());
// Create the boundary area cell field
scalarField* SbPtr(new scalarField(fvMesh_.nCells(), 0));
{
scalarField& Sb = *SbPtr;
const labelList& own = fvMesh_.faceOwner();
const vectorField& Sf = fvMesh_.faceAreas();
forAll(Sf, facei)
{
if (!fvMesh_.isInternalFace(facei))
{
Sb[own[facei]] += mag(Sf[facei]);
}
}
}
// Agglomerate until the required number of cells in the coarsest level
// is reached
label nCreatedLevels = 0;
while (nCreatedLevels < maxLevels_ - 1)
{
label nCoarseCells = -1;
tmp<labelField> finalAgglomPtr = agglomerate
(
nCoarseCells,
minSize,
maxSize,
meshLevel(nCreatedLevels).lduAddr(),
*VPtr,
*SfPtr,
*SbPtr
);
if (continueAgglomerating(nCoarseCells))
{
nCells_[nCreatedLevels] = nCoarseCells;
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
}
else
{
break;
}
agglomerateLduAddressing(nCreatedLevels);
// Agglomerate the cell volumes field for the next level
{
scalarField* aggVPtr
(
new scalarField(meshLevels_[nCreatedLevels].size())
);
restrictField(*aggVPtr, *VPtr, nCreatedLevels);
if (nCreatedLevels)
{
delete VPtr;
}
VPtr = aggVPtr;
}
// Agglomerate the face areas field for the next level
{
vectorField* aggSfPtr
(
new vectorField
(
meshLevels_[nCreatedLevels].upperAddr().size(),
vector::zero
)
);
restrictFaceField(*aggSfPtr, *SfPtr, nCreatedLevels);
if (nCreatedLevels)
{
delete SfPtr;
}
SfPtr = aggSfPtr;
}
// Agglomerate the cell boundary areas field for the next level
{
scalarField* aggSbPtr
(
new scalarField(meshLevels_[nCreatedLevels].size())
);
restrictField(*aggSbPtr, *SbPtr, nCreatedLevels);
delete SbPtr;
SbPtr = aggSbPtr;
}
nCreatedLevels++;
}
// Shrink the storage of the levels to those created
compactLevels(nCreatedLevels);
// Delete temporary geometry storage
if (nCreatedLevels)
{
delete VPtr;
delete SfPtr;
}
delete SbPtr;
}
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::MGridGenGAMGAgglomeration
Description
Agglomerate using the MGridGen algorithm.
SourceFiles
MGridGenGAMGAgglomeration.C
MGridGenGAMGAgglomerate.C
\*---------------------------------------------------------------------------*/
#ifndef MGridGenGAMGAgglomeration_H
#define MGridGenGAMGAgglomeration_H
#include "GAMGAgglomeration.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class MGridGenGAMGAgglomeration Declaration
\*---------------------------------------------------------------------------*/
class MGridGenGAMGAgglomeration
:
public GAMGAgglomeration
{
// Private data
const fvMesh& fvMesh_;
// Private Member Functions
//- Construct the CSR format addressing
void makeCompactCellFaceAddressingAndFaceWeights
(
const lduAddressing& fineAddressing,
labelList& cellCells,
labelList& cellCellOffsets,
const vectorField& Si,
List<scalar>& faceWeights
);
//- Calculate and return agglomeration
tmp<labelField> agglomerate
(
label& nCoarseCells,
const label minSize,
const label maxSize,
const lduAddressing& fineAddressing,
const scalarField& V,
const vectorField& Sf,
const scalarField& Sb
);
//- Disallow default bitwise copy construct
MGridGenGAMGAgglomeration(const MGridGenGAMGAgglomeration&);
//- Disallow default bitwise assignment
void operator=(const MGridGenGAMGAgglomeration&);
public:
//- Runtime type information
TypeName("MGridGen");
// Constructors
//- Construct given mesh and controls
MGridGenGAMGAgglomeration
(
const lduMesh& mesh,
const dictionary& controlDict
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,4 @@
MGridGenGAMGAgglomeration.C
MGridGenGAMGAgglomerate.C
LIB = $(FOAM_LIBBIN)/libMGridGenGAMGAgglomeration

View File

@ -0,0 +1,15 @@
ParMGridGen = $(LIB_SRC)/MGridGenGamgAgglomeration/ParMGridGen-1.0
TYPE_REAL=
#if defined(SP)
TYPE_REAL=-DTYPE_REAL
#endif
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(ParMGridGen)/MGridGen/Lib/lnInclude \
-I$(ParMGridGen)/MGridGen/IMlib/lnInclude \
$(TYPE_REAL)
LIB_LIBS = \
-lMGridGen

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
The distribution of PARMGRIDGEN consists of a number of files arranged in four
directories. The files contained in each directory are as follows:
Doc/ Contains PARMGRIDGEN's user manual
Graphs/ Contains some small sample meshes that can be used with
the stand-alone programs of MGRIDGEN and PARMGRIDGEN
MGridGen/ Contains the serial library
ParMGridGen/ Contains the parallel library
mgridgen Stand-alone serial program
parmgridgen Stand-alone parallel program
The distribution of MGRIDGEN consists of a number of files arranged in three
directories. The files contained in each directory are as follows:
IMlib/ Contains some auxiliary routines
Lib/ Contains the code for MGRIDGEN's library
Programs/ Contains a comprehensive tester for MGRIDGEN's routines
The distribution of PARMGRIDGEN consists of a number of files arranged in three
directories. The files contained in each directory are as follows:
IMParMetis-2.0/ Contains some auxiliary routins from ParMetis-2.0, modified
so as to fit our data types.
ParLib/ Contains the code for MGRIDGEN's library
Programs/ Contains a comprehensive tester for PARMGRIDGEN's routines

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More