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 multiphaseflow 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 
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 
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 
Re: How can generate Uniform Cartesian grid?
correct link to paper is: http://dx.doi.org/10.1002/fld.1685

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. 
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 ! 
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. 
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 HyperionMesh3D. 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 
Re: How can generate Uniform Cartesian grid?
impressive work! This is the part that I wanted. I calculate dense gassolid 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 arbitraryshape 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 generalizedpurpose 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 
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 
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 stateoftheart background in computational gometry 
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 opensource , 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 0506 and now there are more methods and more tools for this (if you realy look for a cad fixing tool send me an offline email) some new methods get only point cloud and generate healthy triangulation over it, basically noone 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 statoftheart CADFIX is a commercial package for this too, also i heard from my friends that SolidWork 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 bodyfitted grid not cartesianoctree, i should say that i only know one semicommercial 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 bodyfitted 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) 
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) 
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) 
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 stlFiles. My EMail:
BastiL2001@yahoo.de You're right I mean body fitted meshing. 
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

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 
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. 
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 
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 
All times are GMT 4. The time now is 08:31. 