Commit 9e1e9011 authored by Henry Weller's avatar Henry Weller
Browse files

decomposePar: Corrected construction of cloud for processors

Resolves bug-report http://bugs.openfoam.org/view.php?id=2239
parent 481f8e5b
......@@ -42,7 +42,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
)
:
procMesh_(procMesh),
positions_(procMesh, cloudName, false),
positions_(procMesh, cloudName, IDLList<passiveParticle>()),
particleIndices_(lagrangianPositions.size())
{
label pi = 0;
......
......@@ -101,7 +101,6 @@ public:
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList<PtrList<IOField<Type>>>& lagrangianFields
// PtrList<IOField<Type>>& lagrangianFields
);
template<class Type>
......@@ -113,7 +112,6 @@ public:
<
PtrList<CompactIOField<Field<Type>, Type>>
>& lagrangianFields
// PtrList<CompactIOField<Field<Type>, Type >>& lagrangianFields
);
......
......@@ -73,7 +73,7 @@ for (label i=0; i < nTypes; i++)
if (lagrangianHeader.headerOk())
{
Cloud<passiveParticle> particles(mesh);
Cloud<passiveParticle> particles(mesh, cloud::defaultName);
IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
......
......@@ -73,7 +73,7 @@ int USERD_get_maxsize_info
{
// Get the maximum number of spray parcels
// and store it
Cloud<passiveParticle> lagrangian(*meshPtr);
Cloud<passiveParticle> lagrangian(*meshPtr, cloud::defaultName);
if (lagrangian.size() > nMaxParcels)
{
......
......@@ -151,7 +151,7 @@ int USERD_set_filenames
{
runTime.setTime(timeDirs[n+1], n+1);
Cloud<passiveParticle> lagrangian(*meshPtr);
Cloud<passiveParticle> lagrangian(*meshPtr, cloud::defaultName);
n++;
if (lagrangian.size())
......@@ -177,7 +177,7 @@ int USERD_set_filenames
delete sprayPtr;
sprayPtr = new Cloud<passiveParticle>(*meshPtr);
sprayPtr = new Cloud<passiveParticle>(*meshPtr, cloud::defaultName);
IOobjectList objects(*meshPtr, runTime.timeName(), cloud::prefix);
......
......@@ -49,9 +49,7 @@ void USERD_set_time_set_and_step
if (Numparts_available > nPatches+1)
{
delete sprayPtr;
sprayPtr = new Cloud<passiveParticle>(*meshPtr);
sprayPtr = new Cloud<passiveParticle>(*meshPtr, cloud::defaultName);
}
}
}
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,10 +30,10 @@ License
namespace Foam
{
defineTypeNameAndDebug(cloud, 0);
defineTypeNameAndDebug(cloud, 0);
const word cloud::prefix("lagrangian");
word cloud::defaultName("defaultCloud");
const word cloud::prefix("lagrangian");
word cloud::defaultName("defaultCloud");
}
......@@ -45,7 +45,7 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
(
IOobject
(
(cloudName.size() ? cloudName : defaultName),
cloudName,
obr.time().timeName(),
prefix,
obr,
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -78,7 +78,7 @@ public:
// Constructors
//- Construct for the given objectRegistry and named cloud instance
cloud(const objectRegistry&, const word& cloudName = "");
cloud(const objectRegistry&, const word& cloudName = defaultName);
//- Destructor
......
......@@ -60,7 +60,12 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
DebugInFunction << "nPatchFaces: " << globalWalls.size() << endl;
// Construct cloud
Cloud<findCellParticle> cloud(mesh_, IDLList<findCellParticle>());
Cloud<findCellParticle> cloud
(
mesh_,
cloud::defaultName,
IDLList<findCellParticle>()
);
// Add particles to track to sample locations
nPatchFaces = 0;
......
......@@ -92,31 +92,6 @@ void Foam::Cloud<ParticleType>::calcCellWallFaces() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
Foam::Cloud<ParticleType>::Cloud
(
const polyMesh& pMesh,
const IDLList<ParticleType>& particles
)
:
cloud(pMesh),
IDLList<ParticleType>(),
polyMesh_(pMesh),
labels_(),
nTrackingRescues_(),
cellWallFacesPtr_()
{
checkPatches();
// Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then
// there is a comms mismatch.
polyMesh_.tetBasePtIs();
IDLList<ParticleType>::operator=(particles);
}
template<class ParticleType>
Foam::Cloud<ParticleType>::Cloud
(
......@@ -139,7 +114,10 @@ Foam::Cloud<ParticleType>::Cloud
// there is a comms mismatch.
polyMesh_.tetBasePtIs();
IDLList<ParticleType>::operator=(particles);
if (particles.size())
{
IDLList<ParticleType>::operator=(particles);
}
}
......
......@@ -131,28 +131,12 @@ public:
//- Construct from mesh and a list of particles
Cloud
(
const polyMesh& mesh,
const IDLList<ParticleType>& particles
);
//- Construct from mesh, cloud name, and a list of particles
Cloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<ParticleType>& particles
);
//- Construct from mesh by reading from file
// Optionally disable checking of class name for post-processing
Cloud
(
const polyMesh& mesh,
const bool checkClass = true
);
//- Construct from mesh by reading from file with given cloud instance
// Optionally disable checking of class name for post-processing
Cloud
......
......@@ -144,25 +144,6 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
Foam::Cloud<ParticleType>::Cloud
(
const polyMesh& pMesh,
const bool checkClass
)
:
cloud(pMesh),
polyMesh_(pMesh),
labels_(),
nTrackingRescues_(),
cellWallFacesPtr_()
{
checkPatches();
initCloud(checkClass);
}
template<class ParticleType>
Foam::Cloud<ParticleType>::Cloud
(
......
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