CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Modelling with many circles in a rectangle

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2007, 11:30
Default Zhou Bin, blockMesh is suit
  #1
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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:


Image of surface mesh:


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 is offline   Reply With Quote

Old   October 5, 2007, 11:32
Default Zhou Bin, blockMesh is suit
  #2
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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:


Image of surface mesh:


Image of how you construct the mesh:


The Blender file:
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 is offline   Reply With Quote

Old   October 5, 2007, 11:38
Default Zhou Bin, blockMesh is suit
  #3
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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:


Image of surface mesh:


Image of how you construct the mesh:


The Blender file:
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 is offline   Reply With Quote

Old   October 10, 2007, 13:45
Default Dear Doug, Really thank you f
  #4
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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 is offline   Reply With Quote

Old   October 13, 2007, 04:44
Default Dear Doug, I have learned Ble
  #5
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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)
zhoubinwx is offline   Reply With Quote

Old   October 13, 2007, 15:11
Default Zhou Bin, I'd take the foll
  #6
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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



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).



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.



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.



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.



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.



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.



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



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.



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.



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.



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.



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.



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.



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
gdbaldw is offline   Reply With Quote

Old   October 15, 2007, 04:03
Default Dear Doug, Really thank you f
  #7
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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?
zhoubinwx is offline   Reply With Quote

Old   October 15, 2007, 11:34
Default Zouh Bin, Blender has a Pyt
  #8
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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 is offline   Reply With Quote

Old   October 25, 2007, 10:40
Default Zhou Bin, Very nicely done.
  #9
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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 is offline   Reply With Quote

Old   October 25, 2007, 23:01
Default Zhou Bin, Better answer is
  #10
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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
gdbaldw is offline   Reply With Quote

Old   October 26, 2007, 11:11
Default Dear Doug, I have tried your
  #11
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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
zhoubinwx is offline   Reply With Quote

Old   October 28, 2007, 09:46
Default Zhou Bin, Your question now
  #12
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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
gdbaldw is offline   Reply With Quote

Old   October 30, 2007, 04:17
Default Dear Doug, Now I'd like to ou
  #13
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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 is offline   Reply With Quote

Old   October 30, 2007, 04:26
Default Well, dear Mr. Doug, do you ha
  #14
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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
zhoubinwx is offline   Reply With Quote

Old   October 30, 2007, 08:25
Default Zhou Bin, You need to attac
  #15
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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
gdbaldw is offline   Reply With Quote

Old   October 30, 2007, 10:13
Default Dear Doug, Thank you for your
  #16
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
Dear Doug,
Thank you for your post. Now let me try to upload the files, please check.
The Blender file is: holes.rar and the txt file is: holes.txt
Zhou Bin
zhoubinwx is offline   Reply With Quote

Old   October 30, 2007, 10:14
Default Dear Doug, It works for me to
  #17
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
Dear Doug,
It works for me to upload files,very interesting, thank you.
Best regards,
Zhou Bin
zhoubinwx is offline   Reply With Quote

Old   October 30, 2007, 11:16
Default Zhou Bin, The file opens an
  #18
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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
gdbaldw is offline   Reply With Quote

Old   October 30, 2007, 12:35
Default Dear Doug, Your suggestion se
  #19
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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
zhoubinwx is offline   Reply With Quote

Old   October 30, 2007, 13:10
Default Zhou Bin, Calculix only sen
  #20
Member
 
Doug Baldwin
Join Date: Mar 2009
Posts: 53
Rep Power: 17
gdbaldw is on a distinguished road
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
gdbaldw is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slip boundary around circles zhoubinwx OpenFOAM Running, Solving & CFD 50 March 2, 2013 07:59
Splitting rectangle? pukiwawa FLUENT 0 September 6, 2008 12:59
Circle of circles Andore Main CFD Forum 1 February 8, 2008 15:45
how to use symetry in my rectangle geometry? harry FLUENT 8 November 2, 2006 10:57
how to use symetry in my rectangle geometry harry FLUENT 0 October 30, 2006 14:11


All times are GMT -4. The time now is 18:15.