CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swiftBlock/swiftSnap] SwiftSnap and SwiftBlock, GUIs for OpenFOAM's meshers (https://www.cfd-online.com/Forums/openfoam-community-contributions/100604-swiftsnap-swiftblock-guis-openfoams-meshers.html)

kalle March 17, 2014 06:50

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

gschaider March 19, 2014 18:05

Quote:

Originally Posted by kalle (Post 480441)
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?

kalle March 20, 2014 02:24

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

gschaider March 20, 2014 13:38

Quote:

Originally Posted by kalle (Post 481016)
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)

pirsquared May 17, 2014 15:53

Quote:

Originally Posted by kalle (Post 471072)
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.

kalle May 20, 2014 01:16

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

f0208secretx May 25, 2014 15:56

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

kalle May 26, 2014 01:36

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

f0208secretx May 26, 2014 09:57

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

f0208secretx May 26, 2014 23:54

1 Attachment(s)
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

kalle May 27, 2014 14:31

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

f0208secretx May 27, 2014 14:50

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 :D

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

kalle May 27, 2014 15:42

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

kcn July 9, 2014 06:09

co-locating vertices
 
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?

kalle July 9, 2014 07:24

Hi Kcn,

See this:

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

Kalle

kcn July 10, 2014 00:18

Hi Kalle,

Thanks a lot for the reply. SwiftBlock is really helpful to my work.

Nucleophobe July 10, 2014 13:35

Preserving internal edges to maintain block structure
 
4 Attachment(s)
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

Attachment 32241

Attachment 32242

Attachment 32243

Attachment 32244

kalle July 11, 2014 04:54

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

rmcfd September 8, 2014 04:29

1 Attachment(s)
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!

kalle September 8, 2014 05:26

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


All times are GMT -4. The time now is 10:38.