mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/hunt2/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -34,9 +34,6 @@ Description
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "incompressible/LESModel/LESModel.H"
|
||||
#include "IFstream.H"
|
||||
#include "OFstream.H"
|
||||
#include "Random.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -251,6 +251,8 @@ $(snGradSchemes)/snGradScheme/snGradSchemes.C
|
||||
$(snGradSchemes)/correctedSnGrad/correctedSnGrads.C
|
||||
$(snGradSchemes)/limitedSnGrad/limitedSnGrads.C
|
||||
$(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C
|
||||
$(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGradData.C
|
||||
$(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGrads.C
|
||||
|
||||
convectionSchemes = finiteVolume/convectionSchemes
|
||||
$(convectionSchemes)/convectionScheme/convectionSchemes.C
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
quadraticFitSnGrad
|
||||
|
||||
Description
|
||||
Simple central-difference snGrad scheme with quadratic fit correction from
|
||||
a larger stencil.
|
||||
|
||||
SourceFiles
|
||||
quadraticFitSnGrad.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef quadraticFitSnGrad_H
|
||||
#define quadraticFitSnGrad_H
|
||||
|
||||
#include "snGradScheme.H"
|
||||
#include "quadraticFitSnGradData.H"
|
||||
#include "extendedStencil.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class quadraticFitSnGrad Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class quadraticFitSnGrad
|
||||
:
|
||||
public snGradScheme<Type>
|
||||
{
|
||||
// Private Data
|
||||
//- weights for central stencil
|
||||
const scalar centralWeight_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const quadraticFitSnGrad&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("quadraticFit");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and scheme data
|
||||
quadraticFitSnGrad
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const scalar centralWeight
|
||||
)
|
||||
:
|
||||
snGradScheme<Type>(mesh),
|
||||
centralWeight_(centralWeight)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from mesh and data stream
|
||||
quadraticFitSnGrad(const fvMesh& mesh, Istream& is)
|
||||
:
|
||||
snGradScheme<Type>(mesh),
|
||||
centralWeight_(readScalar(is))
|
||||
{}
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~quadraticFitSnGrad() {}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the interpolation weighting factors for the given field
|
||||
virtual tmp<surfaceScalarField> deltaCoeffs
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) const
|
||||
{
|
||||
return this->mesh().deltaCoeffs();
|
||||
}
|
||||
|
||||
//- Return true if this scheme uses an explicit correction
|
||||
virtual bool corrected() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return the explicit correction to the quadraticFitSnGrad
|
||||
// for the given field
|
||||
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||
correction(const GeometricField<Type, fvPatchField, volMesh>& vf) const
|
||||
{
|
||||
const fvMesh& mesh = this->mesh();
|
||||
|
||||
const quadraticFitSnGradData& qfd = quadraticFitSnGradData::New
|
||||
(
|
||||
mesh,
|
||||
centralWeight_
|
||||
);
|
||||
|
||||
const extendedStencil& stencil = qfd.stencil();
|
||||
const List<scalarList>& f = qfd.fit();
|
||||
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > sft
|
||||
= stencil.weightedSum(vf, f);
|
||||
|
||||
sft().dimensions() /= dimLength;
|
||||
|
||||
return sft;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,325 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "quadraticFitSnGradData.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
#include "SVD.H"
|
||||
#include "syncTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(quadraticFitSnGradData, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::quadraticFitSnGradData::quadraticFitSnGradData
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const scalar cWeight
|
||||
)
|
||||
:
|
||||
MeshObject<fvMesh, quadraticFitSnGradData>(mesh),
|
||||
centralWeight_(cWeight),
|
||||
#ifdef SPHERICAL_GEOMETRY
|
||||
dim_(2),
|
||||
#else
|
||||
dim_(mesh.nGeometricD()),
|
||||
#endif
|
||||
minSize_
|
||||
(
|
||||
dim_ == 1 ? 3 :
|
||||
dim_ == 2 ? 6 :
|
||||
dim_ == 3 ? 9 : 0
|
||||
),
|
||||
stencil_(mesh),
|
||||
fit_(mesh.nInternalFaces())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info << "Contructing quadraticFitSnGradData" << endl;
|
||||
}
|
||||
|
||||
// check input
|
||||
if (centralWeight_ < 1 - SMALL)
|
||||
{
|
||||
FatalErrorIn("quadraticFitSnGradData::quadraticFitSnGradData")
|
||||
<< "centralWeight requested = " << centralWeight_
|
||||
<< " should not be less than one"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (minSize_ == 0)
|
||||
{
|
||||
FatalErrorIn("quadraticFitSnGradData")
|
||||
<< " dimension must be 1,2 or 3, not" << dim_ << exit(FatalError);
|
||||
}
|
||||
|
||||
// store the polynomial size for each face to write out
|
||||
surfaceScalarField snGradPolySize
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"quadraticFitSnGradPolySize",
|
||||
"constant",
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("quadraticFitSnGradPolySize", dimless, scalar(0))
|
||||
);
|
||||
|
||||
// Get the cell/face centres in stencil order.
|
||||
// Centred face stencils no good for triangles of tets. Need bigger stencils
|
||||
List<List<point> > stencilPoints(stencil_.stencil().size());
|
||||
stencil_.collectData
|
||||
(
|
||||
mesh.C(),
|
||||
stencilPoints
|
||||
);
|
||||
|
||||
// find the fit coefficients for every face in the mesh
|
||||
|
||||
for(label faci = 0; faci < mesh.nInternalFaces(); faci++)
|
||||
{
|
||||
snGradPolySize[faci] = calcFit(stencilPoints[faci], faci);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
snGradPolySize.write();
|
||||
Info<< "quadraticFitSnGradData::quadraticFitSnGradData() :"
|
||||
<< "Finished constructing polynomialFit data"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::quadraticFitSnGradData::findFaceDirs
|
||||
(
|
||||
vector& idir, // value changed in return
|
||||
vector& jdir, // value changed in return
|
||||
vector& kdir, // value changed in return
|
||||
const fvMesh& mesh,
|
||||
const label faci
|
||||
)
|
||||
{
|
||||
idir = mesh.Sf()[faci];
|
||||
idir /= mag(idir);
|
||||
|
||||
#ifndef SPHERICAL_GEOMETRY
|
||||
if (mesh.nGeometricD() <= 2) // find the normal direcion
|
||||
{
|
||||
if (mesh.directions()[0] == -1)
|
||||
{
|
||||
kdir = vector(1, 0, 0);
|
||||
}
|
||||
else if (mesh.directions()[1] == -1)
|
||||
{
|
||||
kdir = vector(0, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
kdir = vector(0, 0, 1);
|
||||
}
|
||||
}
|
||||
else // 3D so find a direction in the place of the face
|
||||
{
|
||||
const face& f = mesh.faces()[faci];
|
||||
kdir = mesh.points()[f[0]] - mesh.points()[f[1]];
|
||||
}
|
||||
#else
|
||||
// Spherical geometry so kdir is the radial direction
|
||||
kdir = mesh.Cf()[faci];
|
||||
#endif
|
||||
|
||||
if (mesh.nGeometricD() == 3)
|
||||
{
|
||||
// Remove the idir component from kdir and normalise
|
||||
kdir -= (idir & kdir)*idir;
|
||||
|
||||
scalar magk = mag(kdir);
|
||||
|
||||
if (magk < SMALL)
|
||||
{
|
||||
FatalErrorIn("findFaceDirs") << " calculated kdir = zero"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
kdir /= magk;
|
||||
}
|
||||
}
|
||||
|
||||
jdir = kdir ^ idir;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::quadraticFitSnGradData::calcFit
|
||||
(
|
||||
const List<point>& C,
|
||||
const label faci
|
||||
)
|
||||
{
|
||||
vector idir(1,0,0);
|
||||
vector jdir(0,1,0);
|
||||
vector kdir(0,0,1);
|
||||
findFaceDirs(idir, jdir, kdir, mesh(), faci);
|
||||
|
||||
scalarList wts(C.size(), scalar(1));
|
||||
wts[0] = centralWeight_;
|
||||
wts[1] = centralWeight_;
|
||||
|
||||
point p0 = mesh().faceCentres()[faci];
|
||||
scalar scale = 0;
|
||||
|
||||
// calculate the matrix of the polynomial components
|
||||
scalarRectangularMatrix B(C.size(), minSize_, scalar(0));
|
||||
|
||||
for(label ip = 0; ip < C.size(); ip++)
|
||||
{
|
||||
const point& p = C[ip];
|
||||
|
||||
scalar px = (p - p0)&idir;
|
||||
scalar py = (p - p0)&jdir;
|
||||
#ifdef SPHERICAL_GEOMETRY
|
||||
scalar pz = mag(p) - mag(p0);
|
||||
#else
|
||||
scalar pz = (p - p0)&kdir;
|
||||
#endif
|
||||
|
||||
if (ip == 0) scale = max(max(mag(px), mag(py)), mag(pz));
|
||||
|
||||
px /= scale;
|
||||
py /= scale;
|
||||
pz /= scale;
|
||||
|
||||
label is = 0;
|
||||
|
||||
B[ip][is++] = wts[0]*wts[ip];
|
||||
B[ip][is++] = wts[0]*wts[ip]*px;
|
||||
B[ip][is++] = wts[ip]*sqr(px);
|
||||
|
||||
if (dim_ >= 2)
|
||||
{
|
||||
B[ip][is++] = wts[ip]*py;
|
||||
B[ip][is++] = wts[ip]*px*py;
|
||||
B[ip][is++] = wts[ip]*sqr(py);
|
||||
}
|
||||
if (dim_ == 3)
|
||||
{
|
||||
B[ip][is++] = wts[ip]*pz;
|
||||
B[ip][is++] = wts[ip]*px*pz;
|
||||
//B[ip][is++] = wts[ip]*py*pz;
|
||||
B[ip][is++] = wts[ip]*sqr(pz);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the fit
|
||||
label stencilSize = C.size();
|
||||
fit_[faci].setSize(stencilSize);
|
||||
scalarList singVals(minSize_);
|
||||
label nSVDzeros = 0;
|
||||
|
||||
const scalar& deltaCoeff = mesh().deltaCoeffs()[faci];
|
||||
|
||||
bool goodFit = false;
|
||||
for(int iIt = 0; iIt < 10 && !goodFit; iIt++)
|
||||
{
|
||||
SVD svd(B, SMALL);
|
||||
|
||||
scalar fit0 = wts[0]*wts[0]*svd.VSinvUt()[1][0]/scale;
|
||||
scalar fit1 = wts[0]*wts[1]*svd.VSinvUt()[1][1]/scale;
|
||||
|
||||
goodFit =
|
||||
fit0 < 0 && fit1 > 0
|
||||
&& mag(fit0 + deltaCoeff) < 0.5*deltaCoeff
|
||||
&& mag(fit1 - deltaCoeff) < 0.5*deltaCoeff;
|
||||
|
||||
if (goodFit)
|
||||
{
|
||||
fit_[faci][0] = fit0;
|
||||
fit_[faci][1] = fit1;
|
||||
for(label i = 2; i < stencilSize; i++)
|
||||
{
|
||||
fit_[faci][i] = wts[0]*wts[i]*svd.VSinvUt()[1][i]/scale;
|
||||
}
|
||||
singVals = svd.S();
|
||||
nSVDzeros = svd.nZeros();
|
||||
}
|
||||
else // (not good fit so increase weight in the centre and for linear)
|
||||
{
|
||||
wts[0] *= 10;
|
||||
wts[1] *= 10;
|
||||
|
||||
for(label i = 0; i < B.n(); i++)
|
||||
{
|
||||
B[i][0] *= 10;
|
||||
B[i][1] *= 10;
|
||||
}
|
||||
|
||||
for(label j = 0; j < B.m(); j++)
|
||||
{
|
||||
B[0][j] *= 10;
|
||||
B[1][j] *= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (goodFit)
|
||||
{
|
||||
// remove the uncorrected snGradScheme coefficients
|
||||
fit_[faci][0] += deltaCoeff;
|
||||
fit_[faci][1] -= deltaCoeff;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< "quadratifFitSnGradData could not fit face " << faci
|
||||
<< " fit_[faci][0] = " << fit_[faci][0]
|
||||
<< " fit_[faci][1] = " << fit_[faci][1]
|
||||
<< " deltaCoeff = " << deltaCoeff << endl;
|
||||
fit_[faci] = 0;
|
||||
}
|
||||
|
||||
return minSize_ - nSVDzeros;
|
||||
}
|
||||
|
||||
bool Foam::quadraticFitSnGradData::movePoints()
|
||||
{
|
||||
notImplemented("quadraticFitSnGradData::movePoints()");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
quadraticFitSnGradData
|
||||
|
||||
Description
|
||||
Data for the quadratic fit correction snGrad scheme
|
||||
|
||||
SourceFiles
|
||||
quadraticFitSnGradData.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef quadraticFitSnGradData_H
|
||||
#define quadraticFitSnGradData_H
|
||||
|
||||
#include "MeshObject.H"
|
||||
#include "fvMesh.H"
|
||||
#include "extendedStencil.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class quadraticFitSnGradData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class quadraticFitSnGradData
|
||||
:
|
||||
public MeshObject<fvMesh, quadraticFitSnGradData>
|
||||
{
|
||||
// Private data
|
||||
|
||||
const scalar centralWeight_;
|
||||
const label dim_;
|
||||
|
||||
//- minimum stencil size
|
||||
const label minSize_;
|
||||
|
||||
//- Extended stencil addressing
|
||||
extendedStencil stencil_;
|
||||
|
||||
//- For each cell in the mesh store the values which multiply the
|
||||
// values of the stencil to obtain the gradient for each direction
|
||||
List<scalarList> fit_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Find the normal direction and i, j and k directions for face faci
|
||||
static void findFaceDirs
|
||||
(
|
||||
vector& idir, // value changed in return
|
||||
vector& jdir, // value changed in return
|
||||
vector& kdir, // value changed in return
|
||||
const fvMesh& mesh,
|
||||
const label faci
|
||||
);
|
||||
|
||||
label calcFit(const List<point>&, const label faci);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
TypeName("quadraticFitSnGradData");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
explicit quadraticFitSnGradData
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const scalar cWeight
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~quadraticFitSnGradData()
|
||||
{};
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return reference to the stencil
|
||||
const extendedStencil& stencil() const
|
||||
{
|
||||
return stencil_;
|
||||
}
|
||||
|
||||
//- Return reference to fit coefficients
|
||||
const List<scalarList>& fit() const { return fit_; }
|
||||
|
||||
//- Delete the data when the mesh moves not implemented
|
||||
virtual bool movePoints();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
Simple central-difference snGrad scheme with quadratic fit correction from
|
||||
a larger stencil.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "quadraticFitSnGrad.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
makeSnGradScheme(quadraticFitSnGrad)
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -123,9 +123,9 @@ public:
|
||||
List<List<T> >& stencilFld
|
||||
) const;
|
||||
|
||||
//- Given weights interpolate vol field
|
||||
//- Calculate weighted sum of vol field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > interpolate
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > weightedSum
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||
const List<List<scalar> >& stencilWeights
|
||||
|
||||
@ -77,7 +77,7 @@ void Foam::extendedStencil::collectData
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
|
||||
Foam::extendedStencil::interpolate
|
||||
Foam::extendedStencil::weightedSum
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||
const List<List<scalar> >& stencilWeights
|
||||
@ -120,7 +120,34 @@ Foam::extendedStencil::interpolate
|
||||
sf[faceI] += stField[i]*stWeight[i];
|
||||
}
|
||||
}
|
||||
// And what for boundaries?
|
||||
|
||||
// Coupled boundaries
|
||||
/*
|
||||
typename GeometricField<Type, fvsPatchField, surfaceMesh>::
|
||||
GeometricBoundaryField& bSfCorr = sf.boundaryField();
|
||||
forAll(bSfCorr, patchi)
|
||||
{
|
||||
fvsPatchField<Type>& pSfCorr = bSfCorr[patchi];
|
||||
|
||||
if (pSfCorr.coupled())
|
||||
{
|
||||
label faceI = pSfCorr.patch().patch().start();
|
||||
|
||||
forAll(pSfCorr, i)
|
||||
{
|
||||
const List<Type>& stField = stencilFld[faceI];
|
||||
const List<scalar>& stWeight = stencilWeights[faceI];
|
||||
|
||||
forAll(stField, j)
|
||||
{
|
||||
pSfCorr[i] += stField[j]*stWeight[j];
|
||||
}
|
||||
|
||||
faceI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return tsfCorr;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
const extendedStencil& stencil = cfd.stencil();
|
||||
const List<scalarList>& f = cfd.fit();
|
||||
|
||||
return stencil.interpolate(vf, f);
|
||||
return stencil.weightedSum(vf, f);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
static int count = 0;
|
||||
|
||||
Foam::quadraticFitData::quadraticFitData
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
@ -113,12 +115,16 @@ Foam::quadraticFitData::quadraticFitData
|
||||
{
|
||||
interpPolySize[faci] = calcFit(stencilPoints[faci], faci);
|
||||
}
|
||||
interpPolySize.write();
|
||||
|
||||
Pout<< "count = " << count << endl;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "quadraticFitData::quadraticFitData() :"
|
||||
<< "Finished constructing polynomialFit data"
|
||||
<< endl;
|
||||
|
||||
interpPolySize.write();
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +212,7 @@ Foam::label Foam::quadraticFitData::calcFit
|
||||
// calculate the matrix of the polynomial components
|
||||
scalarRectangularMatrix B(C.size(), minSize_, scalar(0));
|
||||
|
||||
for(label ip = 0; ip < C.size(); ip++)
|
||||
for(label ip = 0; ip < C.size(); ip++)
|
||||
{
|
||||
const point& p = C[ip];
|
||||
|
||||
@ -228,6 +234,7 @@ Foam::label Foam::quadraticFitData::calcFit
|
||||
pz /= scale;
|
||||
|
||||
label is = 0;
|
||||
|
||||
B[ip][is++] = wts[0]*wts[ip];
|
||||
B[ip][is++] = wts[0]*wts[ip]*px;
|
||||
B[ip][is++] = wts[ip]*sqr(px);
|
||||
@ -253,21 +260,36 @@ Foam::label Foam::quadraticFitData::calcFit
|
||||
scalarList singVals(minSize_);
|
||||
label nSVDzeros = 0;
|
||||
|
||||
const GeometricField<scalar, fvsPatchField, surfaceMesh>& w =
|
||||
mesh().surfaceInterpolation::weights();
|
||||
|
||||
bool goodFit = false;
|
||||
for(int iIt = 0; iIt < 35 && !goodFit; iIt++)
|
||||
for(int iIt = 0; iIt < 10 && !goodFit; iIt++)
|
||||
{
|
||||
SVD svd(B, SMALL);
|
||||
|
||||
scalar fit0 = wts[0]*wts[0]*svd.VSinvUt()[0][0];
|
||||
scalar fit1 = wts[0]*wts[1]*svd.VSinvUt()[0][1];
|
||||
|
||||
goodFit = sign(fit0) == sign(fit1) && fit0 < 1 && fit1 < 1;
|
||||
//goodFit = (fit0 > 0 && fit1 > 0);
|
||||
|
||||
goodFit =
|
||||
(mag(fit0 - w[faci])/w[faci] < 0.15)
|
||||
&& (mag(fit1 - (1 - w[faci]))/(1 - w[faci]) < 0.15);
|
||||
|
||||
//scalar w0Err = fit0/w[faci];
|
||||
//scalar w1Err = fit1/(1 - w[faci]);
|
||||
|
||||
//goodFit =
|
||||
// (w0Err > 0.5 && w0Err < 1.5)
|
||||
// && (w1Err > 0.5 && w1Err < 1.5);
|
||||
|
||||
if (goodFit)
|
||||
{
|
||||
fit_[faci][0] = fit0;
|
||||
fit_[faci][1] = fit1;
|
||||
for(label i = 2; i < stencilSize; i++)
|
||||
|
||||
for(label i=2; i<stencilSize; i++)
|
||||
{
|
||||
fit_[faci][i] = wts[0]*wts[i]*svd.VSinvUt()[0][i];
|
||||
}
|
||||
@ -279,11 +301,13 @@ Foam::label Foam::quadraticFitData::calcFit
|
||||
{
|
||||
wts[0] *= 10;
|
||||
wts[1] *= 10;
|
||||
|
||||
for(label i = 0; i < B.n(); i++)
|
||||
{
|
||||
B[i][0] *= 10;
|
||||
B[i][1] *= 10;
|
||||
}
|
||||
|
||||
for(label j = 0; j < B.m(); j++)
|
||||
{
|
||||
B[0][j] *= 10;
|
||||
@ -291,23 +315,51 @@ Foam::label Foam::quadraticFitData::calcFit
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!goodFit)
|
||||
|
||||
// static const scalar L = 0.1;
|
||||
// static const scalar R = 0.2;
|
||||
|
||||
// static const scalar beta = 1.0/(R - L);
|
||||
// static const scalar alpha = R*beta;
|
||||
|
||||
if (goodFit)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"quadraticFitData::calcFit(const pointField&, const label)"
|
||||
) << "For face " << faci << endl
|
||||
<< "Cannot find good fit"
|
||||
<< exit(FatalError);
|
||||
if ((mag(fit_[faci][0] - w[faci])/w[faci] < 0.15)
|
||||
&& (mag(fit_[faci][1] - (1 - w[faci]))/(1 - w[faci]) < 0.15))
|
||||
{
|
||||
count++;
|
||||
//Pout<< "fit " << mag(fit_[faci][0] - w[faci])/w[faci] << " " << mag(fit_[faci][1] - (1 - w[faci]))/(1 - w[faci]) << endl;
|
||||
}
|
||||
|
||||
// scalar limiter =
|
||||
// max
|
||||
// (
|
||||
// min
|
||||
// (
|
||||
// min(alpha - beta*mag(fit_[faci][0] - w[faci])/w[faci], 1),
|
||||
// min(alpha - beta*mag(fit_[faci][1] - (1 - w[faci]))/(1 - w[faci]), 1)
|
||||
// ), 0
|
||||
// );
|
||||
|
||||
// Remove the uncorrected linear coefficients
|
||||
fit_[faci][0] -= w[faci];
|
||||
fit_[faci][1] -= 1 - w[faci];
|
||||
|
||||
// if (limiter < 0.99)
|
||||
// {
|
||||
// for(label i = 0; i < stencilSize; i++)
|
||||
// {
|
||||
// fit_[faci][i] *= limiter;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< "Could not fit face " << faci
|
||||
<< " " << fit_[faci][0] << " " << w[faci]
|
||||
<< " " << fit_[faci][1] << " " << 1 - w[faci]<< endl;
|
||||
fit_[faci] = 0;
|
||||
}
|
||||
|
||||
const GeometricField<scalar, fvsPatchField, surfaceMesh>& w =
|
||||
mesh().surfaceInterpolation::weights();
|
||||
|
||||
// remove the uncorrected linear coefficients
|
||||
|
||||
fit_[faci][0] -= w[faci];
|
||||
fit_[faci][1] -= 1 - w[faci];
|
||||
|
||||
return minSize_ - nSVDzeros;
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ void Foam::ReactingParcel<ParcelType>::calcCoupled
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const vector U0 = this->U_;
|
||||
const scalar mass0 = this->mass();
|
||||
const scalar cp0 = this->cp_;
|
||||
const scalar np0 = this->nParticle_;
|
||||
const scalar T0 = this->T_;
|
||||
|
||||
@ -116,11 +117,11 @@ void Foam::ReactingParcel<ParcelType>::calcCoupled
|
||||
T1 -=
|
||||
td.constProps().Ldevol()
|
||||
*sum(dMassMT)
|
||||
/(0.5*(mass0 + mass1)*this->cp_);
|
||||
/(0.5*(mass0 + mass1)*cp0);
|
||||
|
||||
// Add retained enthalpy from surface reaction to particle and remove
|
||||
// from gas
|
||||
T1 += dhRet/(0.5*(mass0 + mass1)*this->cp_);
|
||||
T1 += dhRet/(0.5*(mass0 + mass1)*cp0);
|
||||
dhTrans -= dhRet;
|
||||
|
||||
// Correct dhTrans to account for enthalpy of evolved volatiles
|
||||
|
||||
@ -7,5 +7,6 @@ wmake libso forces
|
||||
wmake libso fieldAverage
|
||||
wmake libso foamCalcFunctions
|
||||
wmake libso minMaxFields
|
||||
wmake libso systemCall
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -11,6 +11,7 @@ EXE_INC = \
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
|
||||
const basicThermo& thermo =
|
||||
obr_.lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(Uname_);
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
return -thermo.mu()*dev(twoSymm(fvc::grad(U)));
|
||||
}
|
||||
@ -94,7 +94,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
|
||||
obr_.lookupObject<singlePhaseTransportModel>
|
||||
("transportProperties");
|
||||
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(Uname_);
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
return -rhoRef_*laminarT.nu()*dev(twoSymm(fvc::grad(U)));
|
||||
}
|
||||
@ -105,7 +105,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
|
||||
|
||||
dimensionedScalar nu(transportProperties.lookup("nu"));
|
||||
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(Uname_);
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
return -rhoRef_*nu*dev(twoSymm(fvc::grad(U)));
|
||||
}
|
||||
@ -149,7 +149,7 @@ Foam::forces::forces
|
||||
log_(false),
|
||||
patchSet_(),
|
||||
pName_(""),
|
||||
Uname_(""),
|
||||
UName_(""),
|
||||
rhoRef_(0),
|
||||
CofR_(vector::zero),
|
||||
forcesFilePtr_(NULL)
|
||||
@ -190,18 +190,18 @@ void Foam::forces::read(const dictionary& dict)
|
||||
|
||||
// Optional entries U and p
|
||||
pName_ = dict.lookupOrDefault<word>("pName", "p");
|
||||
Uname_ = dict.lookupOrDefault<word>("Uname", "U");
|
||||
UName_ = dict.lookupOrDefault<word>("UName", "U");
|
||||
|
||||
// Check whether Uname and pName exists, if not deactivate forces
|
||||
// Check whether UName and pName exists, if not deactivate forces
|
||||
if
|
||||
(
|
||||
!obr_.foundObject<volVectorField>(Uname_)
|
||||
!obr_.foundObject<volVectorField>(UName_)
|
||||
|| !obr_.foundObject<volScalarField>(pName_)
|
||||
)
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn("void forces::read(const dictionary& dict)")
|
||||
<< "Could not find " << Uname_ << " or "
|
||||
<< "Could not find " << UName_ << " or "
|
||||
<< pName_ << " in database." << nl
|
||||
<< " De-activating forces."
|
||||
<< endl;
|
||||
@ -299,7 +299,7 @@ void Foam::forces::write()
|
||||
|
||||
Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
|
||||
{
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(Uname_);
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
||||
|
||||
const fvMesh& mesh = U.mesh();
|
||||
|
||||
@ -130,7 +130,7 @@ protected:
|
||||
word pName_;
|
||||
|
||||
//- Name of velocity field
|
||||
word Uname_;
|
||||
word UName_;
|
||||
|
||||
//- Reference density needed for incompressible calculations
|
||||
scalar rhoRef_;
|
||||
|
||||
@ -5,4 +5,5 @@ EXE_INC = \
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
|
||||
50
src/postProcessing/systemCall/IOsystemCall.H
Normal file
50
src/postProcessing/systemCall/IOsystemCall.H
Normal file
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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
|
||||
|
||||
Typedef
|
||||
Foam::IOsystemCall
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for systemCall.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOsystemCall_H
|
||||
#define IOsystemCall_H
|
||||
|
||||
#include "systemCall.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<systemCall> IOsystemCall;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
4
src/postProcessing/systemCall/Make/files
Normal file
4
src/postProcessing/systemCall/Make/files
Normal file
@ -0,0 +1,4 @@
|
||||
systemCall.C
|
||||
systemCallFunctionObject.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libsystemCall
|
||||
9
src/postProcessing/systemCall/Make/options
Normal file
9
src/postProcessing/systemCall/Make/options
Normal file
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
91
src/postProcessing/systemCall/systemCall.C
Normal file
91
src/postProcessing/systemCall/systemCall.C
Normal file
@ -0,0 +1,91 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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 "systemCall.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(systemCall, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::systemCall::systemCall
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
executeCalls_(),
|
||||
writeCalls_()
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::systemCall::~systemCall()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::systemCall::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("executeCalls") >> executeCalls_;
|
||||
dict.lookup("writeCalls") >> writeCalls_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::systemCall::execute()
|
||||
{
|
||||
forAll(executeCalls_, callI)
|
||||
{
|
||||
::system(executeCalls_[callI].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Foam::systemCall::write()
|
||||
{
|
||||
forAll(writeCalls_, callI)
|
||||
{
|
||||
::system(writeCalls_[callI].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
147
src/postProcessing/systemCall/systemCall.H
Normal file
147
src/postProcessing/systemCall/systemCall.H
Normal file
@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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::systemCall
|
||||
|
||||
Description
|
||||
Executes system calls, entered in the form of a string list
|
||||
|
||||
SourceFiles
|
||||
systemCall.C
|
||||
IOsystemCall.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef systemCall_H
|
||||
#define systemCall_H
|
||||
|
||||
#include "stringList.H"
|
||||
#include "pointFieldFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class systemCall Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class systemCall
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this set of forces,
|
||||
// Also used as the name of the probes directory.
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- List of calls to execute - every step
|
||||
stringList executeCalls_;
|
||||
|
||||
//- List of calls to execute - write steps
|
||||
stringList writeCalls_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
systemCall(const systemCall&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const systemCall&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("systemCall");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
systemCall
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~systemCall();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the system call set
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the system calls
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute
|
||||
virtual void execute();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const pointField&)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
43
src/postProcessing/systemCall/systemCallFunctionObject.C
Normal file
43
src/postProcessing/systemCall/systemCallFunctionObject.C
Normal file
@ -0,0 +1,43 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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 "systemCallFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(systemCallFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
systemCallFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
55
src/postProcessing/systemCall/systemCallFunctionObject.H
Normal file
55
src/postProcessing/systemCall/systemCallFunctionObject.H
Normal file
@ -0,0 +1,55 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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
|
||||
|
||||
Typedef
|
||||
Foam::systemCallFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around systemCall to allow them to be created via
|
||||
the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
systemCallFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef systemCallFunctionObject_H
|
||||
#define systemCallFunctionObject_H
|
||||
|
||||
#include "systemCall.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<systemCall>
|
||||
systemCallFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,15 +28,10 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
hThermo<MixtureType>::hThermo(const fvMesh& mesh)
|
||||
Foam::hThermo<MixtureType>::hThermo(const fvMesh& mesh)
|
||||
:
|
||||
basicThermo(mesh),
|
||||
MixtureType(*this, mesh),
|
||||
@ -56,9 +51,12 @@ hThermo<MixtureType>::hThermo(const fvMesh& mesh)
|
||||
hBoundaryTypes()
|
||||
)
|
||||
{
|
||||
forAll(h_, celli)
|
||||
scalarField& hCells = h_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(hCells, celli)
|
||||
{
|
||||
h_[celli] = this->cellMixture(celli).H(T_[celli]);
|
||||
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(h_.boundaryField(), patchi)
|
||||
@ -76,25 +74,33 @@ hThermo<MixtureType>::hThermo(const fvMesh& mesh)
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
hThermo<MixtureType>::~hThermo()
|
||||
Foam::hThermo<MixtureType>::~hThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void hThermo<MixtureType>::calculate()
|
||||
void Foam::hThermo<MixtureType>::calculate()
|
||||
{
|
||||
forAll(T_, celli)
|
||||
const scalarField& hCells = h_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
|
||||
scalarField& TCells = T_.internalField();
|
||||
scalarField& psiCells = psi_.internalField();
|
||||
scalarField& muCells = mu_.internalField();
|
||||
scalarField& alphaCells = alpha_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
const typename MixtureType::thermoType& mixture_ =
|
||||
this->cellMixture(celli);
|
||||
|
||||
T_[celli] = mixture_.TH(h_[celli], T_[celli]);
|
||||
psi_[celli] = mixture_.psi(p_[celli], T_[celli]);
|
||||
TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
|
||||
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
|
||||
|
||||
mu_[celli] = mixture_.mu(T_[celli]);
|
||||
alpha_[celli] = mixture_.alpha(T_[celli]);
|
||||
muCells[celli] = mixture_.mu(TCells[celli]);
|
||||
alphaCells[celli] = mixture_.alpha(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
@ -143,7 +149,7 @@ void hThermo<MixtureType>::calculate()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void hThermo<MixtureType>::correct()
|
||||
void Foam::hThermo<MixtureType>::correct()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -163,7 +169,7 @@ void hThermo<MixtureType>::correct()
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
@ -182,7 +188,7 @@ tmp<scalarField> hThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -201,7 +207,7 @@ tmp<scalarField> hThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hThermo<MixtureType>::Cp
|
||||
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -220,7 +226,7 @@ tmp<scalarField> hThermo<MixtureType>::Cp
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hThermo<MixtureType>::Cp() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -258,7 +264,7 @@ tmp<volScalarField> hThermo<MixtureType>::Cp() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hThermo<MixtureType>::Cv() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cv() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -303,7 +309,7 @@ tmp<volScalarField> hThermo<MixtureType>::Cv() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
bool hThermo<MixtureType>::read()
|
||||
bool Foam::hThermo<MixtureType>::read()
|
||||
{
|
||||
if (basicThermo::read())
|
||||
{
|
||||
@ -317,8 +323,4 @@ bool hThermo<MixtureType>::read()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -28,22 +28,20 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
hMixtureThermo<MixtureType>::hMixtureThermo(const fvMesh& mesh)
|
||||
Foam::hMixtureThermo<MixtureType>::hMixtureThermo(const fvMesh& mesh)
|
||||
:
|
||||
hCombustionThermo(mesh),
|
||||
MixtureType(*this, mesh)
|
||||
{
|
||||
forAll(h_, celli)
|
||||
scalarField& hCells = h_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(hCells, celli)
|
||||
{
|
||||
h_[celli] = this->cellMixture(celli).H(T_[celli]);
|
||||
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(h_.boundaryField(), patchi)
|
||||
@ -61,25 +59,33 @@ hMixtureThermo<MixtureType>::hMixtureThermo(const fvMesh& mesh)
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
hMixtureThermo<MixtureType>::~hMixtureThermo()
|
||||
Foam::hMixtureThermo<MixtureType>::~hMixtureThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void hMixtureThermo<MixtureType>::calculate()
|
||||
void Foam::hMixtureThermo<MixtureType>::calculate()
|
||||
{
|
||||
forAll(T_, celli)
|
||||
const scalarField& hCells = h_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
|
||||
scalarField& TCells = T_.internalField();
|
||||
scalarField& psiCells = psi_.internalField();
|
||||
scalarField& muCells = mu_.internalField();
|
||||
scalarField& alphaCells = alpha_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
const typename MixtureType::thermoType& mixture_ =
|
||||
this->cellMixture(celli);
|
||||
|
||||
T_[celli] = mixture_.TH(h_[celli], T_[celli]);
|
||||
psi_[celli] = mixture_.psi(p_[celli], T_[celli]);
|
||||
TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
|
||||
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
|
||||
|
||||
mu_[celli] = mixture_.mu(T_[celli]);
|
||||
alpha_[celli] = mixture_.alpha(T_[celli]);
|
||||
muCells[celli] = mixture_.mu(TCells[celli]);
|
||||
alphaCells[celli] = mixture_.alpha(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
@ -128,7 +134,7 @@ void hMixtureThermo<MixtureType>::calculate()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hMixtureThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
@ -147,7 +153,7 @@ tmp<scalarField> hMixtureThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hMixtureThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -166,7 +172,7 @@ tmp<scalarField> hMixtureThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hMixtureThermo<MixtureType>::Cp
|
||||
Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -186,7 +192,7 @@ tmp<scalarField> hMixtureThermo<MixtureType>::Cp
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hMixtureThermo<MixtureType>::Cp() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -224,7 +230,7 @@ tmp<volScalarField> hMixtureThermo<MixtureType>::Cp() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
void hMixtureThermo<MixtureType>::correct()
|
||||
void Foam::hMixtureThermo<MixtureType>::correct()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -244,7 +250,7 @@ void hMixtureThermo<MixtureType>::correct()
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
bool hMixtureThermo<MixtureType>::read()
|
||||
bool Foam::hMixtureThermo<MixtureType>::read()
|
||||
{
|
||||
if (hCombustionThermo::read())
|
||||
{
|
||||
@ -258,8 +264,4 @@ bool hMixtureThermo<MixtureType>::read()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -28,23 +28,23 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
hhuMixtureThermo<MixtureType>::hhuMixtureThermo(const fvMesh& mesh)
|
||||
Foam::hhuMixtureThermo<MixtureType>::hhuMixtureThermo(const fvMesh& mesh)
|
||||
:
|
||||
hhuCombustionThermo(mesh),
|
||||
MixtureType(*this, mesh)
|
||||
{
|
||||
forAll(h_, celli)
|
||||
scalarField& hCells = h_.internalField();
|
||||
scalarField& huCells = hu_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
const scalarField& TuCells = Tu_.internalField();
|
||||
|
||||
forAll(hCells, celli)
|
||||
{
|
||||
h_[celli] = this->cellMixture(celli).H(T_[celli]);
|
||||
hu_[celli] = this->cellReactants(celli).H(Tu_[celli]);
|
||||
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
|
||||
huCells[celli] = this->cellReactants(celli).H(TuCells[celli]);
|
||||
}
|
||||
|
||||
forAll(h_.boundaryField(), patchi)
|
||||
@ -71,27 +71,38 @@ hhuMixtureThermo<MixtureType>::hhuMixtureThermo(const fvMesh& mesh)
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
hhuMixtureThermo<MixtureType>::~hhuMixtureThermo()
|
||||
Foam::hhuMixtureThermo<MixtureType>::~hhuMixtureThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void hhuMixtureThermo<MixtureType>::calculate()
|
||||
void Foam::hhuMixtureThermo<MixtureType>::calculate()
|
||||
{
|
||||
forAll(T_, celli)
|
||||
const scalarField& hCells = h_.internalField();
|
||||
const scalarField& huCells = hu_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
|
||||
scalarField& TCells = T_.internalField();
|
||||
scalarField& TuCells = Tu_.internalField();
|
||||
scalarField& psiCells = psi_.internalField();
|
||||
scalarField& muCells = mu_.internalField();
|
||||
scalarField& alphaCells = alpha_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
const typename MixtureType::thermoType& mixture_ =
|
||||
const typename MixtureType::thermoType& mixture_ =
|
||||
this->cellMixture(celli);
|
||||
|
||||
T_[celli] = mixture_.TH(h_[celli], T_[celli]);
|
||||
psi_[celli] = mixture_.psi(p_[celli], T_[celli]);
|
||||
TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
|
||||
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
|
||||
|
||||
mu_[celli] = mixture_.mu(T_[celli]);
|
||||
alpha_[celli] = mixture_.alpha(T_[celli]);
|
||||
muCells[celli] = mixture_.mu(TCells[celli]);
|
||||
alphaCells[celli] = mixture_.alpha(TCells[celli]);
|
||||
|
||||
Tu_[celli] = this->cellReactants(celli).TH(hu_[celli], Tu_[celli]);
|
||||
TuCells[celli] =
|
||||
this->cellReactants(celli).TH(huCells[celli], TuCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
@ -144,7 +155,7 @@ void hhuMixtureThermo<MixtureType>::calculate()
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
void hhuMixtureThermo<MixtureType>::correct()
|
||||
void Foam::hhuMixtureThermo<MixtureType>::correct()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -163,7 +174,7 @@ void hhuMixtureThermo<MixtureType>::correct()
|
||||
}
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hhuMixtureThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
@ -182,7 +193,7 @@ tmp<scalarField> hhuMixtureThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hhuMixtureThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -201,7 +212,7 @@ tmp<scalarField> hhuMixtureThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hhuMixtureThermo<MixtureType>::Cp
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -221,7 +232,7 @@ tmp<scalarField> hhuMixtureThermo<MixtureType>::Cp
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hhuMixtureThermo<MixtureType>::Cp() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -260,7 +271,7 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::Cp() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hhuMixtureThermo<MixtureType>::hu
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
(
|
||||
const scalarField& Tu,
|
||||
const labelList& cells
|
||||
@ -279,7 +290,7 @@ tmp<scalarField> hhuMixtureThermo<MixtureType>::hu
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<scalarField> hhuMixtureThermo<MixtureType>::hu
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
(
|
||||
const scalarField& Tu,
|
||||
const label patchi
|
||||
@ -298,7 +309,7 @@ tmp<scalarField> hhuMixtureThermo<MixtureType>::hu
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hhuMixtureThermo<MixtureType>::Tb() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Tb() const
|
||||
{
|
||||
tmp<volScalarField> tTb
|
||||
(
|
||||
@ -342,7 +353,8 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::Tb() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hhuMixtureThermo<MixtureType>::psiu() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::psiu() const
|
||||
{
|
||||
tmp<volScalarField> tpsiu
|
||||
(
|
||||
@ -388,7 +400,8 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::psiu() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hhuMixtureThermo<MixtureType>::psib() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::psib() const
|
||||
{
|
||||
tmp<volScalarField> tpsib
|
||||
(
|
||||
@ -426,7 +439,8 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::psib() const
|
||||
forAll(ppsib, facei)
|
||||
{
|
||||
ppsib[facei] =
|
||||
this->patchFaceReactants(patchi, facei).psi(pp[facei], pTb[facei]);
|
||||
this->patchFaceReactants
|
||||
(patchi, facei).psi(pp[facei], pTb[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +449,7 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::psib() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hhuMixtureThermo<MixtureType>::muu() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::muu() const
|
||||
{
|
||||
tmp<volScalarField> tmuu
|
||||
(
|
||||
@ -478,7 +492,7 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::muu() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
tmp<volScalarField> hhuMixtureThermo<MixtureType>::mub() const
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::mub() const
|
||||
{
|
||||
tmp<volScalarField> tmub
|
||||
(
|
||||
@ -521,7 +535,7 @@ tmp<volScalarField> hhuMixtureThermo<MixtureType>::mub() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
bool hhuMixtureThermo<MixtureType>::read()
|
||||
bool Foam::hhuMixtureThermo<MixtureType>::read()
|
||||
{
|
||||
if (hhuCombustionThermo::read())
|
||||
{
|
||||
@ -535,8 +549,4 @@ bool hhuMixtureThermo<MixtureType>::read()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -8,6 +8,9 @@ GenSGSStress/GenSGSStress.C
|
||||
|
||||
laminar/laminar.C
|
||||
SpalartAllmaras/SpalartAllmaras.C
|
||||
SpalartAllmarasDDES/SpalartAllmarasDDES.C
|
||||
SpalartAllmarasIDDES/SpalartAllmarasIDDES.C
|
||||
SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C
|
||||
|
||||
oneEqEddy/oneEqEddy.C
|
||||
dynOneEqEddy/dynOneEqEddy.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,8 +42,7 @@ namespace LESModels
|
||||
defineTypeNameAndDebug(SpalartAllmaras, 0);
|
||||
addToRunTimeSelectionTable(LESModel, SpalartAllmaras, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::fv1() const
|
||||
{
|
||||
@ -55,7 +54,6 @@ tmp<volScalarField> SpalartAllmaras::fv1() const
|
||||
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_);
|
||||
}
|
||||
|
||||
@ -73,18 +71,57 @@ tmp<volScalarField> SpalartAllmaras::fv3() const
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
|
||||
tmp<volScalarField> SpalartAllmaras::calcS(const volTensorField& gradU)
|
||||
{
|
||||
volScalarField r = min
|
||||
return ::sqrt(2.0)*mag(skew(gradU));
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::calcSTilda(const volTensorField& gradU)
|
||||
{
|
||||
return fv3()*calcS(gradU) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::r
|
||||
(
|
||||
const volScalarField& visc,
|
||||
const volScalarField& S
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tr
|
||||
(
|
||||
nuTilda_
|
||||
/(
|
||||
max(Stilda, dimensionedScalar("SMALL", Stilda.dimensions(), SMALL))
|
||||
*sqr(kappa_*dTilda_)
|
||||
),
|
||||
scalar(10.0)
|
||||
new volScalarField
|
||||
(
|
||||
min
|
||||
(
|
||||
visc
|
||||
/(
|
||||
max
|
||||
(
|
||||
S,
|
||||
dimensionedScalar("SMALL", S.dimensions(), SMALL)
|
||||
)
|
||||
*sqr(kappa_*dTilda_)
|
||||
+ dimensionedScalar
|
||||
(
|
||||
"ROOTVSMALL",
|
||||
dimensionSet(0, 2 , -1, 0, 0),
|
||||
ROOTVSMALL
|
||||
)
|
||||
),
|
||||
scalar(10.0)
|
||||
)
|
||||
)
|
||||
);
|
||||
r.boundaryField() == 0.0;
|
||||
|
||||
return tr;
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& S) const
|
||||
{
|
||||
volScalarField r = this->r(nuTilda_, S);
|
||||
|
||||
volScalarField g = r + Cw2_*(pow6(r) - r);
|
||||
|
||||
@ -92,17 +129,26 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
|
||||
}
|
||||
|
||||
|
||||
void SpalartAllmaras::dTildaUpdate(const volScalarField&)
|
||||
{
|
||||
if (mesh_.changing())
|
||||
{
|
||||
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
SpalartAllmaras::SpalartAllmaras
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
transportModel& transport,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
LESModel(typeName, U, phi, transport),
|
||||
|
||||
LESModel(modelName, U, phi, transport),
|
||||
|
||||
alphaNut_
|
||||
(
|
||||
@ -113,6 +159,15 @@ SpalartAllmaras::SpalartAllmaras
|
||||
1.5
|
||||
)
|
||||
),
|
||||
kappa_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"kappa",
|
||||
*this,
|
||||
0.4187
|
||||
)
|
||||
),
|
||||
Cb1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
@ -167,15 +222,6 @@ SpalartAllmaras::SpalartAllmaras
|
||||
0.07
|
||||
)
|
||||
),
|
||||
kappa_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"kappa",
|
||||
*this,
|
||||
0.4187
|
||||
)
|
||||
),
|
||||
Cw1_(Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_)),
|
||||
Cw2_
|
||||
(
|
||||
@ -223,10 +269,7 @@ SpalartAllmaras::SpalartAllmaras
|
||||
),
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
printCoeffs();
|
||||
}
|
||||
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -234,13 +277,11 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
|
||||
{
|
||||
LESModel::correct(gradU);
|
||||
|
||||
if (mesh_.changing())
|
||||
{
|
||||
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
|
||||
}
|
||||
const volScalarField STilda = calcSTilda(gradU);
|
||||
|
||||
volScalarField Stilda =
|
||||
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
|
||||
const volScalarField S = calcS(gradU);
|
||||
|
||||
dTildaUpdate(S);
|
||||
|
||||
solve
|
||||
(
|
||||
@ -254,8 +295,8 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
|
||||
)
|
||||
- alphaNut_*Cb2_*magSqr(fvc::grad(nuTilda_))
|
||||
==
|
||||
Cb1_*Stilda*nuTilda_
|
||||
- fvm::Sp(Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_)
|
||||
Cb1_*STilda*nuTilda_
|
||||
- fvm::Sp(Cw1_*fw(STilda)*nuTilda_/sqr(dTilda_), nuTilda_)
|
||||
);
|
||||
|
||||
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
|
||||
@ -268,7 +309,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::epsilon() const
|
||||
{
|
||||
return 2*nuEff()*magSqr(symm(fvc::grad(U())));
|
||||
return 2.0*nuEff()*magSqr(symm(fvc::grad(U())));
|
||||
}
|
||||
|
||||
|
||||
@ -298,16 +339,16 @@ bool SpalartAllmaras::read()
|
||||
if (LESModel::read())
|
||||
{
|
||||
alphaNut_.readIfPresent(coeffDict());
|
||||
kappa_.readIfPresent(*this);
|
||||
Cb1_.readIfPresent(coeffDict());
|
||||
Cb2_.readIfPresent(coeffDict());
|
||||
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
|
||||
Cw2_.readIfPresent(coeffDict());
|
||||
Cw3_.readIfPresent(coeffDict());
|
||||
Cv1_.readIfPresent(coeffDict());
|
||||
Cv2_.readIfPresent(coeffDict());
|
||||
CDES_.readIfPresent(coeffDict());
|
||||
ck_.readIfPresent(coeffDict());
|
||||
kappa_.readIfPresent(*this);
|
||||
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
|
||||
Cw2_.readIfPresent(coeffDict());
|
||||
Cw3_.readIfPresent(coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,10 +23,10 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::incompressible::LESModels::SpalartAllmaras
|
||||
Foam::LESmodels::SpalartAllmaras
|
||||
|
||||
Description
|
||||
SpalartAllmaras for incompressible flows
|
||||
SpalartAllmaras DES (SA + LES) turbulence model for incompressible flows
|
||||
|
||||
SourceFiles
|
||||
SpalartAllmaras.C
|
||||
@ -49,43 +49,67 @@ namespace LESModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SpalartAllmaras Declaration
|
||||
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_;
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
dimensionedScalar alphaNut_;
|
||||
dimensionedScalar kappa_;
|
||||
|
||||
|
||||
// Model constants
|
||||
|
||||
dimensionedScalar Cb1_;
|
||||
dimensionedScalar Cb2_;
|
||||
dimensionedScalar Cv1_;
|
||||
dimensionedScalar Cv2_;
|
||||
dimensionedScalar CDES_;
|
||||
dimensionedScalar ck_;
|
||||
dimensionedScalar Cw1_;
|
||||
dimensionedScalar Cw2_;
|
||||
dimensionedScalar Cw3_;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
volScalarField nuTilda_;
|
||||
volScalarField dTilda_;
|
||||
volScalarField nuSgs_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
// Helper functions
|
||||
|
||||
virtual tmp<volScalarField> fv1() const;
|
||||
virtual tmp<volScalarField> fv2() const;
|
||||
virtual tmp<volScalarField> fv3() const;
|
||||
//-
|
||||
virtual tmp<volScalarField> calcS(const volTensorField& gradU);
|
||||
virtual tmp<volScalarField> calcSTilda(const volTensorField& gradU);
|
||||
virtual tmp<volScalarField> r
|
||||
(
|
||||
const volScalarField& visc,
|
||||
const volScalarField& S
|
||||
) const;
|
||||
virtual tmp<volScalarField> fw(const volScalarField& S) const;
|
||||
|
||||
//- Length scale calculation
|
||||
virtual void dTildaUpdate(const volScalarField& S);
|
||||
|
||||
|
||||
public:
|
||||
@ -101,13 +125,14 @@ public:
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
transportModel& transport,
|
||||
const word& modelName = typeName
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~SpalartAllmaras()
|
||||
virtual ~SpalartAllmaras()
|
||||
{}
|
||||
|
||||
|
||||
@ -145,10 +170,10 @@ public:
|
||||
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
|
||||
|
||||
//- Correct nuTilda and related properties
|
||||
void correct(const tmp<volTensorField>& gradU);
|
||||
virtual void correct(const tmp<volTensorField>& gradU);
|
||||
|
||||
//- Read turbulenceProperties dictionary
|
||||
bool read();
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "SpalartAllmarasDDES.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallDist.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(SpalartAllmarasDDES, 0);
|
||||
addToRunTimeSelectionTable(LESModel, SpalartAllmarasDDES, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasDDES::rd
|
||||
(
|
||||
const volScalarField& visc,
|
||||
const volScalarField& S
|
||||
) const
|
||||
{
|
||||
volScalarField d = wallDist(mesh_).y();
|
||||
|
||||
tmp<volScalarField> trd
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
min
|
||||
(
|
||||
visc
|
||||
/(
|
||||
max
|
||||
(
|
||||
S,
|
||||
dimensionedScalar("SMALL", S.dimensions(), SMALL)
|
||||
)*sqr(kappa_*d)
|
||||
+ dimensionedScalar
|
||||
(
|
||||
"ROOTVSMALL",
|
||||
dimensionSet(0, 2 , -1, 0, 0),
|
||||
ROOTVSMALL
|
||||
)
|
||||
), scalar(10.0)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return trd;
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasDDES::fd(const volScalarField& S)
|
||||
{
|
||||
return 1.0 - tanh(pow3(8.0*rd(nuSgs_ + transport().nu(), S)));
|
||||
}
|
||||
|
||||
|
||||
void SpalartAllmarasDDES::dTildaUpdate(const volScalarField& S)
|
||||
{
|
||||
dTilda_ =
|
||||
wallDist(mesh_).y()
|
||||
- fd(S)*max
|
||||
(
|
||||
dimensionedScalar("zero", dimLength, 0.0),
|
||||
wallDist(mesh_).y() - CDES_*delta()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
SpalartAllmarasDDES::SpalartAllmarasDDES
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
)
|
||||
:
|
||||
SpalartAllmaras(U, phi, transport, typeName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESModels
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
Class
|
||||
Foam::LESmodels::SpalartAllmarasDDES
|
||||
|
||||
Description
|
||||
SpalartAllmaras DDES LES turbulence model for incompressible flows
|
||||
|
||||
Reference:
|
||||
P.R. Spalart, S. Deck, S., M.L.Shur, K.D. Squires, M.Kh Strelets, and
|
||||
A. Travin. `A new version of detached-eddy simulation, resistant to
|
||||
ambiguous grid densities'. Theor. Comp. Fluid Dyn., 20:181-195, 2006.
|
||||
|
||||
SourceFiles
|
||||
SpalartAllmarasDDES.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SpalartAllmarasDDES_H
|
||||
#define SpalartAllmarasDDES_H
|
||||
|
||||
#include "SpalartAllmaras.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SpalartAllmarasDDES Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SpalartAllmarasDDES
|
||||
:
|
||||
public SpalartAllmaras
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
// Disallow default bitwise copy construct and assignment
|
||||
SpalartAllmarasDDES(const SpalartAllmarasDDES&);
|
||||
SpalartAllmarasDDES& operator=(const SpalartAllmarasDDES&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
tmp<volScalarField> fd(const volScalarField& S);
|
||||
tmp<volScalarField> rd
|
||||
(
|
||||
const volScalarField& visc,
|
||||
const volScalarField& S
|
||||
) const;
|
||||
|
||||
//- Length scale calculation
|
||||
virtual void dTildaUpdate(const volScalarField& S);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SpalartAllmarasDDES");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Constructor from components
|
||||
SpalartAllmarasDDES
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SpalartAllmarasDDES()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESModels
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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 "IDDESDelta.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallDist.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(IDDESDelta, 0);
|
||||
addToRunTimeSelectionTable(LESdelta, IDDESDelta, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::IDDESDelta::calcDelta()
|
||||
{
|
||||
const Vector<label>& directions = mesh().directions();
|
||||
label nD = (directions.nComponents + cmptSum(directions))/2;
|
||||
|
||||
// - Init hwn as wall distant.
|
||||
volScalarField hwn = wallDist(mesh()).y();
|
||||
|
||||
scalar deltamaxTmp = 0.;
|
||||
|
||||
const cellList& cells = mesh().cells();
|
||||
|
||||
forAll(cells,cellI)
|
||||
{
|
||||
scalar deltaminTmp = 1.e10;
|
||||
const labelList& cFaces = mesh().cells()[cellI];
|
||||
const point& centrevector = mesh().cellCentres()[cellI];
|
||||
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
label faceI = cFaces[cFaceI];
|
||||
const point& facevector = mesh().faceCentres()[faceI];
|
||||
scalar tmp = mag(facevector-centrevector);
|
||||
if (tmp > deltamaxTmp)
|
||||
{
|
||||
deltamaxTmp = tmp;
|
||||
}
|
||||
if (tmp < deltaminTmp)
|
||||
{
|
||||
deltaminTmp = tmp;
|
||||
}
|
||||
}
|
||||
hwn[cellI] = 2.0*deltaminTmp;
|
||||
}
|
||||
|
||||
dimensionedScalar deltamax("deltamax",dimLength,2.0*deltamaxTmp);
|
||||
|
||||
if (nD == 3)
|
||||
{
|
||||
delta_.internalField() =
|
||||
deltaCoeff_
|
||||
*min(max(max(cw_*wallDist(mesh()).y(),cw_*deltamax),hwn),deltamax);
|
||||
}
|
||||
else if (nD == 2)
|
||||
{
|
||||
WarningIn("IDDESDelta::calcDelta()")
|
||||
<< "Case is 2D, LES is not strictly applicable\n"
|
||||
<< endl;
|
||||
|
||||
delta_.internalField() =
|
||||
deltaCoeff_
|
||||
*min(max(max(cw_*wallDist(mesh()).y(),cw_*deltamax),hwn),deltamax);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("IDDESDelta::calcDelta()")
|
||||
<< "Case is not 3D or 2D, LES is not applicable"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IDDESDelta::IDDESDelta
|
||||
(
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dd
|
||||
)
|
||||
:
|
||||
LESdelta(name, mesh),
|
||||
deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff"))),
|
||||
cw_(0)
|
||||
{
|
||||
dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
|
||||
calcDelta();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::IDDESDelta::read(const dictionary& dd)
|
||||
{
|
||||
dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
|
||||
calcDelta();
|
||||
}
|
||||
|
||||
|
||||
void Foam::IDDESDelta::correct()
|
||||
{
|
||||
if (mesh_.changing())
|
||||
{
|
||||
calcDelta();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,113 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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::IDDESDelta
|
||||
|
||||
Description
|
||||
IDDESDelta used by the IDDES (improved low Re Spalart-Allmaras DES model)
|
||||
The min and max delta are calculated using the double distance of the min or
|
||||
max from the face centre to the cell centre.
|
||||
|
||||
SourceFiles
|
||||
IDDESDelta.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IDDESDeltaDelta_H
|
||||
#define IDDESDeltaDelta_H
|
||||
|
||||
#include "LESdelta.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IDDESDelta Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IDDESDelta
|
||||
:
|
||||
public LESdelta
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar deltaCoeff_;
|
||||
scalar cw_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
IDDESDelta(const IDDESDelta&);
|
||||
void operator=(const IDDESDelta&);
|
||||
|
||||
//- Calculate the delta values
|
||||
void calcDelta();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("IDDESDelta");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name, mesh and IOdictionary
|
||||
IDDESDelta
|
||||
(
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~IDDESDelta()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the LESdelta dictionary
|
||||
void read(const dictionary&);
|
||||
|
||||
// Correct values
|
||||
void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,214 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "SpalartAllmarasIDDES.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallDist.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(SpalartAllmarasIDDES, 0);
|
||||
addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
|
||||
{
|
||||
return
|
||||
0.25
|
||||
- wallDist(mesh_).y()
|
||||
/dimensionedScalar("hMax", dimLength, max(cmptMax(delta())));
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasIDDES::ft(const volScalarField& S) const
|
||||
{
|
||||
return tanh(pow3(sqr(ct_)*r(nuSgs_, S)));
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasIDDES::fl(const volScalarField& S) const
|
||||
{
|
||||
return tanh(pow(sqr(cl_)*r(transport().nu(), S), 10));
|
||||
}
|
||||
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasIDDES::rd
|
||||
(
|
||||
const volScalarField& visc,
|
||||
const volScalarField& S
|
||||
) const
|
||||
{
|
||||
volScalarField d = wallDist(mesh_).y();
|
||||
|
||||
tmp<volScalarField> trd
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
min
|
||||
(
|
||||
visc
|
||||
/(
|
||||
max
|
||||
(
|
||||
S,
|
||||
dimensionedScalar("SMALL", S.dimensions(), SMALL)
|
||||
)*sqr(kappa_*d)
|
||||
+ dimensionedScalar
|
||||
(
|
||||
"ROOTVSMALL",
|
||||
dimensionSet(0, 2 , -1, 0, 0),
|
||||
ROOTVSMALL
|
||||
)
|
||||
), scalar(10.0)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return trd;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<volScalarField> SpalartAllmarasIDDES::fd(const volScalarField& S) const
|
||||
{
|
||||
return 1.0 - tanh(pow3(8.0*rd(nuSgs_+transport().nu(), S)));
|
||||
}
|
||||
|
||||
|
||||
void SpalartAllmarasIDDES::dTildaUpdate(const volScalarField& S)
|
||||
{
|
||||
volScalarField alpha = this->alpha();
|
||||
|
||||
volScalarField expTerm = exp(sqr(alpha));
|
||||
|
||||
volScalarField fHill =
|
||||
2.0*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0));
|
||||
|
||||
|
||||
volScalarField fStep = min(2.0*pow(expTerm, -9.0), 1.0);
|
||||
volScalarField fHyb = max(1.0 - fd(S), fStep);
|
||||
|
||||
volScalarField fAmp = 1.0 - max(ft(S), fl(S));
|
||||
|
||||
volScalarField fRestore = max(fHill - 1.0, 0.0)*fAmp;
|
||||
|
||||
// volScalarField ft2 = IGNORING ft2 terms
|
||||
|
||||
volScalarField Psi = sqrt
|
||||
(
|
||||
min
|
||||
(
|
||||
100.0,
|
||||
(1.0 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*fv2())/max(SMALL, fv1())
|
||||
)
|
||||
);
|
||||
|
||||
dTilda_ = max
|
||||
(
|
||||
dimensionedScalar("zero", dimLength, 0.0),
|
||||
fHyb*(1.0 + fRestore*Psi)*wallDist(mesh_).y()
|
||||
+ (1.0 - fHyb)*CDES_*Psi*delta()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
SpalartAllmarasIDDES::SpalartAllmarasIDDES
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
)
|
||||
:
|
||||
SpalartAllmaras(U, phi, transport, typeName),
|
||||
|
||||
fwStar_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"fwStar",
|
||||
coeffDict(),
|
||||
0.424
|
||||
)
|
||||
),
|
||||
cl_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"cl",
|
||||
coeffDict(),
|
||||
3.55
|
||||
)
|
||||
),
|
||||
ct_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"ct",
|
||||
coeffDict(),
|
||||
1.63
|
||||
)
|
||||
)
|
||||
|
||||
{}
|
||||
|
||||
|
||||
bool SpalartAllmarasIDDES::read()
|
||||
{
|
||||
if (SpalartAllmaras::read())
|
||||
{
|
||||
fwStar_.readIfPresent(coeffDict());
|
||||
cl_.readIfPresent(coeffDict());
|
||||
ct_.readIfPresent(coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESModels
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
Class
|
||||
Foam::LESmodels::SpalartAllmarasIDDES
|
||||
|
||||
Description
|
||||
SpalartAllmarasIDDES LES turbulence model for incompressible flows
|
||||
|
||||
SourceFiles
|
||||
SpalartAllmarasIDDES.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SpalartAllmarasIDDES_H
|
||||
#define SpalartAllmarasIDDES_H
|
||||
|
||||
#include "SpalartAllmaras.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SpalartAllmarasIDDES Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SpalartAllmarasIDDES
|
||||
:
|
||||
public SpalartAllmaras
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Model constants
|
||||
|
||||
dimensionedScalar fwStar_;
|
||||
dimensionedScalar cl_;
|
||||
dimensionedScalar ct_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
tmp<volScalarField> alpha() const;
|
||||
tmp<volScalarField> ft(const volScalarField& S) const;
|
||||
tmp<volScalarField> fl(const volScalarField& S) const;
|
||||
tmp<volScalarField> rd
|
||||
(
|
||||
const volScalarField& visc,
|
||||
const volScalarField& S
|
||||
) const;
|
||||
|
||||
// Disallow default bitwise copy construct and assignment
|
||||
SpalartAllmarasIDDES(const SpalartAllmarasIDDES&);
|
||||
SpalartAllmarasIDDES& operator=(const SpalartAllmarasIDDES&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Delay function
|
||||
tmp<volScalarField> fd(const volScalarField& S) const;
|
||||
|
||||
//- Length scale calculation
|
||||
virtual void dTildaUpdate(const volScalarField& S);
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SpalartAllmarasIDDES");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Constructor from components
|
||||
SpalartAllmarasIDDES
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SpalartAllmarasIDDES()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read turbulenceProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESModels
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user