CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Modelling with many circles in a rectangle (http://www.cfd-online.com/Forums/openfoam-pre-processing/62101-modelling-many-circles-rectangle.html)

gdbaldw October 5, 2007 10:30

Zhou Bin, blockMesh is suit
 
Zhou Bin,

blockMesh is suitable for simple geometries, which yours is not. However, in about an hour I drafted an example of your mesh using Blender and Calculix. Example images and file are attached. I did this simply to see if my technique works for your kind of geometry, which it does. See the following URL for an overview of the technique:

Outline of method

Example Surface:
http://www.cfd-online.com/OpenFOAM_D...your_image.gif

Image of surface mesh:
http://www.cfd-online.com/OpenFOAM_D...your_image.gif

The Blender file:


I would expect you'd need a few days to learn Blender and a day for Calculix, but this would be more rewarding and likely faster than trying to use blockMesh.

Good Luck,
Doug

gdbaldw October 5, 2007 10:32

Zhou Bin, blockMesh is suit
 
Zhou Bin,

blockMesh is suitable for simple geometries, which yours is not. However, in about an hour I drafted an example of your mesh using Blender and Calculix. Example images and file are attached. I did this simply to see if my technique works for your kind of geometry, which it does. See the following URL for an overview of the technique:

Outline of method

Example Surface:
http://www.cfd-online.com/OpenFOAM_D...ges/1/5588.jpg

Image of surface mesh:
http://www.cfd-online.com/OpenFOAM_D...ges/1/5589.jpg

Image of how you construct the mesh:
http://www.cfd-online.com/OpenFOAM_D...ges/1/5590.jpg

The Blender file:
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif barWithHoles.blender.tar.gz

I would expect you'd need a few days to learn Blender and a day for Calculix, but this would be more rewarding and likely faster than trying to use blockMesh.

Good Luck,
Doug

gdbaldw October 5, 2007 10:38

Zhou Bin, blockMesh is suit
 
Zhou Bin,

blockMesh is suitable for simple geometries, which yours is not. However, in about an hour I drafted an example of your mesh using Blender and Calculix. Example images and file are attached. I did this simply to see if my technique works for your kind of geometry, which it does. See the following URL for an overview of the technique:

Outline of method

Example Surface:
http://www.cfd-online.com/OpenFOAM_D...ges/1/5593.jpg

Image of surface mesh:
http://www.cfd-online.com/OpenFOAM_D...ges/1/5594.jpg

Image of how you construct the mesh:
http://www.cfd-online.com/OpenFOAM_D...ges/1/5595.jpg

The Blender file:
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif barWithHoles.blender.tar.gz

I would expect you'd need a few days to learn Blender and a day for Calculix, but this would be more rewarding and likely faster than trying to use blockMesh.

Good Luck,
Doug

zhoubinwx October 10, 2007 12:45

Dear Doug, Really thank you f
 
Dear Doug,
Really thank you for your seggestions, because my geometry is really complex and I think I may have difficulty in meshing. Now you help me a lot, and I'd like to see if we can mesh using Blender and Caululix.
Best regards
Zhou Bin
From Politecnico di Torino

zhoubinwx October 13, 2007 03:44

Dear Doug, I have learned Ble
 
Dear Doug,
I have learned Blender for several days, and it is really powerful, thank you for introducing it to me. Now as far as I know, we first create a basic geometry and then to edit the object.
In the above method you tell me, I should use the Blender function "subsurf", and use only squares for the surface. But at first there's no objects yet, I could not choose "subsurf".
Since I do not know how to create a rectangular with about 100 circles in Blender first. I only have these data (coordinates and diameters), could you explain it to me? If possible, could we talk in MSN? Thank you.
Sincerely,
Zhou Bin
(MSN:zhoubinwx"hotmail.com)

gdbaldw October 13, 2007 14:11

Zhou Bin, I'd take the foll
 
Zhou Bin,

I'd take the following steps...

1) Create a square centered at (0,0,0) with sides of dimension = 1. (Press "N" to see Transform Properties). We will use this square as a template

http://www.cfd-online.com/OpenFOAM_D...ges/1/5666.jpg

2) For each circle, copy this object (shift-D); scale by diameter ("S", then type in the number); and move it to the proper location by typing its coordinates into Transform Properties. Below you will see your first circle as the active object, and the template at (0,0,0).

http://www.cfd-online.com/OpenFOAM_D...ges/1/5667.jpg

3) After repeating (2) above for each circle, you can delete your template. Now, select all the objects and join them (control-J). I've accomplished this for our first three circles as shown below in Edit Mode. You will need to press the Tab-key to enter Edit Mode.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5668.jpg

4) You'll need to delete all the faces while keeping the points and lines. To do this, select all points as is shown in the above image, then press "X" and delete "Only Faces". Now, you need to fill in all of the surfaces on your rectangle. For the example here with only three of your holes it is rather easy. As you add more circles of various dimensions you will need to use judgment to achieve the mesh density you desire. So, I'd select the lower vertices on the three squares, press "E" and select "Only Edges" to extrude the lower edges as shown below.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5669.jpg

5. The above image shows that the cursor is located at (0,0,0). Also, in the bottom of this image you will see the words "Edit Mode". Two spaces to the right of these words you will see that the 3D-Cursor is selected as the Pivot. From here, you can scale the selected vertices down to the Cursor by pressing "S" for scale, then "Y" for scaling parallel to the y-axis, then the number "0" to scale down to Cursor.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5670.jpg

6. Next, I've done the same extrusion in the y-direction. Notice that I've closed the Transform Properties box since we really don't need it at this time.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5671.jpg

7. Now, fill in the faces between the holes by selecting each group of four verticies anf pressing "F". One of the faces is shown below.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5672.jpg

8. After adding all the faces we have the following shape.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5673.jpg

9. Now extrude the upper edges to y=75 for the top of your bar. By now, you will have the technique from (1) through (8) above.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5674.jpg

10. Then extrude the right side to x=430. At this point you have the bar shown below with three tiny holes. The lower panel of the image below is the Buttons Window. By pressing function key "F-9" you will be in editing options mode for the selected object. The selected object is your pink highlighted rectangle in the upper panel. To the far right of this editing options panel you will see the Modifiers tab. Click "Add Modifiers" to then select "Subsurf" from the list. You can increase your surface mesh density by changing "Levels:" which by default is set to 1. For now, we'll keep this default value. Don't be concerned about "Render Levels"; this is only used when you want to make a nice rendering of your object.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5675.jpg

11. By zooming into a view of the three holes and pressing "Z", you will see a wireframe of your mesh beginning to take shape.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5676.jpg

12. A nice feature of subsurf is that by default all the sharp edges of your object become beveled. This default feature has converted the square holes into circles. But sometimes, you'd like the edges to remain in place, like the edges of your rectangle. We need to select the edges of the rectangle and crease them. You'll see in the lower part of the next image, to the far right of the words "Edit Mode", a depressed button that looks like a slash "/". In this selection mode, only edges can be selected. I've selected all the edges on the perimeter of the rectangle (highlighted in yellow below). Then, by pressing "shift-E" followed by the number "1", these edges are creased.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5677.jpg

13. We're nearly done. Tabbing back into object mode we now have the coarse wireframe image. You may have noticed that the far right hole has a pink dot at its center. That dot was the origin of that square back in step (2). When we joined the objects in step (3) above, this became the origin of the joined object. We need to move the object origin to (0,0,0). In edit mode, select only the vertex at (0,0,0), press "shift-S", and then select "Cursor->Selection". This will snap the cursor to the selected vertex. Now, in the lower panel of the image below, we have Edit Options with several tabs. Under the "Mesh" tab you will see the "Center Cursor" button. Press this button, and the object origin will move to the cursor location. This step is much easier than it sounds.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5678.jpg

14. Increase subsurf levels, say to 3, and you will have a more refined surface grid as is shown below. If you need more control of the grid in the neighborhood of each hole, you can extrude a square around each object of (2) above before you perform the join of step (3). I gave an example of a this kind of surface with grid control-points around each hole in my original post to this thread.

http://www.cfd-online.com/OpenFOAM_D...ges/1/5679.jpg

Beyond this, there are many excellent tutorials for Blender available on the internet. Just search "Blender tutorial", or go to the blender.org website.

Enjoy,

Doug

zhoubinwx October 15, 2007 03:03

Dear Doug, Really thank you f
 
Dear Doug,
Really thank you for your detail steps, we are trying now, since we'll have many models of this kind, in your step 2, we repeat to input the circles information, well, as for us, it is labor consuming for many such models. Do you have any good solutions for this problem? By the way, since we could input and scale the circle by hand, could we use code in Blender or not? Because I'm new, I appreciate your great patience to read my problem?

gdbaldw October 15, 2007 10:34

Zouh Bin, Blender has a Pyt
 
Zouh Bin,

Blender has a Python API, useful for data import/export. At "Outline of Method" in my original post to this thread is a Python Script for exporting to Calculix FBD format. You could perhaps develop a similar script to import your data. Blender includes many data import/export scripts which you may want to study.

Doug

gdbaldw October 25, 2007 09:40

Zhou Bin, Very nicely done.
 
Zhou Bin,

Very nicely done. I trust you used some simple program to generate the list of points.

After executing the Python script you created, set the subsurf level=2 (See step 10 above) and while in Object Mode press the "Apply" button next to the subsurf levels. This permanently subdivides each circle into sixteen faces with nine interior verticies. Tab-key to Edit Mode, and for each circle select the nine interior verticies, press the X-key to bring up the delete dialogue, then select verticies to delete the selected verticies. You now have sixteen verticies defining the edge of each circle. This is both good and bad news. The good part is that you have finer control of how the mesh is constructed, while the bad part is you have more lines to manually generate. Given the complexity of your object, this may be more good than bad. After you have created all the faces, you can again modify with subsurf (Step 10 above) to refine the surface grid.

To simplify your work, you could seperate from your mesh an object containing only those circles that need refinement, apply the subsurf to those seperate circles, then rejoint your two objects. You'd then have some circles with sixteen points and others with four points. I'm on travel and away from my workstation so am unable to create mini-tutorial for you, but you should be able to find a seperate/join Blender tutorial on the internet.

This approach will work. You could also create your object directly in Calculix using curved lines, but in my opinion the Blender interface is much easier to use and provides much higher functionality.

Doug

gdbaldw October 25, 2007 22:01

Zhou Bin, Better answer is
 
Zhou Bin,

Better answer is as follows. After you create squares using your Python script, select Mid-Point as your Pivot. (Step 5 above shows how to select the Pivot.) Now, you can select the four verticies of any of your squares and rotate about its mid-point by pressing the "R" key. From what I see of your geometry, you should be able to avoid overlaps by simply rotating neighboring squares. If you still have an overlap, you can seperate that one square from the object, apply the subsurf, then join the two objects together again. This way, most all of your circles will be defined by only 4 points, which reduces the number of faces you'll need to manually create in your surface mesh. You may find after working with this you'd like to apply subsurf to your larger circles, and keep all of your smaller circles at just 4 verticies. My guess is that this approach will help keep all of the cells at a similar size.

Doug

zhoubinwx October 26, 2007 10:11

Dear Doug, I have tried your
 
Dear Doug,
I have tried your suggested way, and I find after I run the script, I can only select all the circles, but not one by one, so I can not rotate;
As I say, in my model I need to link a lot of vertex, which is really time-consuming. I have several this kind of models, not only this one. Therefore, would you please give any suggestions about linking vertex automatically?
I'll think about this during your travel. Wish you a happy weekend.
Best regards,
Zhou Bin

gdbaldw October 28, 2007 09:46

Zhou Bin, Your question now
 
Zhou Bin,

Your question now is regarding basic Blender functionality. There are many, many tutorials available on the internet about how to mesh an object in Blender. As for selecting an individual circle, first select the object which of course will highlight the entire object. Then, press the Tab-key which will toggle you between object mode and edit mode. Once you are in edit mode you can select/edit/add/delete/manipulate individual vertices within the object.

As for linking the circles, I've always found in Blender that I prefer to manually build up the surface because I can then control precisely the size and shape of each face of my surface. An automatic method is available for what you want to do. You can create a second object which is your rectangular bar without any holes, then boolean subtract your Circles Object from the Rectangle Object. You may want to apply subsurf to some or all of the circles in your Circles Object before you boolean subtract it from your Rectangle Object.

I would suggest that if these instructions are unclear that you walk though several Blender tutorials and then re-read these instructions. After you are accomplished at object mode, edit mode, subsurf, vertex manipulation, and boolean operations, and you still have questions I would be happy to help further. You have many, many advanced methods in Blender to create and modify your surface mesh, including smoothing functions, converting triangles to squares (or vice versa), removing faces, subdividing faces, etc. , but you first need to teach yourself the basics.

Doug

zhoubinwx October 30, 2007 04:17

Dear Doug, Now I'd like to ou
 
Dear Doug,
Now I'd like to output the geometry, the data file named "holes.txt"containing the coordinates and diameters:
0 0 430 0 430 75 0 75
44.69 60.83 5.93
100.24 55.18 2.53
72.4 26.52 5.6
389.86 31.52 5.87
169.69 25.04 4.63
383.35 7.28 5.87
35.88 36.69 1.59
181.73 49.3 1.21
283.25 11.04 3.1
16.86 1.61 1.46
156.68 64.18 10.29
200.65 22.23 4.76
321.28 38.1 5.51
2.75 23.87 2.9
332.09 53.86 5.26
359.66 48.71 12.22
5.93 17.32 6.32
78.12 72.39 5.12
220.93 65.76 5.76
115.37 36.68 4.7
112.42 61.96 1.17
57.63 51.96 3.61
240.5 4.66 3.03
242.86 63.09 3.07
230.74 16.71 1.4

zhoubinwx October 30, 2007 04:26

Well, dear Mr. Doug, do you ha
 
Well, dear Mr. Doug, do you have any comment on my current situation?
Now I begin to mesh this geometry in Calculix, for my complex geometry, I do not know if it is difficult to mesh.
I'll study hard on Calculix, Thank you.
Best regards,
Zhou Bin

gdbaldw October 30, 2007 08:25

Zhou Bin, You need to attac
 
Zhou Bin,

You need to attach the script so I can open the file with proper formatting. Cut and paste will not run. See "Formatting" under "Documentation" in the left frame of this webpage for instructions on how to attach a file.

I'd like to see the working script. If it produces a surface mesh that you are happy with, you are very nearly done.

Doug

zhoubinwx October 30, 2007 10:13

Dear Doug, Thank you for your
 
Dear Doug,
Thank you for your post. Now let me try to upload the files, please check.
The Blender file is: http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif holes.rar and the txt file is: http://www.cfd-online.com/OpenFOAM_D...s/mime_txt.gif holes.txt
Zhou Bin

zhoubinwx October 30, 2007 10:14

Dear Doug, It works for me to
 
Dear Doug,
It works for me to upload files,very interesting, thank you.
Best regards,
Zhou Bin

gdbaldw October 30, 2007 11:16

Zhou Bin, The file opens an
 
Zhou Bin,

The file opens and I am able to see the surface mesh you have. I would not be satisfied with this mesh because it has lots of very long lines bunched together, and then very large surfaces in other areas. I doubt that any volume mesh extruded from this surface would pass the OpenFOAM checkMesh utility without errors.

Your automated method is very well done but inappropriate I think, sorry. You need to have a clear understanding of what you want your final mesh to look like. The manual method I suggested above with four points per circle is labor intensive, but in a day or two you'd likely have a good mesh. If you were to start with Calculix, you still have the same issue of connecting your circles in a way that generates a useful surface mesh. The Blender interface is very sophisticated and more productive for this kind of task, which is why I use it and then export to Calculix.

Doug

zhoubinwx October 30, 2007 12:35

Dear Doug, Your suggestion se
 
Dear Doug,
Your suggestion seems quite reasonable. My aim is like: http://www.savefile.com/files/1159333
I really thank you for you encouragement. I will go ahead, and by the way, would you please give me any suggestion after you see the attached pictures.
Best regards,
Zhou bin

gdbaldw October 30, 2007 13:10

Zhou Bin, Calculix only sen
 
Zhou Bin,

Calculix only sends hexahedral elements to OpenFOAM. The image has tetrahedral elements. Netgen, an open source tool, might work for you with tetrahedral. I work exclusively with hex which I understand to be preferred for fluid analyses even though tets will sometimes work. If you need a hex mesh at the boundary layer of the circle and then want to fill the open spaces with tets, you can use your python script with Blender/Calculix to create the boundary layer mesh, and then possibly use Netgen to fill in the open space with tets. OpenFOAM has utilities to then merge and stitch two meshes together. I've considered this approach but did not persue because pure hex has worked for me in Blender/Calculex even for rather complex surfaces. If you need automated meshing for many cases, then tets with possibly hex at the boundary layer could be a productive approach. Search this forum for "cylinder" and you will find some nice images of hex at the blundary layer and tets in the open space. As I recall, the forum also has postings on "Netgen" for exporting tets to OpenFOAM.

Doug


All times are GMT -4. The time now is 14:36.