View Issue Details

IDProjectCategoryView StatusLast Update
0000795OpenFOAMBugpublic2018-07-10 11:23
Reportermonto Assigned Touser4 
PriorityhighSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformLinux x86_64OSOpenSUSEOS Version12.2
Summary0000795: pointField are not remapped if topological changes occur
DescriptionThis issue is similar to the one reported as #638.
If a mesh undergoes a topological change, pointFields are not remapped when calling polyMesh.updateMesh(mapPolyMesh).
The suggested fix outlined in #638 has apparently not ported to version 2.2.x.
Steps To ReproduceThe following piece of code causes an error when the topological change is triggered:


myTopoChangerFvMesh.update()
{
/* ... */
movePoints(motionSolver_->newPoints());
autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(true);
bool hasChanged = topoChangeMap_.valid();
if (hasChanged)
{
    if (topoChangeMap->hasMotionPoints())
    {
        pointField newPoints = topoChangeMap_().preMotionPoints();
        movePoints(newPoints);
        motionSolver_->updateMesh(topoChangeMap_());

        // clear reference to old points
    resetMotion();
    }
}
return;
/* ... */
}

In this particular case, the pointDisplacement field of the motionSolver is not remapped, causing a segmentation fault
Additional InformationA workaround is to move the following instruction

meshObject::clear<polyMesh, GeometricMeshObject>(*this);

from polyMesh::clearGeom() and polyMesh::clearAddressing() to polyMesh::clearOut()

in file polyMeshClear.C (attached).
TagsmotionSolver, pointField, polyMeshClear, topoChangerFvMesh

Activities

monto

2013-03-20 17:41

reporter  

polyMeshClear.C (4,092 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "polyMesh.H"
#include "primitiveMesh.H"
#include "globalMeshData.H"
#include "MeshObject.H"
#include "indexedOctree.H"
#include "treeDataCell.H"

//monto
#include "pointMesh.H"
// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //

void Foam::polyMesh::removeBoundary()
{
    if (debug)
    {
        Info<< "void polyMesh::removeBoundary(): "
            << "Removing boundary patches."
            << endl;
    }

    // Remove the point zones
    boundary_.clear();
    boundary_.setSize(0);

    clearOut();
}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

void Foam::polyMesh::clearGeom()
{
    if (debug)
    {
        Info<< "void polyMesh::clearGeom() : "
            << "clearing geometric data"
            << endl;
    }

	//monto
    //meshObject::clear<polyMesh, GeometricMeshObject>(*this);

    primitiveMesh::clearGeom();

    boundary_.clearGeom();

    // Reset valid directions (could change with rotation)
    geometricD_ = Vector<label>::zero;
    solutionD_ = Vector<label>::zero;

    // Remove the stored tet base points
    tetBasePtIsPtr_.clear();
    // Remove the cell tree
    cellTreePtr_.clear();
}


void Foam::polyMesh::clearAdditionalGeom()
{
    if (debug)
    {
        Info<< "void polyMesh::clearAdditionalGeom() : "
            << "clearing additional geometric data"
            << endl;
    }

    // Remove the stored tet base points
    tetBasePtIsPtr_.clear();
    // Remove the cell tree
    cellTreePtr_.clear();
}


void Foam::polyMesh::clearAddressing()
{
    if (debug)
    {
        Info<< "void polyMesh::clearAddressing() : "
            << "clearing topology"
            << endl;
    }

    //monto
	//meshObject::clear<polyMesh, TopologicalMeshObject>(*this);

    primitiveMesh::clearAddressing();

    // parallelData depends on the processorPatch ordering so force
    // recalculation
    globalMeshDataPtr_.clear();

    // Reset valid directions
    geometricD_ = Vector<label>::zero;
    solutionD_ = Vector<label>::zero;

    // Update zones
    pointZones_.clearAddressing();
    faceZones_.clearAddressing();
    cellZones_.clearAddressing();

    // Remove the stored tet base points
    tetBasePtIsPtr_.clear();

    // Remove the cell tree
    cellTreePtr_.clear();
}


void Foam::polyMesh::clearPrimitives()
{
    resetMotion();

    points_.setSize(0);
    faces_.setSize(0);
    owner_.setSize(0);
    neighbour_.setSize(0);

    clearedPrimitives_ = true;
}


void Foam::polyMesh::clearOut()
{
    clearGeom();
    clearAddressing();

	//monto
	meshObject::clear<polyMesh, GeometricMeshObject>(*this);
}


void Foam::polyMesh::clearCellTree()
{
    if (debug)
    {
        Info<< "void polyMesh::clearCellTree() : "
            << "clearing cell tree"
            << endl;
    }

    cellTreePtr_.clear();
}


// ************************************************************************* //
polyMeshClear.C (4,092 bytes)   

henry

2013-03-21 09:53

manager   ~0002030

We do not have a case which reproduces this problem, could you supply a simple test case we could use for diagnosis?

user331

2013-03-21 17:29

  ~0002033

I reported 638 and will update the case and library files to work with 2.2.x. Once its done I will upload to this issue. I wonder if this is related to 786?

user331

2013-03-21 17:43

 

sprayDyMFoam.tar.gz (441,533 bytes)

user331

2013-03-21 17:43

 

user331

2013-03-21 17:43

 

henry

2013-03-22 12:16

manager   ~0002048

> I wonder if this is related to 786

No the issues are independent. We are working on #786 now and will come back to this one when that issue is resolved.

monto

2013-03-22 12:56

reporter   ~0002049

I have a simple test case, but the code snippet I reported is part of a class that cannot be made publicly available. However, I can send you the source code privately if you indicate me how to do.

henry

2013-03-22 13:21

manager   ~0002050

Depending on the arrangements you have made to keep your classes private there may be an issue with you distibuting your GPL code to me with a redistribution restriction. Please check the GPL on this.

Do you have any exapmle code which reproduces the problem which may be made public under the terms of the GPL?

monto

2013-04-04 17:33

reporter   ~0002087

There is no legal restriction related to our classes: they are fully GPL-compliant. However, they are still under development and in some other parts (not related to this bug report) there is dirty or non-functional code. We are working to provide a minimal and clean working example to test the bug we have reported, and we will post it as soon as it is ready.

user4

2013-12-17 10:18

  ~0002690

This is fixed in the next major release.

Issue History

Date Modified Username Field Change
2013-03-20 17:41 monto New Issue
2013-03-20 17:41 monto File Added: polyMeshClear.C
2013-03-20 17:43 monto Tag Attached: motionSolver
2013-03-20 17:43 monto Tag Attached: pointField
2013-03-20 17:43 monto Tag Attached: polyMeshClear
2013-03-20 17:43 monto Tag Attached: topoChangerFvMesh
2013-03-20 17:43 monto Tag Attached: topological change
2013-03-21 09:53 henry Note Added: 0002030
2013-03-21 17:29 user331 Note Added: 0002033
2013-03-21 17:43 user331 File Added: sprayDyMFoam.tar.gz
2013-03-21 17:43 user331 File Added: aachenBombMoveRefine.tar.gz
2013-03-21 17:43 user331 File Added: dynamicMotionSolverRefineFvMesh.tar.gz
2013-03-22 12:16 henry Note Added: 0002048
2013-03-22 12:56 monto Note Added: 0002049
2013-03-22 13:21 henry Note Added: 0002050
2013-04-04 17:33 monto Note Added: 0002087
2013-12-17 10:17 user4 Status new => resolved
2013-12-17 10:17 user4 Resolution open => fixed
2013-12-17 10:17 user4 Assigned To => user4
2013-12-17 10:18 user4 Note Added: 0002690
2013-12-17 10:18 user4 Status resolved => closed
2013-12-17 10:18 user4 Fixed in Version => Other
2018-07-10 11:23 administrator Tag Detached: topological change