View Issue Details

IDProjectCategoryView StatusLast Update
0003845OpenFOAMBugpublic2022-05-31 19:37
Reportermturcios777Assigned Tohenry 
Status closedResolutionno change required 
Platformx64OSUbuntuOS Version20.03
Product Version9 
Fixed in Versiondev 
Summary0003845: Mass conservation with engineFoam, cyclic boundary conditions and mesh motion
DescriptionWhen using mesh motion classes from engineMesh (layeredEngineMesh, fvMotionSolver) and cyclic boundary conditions, engineFoam does not conserve mass. When the domain is closed has a small drift in mass but not to the extent as cyclic boundaries do. Using the static engine mesh class also conserves mass.
Steps To Reproduce1. Download included case
2. Extract and go to workDir folder
3. Run engineFoam. Function objects have been included for flux through cyclics and total mass.
Additional InformationI am trying to update an old solver created in OF2.3.1, and using the same case setup and sprayEngineFoam has no issues with mass conservation. I know that OpenFOAM 8 updated how cyclic transforms are calculated, so its possible there is a configuration flag we are missing.
TagsNo tags attached.



2022-05-30 21:35


aachenEngineFluxTest_cyclic_engineFoam.tar.gz (85,590 bytes)


2022-05-30 23:10

manager   ~0012607

The layer addition and removal is indeed non-conservative and will need a rewrite. The whole structure for mesh change is being rewritten in OpenFOAM-dev, much of it already complete but there is still more to do. For engine simulations we are implementing a run-time mesh-to-mesh mapping system rather than working on layer addition and removal but if you would like to sponsor the rewrite of this component please contact us directly.


2022-05-30 23:26

reporter   ~0012608

Thank you Henry. This is not the layer addition and removal, but the standard accordion style mesh that scales points below deckHeight and above the piston bowl.


What is strange is that having the cyclic boundary conditions is what causes the mass divergence to grow beyond an acceptable limit.


2022-05-31 00:12

manager   ~0012609

It is not clear what is wrong with your case, we have not seen any conservation issues relating to cyclic boundary conditions.
We could work on your case for you within a support contract.


2022-05-31 01:50

reporter   ~0012610

Just did a quick test with OpenFOAM v8, which means that there was an issue when moving from 8 to 9 that caused issues. Will see if any patches fix the issue and consult with the community


2022-05-31 07:29

reporter   ~0012611

Could you prepare a case for dev version so I could test this as well.

Have you ruled out numerics based errors, i.e. you have ensured that pressure-momentum decoupling does not take place in this test case?


2022-05-31 07:41

reporter   ~0012612

I saw similar behaviour (mass loss) in v9, switching to -dev solved the issue for me. Additionally, check that all your boundary conditions are correct.


2022-05-31 17:27

reporter   ~0012618

Thanks peksa and cgneossni. I will upload a dev version soon. The engineFoam solver has been removed in favor of using reactingFoam and moving the mesh motion to the new fvMeshMovers library. @cgoessni, was your version 9 the most up to date from the git repository? I am using the source pack release and realize that it might not be the most up to date, as I had to manually patch the issue with engineTime not initializing the startTime properly and failing to write out the timesteps.


2022-05-31 17:29

reporter   ~0012619

The boundary conditions are correct; cyclics defined appropriately and walls are:

p: zeroGradient
U: fixedValue, ( 0 0 0), except for the piston which is movingWallVelocity (0 0 0)


2022-05-31 18:16

reporter   ~0012620

I honestly can't recall if it was v9 as released or a "new" v9, but I doubt it would make any difference. I would recommend just using -dev, since there were many other improvements in engine-related stuff, like mesh-to-mesh mapping, fvMeshMover interface and so on.


2022-05-31 18:18

reporter   ~0012621

PS: Here is my bug report with the mass conservation issue


2022-05-31 18:29

reporter   ~0012622

Thank cgoessni! So it looks like we were reporting the same issue. The mass loss in a closed domain was barely noticeable in our cases, but it was amplified by the cyclic boundary conditions. I guess this case can be closed, as dev is where everyone is going these days (I've been away from OF for a while and am getting used to a lot of changes)


2022-05-31 19:37

manager   ~0012623

Assumed to be fixed in OpenFOAM-dev but the case has not been updated or tested.

Issue History

Date Modified Username Field Change
2022-05-30 21:35 mturcios777 New Issue
2022-05-30 21:35 mturcios777 File Added: aachenEngineFluxTest_cyclic_engineFoam.tar.gz
2022-05-30 23:10 henry Note Added: 0012607
2022-05-30 23:10 henry Priority immediate => none
2022-05-30 23:10 henry Severity major => minor
2022-05-30 23:26 mturcios777 Note Added: 0012608
2022-05-31 00:12 henry Note Added: 0012609
2022-05-31 01:50 mturcios777 Note Added: 0012610
2022-05-31 07:29 peksa Note Added: 0012611
2022-05-31 07:41 cgoessni Note Added: 0012612
2022-05-31 17:27 mturcios777 Note Added: 0012618
2022-05-31 17:29 mturcios777 Note Added: 0012619
2022-05-31 18:16 cgoessni Note Added: 0012620
2022-05-31 18:18 cgoessni Note Added: 0012621
2022-05-31 18:29 mturcios777 Note Added: 0012622
2022-05-31 19:37 henry Assigned To => henry
2022-05-31 19:37 henry Status new => closed
2022-05-31 19:37 henry Resolution open => no change required
2022-05-31 19:37 henry Fixed in Version => dev
2022-05-31 19:37 henry Note Added: 0012623