Generalise boundaryFoam for 2-D geometries

This commit is contained in:
Hrvoje Jasak 2018-06-18 10:53:14 +01:00
parent 72854eb5dc
commit 9a8309a47c
2 changed files with 2 additions and 90 deletions

View file

@ -80,23 +80,12 @@ int main(int argc, char *argv[])
U += (Ubar - UbarStar); U += (Ubar - UbarStar);
gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V()); gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());
label id = y.size() - 1;
scalar wallShearStress =
flowDirection & turbulence->R()()[id] & wallNormal;
scalar yplusWall
// = Foam::sqrt(mag(wallShearStress))*y[id]/laminarTransport.nu()()[id];
= Foam::sqrt(mag(wallShearStress))*y[id]/turbulence->nuEff()()[id];
Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())<< tab Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())<< tab
<< "pressure gradient = " << (flowDirection & gradP.value()) << tab << "pressure gradient = " << (flowDirection & gradP.value())
<< "min y+ = " << yplusWall << endl; << endl;
turbulence->correct(); turbulence->correct();
if (runTime.outputTime()) if (runTime.outputTime())
{ {
volSymmTensorField R volSymmTensorField R
@ -113,26 +102,6 @@ int main(int argc, char *argv[])
); );
runTime.write(); runTime.write();
const word& gFormat = runTime.graphFormat();
makeGraph(y, flowDirection & U, "Uf", gFormat);
makeGraph(y, laminarTransport.nu(), gFormat);
makeGraph(y, turbulence->k(), gFormat);
makeGraph(y, turbulence->epsilon(), gFormat);
//makeGraph(y, flowDirection & R & flowDirection, "Rff", gFormat);
//makeGraph(y, wallNormal & R & wallNormal, "Rww", gFormat);
//makeGraph(y, flowDirection & R & wallNormal, "Rfw", gFormat);
//makeGraph(y, sqrt(R.component(tensor::XX)), "u", gFormat);
//makeGraph(y, sqrt(R.component(tensor::YY)), "v", gFormat);
//makeGraph(y, sqrt(R.component(tensor::ZZ)), "w", gFormat);
makeGraph(y, R.component(tensor::XY), "uv", gFormat);
makeGraph(y, mag(fvc::grad(U)), "gammaDot", gFormat);
} }
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View file

@ -57,63 +57,6 @@
vector flowDirection = (Ubar/mag(Ubar)).value(); vector flowDirection = (Ubar/mag(Ubar)).value();
tensor flowMask = sqr(flowDirection); tensor flowMask = sqr(flowDirection);
// Search for wall patches faces and store normals
scalar nWallFaces(0);
vector wallNormal(vector::zero);
const fvPatchList& patches = mesh.boundary();
forAll(patches, patchi)
{
const fvPatch& currPatch = patches[patchi];
if (isA<wallFvPatch>(currPatch))
{
forAll(currPatch, facei)
{
nWallFaces++;
if (nWallFaces == 1)
{
wallNormal =
- mesh.Sf().boundaryField()[patchi][facei]
/mesh.magSf().boundaryField()[patchi][facei];
}
else if (nWallFaces == 2)
{
vector wallNormal2 =
mesh.Sf().boundaryField()[patchi][facei]
/mesh.magSf().boundaryField()[patchi][facei];
//- Check that wall faces are parallel
if
(
mag(wallNormal & wallNormal2) > 1.01
||mag(wallNormal & wallNormal2) < 0.99
)
{
Info<< "boundaryFoam: wall faces are not parallel"
<< endl
<< abort(FatalError);
}
}
else
{
Info<< "boundaryFoam: number of wall faces > 2"
<< endl
<< abort(FatalError);
}
}
}
}
//- create position array for graph generation
scalarField y = wallNormal & mesh.C().internalField();
dimensionedVector gradP dimensionedVector gradP
( (
"gradP", "gradP",