mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: applyBoundaryLayer - updated
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -104,13 +104,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Setting boundary layer velocity" << nl << endl;
|
Info<< "Setting boundary layer velocity" << nl << endl;
|
||||||
scalar yblv = ybl.value();
|
scalar yblv = ybl.value();
|
||||||
forAll(U, celli)
|
forAll(U, cellI)
|
||||||
{
|
{
|
||||||
if (y[celli] <= yblv)
|
if (y[cellI] <= yblv)
|
||||||
{
|
{
|
||||||
U[celli] *= ::pow(y[celli]/yblv, (1.0/7.0));
|
mask[cellI] = 1;
|
||||||
|
U[cellI] *= ::pow(y[cellI]/yblv, (1.0/7.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mask.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Writing U\n" << endl;
|
Info<< "Writing U\n" << endl;
|
||||||
U.write();
|
U.write();
|
||||||
@ -128,11 +130,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (isA<incompressible::RASModel>(turbulence()))
|
if (isA<incompressible::RASModel>(turbulence()))
|
||||||
{
|
{
|
||||||
// Calculate nut
|
// Calculate nut - reference nut is calculated by the turbulence model
|
||||||
|
// on its construction
|
||||||
tmp<volScalarField> tnut = turbulence->nut();
|
tmp<volScalarField> tnut = turbulence->nut();
|
||||||
volScalarField& nut = tnut();
|
volScalarField& nut = tnut();
|
||||||
volScalarField S(mag(dev(symm(fvc::grad(U)))));
|
volScalarField S(mag(dev(symm(fvc::grad(U)))));
|
||||||
nut = sqr(kappa*min(y, ybl))*::sqrt(2)*S;
|
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
|
||||||
|
|
||||||
|
// do not correct BC - wall functions will 'undo' manipulation above
|
||||||
|
// by using nut from turbulence model
|
||||||
|
|
||||||
if (args.optionFound("writenut"))
|
if (args.optionFound("writenut"))
|
||||||
{
|
{
|
||||||
@ -140,9 +146,6 @@ int main(int argc, char *argv[])
|
|||||||
nut.write();
|
nut.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create G field - used by RAS wall functions
|
|
||||||
volScalarField G(turbulence().GName(), nut*2*sqr(S));
|
|
||||||
|
|
||||||
|
|
||||||
//--- Read and modify turbulence fields
|
//--- Read and modify turbulence fields
|
||||||
|
|
||||||
@ -150,8 +153,11 @@ int main(int argc, char *argv[])
|
|||||||
tmp<volScalarField> tk = turbulence->k();
|
tmp<volScalarField> tk = turbulence->k();
|
||||||
volScalarField& k = tk();
|
volScalarField& k = tk();
|
||||||
scalar ck0 = pow025(Cmu)*kappa;
|
scalar ck0 = pow025(Cmu)*kappa;
|
||||||
k = sqr(nut/(ck0*min(y, ybl)));
|
k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl)));
|
||||||
k.correctBoundaryConditions();
|
|
||||||
|
// do not correct BC - operation may use inconsistent fields wrt these
|
||||||
|
// local manipulations
|
||||||
|
// k.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Writing k\n" << endl;
|
Info<< "Writing k\n" << endl;
|
||||||
k.write();
|
k.write();
|
||||||
@ -161,8 +167,11 @@ int main(int argc, char *argv[])
|
|||||||
tmp<volScalarField> tepsilon = turbulence->epsilon();
|
tmp<volScalarField> tepsilon = turbulence->epsilon();
|
||||||
volScalarField& epsilon = tepsilon();
|
volScalarField& epsilon = tepsilon();
|
||||||
scalar ce0 = ::pow(Cmu, 0.75)/kappa;
|
scalar ce0 = ::pow(Cmu, 0.75)/kappa;
|
||||||
epsilon = ce0*k*sqrt(k)/min(y, ybl);
|
epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl);
|
||||||
epsilon.correctBoundaryConditions();
|
|
||||||
|
// do not correct BC - wall functions will use non-updated k from
|
||||||
|
// turbulence model
|
||||||
|
// epsilon.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Writing epsilon\n" << endl;
|
Info<< "Writing epsilon\n" << endl;
|
||||||
epsilon.write();
|
epsilon.write();
|
||||||
@ -181,12 +190,12 @@ int main(int argc, char *argv[])
|
|||||||
if (omegaHeader.headerOk())
|
if (omegaHeader.headerOk())
|
||||||
{
|
{
|
||||||
volScalarField omega(omegaHeader, mesh);
|
volScalarField omega(omegaHeader, mesh);
|
||||||
omega =
|
dimensionedScalar k0("VSMALL", k.dimensions(), VSMALL);
|
||||||
epsilon
|
omega = (1 - mask)*omega + mask*epsilon/(Cmu*k + k0);
|
||||||
/(
|
|
||||||
Cmu*k+dimensionedScalar("VSMALL", k.dimensions(), VSMALL)
|
// do not correct BC - wall functions will use non-updated k from
|
||||||
);
|
// turbulence model
|
||||||
omega.correctBoundaryConditions();
|
// omega.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Writing omega\n" << endl;
|
Info<< "Writing omega\n" << endl;
|
||||||
omega.write();
|
omega.write();
|
||||||
@ -207,7 +216,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
volScalarField nuTilda(nuTildaHeader, mesh);
|
volScalarField nuTilda(nuTildaHeader, mesh);
|
||||||
nuTilda = nut;
|
nuTilda = nut;
|
||||||
nuTilda.correctBoundaryConditions();
|
|
||||||
|
// do not correct BC
|
||||||
|
// nuTilda.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Writing nuTilda\n" << endl;
|
Info<< "Writing nuTilda\n" << endl;
|
||||||
nuTilda.write();
|
nuTilda.write();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -57,5 +57,21 @@ License
|
|||||||
Info<< "\nCreating boundary-layer for U of thickness "
|
Info<< "\nCreating boundary-layer for U of thickness "
|
||||||
<< ybl.value() << " m" << nl << endl;
|
<< ybl.value() << " m" << nl << endl;
|
||||||
|
|
||||||
|
Info<< "Creating mask field" << endl;
|
||||||
|
volScalarField mask
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"mask",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0.0),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user