CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Velocity Gradients or Pressure Gradients? (

owayz October 14, 2011 14:59

Velocity Gradients or Pressure Gradients?
Hallo Foamers,
I have a small problem. I want to calculate the gradients of Velocity in a 2D simulation.
The idea is to calculate the velocity/pressure gradients in the whole mesh and mark the cells with a specified threshold value for the gradient and then refining those cells.
Why I want to do that?
Because I really tried hard to find some automatic mesh refinement strategy in openfoam but I failed.
Thats why I want to perform the refinement in this way. If some one has suggestions regarding my problem I would be really grateful for any help that I shall receive from the big hearted openfoam family.
Awais Ali

akidess October 15, 2011 04:18

InterDyMFoam does not work for you (see damBreakWithObstacle tutorial) ?

owayz October 15, 2011 11:43

Thanks Anton,
I have tried the interDyMFoam tutorial. But before going further into detail I would like to ask whether these dynamic Mesh capabilities are avalable for 2D meshes in openFoam. Because for some solver of the same capability (i think it was dieselDyMFoam) I read that the dynamics mesh capabilities are not available for 2D meshes.
Thanks for you quick reply again.

akidess October 17, 2011 02:40

Ah you are right, that tutorial is 3D indeed. Well, either way, all that code should be re-usable, and you should just try to implement a flag like "restrict2D" that turns of refinement in one direction.

Before you do that, have you tried this:

owayz October 18, 2011 10:25

Thanks again for your reply Anton.
I have one other issue. interDyMFOMA is not the answer to my problem. I want to use rhoCentralDyMfoam. Do you know any place where I could find some tutorials which could help me use this solver with refinement capabilities.

nimasam October 18, 2011 16:42

a simple approach but not totally sure!
compare interFoam and interDyMFoam together, then you will find extra code lines! then use the same method and lines for ur solver!

akidess October 19, 2011 02:34

I'm not aware of any such tutorial, sorry. As Nima pointed out, try to use a diff-tool (e.g. meld or kompare) to check for differences between interFoam and interDyMFoam, or rhoCentralFoam and compressibleInterDyMFoam and try to isolate what code you need to add for the moving mesh capabilities. Test your new solver on a simple 3D case, and then see if you can reduce it to 2D.

owayz October 19, 2011 06:30

Well the suggestions are very nice. I would definitely do that. But if you have understood me correctly I want to refine the mesh for smooth distribution of gradients. But if I use dynamic mesh capabilities I am only stuck with using the velocity or pressure values as the refinement criteria (thats what I have understod from dambreaking tutorial, the refinement is done on basis of a parameter alpha, which actually helps identifies the surface for free surface flows).
I am not sure whether it would a good idea to give a min and max velocity value and refine on the basis of that value. Anyways I will try that and will post the results and observations.
Regards and thanks for your help,

samiam1000 June 13, 2012 05:52

Hi All,

have you found a tutorial for rhoCentralPimpleDyMFoam??

Thanks a lot.


owayz August 14, 2012 13:09

Hallo Samuele,
No actually I stopped looking for dynamic mesh capabilities to refine my mesh. But actually I modified my approach and calculated the Velocity Gradients in the flow field and used them as a criteria to refine my mesh. I adopted this method to refine the mesh in shear layers.
And this thread helped me doing what I did, here is the link may be you can have y look.
If you are trying to do the same thing I would be happy to help you.

All times are GMT -4. The time now is 11:18.