View Issue Details

IDProjectCategoryView StatusLast Update
0003928OpenFOAMBugpublic2022-11-09 09:32
ReportermaHein Assigned Tohenry  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformUnixOSOtherOS Version(please specify)
Product Version10 
Fixed in Version10 
Summary0003928: dynamicMesh: refiner does not write refinementHistory correctly
DescriptionWhen using adaptive mesh refinement, it is vital to have the refinement history in case of restarting a simulation. This field 'refinementHistory' can be written out to the polyMesh folder by the refiner with the bool 'dumpLevel' in dynamicMeshDict.

However, since OpenFOAM 10 this does not work reliably anymore due to the following reason: in line 1681 of fvMeshTopoChangersRefiner.C, there is a if-statement that this field is only written if the mesh topology has actually changed in the current time step, e.g. the mesh was refined:

if (mesh().topoChanged())
Steps To ReproduceThis behaviour can easily be reproduced taking any tutorial case with adaptive mesh refinement. For example, damBreakWithObstacle:

Original setup: here, the refineInterval in dynamicMeshDict is set to 1, so refinement takes place every time step and thus the refinementHistory is written out every writeInterval (here 0.02, 0.04, 0.06, 0.08, and so on).

New setup: changing refineInterval in dynamicMeshDict to 4, suddenly the refinement history is not written out at every writeInterval, instead only at 0.02, 0.08, ... Time step 0.04 and 0.06 are omitted, because the mesh was not refined in those specific time steps.

This way, when restarting at 0.04 or 0.06, already refined cells get refined again because the refiner does not know they were already refined.
Additional InformationThis behaviour can probably be fixed by removing the if-statement in line 1681 of fvMeshTopoChangersRefiner.C because in OpenFOAM 9 there was no such statement in the dynamicRefineFvMesh.C.
TagsNo tags attached.

Activities

henry

2022-11-08 16:10

manager   ~0012863

> This behaviour can probably be fixed by removing the if-statement in line 1681 of fvMeshTopoChangersRefiner.C

Presumably if you make this change the refinement history will be written even if at has not changed since the last time it was written.

maHein

2022-11-08 16:22

reporter   ~0012864

That is correct and the way it was working in OpenFOAM 9. The current implementation forces the user to either set refineInterval to 1 or risk time folders which cannot be restarted as the refinement history is missing.

henry

2022-11-08 16:32

manager   ~0012865

Try this in OpenFOAM-dev

 commit 6d74f7063751722b83e9bc6b2e0953fa4a65c368
Author: Henry Weller <http://cfd.direct>
Date: Tue Nov 8 16:27:18 2022 +0000

    fvMeshTopoChangers::refiner: Added changedSinceWrite_
    
    which is set true if the mesh refinement changed since the last time the
    refinement history was written so that it can be written only at the following
    write time.

if it proves robust I can make the same change to OpenFOAM-10

maHein

2022-11-09 09:19

reporter   ~0012866

The commit works fine for the tutorial cases and should fix the issue.

henry

2022-11-09 09:32

manager   ~0012867

Resolved in OpenFOAM-10 by commit acd844182f00103a8d6b6b45dc6de2c388a4f660
Resolved in OpenFOAM-dev by commit 6d74f7063751722b83e9bc6b2e0953fa4a65c368

Issue History

Date Modified Username Field Change
2022-11-08 13:05 maHein New Issue
2022-11-08 16:10 henry Note Added: 0012863
2022-11-08 16:22 maHein Note Added: 0012864
2022-11-08 16:32 henry Note Added: 0012865
2022-11-09 09:19 maHein Note Added: 0012866
2022-11-09 09:32 henry Assigned To => henry
2022-11-09 09:32 henry Status new => resolved
2022-11-09 09:32 henry Resolution open => fixed
2022-11-09 09:32 henry Fixed in Version => 10
2022-11-09 09:32 henry Note Added: 0012867