View Issue Details

IDProjectCategoryView StatusLast Update
0004118OpenFOAMBugpublic2024-07-27 14:25
Reportercgoessni Assigned Tohenry  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionno change required 
Product Version12 
Fixed in Versiondev 
Summary0004118: XiFluid ignition causes memory corruption with meshToMesh under certain circumstances
DescriptionWhen running ignition in XiFluid v12, and the ignition extends through a meshToMesh mapping, the ignition can cause memory corruption when the ignition cells switch from one processor to another. This is due to not setting the cells_ and volumes_ arrays to zero before the return:

    // Bit tricky: generate C and V before shortcutting if cannot find
    // cell locally. mesh.C generation uses parallel communication.
    const volVectorField& centres = mesh.C();
    const scalarField& vols = mesh.V();

    label ignCell = mesh.findCell(location_);
    if (ignCell == -1)
* {
* return;
    }

We had an engine case that sometimes crashed with certain model combinations, and the crashes were always random (free(): invalid next size, double-linked list corruption, segfault, ...). If we set the size of cells_ and volumes_ to zero before return, all crashes go away:

diff --git a/src/thermophysicalModels/ignition/ignitionSite.C b/src/thermophysicalModels/ignition/ignitionSite.C
index 320467f..7401146 100644
--- a/src/thermophysicalModels/ignition/ignitionSite.C
+++ b/src/thermophysicalModels/ignition/ignitionSite.C
@@ -39,6 +39,9 @@ void Foam::ignitionSite::findIgnitionCells(const fvMesh& mesh)
     label ignCell = mesh.findCell(location_);
     if (ignCell == -1)
     {
+ cells_.setSize(0);
+ cellVolumes_.setSize(0);
+
         return;
     }
Steps To ReproduceVery difficult to reproduce: the ignition cells have to switch from procA to procB (as with our engine case), making cells_ and volumes_ invalid but still with size > 0 on procA. But even under these conditions, some model combinations worked sometimes, sometimes we saw deadlocks and for certain model combinations, we saw random (i.e., always different) crashes.
Additional InformationWe know that in -dev, this is fixed with the fundamentally different approach. It would still be nice to have this small bugfix in v12, if possible?
TagsNo tags attached.

Activities

henry

2024-07-27 14:24

manager   ~0013324

I have made lots of improvements to XiFluid in OpenFOAM-dev, in particular with respect to ignition which had many issues. I recommend that you use the latest XiFluid solver and if you are not able to run OpenFOAM-dev but can compile changes to OpenFOAM-12 you could replace the XiFluid in OpenFOAM-12 with the current version from OpenFOAM-dev.

henry

2024-07-27 14:25

manager   ~0013325

Already resolved in OpenFOAM-dev

Issue History

Date Modified Username Field Change
2024-07-27 13:45 cgoessni New Issue
2024-07-27 14:24 henry Note Added: 0013324
2024-07-27 14:25 henry Assigned To => henry
2024-07-27 14:25 henry Status new => closed
2024-07-27 14:25 henry Resolution open => no change required
2024-07-27 14:25 henry Fixed in Version => dev
2024-07-27 14:25 henry Note Added: 0013325