CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Writing mesh in FORTRAN or C (https://www.cfd-online.com/Forums/fluent/103862-writing-mesh-fortran-c.html)

James Hetfield June 28, 2012 01:30

Writing mesh in FORTRAN or C
 
can anybody please tell me how to generate my own mesh with FORTRAN or C and then import into Fluent?
Ive read UDF manuals but couldnt find anything useful :eek:

I wanna know the structure and order of the code that fluent can work with :confused:

Far June 28, 2012 03:48

Are you talking about the script for automating the process or your own grid generation code?

sbaffini June 28, 2012 05:25

1 Attachment(s)
The information you need is present in the User's guide manual.

However, if you are in need of a free mesh generator for Fluent i think you can use the ones present in the OpenFOAM suite (blockmesh and snappyhexmesh) and convert the mesh in Fluent format (i'm pretty sure there is also something to do that among the several applications)

As an example, you can find attached a simple, single-block, structured grid generator for Fluent. It is written in MATLAB but i am very FORTRAN oriented so it should be easily translated. Of course it is just an example, so do not go over 1-2 million cells. The code should be understandable as it is; you have:

- a routine to create a point distribution over a line (newgrid.m)

- a routine to create 3 matrix of points x(i,j,k), y(i,j,k) and z(i,j,k) (createmesh.m)

- a routine to convert the above matrix in a fluent readable .msh file (writemsh.m)

Hope it helps

James Hetfield June 28, 2012 14:19

Quote:

Originally Posted by Far (Post 368670)
Are you talking about the script for automating the process or your own grid generation code?

I mean the process for my own grid

James Hetfield June 28, 2012 22:27

Quote:

Originally Posted by sbaffini (Post 368686)
The information you need is present in the User's guide manual.

However, if you are in need of a free mesh generator for Fluent i think you can use the ones present in the OpenFOAM suite (blockmesh and snappyhexmesh) and convert the mesh in Fluent format (i'm pretty sure there is also something to do that among the several applications)

As an example, you can find attached a simple, single-block, structured grid generator for Fluent. It is written in MATLAB but i am very FORTRAN oriented so it should be easily translated. Of course it is just an example, so do not go over 1-2 million cells. The code should be understandable as it is; you have:

- a routine to create a point distribution over a line (newgrid.m)

- a routine to create 3 matrix of points x(i,j,k), y(i,j,k) and z(i,j,k) (createmesh.m)

- a routine to convert the above matrix in a fluent readable .msh file (writemsh.m)

Hope it helps


I read UDF and mesh manuals
NOWHERE its been mentioned how to write a mesh code for fluent

sbaffini June 29, 2012 04:38

Of course, in the manual it's not written how to write a mesh but how Fluent is expecting the msh file (which is all you need to write it).

As i said, the reference part in the manual is:

User's guide - B.3 Case and Data File Formats - Grid Sections

This has nothing to do with the UDF

James Hetfield June 30, 2012 19:20

Quote:

Originally Posted by sbaffini (Post 368828)
Of course, in the manual it's not written how to write a mesh but how Fluent is expecting the msh file (which is all you need to write it).

As i said, the reference part in the manual is:

User's guide - B.3 Case and Data File Formats - Grid Sections

This has nothing to do with the UDF

Ill check it

sbaffini June 30, 2012 19:24

What version of Fluent are you working on and what versions of the manuals do you have?

James Hetfield June 30, 2012 19:26

Quote:

Originally Posted by sbaffini (Post 369049)
What version of Fluent are you working on and what versions of the manuals do you have?

sorry i made the wrong comment on your comment

I will check it

James Hetfield July 1, 2012 22:24

Quote:

Originally Posted by sbaffini (Post 368686)
The information you need is present in the User's guide manual.

However, if you are in need of a free mesh generator for Fluent i think you can use the ones present in the OpenFOAM suite (blockmesh and snappyhexmesh) and convert the mesh in Fluent format (i'm pretty sure there is also something to do that among the several applications)

As an example, you can find attached a simple, single-block, structured grid generator for Fluent. It is written in MATLAB but i am very FORTRAN oriented so it should be easily translated. Of course it is just an example, so do not go over 1-2 million cells. The code should be understandable as it is; you have:

- a routine to create a point distribution over a line (newgrid.m)

- a routine to create 3 matrix of points x(i,j,k), y(i,j,k) and z(i,j,k) (createmesh.m)

- a routine to convert the above matrix in a fluent readable .msh file (writemsh.m)

Hope it helps

thanks
it was useful :)

sbaffini July 2, 2012 16:53

You're welcome.

Still, i recently found some warnings related to some faces when using the above routines (actually just writemsh.m). This does not seem to be a major problem as Fluent can handle them correctly but means that something wrong is done somewhere. I was not aware of this or i wouldn't have shared them, i will share the correct version (as soon as i have it) if you still need it.

Regards

James Hetfield July 2, 2012 16:56

Quote:

Originally Posted by sbaffini (Post 369355)
You're welcome.

Still, i recently found some warnings related to some faces when using the above routines (actually just writemsh.m). This does not seem to be a major problem as Fluent can handle them correctly but means that something wrong is done somewhere. I was not aware of this or i wouldn't have shared them, i will share the correct version (as soon as i have it) if you still need it.

Regards

if u share the new version i really appreciate it :rolleyes:

I believe that Ansys stuff is cool but they DO REALLY NEED to develop a good grid generator for their stuff
both Ansys Meshing and ICEM have serious grid issues specially when it comes to quadrilaterals and smoothing in boundary layers :(


All times are GMT -4. The time now is 02:57.