CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing & Mesh Conversion (
-   -   How can I deform a mesh with my own program? Currently getting continuity errors! (

clarence_carter April 23, 2013 04:00

How can I deform a mesh with my own program? Currently getting continuity errors!
I have written a program that deforms a mesh by reading in the points file, applying an algebraic deformation of the points, and then replacing the original points file with a new one.

Unfortunately, although I can generate a mesh in this way, postprocess it and view it in paraview, OpenFOAM (interFoam) does not run when using the deformed mesh. Instead, I get this error:

cfdTools/general/adjustPhi/adjustPhi.C[34] [50] [39] at line Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Total flux : 72466.1
Specified mass inflow : 992.137
Specified mass outflow : 992.137
Adjustable mass outflow : 4.64372e-11

This is using boundary conditions that work perfectly well with a non-deformed mesh.

I was initially concerned that the deformation was not being performed to a high enough accuracy (my first attempt was with Python), so I re-wrote the program using C++ in double precision, but I still get the same error.

What am I doing wrong?

From analysing the polyMesh structure, the only coordinate information seems to be stored in the points file; everything else appears to be derived from the points file, so this is the only file I have modified. Am I missing something, is there some other file I need to modify?

If anybody has formation or advice to share regarding this problem I will be extremely grateful!

Phicau April 23, 2013 04:31


it seems that you are starting off the previous results. Your case is most probably blowing up because your fluxes were calculated to fulfil mass conservation for the previous mesh. Now, with the deformed one, your face areas have changed, and therefore you are having mass discontinuities in some cells.

My guess is that you could try to start this case from 0 or (less advised) delete the phi field on your initial folder and see what happens...

Another option is that your topology may be screwed up due to the movement of the points (e.g. twisted faces). If you have tried checkMesh and it is OK, then do not worry for this.



clarence_carter April 23, 2013 07:13

Thanks for your very fast reply!

Unfortunately I don't think your first suggestion is the answer. I am deforming the mesh before I even run the case, so phi has not been calculated yet.

I have had a look at the checkMesh output and it seems to be reporting a lot of non-orthogonal cells. This is surprising, since the mesh is hexahedral (computed via blockMesh) and the deformation is normal to the hexahedra surface (i.e. in the X-direction).

I will keep thinking on it.

All times are GMT -4. The time now is 08:35.