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   March 17, 2014, 06:50
Default
  #141
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi,

sorry for late response. Seems CFD-Online stopped sending me emails when there was something new here. Problems seem solved though. I have not looked at Blender 2.70, but will do soon when I find time. Did anyone try my tools in 2.70?

Kalle
kalle is offline   Reply With Quote

Old   March 19, 2014, 18:05
Default
  #142
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kalle View Post
Hi,

sorry for late response. Seems CFD-Online stopped sending me emails when there was something new here. Problems seem solved though. I have not looked at Blender 2.70, but will do soon when I find time. Did anyone try my tools in 2.70?
Not yet.

BTW: are there any plans for swiftFoamy?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 20, 2014, 02:24
Default
  #143
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Nice name :-) Could be an idea. I do not have any experience with that mesher (yet), so I do not know which dict-entries are valuable to be able to control with Blender. Actually that applies somewhat to sHM too. My work the last few years has not involved too much meshing...
kalle is offline   Reply With Quote

Old   March 20, 2014, 13:38
Default
  #144
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kalle View Post
Nice name :-) Could be an idea. I do not have any experience with that mesher (yet), so I do not know which dict-entries are valuable to be able to control with Blender. Actually that applies somewhat to sHM too. My work the last few years has not involved too much meshing...
I think it shouldn't be too different from swiftSnap: you generate a STL with the selected surface parts and write a skeleton file. No blockMesh required. But for starts a STL written by swiftSnap is fine (the parameter files have to be written by hand)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 17, 2014, 15:53
Default
  #145
New Member
 
Richard
Join Date: Jan 2014
Posts: 5
Rep Power: 12
pirsquared is on a distinguished road
Quote:
Originally Posted by kalle View Post
Hmm.. strange. I have no clue what could be wrong. The Engrid addon is not under the OpenFOAM category, but sorts under "Mesh". You could try to manually edit the __init__.py files. It is easy. Compare with the Engrid addon and see if you can get it to work!

K
Problem solved: novice error in copying html files from git repository and not actual python scripts. Download as zip, sudo copied into Blender addons, successfully used both swiftSnap and swiftBlock to run a pisoFoam case with turbulence. Thanks very, very much! The value of these scripts cannot be overstated.
pirsquared is offline   Reply With Quote

Old   May 20, 2014, 01:16
Default
  #146
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi Richard,

glad you've got them working. Wouldn't have guessed that problem. Good you found out. Thank you for your kind words!

Maybe it should be clearified that you can easily install this way:

cd Your_Blender_dir
cd Your_Blender_version
cd scripts/addons
git clone https://github.com/nogenmyr/swiftBlock.git
git clone https://github.com/nogenmyr/swiftSnap.git

I have never used git on Windows, but I guess there is a similar way as above.

K
kalle is offline   Reply With Quote

Old   May 25, 2014, 15:56
Default
  #147
Member
 
J.-H. Wang
Join Date: Oct 2010
Posts: 72
Rep Power: 15
f0208secretx is on a distinguished road
Hello,

I am trying the SwiftBlock in Blender 2.70. The machine is running Mac OS X 10.9.2. I have followed the wiki page http://openfoamwiki.net/index.php/Sw...ck#cite_note-1 to create a blockMeshDict for the simple cube. It works fine for the simple cube.

However, once I start doing some more complicated geometry, such as a plate with a cylindrical hole drilled at the center (created by the boolean subtraction of a cylinder from a plate, figure: https://dl.dropboxusercontent.com/u/...47.42%20PM.png), I start getting all kinds of problems. There are typically two types I will encounter:


(1) SwiftBlock completely ignores the hole and gives me a mesh for the solid plate. See figure
https://dl.dropboxusercontent.com/u/...47.54%20PM.png

(2) SwiftBlock gives me empty mesh and this error message will show up:
Code:
 Preview mesh is empty. Too few vertices selected, or broken block structure!
. This usually happens if I select "Set edges" and set it to the perimeter of the holes. See figure
https://dl.dropboxusercontent.com/u/...49.40%20PM.png


As this is a canonical example of external flow, I figured people have looked at it or will use this as a starting point to explore the tool. Does anyone have experience on this geometry or the solution to the problems? Thanks



JHW
f0208secretx is offline   Reply With Quote

Old   May 26, 2014, 01:36
Default
  #148
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi!

To mesh a geometry like that you will need to manually create the block structure. The structure you are looking for can be seen in Fig 2.16:

http://www.openfoam.org/archive/2.2..../plateHole.php

Boolean operations gives typically messy mesh objects, which do not contain any blocks. The only valid block in your mesh object is the one that swiftblock found, the original solid plate.

Creating structures like the one in 2.16 is complicated to do directly in a text editor (just writing the coordinates and combining them into blocks), which is why swiftblock was invented... however, the user still has to manually design each block!

Kalle
kalle is offline   Reply With Quote

Old   May 26, 2014, 09:57
Default
  #149
Member
 
J.-H. Wang
Join Date: Oct 2010
Posts: 72
Rep Power: 15
f0208secretx is on a distinguished road
Hi Kalle,

Edit: Thanks a lot for the response. I read the entire thread and I think I would have to pick up some basic blender operations before I can do anything significant. Keep up the great work!


JHW

Last edited by f0208secretx; May 26, 2014 at 11:08. Reason: see Edit
f0208secretx is offline   Reply With Quote

Old   May 26, 2014, 23:54
Default
  #150
Member
 
J.-H. Wang
Join Date: Oct 2010
Posts: 72
Rep Power: 15
f0208secretx is on a distinguished road
Hello,

I was playing with both blender and swiftSnap today. I was simply trying to create the mesh for a 3D torus, which was constructed in Blender 2.70. Problem occurs when I SnappyHexMesh it.

I used SwiftSnap to produce the blockMeshDict and SnappyMeshDict. The locationinmesh cursor was carefully placed inside the torus and data was generated by swiftsnap as well. I checked the stl file plotted with the background mesh and they look good. When I ran SnappyHexMesh no errors were detected, but the final mesh is no way near the torus... I attached the entire test case folder for your reference.

I was wondering if this is a more upstream problem that occurs when generating the Dict files using SwiftSnap, or more downstream such as incorrect procedural implementation. Any advise is greatly appreciated!


JHW
Attached Files
File Type: zip torus.zip (55.6 KB, 10 views)
f0208secretx is offline   Reply With Quote

Old   May 27, 2014, 14:31
Default
  #151
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 on good way!

The problem with your model is that you try to create a torus mesh with cells that are about the same as the diameter of the torus. Generally for any mesher, you need several cells to resolve a feature of a geometry. Just increase the resolution of the base mesh, and you will see more of the torus appearing.

Kalle
kalle is offline   Reply With Quote

Old   May 27, 2014, 14:50
Default
  #152
Member
 
J.-H. Wang
Join Date: Oct 2010
Posts: 72
Rep Power: 15
f0208secretx is on a distinguished road
Hello Kelle,

Thanks for the response. It is indeed the problem. I guess I was caught up in the thought that the base mesh resolution doesn't matter. I think I read it somewhere. Once I increase the base mesh resolution to 0.1 it solves the problem

Another question: is there a good way to move the 3D cursor into the object? I was using snap to grid but apparently this trick would not work every time on arbitrary object. If I use my mouse the cursor will stick on the surface of the object... Thanks in advance.


JHW
f0208secretx is offline   Reply With Quote

Old   May 27, 2014, 15:42
Default
  #153
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
I do not know of any automatic way to do it. The exact position is not critical, as long as you are not very close to a wall. A few clicks with the mouse button normally does the trick. The cursor is placed in a 2D plane which is normal to the current view, and at a depth defined by the current cursor position. (at least that is what I understand). That means that two clicks should always be enough, if you turn the view camera 90 degrees between the clicks. (for instance, first you select the x-y coords with camera normal in z-direction, then you put the camera in x-direction, and moves the cursor in z-direction). Once you get hold of it, it should not induce any pain

Kalle
kalle is offline   Reply With Quote

Old   July 9, 2014, 06:09
Default co-locating vertices
  #154
kcn
Member
 
Join Date: May 2014
Posts: 31
Rep Power: 11
kcn is on a distinguished road
Hi,

I am new to blender & OpenFoam. Can someone please tell me how to co-locate vertices of cube and cylinder in blender, as pointed in meshing a cylinder example?
kcn is offline   Reply With Quote

Old   July 9, 2014, 07:24
Default
  #155
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi Kcn,

See this:

http://wiki.blender.org/index.php/Do...l/Snap_to_Mesh

Kalle
kalle is offline   Reply With Quote

Old   July 10, 2014, 00:18
Default
  #156
kcn
Member
 
Join Date: May 2014
Posts: 31
Rep Power: 11
kcn is on a distinguished road
Hi Kalle,

Thanks a lot for the reply. SwiftBlock is really helpful to my work.
kcn is offline   Reply With Quote

Old   July 10, 2014, 13:35
Default Preserving internal edges to maintain block structure
  #157
Member
 
Join Date: Aug 2012
Posts: 68
Blog Entries: 1
Rep Power: 13
Nucleophobe is on a distinguished road
First, thank you kalle for these great tools!

I have a (perhaps) simple question about swiftBlock. I have been creating my blender objects primarily by extruding either a cube or a 2D plane into the desired shape. However, the "extrude" operation does not seem to preserve internal edges, so sometimes blocks are not created appropriately for use with swiftBlock.

For instance, if my 2D mesh has an internal vertex (see attached), and is then extruded in the normal direction, internal edges are not created, and swiftBlock reports "broken block structure." For simple geometries, I can add the missing internal edges in by hand, but it can be a bit tedious in other cases.

Is there a way in blender to preserve internal edges? Or is there a better approach that I should be using?

Thanks!
-Nuc

2D_mesh.jpg

2D_mesh_extruded.jpg

2D_mesh_extruded_annotated.jpg

2D_mesh_extruded_fixed.jpg
Nucleophobe is offline   Reply With Quote

Old   July 11, 2014, 04:54
Default
  #158
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi Nuc,

Yes, I know this problem. Blender is for surface modelling, and it thinks the internal vertex should not be extruded into an edge. The only way I know to get around this is that you before extruding deletes all faces in your mesh. Then, of course, you need to recreate faces if you want to define patches. This is one of the reasons I created the repair feature where you can delete unwanted internal faces, and create missing boundary faces.

Thanks for your kind words,
Kalle
wyldckat and Nucleophobe like this.
kalle is offline   Reply With Quote

Old   September 8, 2014, 04:29
Default
  #159
New Member
 
Join Date: Jul 2014
Posts: 5
Rep Power: 11
rmcfd is on a distinguished road
Hi,

i am starting to test swiftBlock + swiftSnap (Blender 2.71).
I followed the install-guide on openFoamWiki

If I want to "Write" the blockMeshDict of the default-box the following ERROR is displayed:

Code:
Report: Error

Traceback (most recent call last):
File ".../blender-2.7.1/2.71/scripts/addons/swiftBlock/__init__.py", line 253, in execute
for f in obj.data.faces:
AttributeError: 'Mesh' object has no attribute 'faces'

location: <unknown location>:-1
Additionally, the buttons "Diagnose", "Preview" etc are not displayed (attached pic)!

Thanks in advance!
Attached Images
File Type: png swiftBlock.PNG (28.6 KB, 20 views)
rmcfd is offline   Reply With Quote

Old   September 8, 2014, 05:26
Default
  #160
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
Hi!

Looks like you have downloaded an old version of the code from openfoamwiki. The up-to-date version is found on github:

https://github.com/nogenmyr/swiftBlock.git

Blender has changed its python API quite a lot the last years. The old version you downloaded is compatible with 2.62-2.63 (as stated)

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 21:11.