Merge branch 'feature-normalisation-dfsem' into 'develop'

ENH: turbulentDFSEMInlet: various improvements

See merge request Development/openfoam!454
This commit is contained in:
Andrew Heather
2021-06-09 13:41:02 +00:00
88 changed files with 2889 additions and 2024 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,37 +49,37 @@ bool Foam::eddy::setScales
vector& alpha
) const
{
// Static array of gamma^2 vs c2 coefficient
// Static array of gamma^2 vs c2 coefficient (PCR:Table 1)
static const scalar gamma2VsC2[8] =
{2, 1.875, 1.737, 1.75, 0.91, 0.825, 0.806, 1.5};
scalar gamma = Foam::sqrt(scalar(gamma2));
const scalar gamma = Foam::sqrt(scalar(gamma2));
// c2 coefficient retrieved from array
scalar c2 = gamma2VsC2[gamma2 - 1];
const scalar c2 = gamma2VsC2[gamma2 - 1];
// Length scale in largest eigenvalue direction
label d1 = dir1_;
label d2 = (d1 + 1) % 3;
label d3 = (d1 + 2) % 3;
// Length scale in the largest eigenvalue direction
const label d1 = dir1_;
const label d2 = (d1 + 1) % 3;
const label d3 = (d1 + 2) % 3;
sigma[d1] = sigmaX;
// Note: sigma_average = 1/3*(sigma_x + sigma_y + sigma_z)
// Substituting for sigma_y = sigma_x/gamma and sigma_z = sigma_y
//sigma[d1] = 3*sigmaX/(1 + 2/gamma);
// Other length scales equal, as function of major axis length and gamma
sigma[d2] = sigma[d1]/gamma;
sigma[d3] = sigma[d2];
vector sigma2 = cmptMultiply(sigma, sigma);
scalar slos2 = cmptSum(cmptDivide(lambda, sigma2));
// (PCR:Eq. 13)
const vector sigma2(cmptMultiply(sigma, sigma));
const scalar slos2 = cmptSum(cmptDivide(lambda, sigma2));
bool ok = true;
for (label beta = 0; beta < 3; ++beta)
for (label beta = 0; beta < vector::nComponents; ++beta)
{
scalar x = slos2 - 2*lambda[beta]/sigma2[beta];
const scalar x = slos2 - 2*lambda[beta]/sigma2[beta];
if (x < 0)
{
@ -88,6 +88,7 @@ bool Foam::eddy::setScales
}
else
{
// (SST:Eq. 23)
alpha[beta] = e[beta]*sqrt(x/(2*c2));
}
}
@ -145,7 +146,7 @@ Foam::eddy::eddy
dir1_(0)
{
// Principal stresses - eigenvalues returned in ascending order
vector lambda(eigenValues(R));
const vector lambda(eigenValues(R));
// Eddy rotation from principal-to-global axes
// - given by the 3 eigenvectors of the Reynold stress tensor as rows in
@ -174,17 +175,17 @@ Foam::eddy::eddy
{
// Random length scale ratio, gamma = sigmax/sigmay = sigmax/sigmaz
// - using gamma^2 to ease lookup of c2 coefficient
label g2 = Gamma2[i];
const label gamma2 = Gamma2[i];
if (setScales(sigmaX, g2, e, lambda, sigma_, alpha_))
if (setScales(sigmaX, gamma2, e, lambda, sigma_, alpha_))
{
found = true;
break;
}
}
// Normalisation coefficient (eq. 11)
// Note: sqrt(10*V)/sqrt(nEddy) applied outside when computing uDash
// Normalisation coefficient (PCR:Eq. 11)
// Note: sqrt(10*V)/sqrt(nEddy) applied outside when computing uPrime
c1_ = cmptAv(sigma_)/cmptProduct(sigma_)*cmptMin(sigma_);
if (found)
@ -226,27 +227,27 @@ Foam::eddy::eddy(const eddy& e)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::vector Foam::eddy::uDash(const point& xp, const vector& n) const
Foam::vector Foam::eddy::uPrime(const point& xp, const vector& n) const
{
// Relative position inside eddy (global system)
const vector r = cmptDivide(xp - position(n), sigma_);
// Relative position inside eddy (global system) (PCR:p. 524)
const vector r(cmptDivide(xp - position(n), sigma_));
if (mag(r) > 1)
if (mag(r) >= scalar(1))
{
return vector::zero;
}
// Relative position inside eddy (eddy principal system)
const vector rp = Rpg_.T() & r;
const vector rp(Rpg_.T() & r);
// Shape function (eddy principal system)
const vector q = cmptMultiply(sigma_, vector::one - cmptMultiply(rp, rp));
const vector q(cmptMultiply(sigma_, vector::one - cmptMultiply(rp, rp)));
// Fluctuating velocity (eddy principal system) (eq. 8)
const vector uDashp = cmptMultiply(q, rp^alpha_);
// Fluctuating velocity (eddy principal system) (PCR:Eq. 8)
const vector uPrimep(cmptMultiply(q, rp^alpha_));
// Convert into global system (eq. 10)
return c1_*(Rpg_ & uDashp);
// Convert into global system (PCR:Eq. 10)
return c1_*(Rpg_ & uPrimep);
}
@ -256,7 +257,7 @@ void Foam::eddy::writeCentreOBJ
Ostream& os
) const
{
point p = position(n);
const point p(position(n));
os << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
}
@ -295,14 +296,14 @@ Foam::label Foam::eddy::writeSurfaceOBJ
x[nEddyPoints - 1] = - axisDir*s[dir1_];
label eddyPtI = 1;
for (label axisI = 1; axisI < nFaceAxis; axisI++)
for (label axisI = 1; axisI < nFaceAxis; ++axisI)
{
scalar z = s[dir1_]*cos(axisI*dPhi);
scalar r = sqrt(sqr(s[dir2])*(1 - sqr(z)/sqr(s[dir1_])));
const scalar z = s[dir1_]*cos(axisI*dPhi);
const scalar r = sqrt(sqr(s[dir2])*(1 - sqr(z)/sqr(s[dir1_])));
for (label thetaI = 0; thetaI < nFaceTheta; thetaI++)
for (label thetaI = 0; thetaI < nFaceTheta; ++thetaI)
{
scalar theta = thetaI*dTheta;
const scalar theta = thetaI*dTheta;
point& p = x[eddyPtI++];
p[dir1_] = z;
p[dir2] = r*sin(theta);
@ -313,33 +314,33 @@ Foam::label Foam::eddy::writeSurfaceOBJ
// Write points
forAll(x, i)
{
point p = position(n) + (Rpg_ & x[i]);
const point p = position(n) + (Rpg_ & x[i]);
os << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
}
// Write the end cap tri faces
for (label faceI = 0; faceI < nFaceTheta; faceI++)
for (label faceI = 0; faceI < nFaceTheta; ++faceI)
{
label p1 = pointI + 1;
label p2 = p1 + faceI + 1;
const label p1 = pointI + 1;
const label p2 = p1 + faceI + 1;
label p3 = p2 + 1;
if (faceI == nFaceTheta - 1) p3 -= nFaceTheta;
os << "f " << p1 << " " << p2 << " " << p3 << nl;
label q1 = pointI + nEddyPoints;
label q2 = q1 - faceI - 1;
const label q1 = pointI + nEddyPoints;
const label q2 = q1 - faceI - 1;
label q3 = q2 - 1;
if (faceI == nFaceTheta - 1) q3 += nFaceTheta;
os << "f " << q1 << " " << q2 << " " << q3 << nl;
}
// Write quad faces
for (label axisI = 1; axisI < nFaceAxis - 1; axisI++)
for (label axisI = 1; axisI < nFaceAxis - 1; ++axisI)
{
for (label thetaI = 0; thetaI < nFaceTheta; thetaI++)
for (label thetaI = 0; thetaI < nFaceTheta; ++thetaI)
{
label p1 = pointI + 1 + (axisI - 1)*nFaceTheta + thetaI + 1;
label p2 = p1 + nFaceTheta;
const label p1 = pointI + 1 + (axisI - 1)*nFaceTheta + thetaI + 1;
const label p2 = p1 + nFaceTheta;
label p3 = p2 + 1;
label p4 = p1 + 1;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,7 +69,7 @@ Ostream& operator<<(Ostream& os, const eddy& e);
class eddy
{
// Private data
// Private Data
static label Gamma2Values[8];
static UList<label> Gamma2;
@ -83,7 +83,7 @@ class eddy
//- Distance from reference position in normal direction
scalar x_;
//- Length scales in 3-D space
//- Integral-length scales in 3-D space
vector sigma_;
//- Time-averaged intensity
@ -133,14 +133,18 @@ public:
const label patchFaceI, // patch face index
const point& position0, // reference position
const scalar x, // distance from reference position
const scalar sigmaX, // length scale
const symmTensor& R, // Stress tensor
const scalar sigmaX, // integral-length scale
const symmTensor& R, // Reynolds stress tensor
Random& rndGen
);
//- Construct copy
//- Copy construct
eddy(const eddy& e);
// Public Data
//- Flag to activate debug statements
static int debug;
@ -149,26 +153,26 @@ public:
// Access
//- Return the patch face index that spawned the eddy
inline label patchFaceI() const;
inline label patchFaceI() const noexcept;
//- Return the reference position
inline const point& position0() const;
inline const point& position0() const noexcept;
//- Return the distance from the reference position
inline scalar x() const;
inline scalar x() const noexcept;
//- Return the lLength scales in 3-D space
inline const vector& sigma() const;
//- Return the length scales in 3-D space
inline const vector& sigma() const noexcept;
//- Return the time-averaged intensity
inline const vector& alpha() const;
inline const vector& alpha() const noexcept;
//- Return the coordinate system transformation from local
// principal to global axes
inline const tensor& Rpg() const;
//- principal to global axes
inline const tensor& Rpg() const noexcept;
//- Return the model coefficient c1
inline scalar c1() const;
inline scalar c1() const noexcept;
//- Return the eddy position
inline point position(const vector& n) const;
@ -192,10 +196,10 @@ public:
inline boundBox bounds(const bool global = true) const;
// Evaluate
// Evaluation
//- Return the fluctuating velocity contribution at local point xp
vector uDash(const point& xp, const vector& n) const;
vector uPrime(const point& xp, const vector& n) const;
// Writing

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,54 +39,54 @@ Foam::scalar Foam::eddy::epsi(Random& rndGen) const
}
inline Foam::label Foam::eddy::patchFaceI() const
inline Foam::label Foam::eddy::patchFaceI() const noexcept
{
return patchFaceI_;
}
inline const Foam::point& Foam::eddy::position0() const
inline const Foam::point& Foam::eddy::position0() const noexcept
{
return position0_;
}
inline Foam::scalar Foam::eddy::x() const
inline Foam::scalar Foam::eddy::x() const noexcept
{
return x_;
}
inline const Foam::vector& Foam::eddy::sigma() const
inline const Foam::vector& Foam::eddy::sigma() const noexcept
{
return sigma_;
}
inline const Foam::vector& Foam::eddy::alpha() const
inline const Foam::vector& Foam::eddy::alpha() const noexcept
{
return alpha_;
}
inline const Foam::tensor& Foam::eddy::Rpg() const
inline const Foam::tensor& Foam::eddy::Rpg() const noexcept
{
return Rpg_;
}
inline Foam::scalar Foam::eddy::c1() const noexcept
{
return c1_;
}
inline Foam::point Foam::eddy::position(const vector& n) const
{
return position0_ + n*x_;
}
inline Foam::scalar Foam::eddy::c1() const
{
return c1_;
}
Foam::vector Foam::eddy::epsilon(Random& rndGen) const
{
return vector(epsi(rndGen), epsi(rndGen), epsi(rndGen));

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,13 +27,9 @@ License
\*---------------------------------------------------------------------------*/
#include "turbulentDFSEMInletFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "momentOfInertia.H"
#include "OFstream.H"
#include "globalIndex.H"
#include "rawIOField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -51,7 +47,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::writeEddyOBJ() const
const labelList& boundaryPoints = pp.boundaryPoints();
const pointField& localPoints = pp.localPoints();
vector offset = patchNormal_*maxSigmaX_;
const vector offset(patchNormal_*maxSigmaX_);
forAll(boundaryPoints, i)
{
point p = localPoints[boundaryPoints[i]];
@ -65,24 +61,6 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::writeEddyOBJ() const
p -= offset;
os << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
}
// Draw lines between points
// Note: need to order to avoid crossing patch
//const label nPoint = boundaryPoints.size();
//
//forAll(boundaryPoints, i)
//{
// label i1 = i;
// label i2 = (i + 1) % nPoint;
// os << "l " << i1 << " " << i2 << nl;
//}
//
//forAll(boundaryPoints, i)
//{
// label i1 = i + nPoint;
// label i2 = ((i + 1) % nPoint) + nPoint;
// os << "l " << i1 << " " << i2 << nl;
//}
}
{
@ -106,141 +84,31 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::writeLumleyCoeffs() const
{
// Output list of xi vs eta
// Before interpolation/raw data
if (interpolateR_)
OFstream os(db().time().path()/"lumley_interpolated.out");
os << "# xi" << token::TAB << "eta" << endl;
const scalar t = db().time().timeOutputValue();
const symmTensorField R(R_->value(t)/sqr(Uref_));
forAll(R, faceI)
{
const fileName valsFile
(
fileName
(
this->db().time().globalPath()
/this->db().time().constant()
/"boundaryData"
/this->patch().name()
/"0"
/"R"
)
);
// Normalised anisotropy tensor
const symmTensor devR(dev(R[faceI]/(tr(R[faceI]))));
IOobject io
(
valsFile, // absolute path
this->db().time(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false, // no need to register
true // is global object (currently not used)
);
// Second tensor invariant
const scalar ii = min(0, invariantII(devR));
const rawIOField<symmTensor> Rexp(io, false);
// Third tensor invariant
const scalar iii = invariantIII(devR);
OFstream os(db().time().path()/"lumley_input.out");
os << "# xi" << token::TAB << "eta" << endl;
forAll(Rexp, faceI)
{
// Normalised anisotropy tensor
symmTensor devR = dev(Rexp[faceI]/(tr(Rexp[faceI])));
// Second tensor invariant
scalar ii = min(0, invariantII(devR));
// Third tensor invariant
scalar iii = invariantIII(devR);
// xi, eta
// See Pope - characterization of Reynolds-stress anisotropy
scalar xi = cbrt(0.5*iii);
scalar eta = sqrt(-ii/3.0);
os << xi << token::TAB << eta << token::TAB
<< ii << token::TAB << iii << endl;
}
// xi, eta
// See Pope - characterization of Reynolds-stress anisotropy
const scalar xi = cbrt(0.5*iii);
const scalar eta = sqrt(-ii/3.0);
os << xi << token::TAB << eta << token::TAB
<< ii << token::TAB << iii << endl;
}
// After interpolation
{
OFstream os(db().time().path()/"lumley_interpolated.out");
os << "# xi" << token::TAB << "eta" << endl;
forAll(R_, faceI)
{
// Normalised anisotropy tensor
symmTensor devR = dev(R_[faceI]/(tr(R_[faceI])));
// Second tensor invariant
scalar ii = min(0, invariantII(devR));
// Third tensor invariant
scalar iii = invariantIII(devR);
// xi, eta
// See Pope - characterization of Reynolds-stress anisotropy
scalar xi = cbrt(0.5*iii);
scalar eta = sqrt(-ii/3.0);
os << xi << token::TAB << eta << token::TAB
<< ii << token::TAB << iii << endl;
}
}
}
const Foam::pointToPointPlanarInterpolation&
Foam::turbulentDFSEMInletFvPatchVectorField::patchMapper() const
{
// Initialise interpolation (2D planar interpolation by triangulation)
if (!mapperPtr_)
{
const fileName samplePointsFile
(
this->db().time().globalPath()
/this->db().time().constant()
/"boundaryData"
/this->patch().name()
/"points"
);
IOobject io
(
samplePointsFile, // absolute path
this->db().time(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false, // no need to register
true // is global object (currently not used)
);
// Read data
const rawIOField<point> samplePoints(io, false);
DebugInFunction
<< " Read " << samplePoints.size() << " sample points from "
<< samplePointsFile << endl;
// tbd: run-time selection
bool nearestOnly =
(
!mapMethod_.empty()
&& mapMethod_ != "planarInterpolation"
);
// Allocate the interpolator
mapperPtr_.reset
(
new pointToPointPlanarInterpolation
(
samplePoints,
this->patch().patch().faceCentres(),
perturb_,
nearestOnly
)
);
}
return *mapperPtr_;
}
@ -252,7 +120,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
patchNormal_ = -gAverage(nf);
// Check that patch is planar
scalar error = max(magSqr(patchNormal_ + nf));
const scalar error = max(magSqr(patchNormal_ + nf));
if (error > SMALL)
{
@ -293,9 +161,9 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
}
}
forAll(sumTriMagSf_, i)
for (auto& s : sumTriMagSf_)
{
sumTriMagSf_[i] = 0.0;
s = 0.0;
}
sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf);
@ -303,7 +171,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
Pstream::listCombineGather(sumTriMagSf_, maxEqOp<scalar>());
Pstream::listCombineScatter(sumTriMagSf_);
for (label i = 1; i < triMagSf.size(); i++)
for (label i = 1; i < triMagSf.size(); ++i)
{
triMagSf[i] += triMagSf[i-1];
}
@ -314,7 +182,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
triCumulativeMagSf_.transfer(triMagSf);
// Convert sumTriMagSf_ into cumulative sum of areas per proc
for (label i = 1; i < sumTriMagSf_.size(); i++)
for (label i = 1; i < sumTriMagSf_.size(); ++i)
{
sumTriMagSf_[i] += sumTriMagSf_[i-1];
}
@ -336,7 +204,9 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddyBox()
{
const scalarField& magSf = patch().magSf();
//const scalarField cellDx(Foam::sqrt(magSf));
const scalarField L(L_->value(db().time().timeOutputValue())/Lref_);
// (PCF:Eq. 14)
const scalarField cellDx(max(Foam::sqrt(magSf), 2/patch().deltaCoeffs()));
// Inialise eddy box extents
@ -344,13 +214,10 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddyBox()
{
scalar& s = sigmax_[faceI];
// Length scale in x direction (based on eq. 14)
s = mag(L_[faceI]);
s = min(s, kappa_*delta_);
// Allow eddies to be smaller than the mesh scale as suggested by
// the reference?
// s = min(s, nCellPerEddy_*cellDx[faceI]);
// Average length scale (SST:Eq. 24)
// Personal communication regarding (PCR:Eq. 14)
// - the min operator in Eq. 14 is a typo, and should be a max operator
s = min(mag(L[faceI]), kappa_*delta_);
s = max(s, nCellPerEddy_*cellDx[faceI]);
}
@ -383,7 +250,8 @@ Foam::pointIndexHit Foam::turbulentDFSEMInletFvPatchVectorField::setNewPosition
if (global)
{
scalar areaFraction = rndGen_.globalPosition<scalar>(0, patchArea_);
const scalar areaFraction =
rndGen_.globalPosition<scalar>(0, patchArea_);
// Determine which processor to use
label procI = 0;
@ -400,7 +268,7 @@ Foam::pointIndexHit Foam::turbulentDFSEMInletFvPatchVectorField::setNewPosition
{
// Find corresponding decomposed face triangle
label triI = 0;
scalar offset = sumTriMagSf_[procI];
const scalar offset = sumTriMagSf_[procI];
forAllReverse(triCumulativeMagSf_, i)
{
if (areaFraction > triCumulativeMagSf_[i] + offset)
@ -423,8 +291,8 @@ Foam::pointIndexHit Foam::turbulentDFSEMInletFvPatchVectorField::setNewPosition
{
// Find corresponding decomposed face triangle on local processor
label triI = 0;
scalar maxAreaLimit = triCumulativeMagSf_.last();
scalar areaFraction = rndGen_.position<scalar>(0, maxAreaLimit);
const scalar maxAreaLimit = triCumulativeMagSf_.last();
const scalar areaFraction = rndGen_.position<scalar>(0, maxAreaLimit);
forAllReverse(triCumulativeMagSf_, i)
{
@ -450,6 +318,9 @@ Foam::pointIndexHit Foam::turbulentDFSEMInletFvPatchVectorField::setNewPosition
void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddies()
{
const scalar t = db().time().timeOutputValue();
const symmTensorField R(R_->value(t)/sqr(Uref_));
DynamicList<eddy> eddies(size());
// Initialise eddy properties
@ -465,18 +336,18 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddies()
{
// Get new parallel consistent position
pointIndexHit pos(setNewPosition(true));
label faceI = pos.index();
const label patchFaceI = pos.index();
// Note: only 1 processor will pick up this face
if (faceI != -1)
if (patchFaceI != -1)
{
eddy e
(
faceI,
patchFaceI,
pos.hitPoint(),
rndGen_.position<scalar>(-maxSigmaX_, maxSigmaX_),
sigmax_[faceI],
R_[faceI],
sigmax_[patchFaceI],
R[patchFaceI],
rndGen_
);
@ -526,16 +397,21 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddies()
WarningInFunction
<< "Patch: " << patch().patch().name()
<< " on field " << internalField().name()
<< ": No eddies seeded - please check your set-up" << endl;
<< ": No eddies seeded - please check your set-up"
<< endl;
}
}
void Foam::turbulentDFSEMInletFvPatchVectorField::convectEddies
(
const vector& UBulk,
const scalar deltaT
)
{
const scalar t = db().time().timeOutputValue();
const symmTensorField R(R_->value(t)/sqr(Uref_));
// Note: all operations applied to local processor only
label nRecycled = 0;
@ -543,7 +419,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::convectEddies
forAll(eddies_, eddyI)
{
eddy& e = eddies_[eddyI];
e.move(deltaT*(UMean_ & patchNormal_));
e.move(deltaT*(UBulk & patchNormal_));
const scalar position0 = e.x();
@ -555,17 +431,17 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::convectEddies
while (search && iter++ < seedIterMax_)
{
// Spawn new eddy with new random properties (intensity etc)
pointIndexHit pos(setNewPosition(false));
label faceI = pos.index();
// Spawn new eddy with new random properties (intensity etc)
pointIndexHit pos(setNewPosition(false));
const label patchFaceI = pos.index();
e = eddy
e = eddy
(
faceI,
patchFaceI,
pos.hitPoint(),
position0 - floor(position0/maxSigmaX_)*maxSigmaX_,
sigmax_[faceI],
R_[faceI],
sigmax_[patchFaceI],
R[patchFaceI],
rndGen_
);
@ -583,27 +459,28 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::convectEddies
if (debug && nRecycled > 0)
{
Info<< "Patch: " << patch().patch().name() << " recycled "
<< nRecycled << " eddies" << endl;
Info<< "Patch: " << patch().patch().name()
<< " recycled " << nRecycled << " eddies"
<< endl;
}
}
Foam::vector Foam::turbulentDFSEMInletFvPatchVectorField::uDashEddy
Foam::vector Foam::turbulentDFSEMInletFvPatchVectorField::uPrimeEddy
(
const List<eddy>& eddies,
const point& patchFaceCf
) const
{
vector uDash(Zero);
vector uPrime(Zero);
forAll(eddies, k)
{
const eddy& e = eddies[k];
uDash += e.uDash(patchFaceCf, patchNormal_);
uPrime += e.uPrime(patchFaceCf, patchNormal_);
}
return uDash;
return uPrime;
}
@ -629,8 +506,8 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies
const eddy& e = eddies_[i];
// Eddy bounds
point x = e.position(patchNormal_);
boundBox ebb = e.bounds();
const point x(e.position(patchNormal_));
boundBox ebb(e.bounds());
ebb.min() += x;
ebb.max() += x;
@ -678,10 +555,10 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies
if (procI != Pstream::myProcNo())
{
// What I need to receive is what other processor is sending to me
label nRecv = sendSizes[procI][Pstream::myProcNo()];
const label nRecv = sendSizes[procI][Pstream::myProcNo()];
constructMap[procI].setSize(nRecv);
for (label i = 0; i < nRecv; i++)
for (label i = 0; i < nRecv; ++i)
{
constructMap[procI][i] = segmentI++;
}
@ -738,37 +615,33 @@ turbulentDFSEMInletFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(p, iF),
delta_(Zero),
d_(Zero),
kappa_(Zero),
perturb_(1e-5),
mapMethod_("nearestCell"),
mapperPtr_(nullptr),
interpolateR_(false),
interpolateL_(false),
interpolateU_(false),
R_(),
L_(),
U_(),
UMean_(Zero),
U_(nullptr),
R_(nullptr),
L_(nullptr),
delta_(1.0),
d_(1.0),
kappa_(0.41),
Uref_(1.0),
Lref_(1.0),
scale_(1.0),
m_(0.5),
nCellPerEddy_(5),
patchArea_(-1),
triFace_(),
triToFace_(),
triCumulativeMagSf_(),
sumTriMagSf_(Pstream::nProcs() + 1, Zero),
patchNormal_(Zero),
patchBounds_(boundBox::invertedBox),
eddies_(Zero),
nCellPerEddy_(5),
patchNormal_(Zero),
v0_(Zero),
rndGen_(Pstream::myProcNo()),
sigmax_(size(), Zero),
maxSigmaX_(Zero),
nEddy_(Zero),
nEddy_(0),
curTimeIndex_(-1),
patchBounds_(boundBox::invertedBox),
singleProc_(false),
writeEddies_(false)
{}
@ -784,37 +657,33 @@ turbulentDFSEMInletFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
U_(ptf.U_.clone(patch().patch())),
R_(ptf.R_.clone(patch().patch())),
L_(ptf.L_.clone(patch().patch())),
delta_(ptf.delta_),
d_(ptf.d_),
kappa_(ptf.kappa_),
perturb_(ptf.perturb_),
mapMethod_(ptf.mapMethod_),
mapperPtr_(nullptr),
interpolateR_(ptf.interpolateR_),
interpolateL_(ptf.interpolateL_),
interpolateU_(ptf.interpolateU_),
R_(ptf.R_, mapper),
L_(ptf.L_, mapper),
U_(ptf.U_, mapper),
UMean_(ptf.UMean_),
Uref_(ptf.Uref_),
Lref_(ptf.Lref_),
scale_(ptf.scale_),
m_(ptf.m_),
nCellPerEddy_(ptf.nCellPerEddy_),
patchArea_(ptf.patchArea_),
triFace_(ptf.triFace_),
triToFace_(ptf.triToFace_),
triCumulativeMagSf_(ptf.triCumulativeMagSf_),
sumTriMagSf_(ptf.sumTriMagSf_),
patchNormal_(ptf.patchNormal_),
patchBounds_(ptf.patchBounds_),
eddies_(ptf.eddies_),
nCellPerEddy_(ptf.nCellPerEddy_),
patchNormal_(ptf.patchNormal_),
v0_(ptf.v0_),
rndGen_(ptf.rndGen_),
sigmax_(ptf.sigmax_, mapper),
maxSigmaX_(ptf.maxSigmaX_),
nEddy_(Zero),
nEddy_(ptf.nEddy_),
curTimeIndex_(-1),
patchBounds_(ptf.patchBounds_),
singleProc_(ptf.singleProc_),
writeEddies_(ptf.writeEddies_)
{}
@ -829,46 +698,42 @@ turbulentDFSEMInletFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
delta_(dict.get<scalar>("delta")),
d_(dict.getOrDefault<scalar>("d", 1)),
kappa_(dict.getOrDefault<scalar>("kappa", 0.41)),
perturb_(dict.getOrDefault<scalar>("perturb", 1e-5)),
mapMethod_(dict.getOrDefault<word>("mapMethod", "nearestCell")),
mapperPtr_(nullptr),
interpolateR_(dict.getOrDefault("interpolateR", false)),
interpolateL_(dict.getOrDefault("interpolateL", false)),
interpolateU_(dict.getOrDefault("interpolateU", false)),
R_(interpolateOrRead<symmTensor>("R", dict, interpolateR_)),
L_(interpolateOrRead<scalar>("L", dict, interpolateL_)),
U_(interpolateOrRead<vector>("U", dict, interpolateU_)),
UMean_(Zero),
U_(PatchFunction1<vector>::New(patch().patch(), "U", dict)),
R_(PatchFunction1<symmTensor>::New(patch().patch(), "R", dict)),
L_(PatchFunction1<scalar>::New(patch().patch(), "L", dict)),
delta_(dict.getCheck<scalar>("delta", scalarMinMax::ge(0))),
d_(dict.getCheckOrDefault<scalar>("d", 1, scalarMinMax::ge(SMALL))),
kappa_(dict.getCheckOrDefault<scalar>("kappa", 0.41, scalarMinMax::ge(0))),
Uref_(dict.getCheckOrDefault<scalar>("Uref", 1, scalarMinMax::ge(SMALL))),
Lref_(dict.getCheckOrDefault<scalar>("Lref", 1, scalarMinMax::ge(SMALL))),
scale_(dict.getCheckOrDefault<scalar>("scale", 1, scalarMinMax::ge(0))),
m_(dict.getCheckOrDefault<scalar>("m", 0.5, scalarMinMax::ge(0))),
nCellPerEddy_(dict.getOrDefault<label>("nCellPerEddy", 5)),
patchArea_(-1),
triFace_(),
triToFace_(),
triCumulativeMagSf_(),
sumTriMagSf_(Pstream::nProcs() + 1, Zero),
patchNormal_(Zero),
patchBounds_(boundBox::invertedBox),
eddies_(),
nCellPerEddy_(dict.getOrDefault<label>("nCellPerEddy", 5)),
patchNormal_(Zero),
v0_(Zero),
rndGen_(),
sigmax_(size(), Zero),
maxSigmaX_(Zero),
nEddy_(Zero),
nEddy_(0),
curTimeIndex_(-1),
patchBounds_(boundBox::invertedBox),
singleProc_(false),
writeEddies_(dict.getOrDefault("writeEddies", false))
{
eddy::debug = debug;
checkStresses(R_);
const scalar t = db().time().timeOutputValue();
const symmTensorField R(R_->value(t)/sqr(Uref_));
// Set UMean as patch area average value
UMean_ = gSum(U_*patch().magSf())/(gSum(patch().magSf()) + ROOTVSMALL);
checkStresses(R);
}
@ -879,37 +744,33 @@ turbulentDFSEMInletFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(ptf),
U_(ptf.U_.clone(patch().patch())),
R_(ptf.R_.clone(patch().patch())),
L_(ptf.L_.clone(patch().patch())),
delta_(ptf.delta_),
d_(ptf.d_),
kappa_(ptf.kappa_),
perturb_(ptf.perturb_),
mapMethod_(ptf.mapMethod_),
mapperPtr_(nullptr),
interpolateR_(ptf.interpolateR_),
interpolateL_(ptf.interpolateL_),
interpolateU_(ptf.interpolateU_),
R_(ptf.R_),
L_(ptf.L_),
U_(ptf.U_),
UMean_(ptf.UMean_),
Uref_(ptf.Uref_),
Lref_(ptf.Lref_),
scale_(ptf.scale_),
m_(ptf.m_),
nCellPerEddy_(ptf.nCellPerEddy_),
patchArea_(ptf.patchArea_),
triFace_(ptf.triFace_),
triToFace_(ptf.triToFace_),
triCumulativeMagSf_(ptf.triCumulativeMagSf_),
sumTriMagSf_(ptf.sumTriMagSf_),
patchNormal_(ptf.patchNormal_),
patchBounds_(ptf.patchBounds_),
eddies_(ptf.eddies_),
nCellPerEddy_(ptf.nCellPerEddy_),
patchNormal_(ptf.patchNormal_),
v0_(ptf.v0_),
rndGen_(ptf.rndGen_),
sigmax_(ptf.sigmax_),
maxSigmaX_(ptf.maxSigmaX_),
nEddy_(Zero),
nEddy_(ptf.nEddy_),
curTimeIndex_(-1),
patchBounds_(ptf.patchBounds_),
singleProc_(ptf.singleProc_),
writeEddies_(ptf.writeEddies_)
{}
@ -923,37 +784,33 @@ turbulentDFSEMInletFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(ptf, iF),
U_(ptf.U_.clone(patch().patch())),
R_(ptf.R_.clone(patch().patch())),
L_(ptf.L_.clone(patch().patch())),
delta_(ptf.delta_),
d_(ptf.d_),
kappa_(ptf.kappa_),
perturb_(ptf.perturb_),
mapMethod_(ptf.mapMethod_),
mapperPtr_(nullptr),
interpolateR_(ptf.interpolateR_),
interpolateL_(ptf.interpolateL_),
interpolateU_(ptf.interpolateU_),
R_(ptf.R_),
L_(ptf.L_),
U_(ptf.U_),
UMean_(ptf.UMean_),
Uref_(ptf.Uref_),
Lref_(ptf.Lref_),
scale_(ptf.scale_),
m_(ptf.m_),
nCellPerEddy_(ptf.nCellPerEddy_),
patchArea_(ptf.patchArea_),
triFace_(ptf.triFace_),
triToFace_(ptf.triToFace_),
triCumulativeMagSf_(ptf.triCumulativeMagSf_),
sumTriMagSf_(ptf.sumTriMagSf_),
patchNormal_(ptf.patchNormal_),
patchBounds_(ptf.patchBounds_),
eddies_(ptf.eddies_),
nCellPerEddy_(ptf.nCellPerEddy_),
patchNormal_(ptf.patchNormal_),
v0_(ptf.v0_),
rndGen_(ptf.rndGen_),
sigmax_(ptf.sigmax_),
maxSigmaX_(ptf.maxSigmaX_),
nEddy_(Zero),
nEddy_(ptf.nEddy_),
curTimeIndex_(-1),
patchBounds_(ptf.patchBounds_),
singleProc_(ptf.singleProc_),
writeEddies_(ptf.writeEddies_)
{}
@ -981,11 +838,11 @@ bool Foam::turbulentDFSEMInletFvPatchVectorField::checkStresses
<< exit(FatalError);
}
scalar a_xx = sqrt(R.xx());
const scalar a_xx = sqrt(R.xx());
scalar a_xy = R.xy()/a_xx;
const scalar a_xy = R.xy()/a_xx;
scalar a_yy_2 = R.yy() - sqr(a_xy);
const scalar a_yy_2 = R.yy() - sqr(a_xy);
if (a_yy_2 < 0)
{
@ -996,13 +853,13 @@ bool Foam::turbulentDFSEMInletFvPatchVectorField::checkStresses
<< exit(FatalError);
}
scalar a_yy = Foam::sqrt(a_yy_2);
const scalar a_yy = Foam::sqrt(a_yy_2);
scalar a_xz = R.xz()/a_xx;
const scalar a_xz = R.xz()/a_xx;
scalar a_yz = (R.yz() - a_xy*a_xz)*a_yy;
const scalar a_yz = (R.yz() - a_xy*a_xz)/a_yy;
scalar a_zz_2 = R.zz() - sqr(a_xz) - sqr(a_yz);
const scalar a_zz_2 = R.zz() - sqr(a_xz) - sqr(a_yz);
if (a_zz_2 < 0)
{
@ -1013,7 +870,7 @@ bool Foam::turbulentDFSEMInletFvPatchVectorField::checkStresses
<< exit(FatalError);
}
scalar a_zz = Foam::sqrt(a_zz_2);
const scalar a_zz = Foam::sqrt(a_zz_2);
if (debug)
{
@ -1036,11 +893,18 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::autoMap
{
fixedValueFvPatchField<vector>::autoMap(m);
// Clear interpolator
mapperPtr_.clear();
R_.autoMap(m);
L_.autoMap(m);
U_.autoMap(m);
if (U_)
{
U_->autoMap(m);
}
if (R_)
{
R_->autoMap(m);
}
if (L_)
{
L_->autoMap(m);
}
sigmax_.autoMap(m);
}
@ -1054,15 +918,21 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::rmap
{
fixedValueFvPatchField<vector>::rmap(ptf, addr);
const turbulentDFSEMInletFvPatchVectorField& dfsemptf =
const auto& dfsemptf =
refCast<const turbulentDFSEMInletFvPatchVectorField>(ptf);
R_.rmap(dfsemptf.R_, addr);
L_.rmap(dfsemptf.L_, addr);
U_.rmap(dfsemptf.U_, addr);
// Clear interpolator
mapperPtr_.clear();
if (U_)
{
U_->rmap(dfsemptf.U_(), addr);
}
if (R_)
{
R_->rmap(dfsemptf.R_(), addr);
}
if (L_)
{
L_->rmap(dfsemptf.L_(), addr);
}
sigmax_.rmap(dfsemptf.sigmax_, addr);
}
@ -1087,38 +957,38 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
if (curTimeIndex_ != db().time().timeIndex())
{
if (debug)
{
label n = eddies_.size();
Info<< "Number of eddies: " << returnReduce(n, sumOp<label>())
<< endl;
}
tmp<vectorField> UMean =
U_->value(db().time().timeOutputValue())/Uref_;
// (PCR:p. 522)
const vector UBulk
(
gSum(UMean()*patch().magSf())
/(gSum(patch().magSf()) + ROOTVSMALL)
);
// Move eddies using bulk velocity
const scalar deltaT = db().time().deltaTValue();
convectEddies(UBulk, deltaT);
// Move eddies using mean velocity
convectEddies(deltaT);
// Set velocity
// Set mean velocity
vectorField& U = *this;
//U = UMean_;
U = U_;
const pointField& Cf = patch().Cf();
U = UMean;
// Apply second part of normalisation coefficient
// Note: factor of 2 required to match reference stresses?
const scalar FACTOR = 2;
const scalar c = FACTOR*Foam::sqrt(10*v0_)/Foam::sqrt(scalar(nEddy_));
const scalar c =
scale_*Foam::pow(10*v0_, m_)/Foam::sqrt(scalar(nEddy_));
// In parallel, need to collect all eddies that will interact with
// local faces
const pointField& Cf = patch().Cf();
if (singleProc_ || !Pstream::parRun())
{
forAll(U, faceI)
{
U[faceI] += c*uDashEddy(eddies_, Cf[faceI]);
U[faceI] += c*uPrimeEddy(eddies_, Cf[faceI]);
}
}
else
@ -1126,7 +996,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
// Process local eddy contributions
forAll(U, faceI)
{
U[faceI] += c*uDashEddy(eddies_, Cf[faceI]);
U[faceI] += c*uPrimeEddy(eddies_, Cf[faceI]);
}
// Add contributions from overlapping eddies
@ -1139,30 +1009,21 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
if (eddies.size())
{
//Pout<< "Applying " << eddies.size()
// << " eddies from processor " << procI << endl;
forAll(U, faceI)
{
U[faceI] += c*uDashEddy(eddies, Cf[faceI]);
U[faceI] += c*uPrimeEddy(eddies, Cf[faceI]);
}
}
}
}
// Re-scale to ensure correct flow rate
scalar fCorr =
gSum((UMean_ & patchNormal_)*patch().magSf())
const scalar fCorr =
gSum((UBulk & patchNormal_)*patch().magSf())
/gSum(U & -patch().Sf());
U *= fCorr;
if (debug)
{
Info<< "Patch:" << patch().patch().name()
<< " min/max(U):" << gMin(U) << ", " << gMax(U) << endl;
}
curTimeIndex_ = db().time().timeIndex();
if (writeEddies_)
@ -1170,9 +1031,22 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
writeEddyOBJ();
}
if (debug && db().time().writeTime())
if (debug)
{
writeLumleyCoeffs();
Info<< "Magnitude of bulk velocity: " << UBulk << endl;
label n = eddies_.size();
Info<< "Number of eddies: " << returnReduce(n, sumOp<label>())
<< endl;
Info<< "Patch:" << patch().patch().name()
<< " min/max(U):" << gMin(U) << ", " << gMax(U)
<< endl;
if (db().time().writeTime())
{
writeLumleyCoeffs();
}
}
}
@ -1183,38 +1057,28 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
void Foam::turbulentDFSEMInletFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
writeEntry("value", os);
os.writeEntry("delta", delta_);
os.writeEntryIfDifferent<scalar>("d", 1.0, d_);
os.writeEntryIfDifferent<scalar>("kappa", 0.41, kappa_);
os.writeEntryIfDifferent<scalar>("perturb", 1e-5, perturb_);
os.writeEntryIfDifferent<scalar>("Uref", 1.0, Uref_);
os.writeEntryIfDifferent<scalar>("Lref", 1.0, Lref_);
os.writeEntryIfDifferent<scalar>("scale", 1.0, scale_);
os.writeEntryIfDifferent<scalar>("m", 0.5, m_);
os.writeEntryIfDifferent<label>("nCellPerEddy", 5, nCellPerEddy_);
os.writeEntryIfDifferent("writeEddies", false, writeEddies_);
if (!interpolateR_)
if (U_)
{
R_.writeEntry("R", os);
U_->writeData(os);
}
if (!interpolateL_)
if (R_)
{
L_.writeEntry("L", os);
R_->writeData(os);
}
if (!interpolateU_)
if (L_)
{
U_.writeEntry("U", os);
}
if (!mapMethod_.empty())
{
os.writeEntryIfDifferent<word>
(
"mapMethod",
"nearestCell",
mapMethod_
);
L_->writeData(os);
}
writeEntry("value", os);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,56 +31,107 @@ Group
grpInletBoundaryConditions
Description
Velocity boundary condition including synthesised eddies for use with LES
and DES turbulent flows.
The \c turbulentDFSEMInlet is a synthesised-eddy based velocity inlet
boundary condition to generate synthetic turbulence-alike time-series
from a given set of turbulence statistics for LES and hybrid RANS-LES
computations.
Reference:
\verbatim
Poletto, R., Craft, T., & Revell, A. (2013).
A new divergence free synthetic eddy method for
the reproduction of inlet flow conditions for LES.
Flow, turbulence and combustion, 91(3), 519-539.
DOI:10.1007/s10494-013-9488-2
\endverbatim
Standard model (tag:PCR):
Poletto, R., Craft, T., & Revell, A. (2013).
A new divergence free synthetic eddy method for
the reproduction of inlet flow conditions for LES.
Flow, turbulence and combustion, 91(3), 519-539.
DOI:10.1007/s10494-013-9488-2
Reynolds stress, velocity and turbulence length scale values can either
be specified directly, or mapped. If mapping, the values should be
entered in the same form as the \c timeVaryingMappedFixedValue condition,
except that no interpolation in time is supported. These should be
located in the directory:
\verbatim
\$FOAM_CASE/constant/boundaryData/\<patchName\>/points
\$FOAM_CASE/constant/boundaryData/\<patchName\>/0/\{R|U|L\}
Expression for the average length scale (tag:SST):
Shur, M., Strelets, M., Travin, A.,
Probst, A., Probst, S., Schwamborn, D., ... & Revell, A. (2018).
Improved embedded approaches.
In: Mockett C., Haase W., Schwamborn D. (eds)
Go4Hybrid: Grey area mitigation for hybrid RANS-LES methods.
Notes on Numerical Fluid Mechanics and Multidisciplinary Design.
p. 51-87. Springer, Cham.
DOI:10.1007/978-3-319-52995-0_3
\endverbatim
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type turbulentDFSEMInlet;
delta <scalar>;
R <PatchFunction1>;
U <PatchFunction1>;
L <PatchFunction1>;
// e.g.
// R uniform (<Rxx> <Rxy> <Rxz> <Ryy> <Ryz> <Rzz>);
// U uniform (<Ux> <Uy> <Uz>);
// L uniform <L>;
// Optional entries
d <scalar>;
nCellPerEddy <label>;
kappa <scalar>;
Uref <scalar>;
Lref <scalar>;
scale <scalar>;
m <scalar>;
writeEddies <bool>;
// Inherited entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Required | Default value
value | Restart value | yes |
delta | Local limiting length scale | yes |
R | Reynolds stress field | no |
U | Velocity field | no |
L | Turbulence length scale field | no |
d | Eddy density (fill fraction) | no | 1
kappa | Von Karman constant | no | 0.41
mapMethod | Method to map reference values | no | nearestCell
perturb | Point perturbation for interpolation | no | 1e-5
interpolateR | Flag to interpolate the R field | no | false
interpolateL | Flag to interpolate the L field | no | false
interpolateU | Flag to interpolate the U field | no | false
writeEddies | Flag to write eddies as OBJ file | no | no
Property | Description | Type | Reqd | Deflt
type | Type name: turbulentDFSEMInlet | word | yes | -
delta | Characteristic length scale | scalar | yes | -
R | Reynolds-stress tensor field <!--
--> | PatchFunction1\<symmTensor\> | yes | -
U | Mean velocity field <!--
--> | PatchFunction1<vector> | yes | -
L | Integral-length scale field <!--
--> | PatchFunction1<scalar> | yes | -
d | Ratio of sum of eddy volumes to eddy box volume <!--
--> i.e. eddy density (fill fraction) | scalar | no | 1.0
nCellPerEddy | Minimum eddy length in units of number of cells <!--
--> | label | no | 5
kappa | von Karman constant | scalar | no | 0.41
Uref | Normalisation factor for Reynolds-stress <!--
--> tensor and mean velocity | scalar | no | 1.0
Lref | Normalisation factor for integral-length scale <!--
--> | scalar | no | 1.0
scale | Heuristic scaling factor being applied <!--
--> on the normalisation factor C1 | scalar | no | 1.0
m | The power of V defined in C1 | scalar | no | 0.5
writeEddies | Flag to write eddies as OBJ file | bool | no | false
\endtable
Note
- The \c delta value typically represents the characteristic scale of flow
or flow domain, e.g. a channel half-height
- For \c R, \c U and \c L specification: if the entry is not user input,
it is assumed that the data will be mapped
The inherited entries are elaborated in:
- \link fixedValueFvPatchFields.H \endlink
- \link PatchFunction1.H \endlink
- \link MappedFile.H \endlink
SeeAlso
timeVaryingMappedFixedValueFvPatchField
turbulentDigitalFilterInlet
Note
- The \c delta value typically represents the characteristic scale of flow
or flow domain, e.g. a channel half height for plane channel flows.
- \c nCellPerEddy and \c scale entries are heuristic entries
which do not exist in the standard method, yet are necessary
to reproduce the results published in the original journal paper.
- In the original journal paper, \c C1 in Eq. 11 is not dimensionless.
It is not clear whether this dimensionality issue was intentional.
To alleviate this matter, users can alter the input entry \c m, which is
the power of the eddy-box volume defined in the \c C1, to obtain a
dimensionless \c C1 coefficient. The default value of \c m is 0.5,
which is the value stated in the original journal paper,
and \c m=1/3 leads to a dimensionless \c C1.
SourceFiles
turbulentDFSEMInletFvPatchVectorField.C
@ -94,15 +145,13 @@ SourceFiles
#include "Random.H"
#include "eddy.H"
#include "pointIndexHit.H"
#include "instantList.H"
#include "PatchFunction1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class pointToPointPlanarInterpolation;
/*---------------------------------------------------------------------------*\
Class turbulentDFSEMInletFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
@ -116,50 +165,38 @@ class turbulentDFSEMInletFvPatchVectorField
//- Maximum number of attempts when seeding eddies
static label seedIterMax_;
//- Characteristic length scale, e.g. half channel height
//- Mean velocity field
autoPtr<PatchFunction1<vector>> U_;
//- Reynolds stress tensor field
autoPtr<PatchFunction1<symmTensor>> R_;
//- Integral-length scale field
autoPtr<PatchFunction1<scalar>> L_;
//- Characteristic length scale
const scalar delta_;
//- Ratio of sum of eddy volumes to eddy box volume; default = 1
//- Ratio of sum of eddy volumes to eddy box volume, i.e. eddy density
const scalar d_;
//- Von Karman constant
//- von Karman constant
const scalar kappa_;
//- Global numbering for faces
mutable autoPtr<globalIndex> globalFacesPtr_;
//- Normalisation factor for Reynolds-stress tensor and mean velocity
const scalar Uref_;
//- Normalisation factor for integral-length scale
const scalar Lref_;
// Table reading for patch inlet flow properties
//- Heuristic scaling factor being applied on the normalisation factor
const scalar scale_;
//- Fraction of perturbation (fraction of bounding box) to add
scalar perturb_;
//- The power of V defined in C1
const scalar m_;
//- Interpolation scheme to use (nearestCell | planarInterpolation)
word mapMethod_;
//- 2D interpolation (for 'planarInterpolation' mapMethod)
mutable autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
//- Flag to identify to interpolate the R field
bool interpolateR_;
//- Flag to identify to interpolate the L field
bool interpolateL_;
//- Flag to identify to interpolate the U field
bool interpolateU_;
//- Reynolds stress tensor
symmTensorField R_;
//- Length scale
scalarField L_;
//- Inlet velocity
vectorField U_;
//- Mean inlet velocity
vector UMean_;
//- Minimum eddy length in units of number of cells
const label nCellPerEddy_;
// Patch information
@ -179,46 +216,51 @@ class turbulentDFSEMInletFvPatchVectorField
//- Cumulative area fractions per processor
scalarList sumTriMagSf_;
//- Patch normal into the domain
vector patchNormal_;
//- List of eddies
List<eddy> eddies_;
//- Patch bounds (local processor)
boundBox patchBounds_;
//- Minimum number of cells required to resolve an eddy
label nCellPerEddy_;
//- Patch normal into the domain
vector patchNormal_;
// Eddy information
//- Eddy box volume
scalar v0_;
//- List of eddies
List<eddy> eddies_;
//- Random number generator
Random rndGen_;
//- Eddy box volume
scalar v0_;
//- Length scale per patch face
scalarField sigmax_;
//- Random number generator
Random rndGen_;
//- Maximum length scale (across all processors)
scalar maxSigmaX_;
//- Integral-length scale per patch face
scalarField sigmax_;
//- Global number of eddies
label nEddy_;
//- Maximum integral-length scale (across all processors)
scalar maxSigmaX_;
//- Current time index (used for updating)
label curTimeIndex_;
//- Global number of eddies
label nEddy_;
//- Patch bounds (local processor)
boundBox patchBounds_;
//- Current time index (used for updating)
label curTimeIndex_;
//- Single processor contains all eddies (flag)
bool singleProc_;
//- Single processor contains all eddies (flag)
bool singleProc_;
//- Flag to write the eddies to file
bool writeEddies_;
//- Flag to write the eddies to file
bool writeEddies_;
// Private Member Functions
//- Write Lumley coefficients to file
void writeLumleyCoeffs() const;
//- Write eddy info in OBJ format
void writeEddyOBJ() const;
//- Initialise info for patch point search
void initialisePatch();
@ -231,37 +273,11 @@ class turbulentDFSEMInletFvPatchVectorField
//- Initialise eddies
void initialiseEddies();
//- Convect the eddies
void convectEddies(const scalar deltaT);
//- Convect the eddies with the bulk velocity
void convectEddies(const vector& UBulk, const scalar deltaT);
//- Calculate the velocity fluctuation at a point
vector uDashEddy(const List<eddy>& eddies, const point& globalX) const;
//- Helper function to interpolate values from the boundary data or
//- read from dictionary
template<class Type>
tmp<Field<Type>> interpolateOrRead
(
const word& fieldName,
const dictionary& dict,
bool& interpolateField
) const;
//- Helper function to interpolate values from the boundary data
template<class Type>
tmp<Field<Type>> interpolateBoundaryData
(
const word& fieldName
) const;
//- Write Lumley coefficients to file
void writeLumleyCoeffs() const;
//- Write eddy info in OBJ format
void writeEddyOBJ() const;
//- Return a reference to the patch mapper object
const pointToPointPlanarInterpolation& patchMapper() const;
//- Return velocity fluctuation vector at a given point
vector uPrimeEddy(const List<eddy>& eddies, const point& globalX) const;
//- Return eddies from remote processors that interact with local
//- processor
@ -345,11 +361,11 @@ public:
// Member Functions
//- Helper function to check that Reynold stresses are valid
//- Return true if input Reynold stresses are valid
static bool checkStresses(const symmTensorField& Rf);
// Mapping functions
// Mapping
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap(const fvPatchFieldMapper& m);
@ -362,14 +378,16 @@ public:
);
// Evaluation functions
// Evaluation
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
// IO
//- Write
virtual void write(Ostream&) const;
};
@ -379,12 +397,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "turbulentDFSEMInletFvPatchVectorFieldTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,109 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "pointToPointPlanarInterpolation.H"
#include "Time.H"
#include "rawIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::turbulentDFSEMInletFvPatchVectorField::interpolateOrRead
(
const word& fieldName,
const dictionary& dict,
bool& interpolateField
) const
{
if (dict.found(fieldName))
{
tmp<Field<Type>> tFld
(
new Field<Type>
(
fieldName,
dict,
this->patch().size()
)
);
interpolateField = false;
return tFld;
}
else
{
interpolateField = true;
return interpolateBoundaryData<Type>(fieldName);
}
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::turbulentDFSEMInletFvPatchVectorField::interpolateBoundaryData
(
const word& fieldName
) const
{
const word& patchName = this->patch().name();
const fileName valsFile
(
fileName
(
this->db().time().globalPath()
/this->db().time().constant()
/"boundaryData"
/patchName
/"0"
/fieldName
)
);
IOobject io
(
valsFile, // absolute path
this->db().time(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false, // no need to register
true // is global object (currently not used)
);
const rawIOField<Type> vals(io, false);
Info<< "Turbulent DFSEM patch " << patchName
<< ": interpolating field " << fieldName
<< " from " << valsFile << endl;
return patchMapper().interpolate(vals);
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -175,8 +175,13 @@ void Foam::PatchFunction1Types::MappedFile<Type>::autoMap
if (startSampledValues_.size())
{
startSampledValues_.autoMap(mapper);
}
if (endSampledValues_.size())
{
endSampledValues_.autoMap(mapper);
}
// Clear interpolator
mapperPtr_.clear();
startSampleTime_ = -1;
@ -196,8 +201,17 @@ void Foam::PatchFunction1Types::MappedFile<Type>::rmap
const PatchFunction1Types::MappedFile<Type>& tiptf =
refCast<const PatchFunction1Types::MappedFile<Type>>(pf1);
startSampledValues_.rmap(tiptf.startSampledValues_, addr);
endSampledValues_.rmap(tiptf.endSampledValues_, addr);
if (tiptf.startSampledValues_.size())
{
startSampledValues_.setSize(this->size());
startSampledValues_.rmap(tiptf.startSampledValues_, addr);
}
if (tiptf.endSampledValues_.size())
{
endSampledValues_.setSize(this->size());
endSampledValues_.rmap(tiptf.endSampledValues_, addr);
}
// Clear interpolator
mapperPtr_.clear();
@ -584,27 +598,11 @@ Foam::PatchFunction1Types::MappedFile<Type>::integrate
template<class Type>
void Foam::PatchFunction1Types::MappedFile<Type>::writeData
void Foam::PatchFunction1Types::MappedFile<Type>::writeEntries
(
Ostream& os
) const
{
PatchFunction1<Type>::writeData(os);
// Check if field name explicitly provided
// (e.g. through timeVaryingMapped bc)
if (dictConstructed_)
{
os.writeEntry(this->name(), type());
os.writeEntryIfDifferent
(
"fieldTable",
this->name(),
fieldTableName_
);
}
if (setAverage_)
{
os.writeEntry("setAverage", setAverage_);
@ -628,4 +626,36 @@ void Foam::PatchFunction1Types::MappedFile<Type>::writeData
}
template<class Type>
void Foam::PatchFunction1Types::MappedFile<Type>::writeData
(
Ostream& os
) const
{
PatchFunction1<Type>::writeData(os);
// Check if field name explicitly provided
// (e.g. through timeVaryingMapped bc)
if (dictConstructed_)
{
os.writeEntry(this->name(), type());
os.writeEntryIfDifferent
(
"fieldTable",
this->name(),
fieldTableName_
);
os.beginBlock(word(this->name() + "Coeffs"));
writeEntries(os);
os.endBlock();
}
else
{
writeEntries(os);
}
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,19 +27,34 @@ Class
Foam::PatchFunction1Types::MappedFile
Description
Patch value mapping from file
Patch value mapping from a set of values stored in a file and
a set of unstructured points using the following directory structure:
\verbatim
constant/boundaryData/\<patchName\>/points
constant/boundaryData/\<patchName\>/\<time\>/\<field\>
\endverbatim
Options:
\table
Property | Description | Required | Default
mapMethod | (nearest/planarInterpolation) | no | planarInterpolation
offset | Time-varying offset values to interpolated data | no |
fieldTable | Name of field data table | no | field-name
points | The name of the points file | no | points
perturb | Perturbation fraction of bounding box | no | 1e-5
setAverage | adjust mapped field to maintain average value | no | false
Property | Description | Type | Reqd | Deflt
mapMethod | Mapping method | word | no <!--
--> | planarInterpolation
offset | Time-varying offset values to interpolated data <!--
--> | Function1\<Type\> | no | -
fieldTable | Name of field data table | word | no | field-name
points | Name of the points file | word | no | points
perturb | Perturbation fraction of bounding box | scalar | no | 1e-5
setAverage | Adjust mapped field to maintain average value <!--
--> | scalar | no | false
\endtable
Options for the \c mapMethod entry:
\verbatim
nearest | Use nearest points only (avoids triangulation)
planarInterpolation | Interpolation using 2D Delaunay triangulation
\endverbatim
SourceFiles
MappedFile.C
@ -229,6 +244,9 @@ public:
// I-O
//- Write coefficient entries in dictionary format
void writeEntries(Ostream& os) const;
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};

View File

@ -1,16 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
runApplication blockMesh
#- Run serial
#runApplication $(getApplication)
#- Run parallel
runApplication decomposePar -cellDist
runParallel $(getApplication)
#runApplication reconstructPar -latestTime
#------------------------------------------------------------------------------

View File

@ -1,18 +0,0 @@
Channel test case for ReTau=395,based on the reference:
Poletto, R., Craft, T., and Revell, A.,
"A New Divergence Free Synthetic Eddy Method for the
Reproduction of Inlet Flow Conditions for LES",
Flow Turbulence Combust (2013) 91:519-539
Inlet patch Reynolds stress, velocity and turbulence length scale data has been
extracted from DNS data of:
Moser, Kim & Mansour
"DNS of Turbulent Channel Flow up to Re_tau=590",
Physics of Fluids (1999) vol 11, 943-945.
Data available from (last checked 28 June 2016)
http://turbulence.ices.utexas.edu/MKM_1999.html

View File

@ -1,259 +0,0 @@
(
0
1.76693e-06
1.06447e-07
2.85582e-08
1.73393e-08
3.56243e-08
3.79499e-08
1.50479e-07
1.55614e-07
1.93408e-07
4.50118e-08
2.6295e-10
6.18128e-08
4.4709e-08
5.98657e-07
2.25711e-06
4.20946e-06
6.292e-06
7.5414e-06
9.02814e-06
1.04737e-05
1.25187e-05
1.37559e-05
1.40338e-05
1.24681e-05
1.08272e-05
9.10144e-06
7.81661e-06
6.08627e-06
4.68729e-06
3.01241e-06
1.93855e-06
1.03945e-06
2.49601e-07
2.33919e-07
3.47823e-08
3.05604e-06
8.25413e-06
1.04748e-05
1.36651e-05
2.35252e-05
3.87371e-05
5.21582e-05
6.71737e-05
6.89399e-05
4.57512e-05
1.94891e-05
9.7778e-06
1.47858e-05
3.40409e-05
6.06823e-05
8.59513e-05
8.29571e-05
5.42278e-05
3.46015e-05
2.20432e-05
1.73878e-05
1.05749e-05
4.67814e-06
8.66793e-06
1.79361e-05
1.22464e-05
3.93103e-06
1.00778e-06
1.81983e-06
2.70815e-05
9.56468e-05
0.000139304
0.00012493
9.50459e-05
4.78307e-05
8.71962e-06
1.24275e-05
4.91383e-05
8.77264e-05
0.000114449
0.00014567
0.000201758
0.000251863
0.000272594
0.000213599
0.000145126
0.000115603
0.000122779
0.000116865
8.36843e-05
4.06009e-05
3.49149e-05
5.22978e-05
5.07525e-05
2.5995e-05
2.6683e-06
9.29144e-06
1.14821e-05
9.41939e-06
1.01946e-05
6.64024e-06
1.1913e-06
3.25066e-06
8.47834e-06
1.42023e-06
4.30742e-05
0.000106228
0.000115468
9.07632e-05
7.04511e-05
9.21776e-05
0.000104486
0.000111678
0.000109852
0.000111867
9.10747e-05
6.82206e-05
4.09085e-05
2.3961e-05
2.0467e-06
7.74345e-06
1.66716e-05
1.54967e-05
2.95089e-05
4.82299e-05
6.99781e-05
7.16947e-05
7.33475e-05
7.40551e-05
9.45846e-05
0.000107202
0.000120068
0.000122517
0.000120068
0.000107202
9.45846e-05
7.40551e-05
7.33475e-05
7.16947e-05
6.99781e-05
4.82299e-05
2.95089e-05
1.54967e-05
1.66716e-05
7.74345e-06
2.0467e-06
2.3961e-05
4.09085e-05
6.82206e-05
9.10747e-05
0.000111867
0.000109852
0.000111678
0.000104486
9.21776e-05
7.04511e-05
9.07632e-05
0.000115468
0.000106228
4.30742e-05
1.42023e-06
8.47834e-06
3.25066e-06
1.1913e-06
6.64024e-06
1.01946e-05
9.41939e-06
1.14821e-05
9.29144e-06
2.6683e-06
2.5995e-05
5.07525e-05
5.22978e-05
3.49149e-05
4.06009e-05
8.36843e-05
0.000116865
0.000122779
0.000115603
0.000145126
0.000213599
0.000272594
0.000251863
0.000201758
0.00014567
0.000114449
8.77264e-05
4.91383e-05
1.24275e-05
8.71962e-06
4.78307e-05
9.50459e-05
0.00012493
0.000139304
9.56468e-05
2.70815e-05
1.81983e-06
1.00778e-06
3.93103e-06
1.22464e-05
1.79361e-05
8.66793e-06
4.67814e-06
1.05749e-05
1.73878e-05
2.20432e-05
3.46015e-05
5.42278e-05
8.29571e-05
8.59513e-05
6.06823e-05
3.40409e-05
1.47858e-05
9.7778e-06
1.94891e-05
4.57512e-05
6.89399e-05
6.71737e-05
5.21582e-05
3.87371e-05
2.35252e-05
1.36651e-05
1.04748e-05
8.25413e-06
3.05604e-06
3.47823e-08
2.33919e-07
2.49601e-07
1.03945e-06
1.93855e-06
3.01241e-06
4.68729e-06
6.08627e-06
7.81661e-06
9.10144e-06
1.08272e-05
1.24681e-05
1.40338e-05
1.37559e-05
1.25187e-05
1.04737e-05
9.02814e-06
7.5414e-06
6.292e-06
4.20946e-06
2.25711e-06
5.98657e-07
4.4709e-08
6.18128e-08
2.6295e-10
4.50118e-08
1.93408e-07
1.55614e-07
1.50479e-07
3.79499e-08
3.56243e-08
1.73393e-08
2.85582e-08
1.06447e-07
1.76693e-06
0
)

View File

@ -1,31 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
// Re_tau = u_tau L / nu
// Re_tau = 395
// L = half channel height = 1
// Ubulk/u_tau = 17.55
// U_bulk = 17.55 -> u_tau = 1
// -> nu = 1*1/395 = 2.532e-3
nu 2.532e-3;
// ************************************************************************* //

View File

@ -1,127 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 85;
deltaT 4e-3;
writeControl timeStep;
writeInterval 25;
purgeWrite 10;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// Allow 10% run-up before calculating mean
timeStart #eval{ 0.1 * ${/endTime} };
functions
{
Q1
{
type Q;
libs (fieldFunctionObjects);
writeControl writeTime;
}
vorticity1
{
type vorticity;
libs (fieldFunctionObjects);
writeControl writeTime;
}
yPlus
{
type yPlus;
libs (fieldFunctionObjects);
writeControl writeTime;
}
LambVector1
{
type LambVector;
libs (fieldFunctionObjects);
writeControl writeTime;
field U;
}
div1
{
type div;
libs (fieldFunctionObjects);
writeControl writeTime;
field LambVector;
}
fieldAverage1
{
type fieldAverage;
libs (fieldFunctionObjects);
writeControl writeTime;
timeStart ${/timeStart};
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
LambVector
{
mean on;
prime2Mean off;
base time;
}
div(LambVector)
{
mean on;
prime2Mean off;
base time;
}
);
}
}
// ************************************************************************* //

View File

@ -5,10 +5,10 @@ cd "${0%/*}" || exit # Run from this directory
cleanCase0
rm -f system/controlDict
rm -rf constant/boundaryData/inlet
rm -rf 0.orig
rm -rf constant
rm -rf system
rm -rf results
rm -f *.png
rm -f constant/{R*,points*,UMean*}
rm -rf plots
#------------------------------------------------------------------------------

View File

@ -0,0 +1,121 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
# settings
# operand setups
setups="
DFSEM
"
# flag to enable computations in parallel mode
parallel=true
#------------------------------------------------------------------------------
#######################################
# Collect results into a given path
# and clean the case for the next run
# Arguments:
# $1 = Path to move results
# Outputs:
# Writes info to stdout
#######################################
collect() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
collection="$1"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
if [ ! -d "$dirResult" ]
then
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
fi
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
else
runApplication $(getApplication)
fi
runApplication -s columnAverage \
postProcess -func columnAverage -latestTime
runApplication -s sample \
postProcess -func sample -latestTime
runApplication -s skinFriction \
postProcess -func sampleCf -latestTime
collect "$setup"
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,607 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
# settings
# operand setups
setups="
DFSEM
"
#------------------------------------------------------------------------------
plot_R_vs_y() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
n=0
m=0
for l in {1..11}
do
m=$(($m+5))
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/l${m}_columnAverage:columnAverage(UPrime2Mean).xy"
n=$(($n+1))
done
image="plots/$setup/Ruu_vs_y.png"
gnuplot<<PLT_RUU_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set xrange [0:8]
set yrange [0:1]
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "R_{uu} [m^2/s^2]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark ="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 2:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 3:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_RUU_VS_Y
image="plots/$setup/Rvv_vs_y.png"
gnuplot<<PLT_RVV_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set xrange [0:1]
set yrange [0:1]
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "R_{vv} [m^2/s^2]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 5:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 4:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_RVV_VS_Y
image="plots/$setup/Rww_vs_y.png"
gnuplot<<PLT_RWW_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set xrange [0:1.8]
set xtics 1.8/4
set yrange [0:1]
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "R_{ww} [m^2/s^2]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 7:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_RWW_VS_Y
image="plots/$setup/Ruv_vs_y.png"
gnuplot<<PLT_RUV_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set xrange [0:1]
set yrange [0:1]
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "R_{uv} [m^2/s^2]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u (-\$3):1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u (-\$6):1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_RUV_VS_Y
}
plot_U_vs_y() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.means"
n=0
m=0
for l in {1..11}
do
m=$(($m+5))
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/l${m}_columnAverage:columnAverage(UMean).xy"
n=$(($n+1))
done
image="plots/$setup/u_vs_y.png"
gnuplot<<PLT_U_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set xrange [0:25]
set yrange [0:1]
set key left top
set key samplen 2
set key spacing 0.75
set xlabel "u [m/s]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 2:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 3:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_U_VS_Y
image="plots/$setup/v_vs_y.png"
gnuplot<<PLT_V_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set yrange [0:1]
set key left top
set key samplen 2
set key spacing 0.75
set xlabel "v [m/s]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 3:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_V_VS_Y
image="plots/$setup/w_vs_y.png"
gnuplot<<PLT_W_VS_Y
set terminal pngcairo font "helvetica,20" size 5000, 1000
set grid
set yrange [0:1]
set key left top
set key samplen 2
set key spacing 0.75
set xlabel "w [m/s]"
set ylabel "y/h [-]"
set output "$image"
set multiplot layout 1,11 title "Setup: $setup" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples="${sampleFiles[*]}"
list="5h 10h 15h 20h 25h 30h 35h 40h 45h 50h 55h"
do for [i = 1:11] {
if (i != 1) { unset ylabel }
plot \
word(samples, i) u 4:1 t word(list, i) w l lw 2 lc rgb "#4169e1"
# benchmark every 4 u 5:1 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
}
unset multiplot
unset output
PLT_W_VS_Y
}
plot_x_vs_cf() {
setup="$1"
endTime="$2"
#benchmarkFile=N/A
sampleFile="results/$setup/postProcessing/sampleCf/$endTime/planeAA_CfMean.xy"
image="plots/$setup/x_vs_cf.png"
gnuplot<<PLT_X_VS_CF
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set xrange [0:60]
set yrange [0:0.01]
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "x/h [-]"
set ylabel "C_f"
set output "$image"
# OpenFOAM - Numerical
samples="$sampleFile"
plot samples u 1:4 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
PLT_X_VS_CF
}
plot_yPlus_vs_u() {
setup="$1"
endTime="$2"
nu="$3"
# benchmarkFile="ReTau-395/dataset/chan395.means"
sampleFile_patch="results/$setup/postProcessing/sample/$endTime/inletPatch_columnAverage:columnAverage(UMean).xy"
sampleFile_cell="results/$setup/postProcessing/sample/$endTime/inletCell_columnAverage:columnAverage(UMean).xy"
image_patch="plots/$setup/yPlus_vs_u_patch.png"
image_cell="plots/$setup/yPlus_vs_u_cell.png"
gnuplot<<PLT_Y_VS_U
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set xrange [0:395]
set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "u [m/s]"
set output "$image_patch"
set title "Setup: $setup (inlet patch face)" noenhanced
# Benchmark - Experimental
# benchmark="$benchmarkFile"
# OpenFOAM - Numerical
samples_patch="$sampleFile_patch"
samples_cell="$sampleFile_cell"
plot \
samples_patch u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
set output "$image_cell"
set title "Setup: $setup (inlet patch cell)" noenhanced
plot \
samples_cell u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#D55E00"
PLT_Y_VS_U
}
plot_yPlus_vs_R_patch() {
setup="$1"
endTime="$2"
nu="$3"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletPatch_columnAverage:columnAverage(UPrime2Mean).xy"
imageUU="plots/$setup/yPlus_vs_Ruu_patch.png"
imageVV="plots/$setup/yPlus_vs_Rvv_patch.png"
imageWW="plots/$setup/yPlus_vs_Rww_patch.png"
imageUV="plots/$setup/yPlus_vs_Ruv_patch.png"
gnuplot<<PLT_Y_VS_R_PATCH
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set xrange [0:395]
set yrange [-1:8]
set logscale x
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "(uu)^+"
set output "$imageUU"
set title "Setup: $setup (inlet patch face)" noenhanced
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageVV"
set ylabel "(vv)^+"
plot \
samples u (\$1/$nu):5 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:4 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageWW"
set ylabel "(ww)^+"
plot \
samples u (\$1/$nu):7 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:5 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageUV"
set ylabel "(uv)^+"
plot \
samples u (\$1/$nu):(-\$3) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:(\$6*-1) t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_Y_VS_R_PATCH
}
plot_yPlus_vs_R_cell() {
setup="$1"
endTime="$2"
nu="$3"
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletCell_columnAverage:columnAverage(UPrime2Mean).xy"
imageUU="plots/$setup/yPlus_vs_Ruu_cell.png"
imageVV="plots/$setup/yPlus_vs_Rvv_cell.png"
imageWW="plots/$setup/yPlus_vs_Rww_cell.png"
imageUV="plots/$setup/yPlus_vs_Ruv_cell.png"
gnuplot<<PLT_Y_VS_R_CELL
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set xrange [0:395]
set yrange [-1:8]
set logscale x
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "(uu)^+"
set output "$imageUU"
set title "Setup: $setup (inlet patch cell)" noenhanced
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u (\$1/$nu):2 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:3 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageVV"
set ylabel "(vv)^+"
plot \
samples u (\$1/$nu):5 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:4 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageWW"
set ylabel "(ww)^+"
plot \
samples u (\$1/$nu):7 t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:5 t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
set output "$imageUV"
set ylabel "(uv)^+"
plot \
samples u (\$1/$nu):(-\$3) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
# benchmark u 2:(\$6*-1) t "DNS" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_Y_VS_R_CELL
}
plot_R_patch() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletPatch_columnAverage:columnAverage(UPrime2Mean).xy"
image="plots/$setup/R_patch.png"
gnuplot<<PLT_R_PATCH
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set key top right
set xrange [0:1]
set yrange [-1:8]
set key samplen 2
set key spacing 0.75
set xlabel "Channel height [m]"
set ylabel "<u_i^' u_i^'> [m^2/s^2]"
set offset .05, .05
set output "$image"
set title "Reynolds stresses on patch"
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
samples u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
samples u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00"
#benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
#benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
#benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
#benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_R_PATCH
}
plot_R_cell() {
setup="$1"
endTime="$2"
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sample/$endTime/inletCell_columnAverage:columnAverage(UPrime2Mean).xy"
image="plots/$setup/R_cell.png"
gnuplot<<PLT_R_CELL
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set key top right
set xrange [0:1]
set yrange [-1:8]
set key samplen 2
set key spacing 0.75
set xlabel "Channel height [m]"
set ylabel "<u_i^' u_i^'> [m^2/s^2]"
set offset .05, .05
set output "$image"
set title "Reynolds stresses on cell"
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
samples u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
samples u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00"
#benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
#benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
#benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
#benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_R_CELL
}
#------------------------------------------------------------------------------
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Check directory: "results"
[ -d "results" ] || {
echo "No results directory found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Plots for the setup: $setup"
echo ""
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
# few manipulations
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/settings/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
plot_yPlus_vs_u "$setup" "$endTime" "$nu"
plot_yPlus_vs_R_patch "$setup" "$endTime" "$nu"
plot_yPlus_vs_R_cell "$setup" "$endTime" "$nu"
plot_R_patch "$setup" "$endTime"
plot_R_cell "$setup" "$endTime"
plot_R_vs_y "$setup" "$endTime"
plot_U_vs_y "$setup" "$endTime"
plot_x_vs_cf "$setup" "$endTime"
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (17.55 0 0);
boundaryField
{
inlet
{
type turbulentDFSEMInlet;
delta 1;
U
{
type mappedFile;
mapMethod nearest;
}
R
{
type mappedFile;
mapMethod nearest;
}
L
{
type mappedFile;
mapMethod nearest;
}
d 1;
nCellPerEddy 1;
scale 1;
value $internalField;
}
outlet
{
type advective;
value $internalField;
}
"(bottom|top)"
{
type noSlip;
}
"(left|right)"
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/0.orig/nut

View File

@ -0,0 +1 @@
../../common/0.orig/p

View File

@ -0,0 +1,259 @@
(
1.6760001447599677e-43
1.0868009617044407e-08
6.96632299316915e-07
7.964006730807538e-06
4.4886053894517664e-05
0.00017142819717599743
0.0005109590309958684
0.001282137130408118
0.0028356245991423275
0.0056945923004052415
0.010583536322306776
0.018389090000706376
0.029956201643692996
0.04567240383684011
0.06499017109073807
0.0863645775310708
0.10780875116479441
0.12771755696515344
0.1453567712304755
0.16062365567853595
0.17380736699507915
0.18524165214197616
0.19522234333586158
0.20396794244081784
0.21161151098126862
0.2182925640222298
0.22425210908087323
0.22980954591037686
0.2352612116306475
0.24076016447211382
0.24635042180862582
0.25215417623227027
0.2581319159366946
0.2642162232341277
0.2705976827635888
0.2775262136577681
0.2851339428170316
0.29320770439789223
0.30169588718043017
0.3104960794811366
0.3194954534280035
0.3286450052926366
0.3378100136077759
0.3471174687143672
0.3562151631412292
0.36527552859716594
0.37494504798108247
0.38502865612338205
0.3952322027438534
0.40553467840927804
0.41578800746270134
0.4264058548357003
0.43712919288926017
0.44842576293128633
0.46008767937618383
0.4714866924807228
0.4827246039731494
0.49330673743341724
0.5036846762826384
0.5140216569857357
0.5243625990429793
0.5348735169176119
0.5446788615067326
0.5535535437038963
0.5615373928208507
0.5689987179058951
0.5773301273285831
0.5862857780666765
0.5953526108855274
0.6049390063729172
0.6143870357093343
0.6221292179475515
0.6288137731042791
0.6356831550607555
0.6428919658813926
0.6494740048271094
0.6558426649799869
0.6615093242166988
0.6667263216815766
0.6713265835399524
0.6760870855398617
0.6817697212117945
0.6868490918716819
0.6901331296539219
0.6934577171362739
0.6979552723619237
0.7038154195965829
0.7108862054012115
0.7172470897092121
0.7224010326710795
0.727453975349662
0.731494652619959
0.7349775398199252
0.7370734048228417
0.737434256293814
0.7365824697737319
0.7350609217033188
0.7329836659249739
0.730256405839164
0.7283242805479961
0.726231012899943
0.7235685746646292
0.7213160623172862
0.7194814238726635
0.7166228475003421
0.7120932098489855
0.7068169772751501
0.702036389755952
0.697518544808241
0.6937121394109932
0.6904454421400188
0.6866438800820893
0.6818576320301258
0.6766627824128105
0.6727179770747246
0.6689431320803964
0.6631717982054145
0.6561721428602678
0.6481600843658191
0.6405213608738373
0.6341476825999275
0.6280008937349648
0.6214551987295783
0.6145563256095296
0.6071697457595765
0.6005761440226519
0.5951460432382282
0.5923426315298634
0.5915671133699071
0.5923426315298634
0.5951460432382282
0.6005761440226519
0.6071697457595765
0.6145563256095296
0.6214551987295783
0.6280008937349648
0.6341476825999275
0.6405213608738373
0.6481600843658191
0.6561721428602678
0.6631717982054145
0.6689431320803964
0.6727179770747246
0.6766627824128105
0.6818576320301258
0.6866438800820893
0.6904454421400188
0.6937121394109932
0.697518544808241
0.702036389755952
0.7068169772751501
0.7120932098489855
0.7166228475003421
0.7194814238726635
0.7213160623172862
0.7235685746646292
0.726231012899943
0.7283242805479961
0.730256405839164
0.7329836659249739
0.7350609217033188
0.7365824697737319
0.737434256293814
0.7370734048228417
0.7349775398199252
0.731494652619959
0.727453975349662
0.7224010326710795
0.7172470897092121
0.7108862054012115
0.7038154195965829
0.6979552723619237
0.6934577171362739
0.6901331296539219
0.6868490918716819
0.6817697212117945
0.6760870855398617
0.6713265835399524
0.6667263216815766
0.6615093242166988
0.6558426649799869
0.6494740048271094
0.6428919658813926
0.6356831550607555
0.6288137731042791
0.6221292179475515
0.6143870357093343
0.6049390063729172
0.5953526108855274
0.5862857780666765
0.5773301273285831
0.5689987179058951
0.5615373928208507
0.5535535437038963
0.5446788615067326
0.5348735169176119
0.5243625990429793
0.5140216569857357
0.5036846762826384
0.49330673743341724
0.4827246039731494
0.4714866924807228
0.46008767937618383
0.44842576293128633
0.43712919288926017
0.4264058548357003
0.41578800746270134
0.40553467840927804
0.3952322027438534
0.38502865612338205
0.37494504798108247
0.36527552859716594
0.3562151631412292
0.3471174687143672
0.3378100136077759
0.3286450052926366
0.3194954534280035
0.3104960794811366
0.30169588718043017
0.29320770439789223
0.2851339428170316
0.2775262136577681
0.2705976827635888
0.2642162232341277
0.2581319159366946
0.25215417623227027
0.24635042180862582
0.24076016447211382
0.2352612116306475
0.22980954591037686
0.22425210908087323
0.2182925640222298
0.21161151098126862
0.20396794244081784
0.19522234333586158
0.18524165214197616
0.17380736699507915
0.16062365567853595
0.1453567712304755
0.12771755696515344
0.10780875116479441
0.0863645775310708
0.06499017109073807
0.04567240383684011
0.029956201643692996
0.018389090000706376
0.010583536322306776
0.0056945923004052415
0.0028356245991423275
0.001282137130408118
0.0005109590309958684
0.00017142819717599743
4.4886053894517664e-05
7.964006730807538e-06
6.96632299316915e-07
1.0868009617044407e-08
1.6760001447599677e-43
)

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1 @@
../../common/constant/turbulenceProperties

View File

@ -0,0 +1 @@
../common/system/

View File

@ -20,21 +20,21 @@ internalField uniform 0;
boundaryField
{
"bottomWall|topWall"
"(inlet|outlet)"
{
type calculated;
value uniform 1e-08;
}
"(bottom|top)"
{
type zeroGradient;
}
"left|right"
"(left|right)"
{
type cyclic;
}
"inlet|outlet"
{
type calculated;
value uniform 1e-08;
}
}

View File

@ -20,14 +20,14 @@ internalField uniform 0;
boundaryField
{
"bottomWall|topWall|inlet"
inlet
{
type zeroGradient;
}
"left|right"
"(bottom|top)"
{
type cyclic;
type zeroGradient;
}
outlet
@ -35,6 +35,11 @@ boundaryField
type fixedValue;
value $internalField;
}
"(left|right)"
{
type cyclic;
}
}

View File

@ -10,19 +10,13 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
// ReTau = uTau delta / nuFluid
// ReTau = 395 [-]
// delta = half channel height = 1 [m]
// -> nuFluid = 1*1/395 = 2.532e-3 [m2/s]
nu 2.532e-3;
nu 2.5494595145829e-3;
// ************************************************************************* //

View File

@ -10,12 +10,11 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType LES;
simulationType LES;
LES
{
@ -23,7 +22,7 @@ LES
SmagorinskyCoeffs
{
Ce 1.048;
Ck 0.02654; // Updated to give Cs = 0.065
Ck 0.0265463553; // Updated to give Cs = 0.065
}
delta vanDriest;
@ -32,7 +31,7 @@ LES
delta cubeRootVol;
cubeRootVolCoeffs
{
deltaCoeff 2;
deltaCoeff 1;
}
Aplus 26;
Cdelta 0.158;

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -14,14 +14,13 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
mergeType topology; // Point merging is very slow
scale 1;
L #eval{ 20*pi() };
H 1.0;
H2 #eval{ 2*$H };
W #eval{ pi() };
// L:length, H:height, W:width
L 60.0;
H 1.0;
H2 #eval{ 2*$H };
W #eval{ pi() };
vertices
(
@ -42,40 +41,34 @@ vertices
blocks
(
hex ( 0 1 2 5 6 7 8 11) (500 23 82) simpleGrading (1 25 1)
hex ( 5 2 3 4 11 8 9 10) (500 23 82) simpleGrading (1 -25 1)
);
edges
(
hex ( 0 1 2 5 6 7 8 11) (600 32 70) simpleGrading (1 10.7028 1)
hex ( 5 2 3 4 11 8 9 10) (600 32 70) simpleGrading (1 -10.7028 1)
);
boundary
(
bottomWall
bottom
{
type wall;
faces ((0 6 7 1));
}
topWall
top
{
type wall;
faces ((4 3 9 10));
}
sides_half0
left
{
type cyclic;
neighbourPatch sides_half1;
neighbourPatch right;
faces ((1 2 5 0)(2 3 4 5));
}
sides_half1
right
{
type cyclic;
neighbourPatch sides_half0;
neighbourPatch left;
faces ((6 11 8 7)(11 10 9 8));
}
inlet
{
type patch;
@ -88,8 +81,5 @@ boundary
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
// -*- C++ -*-
type columnAverage;
libs (fieldFunctionObjects);
patches ( left );
fields ( UPrime2Mean UMean );
executeControl onEnd;
writeControl onEnd;
// ************************************************************************* //

View File

@ -0,0 +1,164 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pisoFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 10; // 180;
deltaT 2e-3;
writeControl timeStep;
writeInterval 1000;
purgeWrite 3;
writeFormat binary;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 8;
runTimeModifiable false;
adjustTimeStep false;
// Allow one-third of time for initialisation before sampling
timeStart #eval #{ 1.0/3.0 * ${/endTime} #};
functions
{
wallShearStress
{
type wallShearStress;
libs (fieldFunctionObjects);
patches ( bottom top );
writePrecision 10;
writeToFile yes;
log yes;
executeControl timeStep;
executeInterval 1;
writeControl writeTime;
timeStart $/timeStart;
}
Cf
{
type coded;
libs (utilityFunctionObjects);
name Cf;
writeControl writeTime;
codeExecute
#{
static autoPtr<volScalarField> Cf;
if
(
mesh().time().timeIndex() == 1
||
mesh().time().startTimeIndex() == mesh().time().timeIndex() - 1
)
{
Info<< "Create skin-friction coefficient field" << nl;
Cf.set
(
new volScalarField
(
IOobject
(
"Cf",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
dimless
)
);
}
if
(
mesh().time().timeIndex() != 1
&& mesh().time().timeIndex() > 3 // 60 // = timeStart
)
{
Info<< "Computing skin-friction coefficient field" << endl;
const auto& tau =
mesh().lookupObject<volVectorField>("wallShearStress");
auto& Cf = mesh().lookupObjectRef<volScalarField>("Cf");
const dimensionedScalar Ubulk(dimVelocity, 17.55);
Cf = mag(tau.component(0))/(0.5*sqr(Ubulk));
}
#};
}
fieldAverage1
{
type fieldAverage;
libs (fieldFunctionObjects);
timeStart $/timeStart;
writeControl writeTime;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
wallShearStress
{
mean on;
prime2Mean off;
base time;
}
Cf
{
mean on;
prime2Mean off;
base time;
}
);
}
}
// ************************************************************************* //

View File

@ -14,14 +14,9 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
numberOfSubdomains 36;
method hierarchical;
coeffs
{
n (4 2 1);
}
method scotch;
// ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -22,23 +21,21 @@ ddtSchemes
gradSchemes
{
default leastSquares;
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
div(phi,k) Gauss limitedLinear 0.1;
div(phi,B) Gauss limitedLinear 0.1;
div(B) Gauss linear;
div(phi,nuTilda) Gauss limitedLinear 0.1;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
default Gauss linear orthogonal;
}
interpolationSchemes
@ -48,7 +45,7 @@ interpolationSchemes
snGradSchemes
{
default corrected;
default orthogonal;
}

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -20,13 +19,13 @@ solvers
p
{
solver GAMG;
tolerance 0;
relTol 0.01;
smoother DICGaussSeidel;
tolerance 1e-06;
relTol 0.001;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
nCellsInCoarsestLevel 1000;
agglomerator faceAreaPair;
mergeLevels 1;
}
@ -34,32 +33,32 @@ solvers
pFinal
{
$p;
smoother DICGaussSeidel;
tolerance 1e-06;
relTol 0;
}
"(U|k)"
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
tolerance 1e-08;
relTol 0.1;
}
"(U|k)Final"
UFinal
{
$U;
tolerance 1e-06;
tolerance 1e-08;
relTol 0;
}
}
PIMPLE
PISO
{
nOuterCorrectors 2;
nCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}

View File

@ -0,0 +1,214 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPatchConstrained;
setFormat raw;
fields
(
columnAverage:columnAverage(UMean)
columnAverage:columnAverage(UPrime2Mean)
);
sets
(
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
l1 // 1, 5, 10, ... delta
{
type uniform;
axis distance;
start (0.1 0.0 1.57);
end (0.1 2.0 1.57);
nPoints 200;
}
l5
{
type uniform;
axis distance;
start (5.0 0.0 1.57);
end (5.0 2.0 1.57);
nPoints 200;
}
l10
{
type uniform;
axis distance;
start (10.0 0.0 1.57);
end (10.0 2.0 1.57);
nPoints 200;
}
l15
{
type uniform;
axis distance;
start (15.0 0.0 1.57);
end (15.0 2.0 1.57);
nPoints 200;
}
l20
{
type uniform;
axis distance;
start (20.0 0.0 1.57);
end (20.0 2.0 1.57);
nPoints 200;
}
l25
{
type uniform;
axis distance;
start (25.0 0.0 1.57);
end (25.0 2.0 1.57);
nPoints 200;
}
l30
{
type uniform;
axis distance;
start (30.0 0.0 1.57);
end (30.0 2.0 1.57);
nPoints 200;
}
l35
{
type uniform;
axis distance;
start (35.0 0.0 1.57);
end (35.0 2.0 1.57);
nPoints 200;
}
l40
{
type uniform;
axis distance;
start (40.0 0.0 1.57);
end (40.0 2.0 1.57);
nPoints 200;
}
l45
{
type uniform;
axis distance;
start (45.0 0.0 1.57);
end (45.0 2.0 1.57);
nPoints 200;
}
l50
{
type uniform;
axis distance;
start (50.0 0.0 1.57);
end (50.0 2.0 1.57);
nPoints 200;
}
l55
{
type uniform;
axis distance;
start (55.0 0.0 1.57);
end (55.0 2.0 1.57);
nPoints 200;
}
Poletto0 // Poletto et al.
{
type uniform;
axis distance;
start (0.1 0.0 1.57);
end (0.1 2.0 1.57);
nPoints 200;
}
Poletto36
{
type uniform;
axis distance;
start (3.6 0.0 1.57);
end (3.6 2.0 1.57);
nPoints 200;
}
Poletto75
{
type uniform;
axis distance;
start (7.5 0.0 1.57);
end (7.5 2.0 1.57);
nPoints 200;
}
Poletto113
{
type uniform;
axis distance;
start (11.3 0.0 1.57);
end (11.3 2.0 1.57);
nPoints 200;
}
Poletto151
{
type uniform;
axis distance;
start (15.1 0.0 1.57);
end (15.1 2.0 1.57);
nPoints 200;
}
Poletto226
{
type uniform;
axis distance;
start (22.6 0.0 1.57);
end (22.6 2.0 1.57);
nPoints 200;
}
Poletto302
{
type uniform;
axis distance;
start (30.2 0.0 1.57);
end (30.2 2.0 1.57);
nPoints 200;
}
Poletto377
{
type uniform;
axis distance;
start (37.7 0.0 1.57);
end (37.7 2.0 1.57);
nPoints 200;
}
);
// ************************************************************************* //

View File

@ -0,0 +1,34 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPatchConstrained;
setFormat raw;
fields ( CfMean );
_planes
{
type patchEdge;
axis xyz;
patches ( bottom );
surfaceType searchablePlane;
planeType pointAndNormal;
origin ( 0 0 1.57079632679 );
}
sets
(
// Intersections of patches with plane
planeAA
{
${_planes}
pointAndNormalDict
{
point ( 0 0 1.57079632679 );
normal ( 0 0 1 );
}
}
);
// ************************************************************************* //

View File

@ -29,7 +29,21 @@ boundaryField
type turbulentDFSEMInlet;
delta 1;
nCellPerEddy 3;
mapMethod nearestCell;
U
{
type mappedFile;
mapMethod nearest;
}
R
{
type mappedFile;
mapMethod nearest;
}
L
{
type mappedFile;
mapMethod nearest;
}
value $internalField;
}

View File

@ -1,30 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
type turbulentDigitalFilterInlet;
n ( 64 70 );
L
(
0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995
);
Ubulk 20.133;
}
// ************************************************************************* //

View File

@ -1,31 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
type turbulentDigitalFilterInlet;
fsm true;
n ( 64 70 );
L
(
0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995
);
Ubulk 20.133;
}
// ************************************************************************* //

View File

@ -1,84 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
# Collect data into the 'results' directory,
# and clean the case for the next run
#
# $1 = model
# ----
collectData(){
model=$1
runType=$2
echo " Moving results into 'results/$model.$runType'"
results="results/$model.$runType"
mkdir -p "$results"
timeDir=$(foamListTimes -latestTime)
mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
cleanTimeDirectories
rm -rf processor* > /dev/null 2>&1
}
# Compute the case in 'serial' mode,
# and collect the data
#
# $* = models
# ----
serialRun(){
models=$*
for model in $models
do
echo " Running with the synthetic turbulence model: $model"
(cd 0 && ln -snf "inlet.$model" inlet)
(cd constant/boundaryData && ln -snf "inlet.$model" inlet)
runApplication -s "$model" $(getApplication)
./plot
collectData $model "serial"
done
}
# Compute the case in 'parallel' mode,
# and collect the data
#
# $* = models
# ----
parallelRun(){
models=$*
for model in $models
do
echo " Running with the synthetic turbulence model: $model"
(cd 0 && ln -snf "inlet.$model" inlet)
(cd constant/boundaryData && ln -snf "inlet.$model" inlet)
runApplication -s "$model" decomposePar -force
runParallel -s "$model" $(getApplication)
runApplication -s "$model" reconstructPar -latestTime
./plot
collectData $model "parallel"
done
}
#------------------------------------------------------------------------------
# Prepare the numerical setup
./Allrun.pre
# Run with the synthetic turbulence models
models="
FSM
DFM
DFSEM
"
parallelRun $models
serialRun $models
#------------------------------------------------------------------------------

View File

@ -1,32 +0,0 @@
#------------------------------------------------------------------------------
The following three synthetic turbulence inflow boundary conditions are
examined through a single-cell-domain smooth-wall plane channel flow setup:
- turbulentDFSEMInlet (DFSEM)
- turbulentDigitalFilterInlet (DFM)
- turbulentDigitalFilterInlet with the forward-stepwise method (FSM)
The input statistics are obtained from:
Moser, R. D., Kim, J., & Mansour, N. N. (1999).
Direct numerical simulation of turbulent channel flow up to Reτ=590.
Physics of fluids, 11(4), 943-945.
DOI:10.1063/1.869966
from which the input first-/second-order turbulence statistics data for the
smooth-wall plane channel flow at ReTau=395 were used.
The data is available online from (Retrieved: 21-06-2019):
https://turbulence.oden.utexas.edu/data/MKM/chan395/
Executing:
./Allrun
The script will run the test case, and collect the plots and samples into
the 'results' directory.
#------------------------------------------------------------------------------

View File

@ -1,259 +0,0 @@
(
0
1.76693e-06
1.06447e-07
2.85582e-08
1.73393e-08
3.56243e-08
3.79499e-08
1.50479e-07
1.55614e-07
1.93408e-07
4.50118e-08
2.6295e-10
6.18128e-08
4.4709e-08
5.98657e-07
2.25711e-06
4.20946e-06
6.292e-06
7.5414e-06
9.02814e-06
1.04737e-05
1.25187e-05
1.37559e-05
1.40338e-05
1.24681e-05
1.08272e-05
9.10144e-06
7.81661e-06
6.08627e-06
4.68729e-06
3.01241e-06
1.93855e-06
1.03945e-06
2.49601e-07
2.33919e-07
3.47823e-08
3.05604e-06
8.25413e-06
1.04748e-05
1.36651e-05
2.35252e-05
3.87371e-05
5.21582e-05
6.71737e-05
6.89399e-05
4.57512e-05
1.94891e-05
9.7778e-06
1.47858e-05
3.40409e-05
6.06823e-05
8.59513e-05
8.29571e-05
5.42278e-05
3.46015e-05
2.20432e-05
1.73878e-05
1.05749e-05
4.67814e-06
8.66793e-06
1.79361e-05
1.22464e-05
3.93103e-06
1.00778e-06
1.81983e-06
2.70815e-05
9.56468e-05
0.000139304
0.00012493
9.50459e-05
4.78307e-05
8.71962e-06
1.24275e-05
4.91383e-05
8.77264e-05
0.000114449
0.00014567
0.000201758
0.000251863
0.000272594
0.000213599
0.000145126
0.000115603
0.000122779
0.000116865
8.36843e-05
4.06009e-05
3.49149e-05
5.22978e-05
5.07525e-05
2.5995e-05
2.6683e-06
9.29144e-06
1.14821e-05
9.41939e-06
1.01946e-05
6.64024e-06
1.1913e-06
3.25066e-06
8.47834e-06
1.42023e-06
4.30742e-05
0.000106228
0.000115468
9.07632e-05
7.04511e-05
9.21776e-05
0.000104486
0.000111678
0.000109852
0.000111867
9.10747e-05
6.82206e-05
4.09085e-05
2.3961e-05
2.0467e-06
7.74345e-06
1.66716e-05
1.54967e-05
2.95089e-05
4.82299e-05
6.99781e-05
7.16947e-05
7.33475e-05
7.40551e-05
9.45846e-05
0.000107202
0.000120068
0.000122517
0.000120068
0.000107202
9.45846e-05
7.40551e-05
7.33475e-05
7.16947e-05
6.99781e-05
4.82299e-05
2.95089e-05
1.54967e-05
1.66716e-05
7.74345e-06
2.0467e-06
2.3961e-05
4.09085e-05
6.82206e-05
9.10747e-05
0.000111867
0.000109852
0.000111678
0.000104486
9.21776e-05
7.04511e-05
9.07632e-05
0.000115468
0.000106228
4.30742e-05
1.42023e-06
8.47834e-06
3.25066e-06
1.1913e-06
6.64024e-06
1.01946e-05
9.41939e-06
1.14821e-05
9.29144e-06
2.6683e-06
2.5995e-05
5.07525e-05
5.22978e-05
3.49149e-05
4.06009e-05
8.36843e-05
0.000116865
0.000122779
0.000115603
0.000145126
0.000213599
0.000272594
0.000251863
0.000201758
0.00014567
0.000114449
8.77264e-05
4.91383e-05
1.24275e-05
8.71962e-06
4.78307e-05
9.50459e-05
0.00012493
0.000139304
9.56468e-05
2.70815e-05
1.81983e-06
1.00778e-06
3.93103e-06
1.22464e-05
1.79361e-05
8.66793e-06
4.67814e-06
1.05749e-05
1.73878e-05
2.20432e-05
3.46015e-05
5.42278e-05
8.29571e-05
8.59513e-05
6.06823e-05
3.40409e-05
1.47858e-05
9.7778e-06
1.94891e-05
4.57512e-05
6.89399e-05
6.71737e-05
5.21582e-05
3.87371e-05
2.35252e-05
1.36651e-05
1.04748e-05
8.25413e-06
3.05604e-06
3.47823e-08
2.33919e-07
2.49601e-07
1.03945e-06
1.93855e-06
3.01241e-06
4.68729e-06
6.08627e-06
7.81661e-06
9.10144e-06
1.08272e-05
1.24681e-05
1.40338e-05
1.37559e-05
1.25187e-05
1.04737e-05
9.02814e-06
7.5414e-06
6.292e-06
4.20946e-06
2.25711e-06
5.98657e-07
4.4709e-08
6.18128e-08
2.6295e-10
4.50118e-08
1.93408e-07
1.55614e-07
1.50479e-07
3.79499e-08
3.56243e-08
1.73393e-08
2.85582e-08
1.06447e-07
1.76693e-06
0
)

View File

@ -1,135 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
plotCellR() {
timeDir=$1
echo " Plotting the normal and Reynolds stresses on cell."
outName="stress-cell.png"
gnuplot<<PLT_CELL_R
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [-1:8]
set grid
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "Channel height from the bottomWall [m]"
set ylabel "<u_i^' u_i^'> [m2/s2]"
set offset .05, .05
set output "$outName"
set title "Normal and Reynolds stresses on cell"
input = "$timeDir/inletCell_UPrime2Mean.xy"
bench = "constant/pointsRdata"
plot \
input u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
input u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
input u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
input u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
bench u 2:4 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
bench u 2:7 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
bench u 2:9 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
bench u 2:5 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_CELL_R
}
plotPatchR() {
timeDir=$1
echo " Plotting the normal and Reynolds stresses on inlet patch faces."
outName="stress-patch.png"
gnuplot<<PLT_PATCH_R
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [-1:8]
set grid
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "Channel height from the bottomWall [m]"
set ylabel "<u_i^' u_i^'> [m2/s2]"
set offset .05, .05
set output "$outName"
set title "Normal and Reynolds stresses on patch"
input = "$timeDir/inletPatch_UPrime2Mean.xy"
bench = "constant/pointsRdata"
plot \
input u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
input u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
input u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
input u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
bench u 2:4 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
bench u 2:7 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
bench u 2:9 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
bench u 2:5 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_PATCH_R
}
plotPatchUMean() {
timeDir=$1
echo " Plotting the streamwise mean flow speed on inlet patch faces."
outName="u-patch.png"
gnuplot<<PLT_PATCH_UMEAN
set terminal pngcairo font "helvetica,20" size 1000, 800
set xrange [0:1]
set yrange [0:25]
set grid
set key top right
set key samplen 2
set key spacing 0.75
set xlabel "Channel height from the bottomWall [m]"
set ylabel "u [m/s]"
set offset .05, .05
set output "$outName"
input = "$timeDir/inletPatch_UMean.xy"
bench = "constant/pointsUMeanData"
plot \
input u 1:2 t "u" w l lw 2 lc rgb "#009E73", \
bench u 2:4 t "u_{DNS}" w l lw 2 dt 2 lc rgb "#009E73"
PLT_PATCH_UMEAN
}
#------------------------------------------------------------------------------
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Prepare the benchmark data
cp -f constant/boundaryData/inlet/0/R constant/R
cp -f constant/boundaryData/inlet/points constant/points
cp -f constant/boundaryData/inlet.DFM/0/UMean constant/UMean
cat constant/R | tr -d '()' > constant/Rdata
cat constant/points | tr -d '()' > constant/pointsData
cat constant/UMean | tr -d '()' > constant/UMeanData
paste constant/pointsData constant/Rdata > constant/pointsRdata
paste constant/pointsData constant/UMeanData > constant/pointsUMeanData
# The latestTime in postProcessing/sampling1
timeDir=$(foamListTimes -case postProcessing/sampling1 -latestTime 2>/dev/null)
[ -n "$timeDir" ] || {
echo "No postProcessing/sampling1 found - skipping graph creation" 1>&2
exit 1
}
timeDir="postProcessing/sampling1/$timeDir"
plotCellR "$timeDir"
plotPatchR "$timeDir"
plotPatchUMean "$timeDir"
#------------------------------------------------------------------------------

View File

@ -1,20 +1,14 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
endTime=10
if notTest "$@"
then
endTime=85
fi
sed "s|END_TIME|$endTime|g" system/controlDict.template > system/controlDict
restore0Dir
runApplication blockMesh
cleanCase0
rm -rf 0.orig
rm -rf system
rm -rf constant
rm -rf results
rm -rf plots
#------------------------------------------------------------------------------

View File

@ -0,0 +1,123 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
# setups
# operand setups
setups="
DFSEM
DFM
FSM
"
# flag to enable computations in parallel mode
parallel=true
#------------------------------------------------------------------------------
#######################################
# Collect results into a given path
# and clean the case for the next run
# Arguments:
# $1 = Path to move results
# Outputs:
# Writes info to stdout
#######################################
collect() {
[ $# -eq 0 ] && { echo "Usage: $0 dir-model"; exit 1; }
collection="$1"
dirResult=results/"$collection"
dirSettings="$dirResult"/settings
if [ ! -d "$dirResult" ]
then
echo " # Collecting results and settings into $dirResult"
mkdir -p "$dirResult"
mkdir -p "$dirSettings"
mv -f $(foamListTimes) "$dirResult"
[ -d postProcessing ] && mv -f postProcessing "$dirResult"
[ -d processor0 ] && mv -f processor* "$dirResult"
mv -f log.* "$dirResult"
cp -f system/{fv*,controlDict} constant/*Properties "$dirSettings"
mv -f 0/ "$dirSettings"
echo " # Cleaning up the case"
cleanTimeDirectories
cleanPostProcessing
else
echo " # Directory $dirResult already exists"
echo " # Skipping the computation"
fi
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Computations for the setup: $setup"
echo ""
dirSetup="setups.orig/$setup"
cp -rfL "$dirSetup/0.orig" .
cp -rfL "$dirSetup/constant" .
cp -rfL "$dirSetup/system" .
cp -rf 0.orig/ 0/
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
if [ "$parallel" = true ]
then
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
else
runApplication $(getApplication)
fi
runApplication -s columnAverage \
postProcess -func columnAverage -latestTime
runApplication -s sampleCellPatchConstrained \
postProcess -func sampleCellPatchConstrained -latestTime
runApplication -s sampleCellPoint \
postProcess -func sampleCellPoint -latestTime
collect "$setup"
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,176 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
# settings
# operand setups
setups="
DFSEM
DFM
FSM
"
#------------------------------------------------------------------------------
plot_R_patch() {
setup="$1"
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleCellPoint/$endTime/inletPatch_columnAverage:columnAverage(UPrime2Mean).xy"
image="plots/$setup/R_patch.png"
gnuplot<<PLT_R_PATCH
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set key top right
set xrange [0:1]
set yrange [-1:8]
set key samplen 2
set key spacing 0.75
set xlabel "Channel height [m]"
set ylabel "<u_i^' u_i^'> [m^2/s^2]"
set offset .05, .05
set output "$image"
set title "Reynolds stresses on patch"
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
samples u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
samples u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00"
# benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
# benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
# benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
# benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_R_PATCH
}
plot_R_cell() {
setup="$1"
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
# benchmarkFile="ReTau-395/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleCellPoint/$endTime/inletCell_columnAverage:columnAverage(UPrime2Mean).xy"
image="plots/$setup/R_cell.png"
gnuplot<<PLT_R_CELL
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set key top right
set xrange [0:1]
set yrange [-1:8]
set key samplen 2
set key spacing 0.75
set xlabel "Channel height [m]"
set ylabel "<u_i^' u_i^'> [m^2/s^2]"
set offset .05, .05
set output "$image"
set title "Reynolds stresses on cell"
# Benchmark - DNS
# benchmark= "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
samples u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
samples u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
samples u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00"
# benchmark u 1:3 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
# benchmark u 1:4 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
# benchmark u 1:5 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
# benchmark u 1:6 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
PLT_R_CELL
}
plot_UMean_patch() {
setup="$1"
endTime=$(foamDictionary results/$setup/settings/controlDict -entry endTime -value)
benchmarkFile="../../resources/incompressible/oneCellThickPlaneChannelFlow/ReTau-395/dataset/chan395.means"
sampleFile="results/$setup/postProcessing/sampleCellPoint/$endTime/inletPatch_columnAverage:columnAverage(UMean).xy"
image="plots/$setup/UMean_patch.png"
gnuplot<<PLT_UMEAN_PATCH
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
set key top right
set xrange [0:1]
set yrange [0:25]
set key samplen 2
set key spacing 0.75
set xlabel "Channel height [m]"
set ylabel "u [m/s]"
set offset .05, .05
set output "$image"
set title "Streamwise mean flow speed on patch"
# Benchmark - DNS
# benchmark = "$benchmarkFile"
# Samples - OpenFOAM
samples="$sampleFile"
plot \
samples u 1:2 t "u" w l lw 2 lc rgb "#009E73"
# benchmark u 1:3 t "u_{DNS}" w l lw 2 dt 2 lc rgb "#009E73"
PLT_UMEAN_PATCH
}
#------------------------------------------------------------------------------
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Check directory: "results"
[ -d "results" ] || {
echo "No results directory found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Plots for the setup: $setup"
echo ""
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
plot_R_patch "$setup"
plot_R_cell "$setup"
plot_UMean_patch "$setup"
done
#------------------------------------------------------------------------------

View File

@ -20,29 +20,34 @@ internalField uniform (0 0 0);
boundaryField
{
"bottomWall|topWall"
{
type fixedValue;
value $internalField;
}
"left|right"
{
type cyclic;
}
inlet
{
type turbulentDigitalFilterInlet;
n ( 64 70 );
L
(
0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995
);
Ubulk 17.55;
value $internalField;
}
#include "inlet/U"
outlet
{
type inletOutlet;
inletValue $internalField;
type advective;
value $internalField;
}
"(bottom|top)"
{
type noSlip;
}
"(left|right)"
{
type cyclic;
}
}

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1 @@
../../common/constant/turbulenceProperties

View File

@ -10,49 +10,56 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
location "1";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 1 -1 0 0 0 0 ];
dimensions [0 1 -1 0 0 0 0];
// Ub/utau = 17.55
internalField uniform ( 17.55 0 0 );
internalField uniform (0 0 0);
boundaryField
{
bottomWall
{
type fixedValue;
value uniform ( 0 0 0 );
}
topWall
{
type fixedValue;
value uniform ( 0 0 0 );
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
inlet
{
type turbulentDFSEMInlet;
delta 2;
delta 1;
U
{
type mappedFile;
mapMethod nearest;
}
R
{
type mappedFile;
mapMethod nearest;
}
L
{
type mappedFile;
mapMethod nearest;
}
d 1;
nCellPerEddy 1;
mapMethod nearestCell;
scale 1;
value $internalField;
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
type advective;
value $internalField;
}
"(bottom|top)"
{
type noSlip;
}
"(left|right)"
{
type cyclic;
}
}

View File

@ -0,0 +1,259 @@
(
1.6760001447599677e-43
1.0868009617044407e-08
6.96632299316915e-07
7.964006730807538e-06
4.4886053894517664e-05
0.00017142819717599743
0.0005109590309958684
0.001282137130408118
0.0028356245991423275
0.0056945923004052415
0.010583536322306776
0.018389090000706376
0.029956201643692996
0.04567240383684011
0.06499017109073807
0.0863645775310708
0.10780875116479441
0.12771755696515344
0.1453567712304755
0.16062365567853595
0.17380736699507915
0.18524165214197616
0.19522234333586158
0.20396794244081784
0.21161151098126862
0.2182925640222298
0.22425210908087323
0.22980954591037686
0.2352612116306475
0.24076016447211382
0.24635042180862582
0.25215417623227027
0.2581319159366946
0.2642162232341277
0.2705976827635888
0.2775262136577681
0.2851339428170316
0.29320770439789223
0.30169588718043017
0.3104960794811366
0.3194954534280035
0.3286450052926366
0.3378100136077759
0.3471174687143672
0.3562151631412292
0.36527552859716594
0.37494504798108247
0.38502865612338205
0.3952322027438534
0.40553467840927804
0.41578800746270134
0.4264058548357003
0.43712919288926017
0.44842576293128633
0.46008767937618383
0.4714866924807228
0.4827246039731494
0.49330673743341724
0.5036846762826384
0.5140216569857357
0.5243625990429793
0.5348735169176119
0.5446788615067326
0.5535535437038963
0.5615373928208507
0.5689987179058951
0.5773301273285831
0.5862857780666765
0.5953526108855274
0.6049390063729172
0.6143870357093343
0.6221292179475515
0.6288137731042791
0.6356831550607555
0.6428919658813926
0.6494740048271094
0.6558426649799869
0.6615093242166988
0.6667263216815766
0.6713265835399524
0.6760870855398617
0.6817697212117945
0.6868490918716819
0.6901331296539219
0.6934577171362739
0.6979552723619237
0.7038154195965829
0.7108862054012115
0.7172470897092121
0.7224010326710795
0.727453975349662
0.731494652619959
0.7349775398199252
0.7370734048228417
0.737434256293814
0.7365824697737319
0.7350609217033188
0.7329836659249739
0.730256405839164
0.7283242805479961
0.726231012899943
0.7235685746646292
0.7213160623172862
0.7194814238726635
0.7166228475003421
0.7120932098489855
0.7068169772751501
0.702036389755952
0.697518544808241
0.6937121394109932
0.6904454421400188
0.6866438800820893
0.6818576320301258
0.6766627824128105
0.6727179770747246
0.6689431320803964
0.6631717982054145
0.6561721428602678
0.6481600843658191
0.6405213608738373
0.6341476825999275
0.6280008937349648
0.6214551987295783
0.6145563256095296
0.6071697457595765
0.6005761440226519
0.5951460432382282
0.5923426315298634
0.5915671133699071
0.5923426315298634
0.5951460432382282
0.6005761440226519
0.6071697457595765
0.6145563256095296
0.6214551987295783
0.6280008937349648
0.6341476825999275
0.6405213608738373
0.6481600843658191
0.6561721428602678
0.6631717982054145
0.6689431320803964
0.6727179770747246
0.6766627824128105
0.6818576320301258
0.6866438800820893
0.6904454421400188
0.6937121394109932
0.697518544808241
0.702036389755952
0.7068169772751501
0.7120932098489855
0.7166228475003421
0.7194814238726635
0.7213160623172862
0.7235685746646292
0.726231012899943
0.7283242805479961
0.730256405839164
0.7329836659249739
0.7350609217033188
0.7365824697737319
0.737434256293814
0.7370734048228417
0.7349775398199252
0.731494652619959
0.727453975349662
0.7224010326710795
0.7172470897092121
0.7108862054012115
0.7038154195965829
0.6979552723619237
0.6934577171362739
0.6901331296539219
0.6868490918716819
0.6817697212117945
0.6760870855398617
0.6713265835399524
0.6667263216815766
0.6615093242166988
0.6558426649799869
0.6494740048271094
0.6428919658813926
0.6356831550607555
0.6288137731042791
0.6221292179475515
0.6143870357093343
0.6049390063729172
0.5953526108855274
0.5862857780666765
0.5773301273285831
0.5689987179058951
0.5615373928208507
0.5535535437038963
0.5446788615067326
0.5348735169176119
0.5243625990429793
0.5140216569857357
0.5036846762826384
0.49330673743341724
0.4827246039731494
0.4714866924807228
0.46008767937618383
0.44842576293128633
0.43712919288926017
0.4264058548357003
0.41578800746270134
0.40553467840927804
0.3952322027438534
0.38502865612338205
0.37494504798108247
0.36527552859716594
0.3562151631412292
0.3471174687143672
0.3378100136077759
0.3286450052926366
0.3194954534280035
0.3104960794811366
0.30169588718043017
0.29320770439789223
0.2851339428170316
0.2775262136577681
0.2705976827635888
0.2642162232341277
0.2581319159366946
0.25215417623227027
0.24635042180862582
0.24076016447211382
0.2352612116306475
0.22980954591037686
0.22425210908087323
0.2182925640222298
0.21161151098126862
0.20396794244081784
0.19522234333586158
0.18524165214197616
0.17380736699507915
0.16062365567853595
0.1453567712304755
0.12771755696515344
0.10780875116479441
0.0863645775310708
0.06499017109073807
0.04567240383684011
0.029956201643692996
0.018389090000706376
0.010583536322306776
0.0056945923004052415
0.0028356245991423275
0.001282137130408118
0.0005109590309958684
0.00017142819717599743
4.4886053894517664e-05
7.964006730807538e-06
6.96632299316915e-07
1.0868009617044407e-08
1.6760001447599677e-43
)

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1 @@
../../common/constant/turbulenceProperties

View File

@ -9,46 +9,46 @@ FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1";
object k;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
dimensions [0 1 -1 0 0 0 0];
internalField uniform 1e-5;
internalField uniform (0 0 0);
boundaryField
{
bottomWall
{
type fixedValue;
value uniform 0;
}
topWall
{
type fixedValue;
value uniform 0;
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
inlet
{
type fixedValue;
type turbulentDigitalFilterInlet;
fsm true;
n ( 64 70 );
L
(
0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995
);
Ubulk 17.55;
value $internalField;
}
outlet
{
type fixedValue;
type advective;
value $internalField;
}
"(bottom|top)"
{
type noSlip;
}
"(left|right)"
{
type cyclic;
}
}

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1 @@
../../common/constant/turbulenceProperties

View File

@ -10,43 +10,31 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
location "1";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -1 0 0 0 0 ];
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
bottomWall
"(inlet|outlet)"
{
type calculated;
value uniform 1e-08;
}
"(bottom|top)"
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
sides_half0
"(left|right)"
{
type cyclic;
}
sides_half1
{
type cyclic;
}
inlet
{
type calculated;
value uniform 1e-8;
}
outlet
{
type calculated;
value uniform 1e-8;
}
}

View File

@ -10,41 +10,35 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
location "1";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
bottomWall
{
type zeroGradient;
}
topWall
{
type zeroGradient;
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
inlet
{
type zeroGradient;
}
"(bottom|top)"
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
value $internalField;
}
"(left|right)"
{
type cyclic;
}
}

View File

@ -9,18 +9,14 @@ FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
type turbulentDFSEMInlet;
delta 1;
nCellPerEddy 1;
mapMethod nearestCell;
}
transportModel Newtonian;
nu 2.5494595145829e-3;
// ************************************************************************* //

View File

@ -10,26 +10,21 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType LES;
simulationType LES;
LES
{
turbulence on;
LESModel kEqn;
kEqnCoeffs
LESModel Smagorinsky;
SmagorinskyCoeffs
{
Ce 1.048;
Ck 0.02654; // set to approximate a Cs of 0.065
Ck 0.0265463553; // Updated to give Cs = 0.065
}
printCoeffs on;
delta vanDriest;
vanDriestCoeffs
{
@ -41,6 +36,9 @@ LES
Aplus 26;
Cdelta 0.158;
}
printCoeffs on;
turbulence on;
}

View File

@ -16,10 +16,11 @@ FoamFile
scale 1;
L 0.125664;
H 1.0;
H2 #eval{ 2*$H };
W #eval{ pi() };
// L:length, H:height, W:width
L 0.125664;
H 1.0;
H2 #eval{ 2*$H };
W #eval{ pi() };
vertices
(
@ -40,22 +41,18 @@ vertices
blocks
(
hex ( 0 1 2 5 6 7 8 11) (1 23 82) simpleGrading (1 15 1)
hex ( 5 2 3 4 11 8 9 10) (1 23 82) simpleGrading (1 -15 1)
);
edges
(
hex ( 0 1 2 5 6 7 8 11) (1 23 82) simpleGrading (1 10.7028 1)
hex ( 5 2 3 4 11 8 9 10) (1 23 82) simpleGrading (1 -10.7028 1)
);
boundary
(
bottomWall
bottom
{
type wall;
faces ((0 6 7 1));
}
topWall
top
{
type wall;
faces ((4 3 9 10));
@ -84,9 +81,5 @@ boundary
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
// -*- C++ -*-
type columnAverage;
libs (fieldFunctionObjects);
patches ( left );
fields ( UPrime2Mean UMean );
executeControl onEnd;
writeControl onEnd;
// ************************************************************************* //

View File

@ -10,12 +10,11 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
application pisoFoam;
startFrom latestTime;
@ -23,9 +22,9 @@ startTime 0;
stopAt endTime;
endTime END_TIME;
endTime 30.0;
deltaT 4e-3;
deltaT 2e-3;
writeControl timeStep;
@ -47,7 +46,6 @@ runTimeModifiable false;
adjustTimeStep false;
// Allow 10% of time for initialisation before sampling
timeStart #eval{ 0.1 * ${/endTime} };
@ -70,35 +68,6 @@ functions
}
);
}
sampling1
{
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
writeControl onEnd;
fields (UPrime2Mean UMean);
sets
(
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
}
}

View File

@ -16,11 +16,7 @@ FoamFile
numberOfSubdomains 4;
method hierarchical;
method random;
coeffs
{
n (1 2 2);
}
// ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -22,24 +21,21 @@ ddtSchemes
gradSchemes
{
default leastSquares;
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
div(phi,k) Gauss limitedLinear 0.1;
div(phi,B) Gauss limitedLinear 0.1;
div(B) Gauss linear;
div(phi,nuTilda) Gauss limitedLinear 0.1;
div(LambVector) Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear uncorrected;
default Gauss linear orthogonal;
}
interpolationSchemes
@ -49,7 +45,7 @@ interpolationSchemes
snGradSchemes
{
default uncorrected;
default orthogonal;
}

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -20,13 +19,13 @@ solvers
p
{
solver GAMG;
tolerance 0;
relTol 0.01;
smoother DICGaussSeidel;
tolerance 1e-06;
relTol 0.001;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
nCellsInCoarsestLevel 1000;
agglomerator faceAreaPair;
mergeLevels 1;
}
@ -34,33 +33,32 @@ solvers
pFinal
{
$p;
smoother DICGaussSeidel;
tolerance 1e-06;
relTol 0;
}
"(U|k)"
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
solver PBiCG;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
minIter 1;
}
"(U|k)Final"
UFinal
{
$U;
tolerance 1e-06;
tolerance 1e-08;
relTol 0;
}
}
PIMPLE
PISO
{
nOuterCorrectors 3;
nCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}

View File

@ -0,0 +1,35 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPatchConstrained;
setFormat raw;
writeControl onEnd;
fields
(
columnAverage:columnAverage(UMean)
columnAverage:columnAverage(UPrime2Mean)
);
sets
(
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
writeControl onEnd;
fields
(
columnAverage:columnAverage(UMean)
columnAverage:columnAverage(UPrime2Mean)
);
sets
(
inletPatch
{
type face;
axis y;
start (0.0 0 1.57);
end (0.0 2 1.57);
}
inletCell
{
type midPoint;
axis y;
start (0.062832 0 1.57);
end (0.062832 2 1.57);
}
);
// ************************************************************************* //