From a27eb13ad6179bb5e7df849d43a6c235e63838c2 Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Wed, 21 Sep 2016 17:19:58 +0100 Subject: [PATCH] decomposePar: Corrected construction of cloud for processors Resolves bug-report http://bugs.openfoam.org/view.php?id=2239 --- .../decomposePar/lagrangianFieldDecomposer.C | 2 +- .../decomposePar/lagrangianFieldDecomposer.H | 2 -- .../dataConversion/foamToGMV/gmvOutput.H | 2 +- .../USERD_get_maxsize_info.H | 2 +- .../ensightFoamReader/USERD_set_filenames.H | 4 +-- .../USERD_set_time_set_and_step.H | 4 +-- src/OpenFOAM/fields/cloud/cloud.C | 10 +++---- src/OpenFOAM/fields/cloud/cloud.H | 4 +-- .../field/nearWallFields/nearWallFields.C | 7 ++++- src/lagrangian/basic/Cloud/Cloud.C | 30 +++---------------- src/lagrangian/basic/Cloud/Cloud.H | 16 ---------- src/lagrangian/basic/Cloud/CloudIO.C | 19 ------------ 12 files changed, 23 insertions(+), 79 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.C b/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.C index 274e3a51a3..efb7dd2a23 100644 --- a/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.C +++ b/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.C @@ -42,7 +42,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer ) : procMesh_(procMesh), - positions_(procMesh, cloudName, false), + positions_(procMesh, cloudName, IDLList<passiveParticle>()), particleIndices_(lagrangianPositions.size()) { label pi = 0; diff --git a/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.H b/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.H index 6e0280398d..aca0672296 100644 --- a/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.H +++ b/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposer.H @@ -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 ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H index a6c0c7dd36..4c65e583e3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H @@ -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); diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H index ca2033453e..aab4c0c903 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H @@ -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) { diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index fdb7c38c9f..6167798a3b 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -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); diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H index 5459f67ba6..7bc4ba1c5c 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H @@ -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); } } } - - diff --git a/src/OpenFOAM/fields/cloud/cloud.C b/src/OpenFOAM/fields/cloud/cloud.C index 3a7b98e968..69cba912e0 100644 --- a/src/OpenFOAM/fields/cloud/cloud.C +++ b/src/OpenFOAM/fields/cloud/cloud.C @@ -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, diff --git a/src/OpenFOAM/fields/cloud/cloud.H b/src/OpenFOAM/fields/cloud/cloud.H index 4578588380..9b7aa43291 100644 --- a/src/OpenFOAM/fields/cloud/cloud.H +++ b/src/OpenFOAM/fields/cloud/cloud.H @@ -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 diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index b63ee95583..063ff610f9 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -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; diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 1e108771a9..710e36bfd2 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -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); + } } diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index cb6b5eee81..2ad874691b 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -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 diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index 5cdba6ba86..0be85442e5 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -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 ( -- GitLab