Check mesh is 2D and scale resulting steam-function by the thickness

This commit is contained in:
Henry
2013-09-02 22:51:15 +01:00
parent b7187c6018
commit 3e12a89a04

View File

@ -51,6 +51,18 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H" #include "createNamedMesh.H"
label nD = mesh.nGeometricD();
if (nD != 2)
{
FatalErrorIn(args.executable())
<< "Case is not 2D, stream-function cannot be computed"
<< exit(FatalError);
}
const vector slabDir((Vector<label>::one - mesh.geometricD())/2);
scalar thickness = slabDir & mesh.bounds().span();
const pointMesh& pMesh = pointMesh::New(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
@ -428,7 +440,6 @@ int main(int argc, char *argv[])
} }
Info<< "."; Info<< ".";
// Info<< "One pass, n visited = " << nVisited << endl;
if (nVisited == nVisitedOld) if (nVisited == nVisitedOld)
{ {
@ -449,6 +460,8 @@ int main(int argc, char *argv[])
Info<< endl; Info<< endl;
} while (!finished); } while (!finished);
// Normalise the stream-function by the 2D mesh thickness
streamFunction /= thickness;
streamFunction.boundaryField() = 0.0; streamFunction.boundaryField() = 0.0;
streamFunction.write(); streamFunction.write();
} }