CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Mesh Utilities (
-   -   Import or generating Meshes from Koordinates Gau%c3%9fKr%c3%bcger (

toby August 15, 2008 06:47

Hello We are trying to eva

We are trying to evaluate if OpenFoam could help us solving different hydrodynamic and temperature distribution problems.

The Main Problem i have right know, is to generate a mesh from pure data or to import a mesh.
Maybe it helps if i tell briefly what we try to solve for: Most of the time we are generating meshes from koordinates which represents a 3D Surface, in general a river bed or part of a coastline. Then we start with certain water levels, water temperatures, water input at the one end of the model and water outgoing at the other end of the model. After these parameters are set we try to compute and visualise for water flow, turbulence or areas of overflooding.

So back to the origin Problem. I only have Data represented by koordinates in the Gauß-Krüger format (like 3559041.037 5813109.094 55.239). Generally there are about 10000-20000 of these points to describe the surface of the modelled area. So far i could not find out how to generate a mesh from this data. The other option would be to use another programm (opensource if possible) to generate the mesh from this data and then export in a format OpenFoam would be able to read.

Maybe anyone has an idea how we can do this or which mesh generator could work.

Maybe anyone solved allready hydrodynamic problems like described above with OpenFoam and could us to get started.

Thanks in advance.


hjasak August 15, 2008 08:42

It sounds to me that you need
It sounds to me that you need a separate mesh generator, capable of generating a surface description from a bunch of points (no ideas here).

As for hydrodynamics, I have been doing a lot of work here) - have a look at one recent movie of 2 bodies with 6-DOF solvers and automatic mesh motion in a free surface VOF flow: e.mpg



ngj August 15, 2008 10:16

Hi I do not know, if the n

I do not know, if the numerical scheme behind the mesh motion is robust enough to accept possibly very large deformations, but assume that it is sufficiently robust then could you achieve what you want in the following way?

1. Generate a mesh with the correct horizontal lay-out which is extruded some magnitude in the y-direction.

2. The bottom patch, in the following called the bathymetry patch (BP), is horizontal, but you know the y-coordinate, y_Old.

3. Make an interpolation of you measured bathymetry onto every point on BP considered as a y_New=h(x,z) making the depth a dependent variable of the horizontal coordinates.

4. The distance delta = y_New - y_Old, could then be used to make a displacement of the lowermost points using the moving mesh algorithms.

5. The mesh is ready for some interesting work.

If it works, please let us know.

As it is bathymetries you are looking at the data set should be well behaved, i.e. one bed level per horizontal coordinate (x,z).

The most significant drawback is that you do not completely control the actual discretization of the mesh, but using the correct diffusion coefficients in the laplacian and make some clever choices in the initial plane bed mesh you should be able to control the upper bound in the discretization.

Further, as far as I am aware of, no such routine is present in OF, but it will not be impossible to make such an implementation.

Have fun,


P.S. Nice movie, Hrv

hjasak August 15, 2008 18:56

It depends on the geometry: I
It depends on the geometry: I can do "reasonable things, corresponding to a non-trivial transfnite mapping, but wrapping a mesh around corners or in deep/sharp concave angles will probably not work...


ngj August 16, 2008 10:07

I agree on the point that shar
I agree on the point that sharp angles will not do, but as Tobias apparently is considering river engineering, then it is highly unlikely that any angle will exceed the angle of repose (30 degrees), except if constructions are present of course.

- Niels

toby August 18, 2008 04:07

Well, thx for the answers so f
Well, thx for the answers so far, i will review the proposals as soon as i get to that point. I did some work on generating/importing an mesh in OF on Friday. I do have a closed source tool (which i would like to discard) to generate a mesh from my given Data and i also have a possibility to export this mesh in STL format. The next task has been to convert the mesh into a format OF can read and to manipulate the mesh. At the moment i'm trying out engrid, an opensource tool from . The current release (0.9) gives the possibility to import my STL Mesh and to export the mesh (after working on it) into Gmsh or Netgen Files. These formats i should then be able to import into OF (not done till now, i will try to do today). The next release shell even give native OF export which should make things easier.

I will now try to import the, lets call it "Bottom Surface Mesh" which represents the Riverbed and then i have to get somehow an other layer into it which shell represent my waterlevel or, as we talk about an VOF Problem, a fixed concentration at these points. After this i hopefully have a true 3-D Mesh and start with some calc on it.

I keep you informed about progress.

vinz November 21, 2008 06:48

Hi Tobias, Engrid looks nic
Hi Tobias,

Engrid looks nice indeed.
Apparently you already tried it. I see you said you were importing STL files into Engrid and working with them.
Is it really possible to directly work on the stl file or should one do a surface mesh first in gmesh for intance??
I would be very interested in knowing what you think about this software after using it for sometime.

Thanks in advance.


jasonneuswanger February 27, 2009 15:25

I faced this same meshing prob
I faced this same meshing problem recently. I figured out something that kind of worked, although it was an ugly process and the results are far from ideal.

I set up my data for a simple ASCII .obj file using Excel, and copied and pasted it into a text editor and saved as .obj after replacing tabs with spaces. Then I imported the .obj file into Meshlab, which I used to create a 2D surface for the bathymetry, and saved it as a .ply file. I imported the .ply file into Blender, which I used to extrude the mesh to 3D, flatten the top, and separate different faces. I exported the .stl file from Blender that could be read by OpenFOAM.

Now I have a 3D snappyHexMesh for my riverbed in OpenFOAM, constructed entirely with open source software. That said, there were a million little tricks along the way, and the mesh misses a lot of bathymetry points.

I would like to know if you found a better solution to the problem using free and/or open-source software.

All times are GMT -4. The time now is 20:03.