libWallModelledLES icon indicating copy to clipboard operation
libWallModelledLES copied to clipboard

renumberMesh crashes when lengthScale is cubeRootVol

Open timofeymukha opened this issue 1 year ago • 0 comments

When lengthScale is set to cubeRootVol (whichis the default), the utility renumberMesh will crash with

--> FOAM FATAL ERROR: (openfoam-2306)
unallocated autoPtr of type N4Foam5FieldIdEE

    From T& Foam::autoPtr<T>::operator*() [with T = Foam::Field<double>]
    in file /home/timofey/code/openfoam/OpenFOAM-v2306/src/OpenFOAM/lnInclude/autoPtrI.H at line 95.

Very strange bug, the crash seems to happen due to the function

void Foam::SingleCellSampler::createLengthListCubeRootVol()
{
    // Cell volumes
    const scalarField & V = mesh_.V();
    
    forAll(lengthList_, i)
    {
        lengthList_[i] = pow(V[indexList_[i]], 1.0/3.0);
    }
}

particularly due to the mesh_.V();. If one removes any mention of mesh_V() things work... I have no idea what is happening.

Setting lengthScale to WallNormalDistance works fine, even though that also uses the mesh class, even more extensively in fact.

timofeymukha avatar Oct 27 '23 14:10 timofeymukha