CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How can generate Uniform Cartesian grid? (https://www.cfd-online.com/Forums/main/14625-how-can-generate-uniform-cartesian-grid.html)

Harry January 12, 2008 04:59

How can generate Uniform Cartesian grid?
 
Hi, Guys

I need generate uniform Cartesian grid for any arbitrary geometry. This is supposed to be used for some specific multiphase-flow coding. At the first step, I mesh the domain which should cover the whole geometry of interest, and be possibly larger than the space occupied by the geometry. The second step is to determine which cubic cells are located inside the geometry. The third step is to cut the cells near the boundaries of the geometry. I would appreciate your hints about the last two steps. Is there any package available to handle this problem?

Regards,

Harry

BastiL January 12, 2008 06:55

Re: How can generate Uniform Cartesian grid?
 
Harry,

this seem so be a non trivial problem. There are several packages out there that try to do this. Especially for highly complex geometry cutting step is extremly difficult and generating good cell quality is a challange.

I need some more information: What does you geometry look like? Is it very complex? Do you need to access the mesh generated in Step 2 (Inside cells, not boundary fitted)? Is your initial surface closed and manifold? How good is th emesh quality of your inital surface mesh? (criterions like triquality or equiangle skewness may be helpful)

BastiL

rt January 12, 2008 08:34

Re: How can generate Uniform Cartesian grid?
 
i do some job in this regard, related paper is:

http://www3.interscience.wiley.com/c...TRY=1&SRETRY=0

this paper describe fairly simplems possible method to generate cartesian grid, its implementation is available here:

http://mehr.sharif.ir/~tav/cartgen.htm


rt January 12, 2008 08:40

Re: How can generate Uniform Cartesian grid?
 
correct link to paper is: http://dx.doi.org/10.1002/fld.1685

BastiL January 12, 2008 13:28

Re: How can generate Uniform Cartesian grid?
 
Interesting project. I tried to compile it but I struggle with gfortran. Which compiler is best?

These structured octree methods face lots of challenges. All codes have their certain pros and cons so it might be helpful to know how Harrys requirements are. I know most of the tools and can give him some feedback afterwards.

rt January 12, 2008 14:39

Re: How can generate Uniform Cartesian grid?
 
> Interesting project. I tried to compile it but I struggle with gfortran. Which compiler is best?

i think that it will be possible to compile it under any f90 compiler (i have tried DF), maybe you sholud separate module part from other parts and then compile its.

> These structured octree methods face lots of challenges.

i do not understand what you mean, but i could say that, generation of "Cartesian Octree" is fairly robust and simple procedure and there is not any challenge in this regard.

but note that: you sholud have a healthy CAD geometry, without gap, ..., fortunately there are several methods to repaire CAD files !


BastiL January 12, 2008 16:40

Re: How can generate Uniform Cartesian grid?
 
Thanks, how do I seperate modules? I will lool for the error messages - it has something to do with boolean operators as far as I remember.

The challenges: Generating a healty CAD is one of these. I do not really know good ways to repair really compelex CAD data so far.... So this sould be possible to handle as very few meshers can. What CAD repair do you propose? Another one is boundary adaption. I have seen very few (commercial) tools that are able to produce sufficiant quality for really complex geometries. Some companies do not even try to programm such a tool... Cartesian octree itself is robust no doubt.

TITAN Algorithms January 12, 2008 18:02

Re: How can generate Uniform Cartesian grid?
 
Harry,

What kind of geometry do you have? I would like to take a try at it with Hyperion-Mesh3D. Mesh3D generates a structured Hexahedral mesh from generic input geometries. I would be happy to issue a free license for your evaluation. Also, if anyone else is interested, please contact me.

www.titanalgorithms.com/hyperion_mesh3d

Best Regards

DSS

Harry January 12, 2008 18:36

Re: How can generate Uniform Cartesian grid?
 
impressive work! This is the part that I wanted. I calculate dense gas-solid flows. Hopefully, uniform Cartesian grid is just used to calculate solid concentration which requires to be mapped to CFD grid later. CFD grid generated by some commercial grid generators such as Gambit and ICEM/CFD is composed of arbitrary-shape cells. I can extract surface grid and triangulate it for the generation of uniform Cartesian grid. So my case may not be as hard as what BastiL is considering although I do be looking for a generalized-purpose method. However, in my work I need calculate solid concentration/porosity by dividing the volume of particles with the volume of cell where the particles are residing. This means that cell size needs to be big enough to obtain solid concentration having physical meanings, and it is necessary to obtain the exact volumes of the boundary cells which are partially located inside the domain of interest. I have quickly looked through rt's paper, it seems these volumes are not available in his method. Therefore I would appreciate your further suggestion.

Cheers, Harry

BastiL January 13, 2008 11:15

Re: How can generate Uniform Cartesian grid?
 
rt, this is what I get with gfortran (mere than once):

... IF(FLG_OCTREE) CALL MAKE_REMAINED_LEVELS

1

Error: ELSE IF clause at (1) requires a scalar LOGICAL expression ...

However your project looks interestign. Can you tell me more: What input and output file formats, is boundary fitting of octree mesh to geometry done and if yes, how? Thanks.

BastiL

rt January 15, 2008 08:33

Re: How can generate Uniform Cartesian grid?
 
> However, in my work I need calculate solid concentration/porosity by dividing the volume of particles

this is separated task from grid generator, you only need to determine number/type (include their volume) of particles in each cartesion cell which is easy for a uniform cartesian mesh.

> and it is necessary to obtain the exact volumes of the boundary cells which are partially located inside the domain of interest

my method compute approximate partial volume with more than 2nd order accuracy (you could increase its), i disscuss in paper about its. When we use approximate method (FDM, FVM, ...) why you try to use exact geometry! note that accuracy of suggested approximate method could be easily controlled and i think for a corse grid an geometry with approximately smooth boundary, it could be matched with computer floating point resolution.

but if you look for exact one (which is not essential in my opinion) you should implement method like M. Aftosmis method (AIAA98) which is fairly difficult to implement and needs state-of-the-art background in computational gometry


rt January 15, 2008 08:43

Re: How can generate Uniform Cartesian grid?
 
regarding to error under gfortran let me time to check its, now i am busy but i post my comment in this regard as soon as possible (but i think it will be very easy to resolve, basically compile of Fortran code is not challenge).

redarding to CAD repaire:

I list a few one in CartGen paper (get your email, i will send paper if u do not have access) some of them are open-source , e.g. http://graphics.stanford.edu/software/volfill/ is one of the old methods, for some of them binary package are available. Usually a surface triangulation, e.g. STL is required, but cargen is work of 05-06 and now there are more methods and more tools for this (if you realy look for a cad fixing tool send me an off-line email)

some new methods get only point cloud and generate healthy triangulation over it, basically no-one claim for robust method to repair dirty geometries (read related papers to figure out what is challenge in this field), but results are usually satisfactory.

a good resource in this field is ACM: http://portal.acm.org/ (ACM SIGRAGH and ACM TOG is one of the best) search in this bank by suitable keyword, if you do not have direct acces to paper do not worry in the computer science field peoples usually put their work on web and with google you usually could get them.

Also, you could use some from refs. of cartgen paper in this field, and then follow their citation by google scholar to know what is new works and stat-of-the-art

CADFIX is a commercial package for this too, also i heard from my friends that Solid-Work could repair "dirty" STL files

> I have seen very few (commercial) tools that are able to produce sufficient quality for really complex geometries

probably you mean body-fitted grid not cartesian-octree, i should say that i only know one semi-commercial cartesain octree solver (available only for US), Cart3D due to M. Aftosmis. Writing an immersed boundary octree flow solver is an order of magnitude difficult in contrast to body-fitted solver (if we try to preserve efficiency).

to my knowledge adaptation available in commercial grid generators are not fully automatic and generation of a suitable method needs large human efforts and is really art. (automation is one of main benefits of Cartesian solver)


rt January 15, 2008 08:45

Re: How can generate Uniform Cartesian grid?
 
regarding to compile error, i feedback in near future, i am quit busy right now.

> However your project looks interestign. Can you tell me more: What input and output file formats, is boundary fitting of octree mesh to geometry done and if yes, how?

please look at the paper, method is quit clear and easy, you got all of your question are answered un its (get your email, i could forward its)

input geometry is surface triangulation, e.g. STL

you could write output based on your need, only for show i put Tecplot and binary VTK (paraveiw read its)

rt January 15, 2008 08:45

Re: How can generate Uniform Cartesian grid?
 
regarding to compile error, i feedback in near future, i am quit busy right now.

> However your project looks interestign. Can you tell me more: What input and output file formats, is boundary fitting of octree mesh to geometry done and if yes, how?

please look at the paper, method is quit clear and easy, you got all of your question are answered un its (get your email, i could forward it to u)

input geometry is surface triangulation, e.g. STL

you could write output based on your need, only for show i put Tecplot and binary VTK (paraveiw read its)

BastiL January 15, 2008 09:31

Re: How can generate Uniform Cartesian grid?
 
Thanks so far rt. I have no access to the paper and CAD repair is of interest for me, I have stl-Files. My E-Mail:

BastiL2001@yahoo.de

You're right I mean body fitted meshing.

marco January 15, 2008 17:33

Re: How can generate Uniform Cartesian grid?
 
Could you send me too a copy of your paper ? I try to use CartGen compiling it with gfortran: I solve some problems in order to compile it, and at the end I've been able to compile it and process your example files. But I've a working file only for tecplot format; for VTK format, changing some part of the OPEN instruction in the subroutine in order to compile with gfortran, I was not be able to read the binary file with Paraview 3.2: do you have some suggestions ? Thanks Marco

Gonski January 15, 2008 17:53

Re: How can generate Uniform Cartesian grid?
 
"my method compute approximate partial volume with more than 2nd order accuracy (you could increase its), i disscuss in paper about its."

Great! this is exactly what I want.

"When we use approximate method (FDM, FVM, ...) why you try to use exact geometry!"

In my case, Cartesian grid is only used to evaluate solid concentration.

Now it seems all my problems have got being solved. Thanks for your kindly help.

Cheers,

Harry

rt January 16, 2008 00:43

Re: How can generate Uniform Cartesian grid?
 
Harry,

so what u need is a (high resolution) uniform cartesian grid (not octree), then u could extract partial volume, etc. information easily from its based on method disscussed in the paper. My code has a simple version for generation of uniform grid too, which is more easy to use and understand, give your mail ID i forward its to you.

rt January 16, 2008 00:49

Re: How can generate Uniform Cartesian grid?
 
> Could you send me too a copy of your paper ?

give ur mail ID

please let me know what u do to compile its under gfortran.

note that the output is only for showing the results, to use grid you should write your own output.

basically, i try to introduce an easy to implement cart grid generator (for uniform one it takes belw 2 days for me from scratch and i think for a people that read paper it take more little time), so code is not designed for end user and is not well documented with suitable output port, and is just to show programming and ease of implementation, i.e., converting 3d grid generation over complex geometry to sequense of 2d grid generation and in the same manner converting 2d to sequence of 1d grid generation


Harry January 16, 2008 02:51

Re: How can generate Uniform Cartesian grid?
 
"so what u need is a (high resolution) uniform cartesian grid (not octree), then u could extract partial volume, etc. information easily from its based on method disscussed in the paper. My code has a simple version for generation of uniform grid too, which is more easy to use and understand, give your mail ID i forward its to you."

This would greatly help. My email is s.b.kuang@gmail.com

Harry January 16, 2008 04:49

Re: How can generate Uniform Cartesian grid?
 
Rt, Have you sent me your simple-version code? I guess you miss ed my last message. My email address is s.b.kuang@gmail.com. Thanks for your help. Cheers, Harry

BastiL January 17, 2008 03:50

Re: How can generate Uniform Cartesian grid?
 
I am also interested in the changes done for compiling the code with gfortran. I am struggeling with that.

marco January 17, 2008 17:40

Re: How can generate Uniform Cartesian grid?
 
For these errors:

1)

IF(FLG_OCTREE) CALL MAKE_REMAINED_LEVELS

1 Error: ELSE IF clause at (1) requires a scalar LOGICAL expression In file CartGen.f90:139 you have to add ".EQ.1" to the if condition, that should be as IF(TRUE) ....

2) DO WHILE(FLG)

1 Error: Exit condition of DO WHILE loop at (1) must be a scalar LOGICAL expression In file CartGen.f90:1298

for this the same as before.

3) delete line 129 and 141 for TIMEF()

4) opening STL file change ACCESS and FORM:

!OPEN(UNIT=1,FILE=FNAME(IFF),ACCESS='DIRECT',FORM= 'BINARY',RECL=2) OPEN(UNIT=1,FILE=FNAME(IFF),ACCESS='STREAM',FORM=' UNFORMATTED',RECL=2)

5) the same for this line:

OPEN(UNIT=1,FILE=FNAME(IFF),ACCESS='STREAM',FORM=' UNFORMATTED',RECL=2) !OPEN(UNIT=1,FILE=FNAME(IFF),ACCESS='DIRECT',FORM= 'BINARY',RECL=2)

6) change line 1707 and 1855 :

!open(unit=ivtk,file=VTKFILE,form='binary',convert ='BIG_ENDIAN') OPEN(unit=ivtk,file=VTKFILE,ACCESS='STREAM',FORM=' UNFORMATTED')

but when I generate the binary VTK file I'm not be able to read it with paraview. I don't know if this is due to this last modification. Reading gfortran documentation CONVERT should be available, but only deleting it I compile the code.

My e-mail is: iota2@libero.it



All times are GMT -4. The time now is 06:10.