Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-07-07 19:48:11 +01:00
5 changed files with 83 additions and 89 deletions

View File

@ -209,6 +209,8 @@ snapControls
// Settings for the layer addition. // Settings for the layer addition.
addLayersControls addLayersControls
{ {
// Are the thickness parameters below relative to the undistorted
// size of the refined cell outside layer (true) or absolute sizes (false).
relativeSizes true; relativeSizes true;
// Per final patch (so not geometry!) the layer information // Per final patch (so not geometry!) the layer information
@ -230,14 +232,13 @@ addLayersControls
//- Wanted thickness of final added cell layer. If multiple layers //- Wanted thickness of final added cell layer. If multiple layers
// is the // is the thickness of the layer furthest away from the wall.
// thickness of the layer furthest away from the wall. // See relativeSizes parameter.
// Relative to undistorted size of cell outside layer.
finalLayerThickness 0.3; finalLayerThickness 0.3;
//- Minimum thickness of cell layer. If for any reason layer //- Minimum thickness of cell layer. If for any reason layer
// cannot be above minThickness do not add layer. // cannot be above minThickness do not add layer.
// Relative to undistorted size of cell outside layer. // See relativeSizes parameter.
minThickness 0.25; minThickness 0.25;
//- If points get not extruded do nGrow layers of connected faces that are //- If points get not extruded do nGrow layers of connected faces that are

View File

@ -38,7 +38,7 @@ Description
#include "Time.H" #include "Time.H"
#include "timeSelector.H" #include "timeSelector.H"
#include "OFstream.H" #include "OFstream.H"
#include "passiveParticle.H" #include "passiveParticleCloud.H"
using namespace Foam; using namespace Foam;
@ -61,7 +61,8 @@ int main(int argc, char *argv[])
fileName vtkPath(runTime.path()/"VTK"); fileName vtkPath(runTime.path()/"VTK");
mkDir(vtkPath); mkDir(vtkPath);
Info<< "Scanning times to determine track data" << nl << endl; Info<< "Scanning times to determine track data for cloud " << cloudName
<< nl << endl;
labelList maxIds(Pstream::nProcs(), -1); labelList maxIds(Pstream::nProcs(), -1);
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
@ -69,23 +70,12 @@ int main(int argc, char *argv[])
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
IOobject positionsHeader
(
"positions",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (positionsHeader.headerOk())
{
Info<< " Reading particle positions" << endl; Info<< " Reading particle positions" << endl;
Cloud<passiveParticle> myCloud(mesh, cloudName, false); passiveParticleCloud myCloud(mesh, cloudName);
Info<< " Read " << returnReduce(myCloud.size(), sumOp<label>())
<< " particles" << endl;
forAllConstIter(Cloud<passiveParticle>, myCloud, iter) forAllConstIter(passiveParticleCloud, myCloud, iter)
{ {
label origId = iter().origId(); label origId = iter().origId();
label origProc = iter().origProc(); label origProc = iter().origProc();
@ -93,11 +83,20 @@ int main(int argc, char *argv[])
maxIds[origProc] = max(maxIds[origProc], origId); maxIds[origProc] = max(maxIds[origProc], origId);
} }
} }
} Pstream::listCombineGather(maxIds, maxEqOp<label>());
Pstream::listCombineGather(maxIds, maxOp<label>());
Pstream::listCombineScatter(maxIds); Pstream::listCombineScatter(maxIds);
labelList numIds = maxIds + 1; labelList numIds = maxIds + 1;
Info<< nl << "Particle statistics:" << endl;
forAll(maxIds, procI)
{
Info<< " Found " << numIds[procI] << " particles originating"
<< " from processor " << procI << endl;
}
Info<< nl << 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++)
@ -106,56 +105,49 @@ int main(int argc, char *argv[])
} }
label nParticle = startIds[startIds.size()-1] + numIds[startIds.size()-1]; label nParticle = startIds[startIds.size()-1] + numIds[startIds.size()-1];
// number of tracks to generate // number of tracks to generate
label nTracks = nParticle/sampleFrequency; label nTracks = nParticle/sampleFrequency;
// storage for all particle tracks // storage for all particle tracks
List<DynamicList<vector> > allTracks(nTracks); List<DynamicList<vector> > allTracks(nTracks);
Info<< "\nGenerating " << nTracks << " particle tracks" << nl << endl; Info<< "\nGenerating " << nTracks << " particle tracks for cloud "
<< cloudName << nl << endl;
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
IOobject positionsHeader
(
"positions",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (positionsHeader.headerOk())
{
Info<< " Reading particle positions" << endl;
Cloud<passiveParticle> myCloud(mesh, cloudName, false);
// collect the track data on the master processor
List<pointField> allPositions(Pstream::nProcs()); List<pointField> allPositions(Pstream::nProcs());
List<labelField> allOrigIds(Pstream::nProcs());
List<labelField> allOrigProcs(Pstream::nProcs());
// Read particles. Will be size 0 if no particles.
Info<< " Reading particle positions" << endl;
passiveParticleCloud myCloud(mesh, cloudName);
// collect the track data on all processors that have positions
allPositions[Pstream::myProcNo()].setSize allPositions[Pstream::myProcNo()].setSize
( (
myCloud.size(), myCloud.size(),
point::zero point::zero
); );
List<labelField> allOrigIds(Pstream::nProcs());
allOrigIds[Pstream::myProcNo()].setSize(myCloud.size(), 0); allOrigIds[Pstream::myProcNo()].setSize(myCloud.size(), 0);
List<labelField> allOrigProcs(Pstream::nProcs());
allOrigProcs[Pstream::myProcNo()].setSize(myCloud.size(), 0); allOrigProcs[Pstream::myProcNo()].setSize(myCloud.size(), 0);
label i = 0; label i = 0;
forAllConstIter(Cloud<passiveParticle>, myCloud, iter) forAllConstIter(passiveParticleCloud, myCloud, iter)
{ {
allPositions[Pstream::myProcNo()][i] = iter().position(); allPositions[Pstream::myProcNo()][i] = iter().position();
allOrigIds[Pstream::myProcNo()][i] = iter().origId(); allOrigIds[Pstream::myProcNo()][i] = iter().origId();
allOrigProcs[Pstream::myProcNo()][i] = iter().origProc(); allOrigProcs[Pstream::myProcNo()][i] = iter().origProc();
i++; i++;
} }
// collect the track data on the master processor
Pstream::gatherList(allPositions); Pstream::gatherList(allPositions);
Pstream::gatherList(allOrigIds); Pstream::gatherList(allOrigIds);
Pstream::gatherList(allOrigProcs); Pstream::gatherList(allOrigProcs);
@ -186,18 +178,14 @@ int main(int argc, char *argv[])
} }
} }
} }
else
{
Info<< " No particles read" << nl << endl;
}
}
if (Pstream::master()) if (Pstream::master())
{ {
Info<< "\nWriting particle tracks" << nl << endl;
OFstream vtkTracks(vtkPath/"particleTracks.vtk"); OFstream vtkTracks(vtkPath/"particleTracks.vtk");
Info<< "\nWriting particle tracks to " << vtkTracks.name()
<< nl << endl;
// Total number of points in tracks + 1 per track // Total number of points in tracks + 1 per track
label nPoints = 0; label nPoints = 0;
forAll(allTracks, trackI) forAll(allTracks, trackI)

View File

@ -117,6 +117,7 @@ void Foam::Particle<ParticleType>::readFields
} }
IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ)); IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ));
if (procIO.headerOk()) if (procIO.headerOk())
{ {
IOField<label> origProcId(procIO); IOField<label> origProcId(procIO);

View File

@ -49,7 +49,9 @@ Foam::indexedParticleCloud::indexedParticleCloud
) )
: :
Cloud<indexedParticle>(mesh, cloudName, false) Cloud<indexedParticle>(mesh, cloudName, false)
{} {
indexedParticle::readFields(*this);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -47,7 +47,9 @@ Foam::passiveParticleCloud::passiveParticleCloud
) )
: :
Cloud<passiveParticle>(mesh, cloudName, false) Cloud<passiveParticle>(mesh, cloudName, false)
{} {
readFields();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //