Commit fcebb1e6 authored by mattijs's avatar mattijs
Browse files

BUG: potentialFoam/cylinder: indexing into non-existing patch in parallel

parent f1c79673
...@@ -37,8 +37,8 @@ boundaryField ...@@ -37,8 +37,8 @@ boundaryField
left left
{ {
type fixedValue; type uniformFixedValue;
value uniform (1 0 0); uniformValue (1 0 0);
} }
cylinder cylinder
......
...@@ -62,19 +62,39 @@ functions ...@@ -62,19 +62,39 @@ functions
Info<< "Reading inlet velocity uInfX\n" << endl; Info<< "Reading inlet velocity uInfX\n" << endl;
scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI];
if (fvp.size())
{
ULeft = fvp[0].x();
}
reduce(ULeft, maxOp<scalar>());
dimensionedScalar uInfX dimensionedScalar uInfX
( (
"uInfx", "uInfx",
dimensionSet(0, 1, -1, 0, 0), dimensionSet(0, 1, -1, 0, 0),
U.boundaryField()[3][0].x() ULeft
); );
Info << "U at inlet = " << uInfX.value() << " m/s" << endl; Info << "U at inlet = " << uInfX.value() << " m/s" << endl;
scalar magCylinder = 0.0;
label cylI = mesh().boundaryMesh().findPatchID("cylinder");
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
if (cylFvp.size())
{
magCylinder = mag(cylFvp[0]);
}
reduce(magCylinder, maxOp<scalar>());
dimensionedScalar radius dimensionedScalar radius
( (
"radius", "radius",
dimensionSet(0, 1, 0, 0, 0), dimensionSet(0, 1, 0, 0, 0),
mag(U.mesh().boundary()[4].Cf()[0]) magCylinder
); );
Info << "Cylinder radius = " << radius.value() << " m" << endl; Info << "Cylinder radius = " << radius.value() << " m" << endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment