Repository navigation
Conversation
The refiners set topoChanging only in the steps in which they run (every refineInterval steps). After a step that changed the mesh, the flag therefore stays true until the next refinement step, so solvers see mesh.changing() in steps in which nothing changed. interIsoFoam, interFoam and the other dynamic-mesh solvers then redo their mesh-change work in every such step: gh/ghf, and correctPhi with a pcorr solve on the whole mesh. adaptiveFvMesh::update() now resets the flag before refining, as OpenFOAM's dynamicRefineFvMesh does, and sets it when the mesh changed, which also covers a redistribution in a step without refinement. test: topoChanging() must equal the return value of update() in every step, with refinement and balancing every third step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The refiners set
mesh.topoChanging()only in the steps in which they run, i.e. everyrefineIntervalsteps (fvMeshHexRefiner.C,fvMeshPolyRefiner.C,fvMeshDirectionalRefiner.C:mesh_.topoChanging(hasChanged)). After a step that changed the mesh, nothing resets the flag, so it staystrueuntil the next refinement step. Solvers then seemesh.changing()in steps in which nothing changed and redo their mesh-change work in every one of them. ForinterIsoFoam/interFoamthis is gh/ghf andcorrectPhi, with apcorrsolve on the whole mesh.With
refineInterval 1the refiner runs in every step and sets the flag correctly, so the problem only appears withrefineInterval > 1.Fix
adaptiveFvMesh::update()resets the flag before refining, as OpenFOAM'sdynamicRefineFvMeshdoes, and sets it whenever the mesh changed. That includes a redistribution in a step without refinement, which previously did not set the flag at all. It adds 12 lines inadaptiveFvMesh.C.Test
A new foamUT test case, "Check that topoChanging is reset in steps without a mesh change":
mesh.topoChanging() == mesh.update();v2212(e26920b)REQUIRE, all other tests passEffect on
tutorials/interIsoFoam/damBreak2D_hexRefinerThe case was run with 4 ranks to t = 0.3 s, both builds against the same OpenFOAM v2506. That build has local changes in GAMG agglomeration,
reconstructParandconstantAlphaContactAngle, none in the dynamic-mesh code. The foamUT results above use the same build.refine/unrefine/balanceIntervalpcorrsolvesv2212v2212pcorrnow runs only in the steps that change the mesh.v2212with interval 10 vs interval 1 differs by 10 mm and 6.7e-4.In a larger case, a 3D hydraulic jump with
interIsoFoamon 96 ranks andrefineInterval 10, the fix saved 30-38 % of the time per step.