mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Code refactoring/clean-up
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,8 +41,6 @@ namespace Foam
|
|||||||
|
|
||||||
void Foam::IDDESDelta::calcDelta()
|
void Foam::IDDESDelta::calcDelta()
|
||||||
{
|
{
|
||||||
label nD = mesh().nGeometricD();
|
|
||||||
|
|
||||||
const volScalarField& hmax = hmax_();
|
const volScalarField& hmax = hmax_();
|
||||||
|
|
||||||
// initialise wallNorm
|
// initialise wallNorm
|
||||||
@ -50,7 +48,7 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
|
|
||||||
const volVectorField& n = wallNorm.n();
|
const volVectorField& n = wallNorm.n();
|
||||||
|
|
||||||
tmp<volScalarField> faceToFacenMax
|
tmp<volScalarField> tfaceToFacenMax
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
(
|
(
|
||||||
@ -67,61 +65,60 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const cellList& cells = mesh().cells();
|
scalarField& faceToFacenMax = tfaceToFacenMax().internalField();
|
||||||
|
|
||||||
forAll(cells,cellI)
|
const cellList& cells = mesh().cells();
|
||||||
|
const vectorField& faceCentres = mesh().faceCentres();
|
||||||
|
|
||||||
|
forAll(cells, cellI)
|
||||||
{
|
{
|
||||||
scalar deltaMaxTmp = 0.0;
|
scalar deltaMaxTmp = 0.0;
|
||||||
const labelList& cFaces = mesh().cells()[cellI];
|
const labelList& cFaces = cells[cellI];
|
||||||
const point& faceCentre = mesh().faceCentres()[cFaces[0]];
|
const point& faceCentre = faceCentres[cFaces[0]];
|
||||||
const vector nCell = n[cellI];
|
const vector nCell = n[cellI];
|
||||||
forAll(cFaces, cFaceI)
|
forAll(cFaces, cFaceI)
|
||||||
{
|
{
|
||||||
label faceI = cFaces[cFaceI];
|
label faceI = cFaces[cFaceI];
|
||||||
const point& faceCentreTwo = mesh().faceCentres()[faceI];
|
const point& faceCentreTwo = faceCentres[faceI];
|
||||||
scalar tmp = (faceCentre - faceCentreTwo) & nCell;
|
scalar tmp = (faceCentre - faceCentreTwo) & nCell;
|
||||||
if (tmp > deltaMaxTmp)
|
if (tmp > deltaMaxTmp)
|
||||||
{
|
{
|
||||||
deltaMaxTmp = tmp;
|
deltaMaxTmp = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
faceToFacenMax()[cellI] = deltaMaxTmp;
|
faceToFacenMax[cellI] = deltaMaxTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nD == 3)
|
|
||||||
|
label nD = mesh().nGeometricD();
|
||||||
|
|
||||||
|
if (nD == 2)
|
||||||
{
|
{
|
||||||
|
WarningIn("IDDESDelta::calcDelta()")
|
||||||
|
<< "Case is 2D, LES is not strictly applicable" << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else if (nD != 3)
|
||||||
|
{
|
||||||
|
FatalErrorIn("IDDESDelta::calcDelta()")
|
||||||
|
<< "Case must be either 2D or 3D" << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
delta_.internalField() =
|
delta_.internalField() =
|
||||||
deltaCoeff_
|
deltaCoeff_
|
||||||
*min
|
*min
|
||||||
(
|
(
|
||||||
max
|
max
|
||||||
(
|
(
|
||||||
max(cw_*wallDist(mesh()).y(), cw_*hmax),
|
max
|
||||||
faceToFacenMax()
|
(
|
||||||
|
cw_*wallDist(mesh()).y(),
|
||||||
|
cw_*hmax
|
||||||
|
),
|
||||||
|
tfaceToFacenMax
|
||||||
),
|
),
|
||||||
hmax
|
hmax
|
||||||
);
|
);
|
||||||
}
|
|
||||||
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_*hmax), faceToFacenMax()),
|
|
||||||
hmax
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorIn("IDDESDelta::calcDelta()")
|
|
||||||
<< "Case is not 3D or 2D, LES is not strictly applicable"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,10 +133,7 @@ Foam::IDDESDelta::IDDESDelta
|
|||||||
:
|
:
|
||||||
LESdelta(name, mesh),
|
LESdelta(name, mesh),
|
||||||
hmax_(LESdelta::New("hmax", mesh, dd.parent())),
|
hmax_(LESdelta::New("hmax", mesh, dd.parent())),
|
||||||
deltaCoeff_
|
deltaCoeff_(readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff"))),
|
||||||
(
|
|
||||||
readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff"))
|
|
||||||
),
|
|
||||||
cw_(0.15)
|
cw_(0.15)
|
||||||
{
|
{
|
||||||
dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
|
dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
|
||||||
|
|||||||
Reference in New Issue
Block a user