mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
updates
This commit is contained in:
@ -26,6 +26,8 @@ Application
|
|||||||
particleTracks
|
particleTracks
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Generates a VTK file of particle tracks for cases that were computed using
|
||||||
|
a tracked-parcel-type cloud
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -54,6 +56,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "Scanning times to determine track data" << nl << endl;
|
||||||
|
|
||||||
labelList maxIds(Pstream::nProcs(), -1);
|
labelList maxIds(Pstream::nProcs(), -1);
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
@ -90,8 +94,6 @@ int main(int argc, char *argv[])
|
|||||||
Pstream::listCombineScatter(maxIds);
|
Pstream::listCombineScatter(maxIds);
|
||||||
labelList numIds = maxIds + 1;
|
labelList numIds = maxIds + 1;
|
||||||
|
|
||||||
Info<< "numIds = " << numIds << endl;
|
|
||||||
|
|
||||||
// calc starting ids for particles on each processor
|
// calc starting ids for particles on each processor
|
||||||
List<label> startIds(numIds.size(), 0);
|
List<label> startIds(numIds.size(), 0);
|
||||||
for (label i = 0; i < numIds.size()-1; i++)
|
for (label i = 0; i < numIds.size()-1; i++)
|
||||||
@ -155,17 +157,20 @@ int main(int argc, char *argv[])
|
|||||||
Info<< " Reading particle positions" << endl;
|
Info<< " Reading particle positions" << endl;
|
||||||
Cloud<passiveParticle> myCloud(mesh, cloudName, false);
|
Cloud<passiveParticle> myCloud(mesh, cloudName, false);
|
||||||
|
|
||||||
pointField positions(myCloud.size(), vector::zero);
|
Info<< " Reading particle id" << endl;
|
||||||
label i = 0;
|
|
||||||
forAllConstIter(Cloud<passiveParticle>, myCloud, iter)
|
|
||||||
{
|
|
||||||
positions[i++] = iter().position();
|
|
||||||
}
|
|
||||||
IOField<label> id(idHeader);
|
IOField<label> id(idHeader);
|
||||||
|
|
||||||
|
Info<< " Reading particle origProc" << endl;
|
||||||
IOField<label> origProc(origProcHeader);
|
IOField<label> origProc(origProcHeader);
|
||||||
|
|
||||||
|
// collect the track data on the master processor
|
||||||
|
label i = 0;
|
||||||
List<pointField> allPositions(Pstream::nProcs());
|
List<pointField> allPositions(Pstream::nProcs());
|
||||||
allPositions[Pstream::myProcNo()] = positions;
|
allPositions[Pstream::myProcNo()].setSize(myCloud.size());
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, myCloud, iter)
|
||||||
|
{
|
||||||
|
allPositions[Pstream::myProcNo()][i++] = iter().position();
|
||||||
|
}
|
||||||
Pstream::gatherList(allPositions);
|
Pstream::gatherList(allPositions);
|
||||||
|
|
||||||
List<labelList> allIds(Pstream::nProcs());
|
List<labelList> allIds(Pstream::nProcs());
|
||||||
@ -176,6 +181,7 @@ int main(int argc, char *argv[])
|
|||||||
allOrigProcs[Pstream::myProcNo()] = origProc;
|
allOrigProcs[Pstream::myProcNo()] = origProc;
|
||||||
Pstream::gatherList(allOrigProcs);
|
Pstream::gatherList(allOrigProcs);
|
||||||
|
|
||||||
|
Info<< " Constructing tracks" << nl << endl;
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
forAll(allPositions, procI)
|
forAll(allPositions, procI)
|
||||||
@ -200,16 +206,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
Info<< " No particles read" << nl << endl;
|
{
|
||||||
}
|
Info<< " No particles read" << nl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
Info<< "Writing particle tracks" << nl << endl;
|
Info<< "\nWriting particle tracks" << nl << endl;
|
||||||
|
|
||||||
OFstream vtkTracks("particleTracks.vtk");
|
OFstream vtkTracks("particleTracks.vtk");
|
||||||
|
|
||||||
@ -221,11 +227,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
vtkTracks
|
vtkTracks
|
||||||
<< "# vtk DataFile Version 2.0\n"
|
<< "# vtk DataFile Version 2.0" << nl
|
||||||
<< "particleTracks" << nl
|
<< "particleTracks" << nl
|
||||||
<< "ASCII\n"
|
<< "ASCII" << nl
|
||||||
<< "DATASET POLYDATA\n"
|
<< "DATASET POLYDATA" << nl
|
||||||
<< "POINTS " << nPoints << " float\n";
|
<< "POINTS " << nPoints << " float" << nl;
|
||||||
|
|
||||||
// Write track points to file
|
// Write track points to file
|
||||||
forAll(allTracks, trackI)
|
forAll(allTracks, trackI)
|
||||||
|
|||||||
Reference in New Issue
Block a user