Skip to content

BUG: storeGlobalPositions has not been called when running lagrangian solver with AMR and collisionModel pairCollision

Summary

(I tried to format this post by following the template, but it seems that some code is being cutted out and the google drive link I included with the case is not showing up. Sorry!)

The lagrangian solver DPMDyMFoam runs normally when using the dynamicRefineFvMesh AMR utility to refine any field (for example p) with the entry "collisionModel none;". The solver crashes when "collisionModel pairCollision;" is set, with the error:

` --> FOAM FATAL ERROR: (openfoam-2406) Global positions are not available. Cloud::storeGlobalPositions has not been called.

From void Foam::Cloud<ParticleType>::autoMap(const Foam::mapPolyMesh&) [with ParticleType = Foam::CollidingParcel<Foam::KinematicParcel<Foam::particle> >]
in file /usr/src/packages/BUILD/src/lagrangian/basic/lnInclude/Cloud.C at line 308.

FOAM exiting `

This this error may be linked to the InteractionLists class, used to identify possible collision partners within the same CPU or collision partners from different CPUs by using direct interaction lists and referred interaction lists.

A similar issue is addressed in the following thread:

https://www.cfd-online.com/Forums/openfoam-programming-development/218828-cloud-storeglobalpositions-has-not-been-called-how-call.html

The Cloud::autoMap function cannot communicate with the Cloud::storeGlobalPositions function?

I have tried including the storeGlobalPositions function directly in the autoMap function. The case runs, but wrong cell IDs are identified for the particle positions.

` template void Foam::Cloud::autoMap(const mapPolyMesh& mapper) {

globalPositionsPtr_.reset(new vectorField(this->size()));    
   
vectorField& positions = globalPositionsPtr_(); 

label i = 0;
forAllIters(*this, iter)
{
    positions[i] = iter().position();
    ++i;
}

if (!globalPositionsPtr_.valid())
{
    FatalErrorInFunction
        << "Global positions are not available. "
        << "Cloud::storeGlobalPositions has not been called."
        << exit(FatalError);
}

// Reset stored data that relies on the mesh
//    polyMesh_.clearCellTree();
cellWallFacesPtr_.clear();

// 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();   

i = 0;
forAllIters(*this, iter)
{
    iter().autoMap(positions[i], mapper);
    ++i;
}

} `

Steps to reproduce

Run the DPMFoam/Goldsmith tutorial including the following dynamicMeshDict file in constant/: ` /--------------------------------- C++ -----------------------------------
| ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: v2406 | | \ / A nd | Website: www.openfoam.com | | \/ M anipulation | | *---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object dynamicMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh dynamicRefineFvMesh;

// How often to refine refineInterval 1;

// Field to be refinement on field p;

// Refine field inbetween lower..upper lowerRefineLevel 0.001; upperRefineLevel 0.999;

// If value < unrefineLevel unrefine unrefineLevel 10;

// Have slower than 2:1 refinement nBufferLayers 1;

// Refine cells only up to maxRefinement levels maxRefinement 2;

// Stop refinement if maxCells reached maxCells 200000;

// Flux field and corresponding velocity field. Fluxes on changed // faces get recalculated by interpolating the velocity. Use 'none' // on surfaceScalarFields that do not need to be reinterpolated. correctFluxes ( (phi none) (nHatf none) (rhoPhi none) (alphaPhi0.water none) (ghf none) (alphaPhiUn none) );

// Write the refinement level as a volScalarField dumpLevel true;

// ************************************************************************* // ` Also modify system/fvSolution by including the following in solvers:

` p_Final { $p; relTol 0; tolerance 1e-08; }

"pcorr.*"
{
    $p_Final;
    tolerance       1e-08;
} 

`

Example case

The Goldsmith tutorial case with the modifications can be downloaded from: https://drive.google.com/drive/folders/1uN-xn3-52p7O5_3e01wFCuZ9fXAcVxr_?usp=sharing

What is the current bug behaviour?

The solver crashes when the first AMR mesh refinement operation occurs and new cell addressing has to be made.

Relevant logs and/or images

(/uploads/fc8faa733d667f4a6701d7ada11f6dce/error.PNG)

Environment information

OpenFOAM version : v2406|v1812 Operating system : ubuntu

Edited by Richard Tribess