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

@ -42,14 +42,26 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
# include "addRegionOption.H" #include "addRegionOption.H"
# include "setRootCase.H" #include "setRootCase.H"
# include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
# 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);
@ -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();
} }