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

[swiftBlock/swiftSnap] SwiftSnap and SwiftBlock, GUIs for OpenFOAM's meshers

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree70Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2012, 15:58
Default
  #41
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Cool, 2.64 is out. I did not know. Let's give it a try. If the script gives errors, there might been changes in the API, normally rather easy to fix. I'll get back here if I find problems with 2.64.


2.62 works fairly OK. Only problem is that the shortest path algorithm there do not find the most short path. For simple objects I guess it works OK, though... but as precompiled versions are available, it should not be any problems installing latest versions.

K
kalle is offline   Reply With Quote

Old   October 11, 2012, 05:37
Default
  #42
Senior Member
 
sivakumar selvaraju
Join Date: Mar 2009
Location: India
Posts: 205
Rep Power: 18
sivakumar is on a distinguished road
Send a message via Skype™ to sivakumar
Hi Kalle,
I have installed blender 2.64, I am trying to follow the procedure in the wiki link.
I am not able to follow. In the very beginning step itself I am struggling.

can you please tell me, that the swiftBlock and swiftSnap compatible with Blender 2.64?
If you dont mind can you please give me some tutorial document.

thanks and Regards,
Sivakumar
sivakumar is offline   Reply With Quote

Old   October 11, 2012, 14:21
Default
  #43
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi,

I've used SwiftBlock without problems (so far) in 2.64. SwiftSnap, I did not try yet, so there might be problems. I should work with 2.62, though. As 2.64 now is out I will update both (if needed) to assure they work, as soon as I find time.

I have no tutorial to provide; all info available is in this thread and on the wiki. I've been thinking that I should maybe do a video and post on youtube. It is really quite easy to use the code if you are experienced with Blender and have understood the concept of block structured meshes. These two obstacles are unfortunately not insignificant though =\. Took me weeks before I could just zoom properly in Blender! (shift+middle mouse button). However, info on how o use Blender is available in large amounts on the web, and there I cannot make any useful contribution.

I would however like to encourage anyone to learn Blender, not only for meshing. It's a great software.

If you have trouble getting started, please let us know which step is troublesome, and I am confident we can solve it here. Probably a dozen other people have the same issue!

Regards,
Kalle

Last edited by kalle; October 14, 2012 at 12:44.
kalle is offline   Reply With Quote

Old   October 11, 2012, 15:40
Default
  #44
Senior Member
 
sivakumar selvaraju
Join Date: Mar 2009
Location: India
Posts: 205
Rep Power: 18
sivakumar is on a distinguished road
Send a message via Skype™ to sivakumar
Hello kalle,
Thank you very much for the positive reply, I will degrade my blender software in to 2.62. Then I will try to use blender.

if you upload any video regarding this please dont forget to sent the information.

my email id is: sivakumar81.s@gmail.com


thanks and regards,
Sivakumar
sivakumar is offline   Reply With Quote

Old   October 12, 2012, 02:11
Default
  #45
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Dear Sivakumar,

Before going back to 2.62, you can give 2.64+swiftsnap a try. Open the __init__.py file and search for "2.63" and edit the lines according to the instructions in the comment. There is a good chance the code will work in 2.64 then. SwiftBlock seems to run fine in 2.64.

Regards,
K
kalle is offline   Reply With Quote

Old   October 12, 2012, 16:05
Default
  #46
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
I've just pushed an updated version of swiftSnap compatible with Blender 2.64. There were issues with feature detection and some other small annoying things due to changes in Blender's API. Now the script will remember save out location and settings too. I'd guess this is compatible with 2.63, but I have not tested.

Kalle
wyldckat likes this.
kalle is offline   Reply With Quote

Old   October 21, 2012, 15:04
Default
  #47
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi folks,

I just pushed an update of SwiftBlock. A lot of small changes to grease the machinery were done. The user will see following changes:

  • Preview mesh and write outputs number of cells in mesh to Info Window in Blender
  • To create a curved edge for a block, you can snap to either vertices or edges of the polyLine object. (before you had to snap to vertices). This also required an ability to tell an edge not to be curved, but straight. Two new buttons control this. This is used in the updated structural part example.
  • You can inspect and change settings for individual edges by selecting and pressing "Edge settings"
  • You can give names to blocks (for creating cellZones/Sets) by assigning all the block's vertices to a Blender Vertex Group. The name of the group will be used. If the name "disabled" is used, SwiftBlock will not include that block in structure. This is useful for meshing, for instance, annular pipes. The structural part example was updated to illustrate this feature.
Please let me know if there are issues using the new version.

Regards,
Kalle
elvis, wyldckat and caduqued like this.
kalle is offline   Reply With Quote

Old   November 7, 2012, 08:48
Default
  #48
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi again,

I made a minor edit to SwiftBlock; now the preview mesh consists of faces rather than just edges. Now it is a lot easier to see how the mesh actually looks like. Use the Z-key to switch from viewing edges or faces. Which of these two states the preview mesh ends up in depends on your current setting in Blender.

When viewing faces, the mesh looks much like when you view the mesh in paraview; except that here you can also see internal faces of the mesh on block faces.

As usual; let me know if there are problems.

Regards,
Kalle
Attached Images
File Type: jpg preview mesh.jpg (53.2 KB, 164 views)
wyldckat likes this.
kalle is offline   Reply With Quote

Old   November 8, 2012, 11:57
Default
  #49
Member
 
Join Date: May 2012
Posts: 55
Rep Power: 14
styleworker is on a distinguished road
Really great job! Could you please upload the blend file for the cylinder example?
styleworker is offline   Reply With Quote

Old   November 8, 2012, 14:29
Default
  #50
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi,

You mean from the figure on the wiki? That is just a figure, but since you asked I have thrown together a similar case. I don't think I made it 100% circular, so only use it as an example!

Kalle
Attached Files
File Type: zip cylinder.blend.zip (70.7 KB, 44 views)
kalle is offline   Reply With Quote

Old   December 4, 2012, 16:31
Default
  #51
qzt
New Member
 
Join Date: Aug 2012
Posts: 10
Rep Power: 13
qzt is on a distinguished road
Hello,

I struggled to get the swiftBlock work on my geometry. The sample file (cylinder) worked without problem. However, when I tried to mesh my geometry using swiftBlock, it always meshed the interior void spaces instead of the fluid channel I want to mesh. Did I missed something regarding to the inside/outside of the meshing structure ?
Attached is my blender file.

Thanks in advance for your help.
Attached Files
File Type: zip swiftblock_test.blend.zip (80.8 KB, 13 views)
qzt is offline   Reply With Quote

Old   December 5, 2012, 02:23
Default
  #52
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi,

I see. Your blender object "DXFmesh" does not contain the block structure. You should create your block structure in a separate blender object, and then use "DXFmesh" to provide polyLines for your block's edges. I started in one corner for you, but you have to completely fill your computational domain with blocks. The block structure is in the object "Cube". I guess you can get a pretty good block mesh here, but it takes some thinking on how to place the blocks.

K
Attached Files
File Type: zip swiftblock_test.zip (81.0 KB, 13 views)
kalle is offline   Reply With Quote

Old   December 5, 2012, 06:24
Default
  #53
qzt
New Member
 
Join Date: Aug 2012
Posts: 10
Rep Power: 13
qzt is on a distinguished road
Hi Kalle,
Thanks for the quick reply.
I have to admit that I am pretty novice in blender. According to what you suggested, I tried to put cubes inside my structure (dxfmesh) but the whole process is very inefficient. First, I couldn't manage to use vertices in the dxfmesh object to build new meshes in the cube object. I think I must missed some basic techniques here. Second, even with the possibility to select vertices in dxfmesh object and build new cubes from them in the cube object, it is still not an automated way to build mesh as I expected..... Is that the limitation for this swiftBlock method ?

Cheers,
qzt is offline   Reply With Quote

Old   December 5, 2012, 13:23
Default
  #54
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi,

You are right, this is no tool for automatically constructing block structures. You still have to provide that "intellectual" part of the work yourself. The efficiency is largely dependent on how comfortable the user is with blender. It has its fairly steep learning curve, but there is also a lot of help availble online, for instance on youtube. I myself use extruding a lot, but there are as many habits as there are users, I'd guess.

For a 2D structure like this, I would create 2D block structure and then extrude it.

Kalle
kalle is offline   Reply With Quote

Old   December 7, 2012, 10:18
Default
  #55
qzt
New Member
 
Join Date: Aug 2012
Posts: 10
Rep Power: 13
qzt is on a distinguished road
I finally turned to your swiftSnap instead of swiftBlock. It is true that in terms of meshing efficiency, my structure could be meshed much faster via using blockMesh. But using snappyHexMesh via swiftSnap requires less user interventions.

Thanks again for your help and such great addons.

p.s. The set locationinMesh function sometimes didn't update the 3d cursor position, see the attached file for example.
Attached Files
File Type: zip 3dcursor_.blend.zip (85.5 KB, 9 views)
qzt is offline   Reply With Quote

Old   December 7, 2012, 15:58
Default
  #56
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
You are welcome!

I think the addons are fairly self explaning for people who are familiar with how to set up snappyhexmesh and blockmesh by hand, i.e. writing all the entries in the dict in an editor. For people new to the meshers, some buttons and settings can be rather cryptic. The "Set locationInMesh" is one such button. When pressing it, the SwiftSnap internal vector variable "locinmesh" is set by copying the current value of the position of the blender 3D cursor. Later, when the snappyHexMeshDict is written, the value in "locinmesh" is used for the entry "locationInMesh". Hence this provides a way for the user to control which volume SHM should mesh in the current geometry. I use the 3D cursor, because it is the easiest way for a Blender user to communicate a space position to a blender script. Hence: the button is not supposed to update the position of the 3D cursor, it is the other way around, the cursor should update the internal variable. However, there is currently no feedback to the user that anything happened when the button was pressed... maybe I should add a popup window saying something like: "The locationInMesh was now set to (x, y, z), and the volume containing this point will be meshed" [OK]?

Please let me know if I misunderstood your comment.

Kalle
kalle is offline   Reply With Quote

Old   December 7, 2012, 17:28
Default
  #57
qzt
New Member
 
Join Date: Aug 2012
Posts: 10
Rep Power: 13
qzt is on a distinguished road
Yes, having a message telling what are the actual coordinates set would be helpful. But the problem is that sometimes it just failed to take the current 3D cursor position when I press "set locationinMesh" and write the file.

I tried to use the python console and use "bpy.context.scene.cursor_location" to get the cursor location but it also failed to get the current position (wherever I moved the cursor, it always returned the same value). It seems to me it is related to the swiftSnap plugin, since there was no problem if I just open a fresh blender file.
Maybe you can have a look at the attached file in my previous post. The cursor position won't update anymore in that file.
qzt is offline   Reply With Quote

Old   December 8, 2012, 04:39
Default
  #58
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi,

Thanks for the detailed description. You are right, the bpy.context.scene.cursor_location is fixed in your blend file. Strange. I am not able to repeat it for a fresh SwiftSnap-enabled case. I have implemented a feedback to the user about updates in location in mesh (and pushed it to github). Further I now use bpy.context.scene.cursor_location.copy() to access the location. Before I did not use the copy() method. It is possible that the object's locinmesh variable was a reference, instead of an independent variable... but as I said, I was not able to repeat the behaviour in a fresh case... Let me know if you can find a way to cause the problem!

Kalle
kalle is offline   Reply With Quote

Old   December 17, 2012, 09:36
Default Visualization/selection of features for polylines
  #59
New Member
 
RDG
Join Date: Feb 2011
Posts: 29
Rep Power: 15
onyir is on a distinguished road
Hi.

I've been playing a little bit with swiftblock and it seems an interesting tool.

Is there anyway to visualized / specify which edges of your local mesh it takes to create the polylines?

I've been trying to create a C-grid for a wing, but its taking polylines that blend into themselves, resulting in illegal cells.

Thanks.

Ricardo.
onyir is offline   Reply With Quote

Old   December 17, 2012, 11:41
Default
  #60
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
You can unfortunately not specify that directly like you can in commercial block meshers. What you have to consider is that SwiftBlock will use the shortest path in the geometry object. If you use the magnetic tool in "snap to vertex"-mode you can see this for yourself in Blender by selecting the two vertices you have snapped to and, in Edit Mode, use the Select->Vertex Path. The path taken will then be selected.

If you instead use the magnetic tool in "snap to edge"-mode, SwiftBlock will create a temporary copy of your geometry object. In that object, vertices will be inserted at snapped edges, and then the "vertex path" function in Blender will be used. That object is later deleted. The only way to find out which path is taken is then to use the preview function (I guess you already do this, though).

If you have an edge that you want to be straight, even though it's both vertices are snapped, you can explicitly tell it not to have a polyLine under the "Edge settings" button.

Kalle
kalle is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



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