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)

Shaney November 27, 2013 06:04

Oh dear, do I have a lot to learn or what!

Just realised that the finer, snapped mesh which is in another directory, you need to tell paraFoam to go to that "time" to use those cell layers. You could see the snapped mesh in there.

blimey. steep learning curve.

kalle November 27, 2013 08:14

Good to hear you solved it! I did not have any immediate clue what was going on...

K

Shaney November 27, 2013 08:46

Kalle,

if you are still online, perhaps you could advise on this:

in swiftsnap, is it important to specify boundary patches which:
a) do not overlap (in other words, that STL triangles are not shared between patches
b) together cover the whole surface?

I think A) must be true, otherwise OF will get confused. The reason I ask is that swiftsnap seems to start with all mesh surfaces by default in the defaultname wall. So, I believe I have to deselect mesh surfaces that would be used in other patches, such as an inlet?

For B) it would be much easier just to identify the inlet/outlet patches, and then hopefully OF treats everything else as a default wall patch. So, I could not have the defaultname wall patch, and just make inlet and outlet patches. However I do not see a way to remove the defaultname patch from the list of patches....?

Thanks
Shane

kalle November 27, 2013 13:55

Hi

A) True, you cannot have overlapping STLs. As SwiftSnap handles the whole geometry in one Blender mesh object, this comes naturally. Different patches are handled in Blender using Blender materials (with different colors). Upon initialization, all the objects faces are given the material named "defaultName". The user should then select faces and assign them proper names, hence defining the patches.

B) For sHM, there are no default patches, except those that are remaining from the blockMesh-mesh. For external flows, this is natural and wanted. For such flows, the user has to create the blockMeshDict (maybe using SwiftBlock), and define patches, like inlet and outlet. For internal flows, like the pipe bend example, none of the patches from the blockMesh-mesh remains in the final mesh. Then the user should define patches in the SwiftSnap Blender object, like described in A). Further, like you ask, the Blender object has to be "water tight", otherwise, mesh will "leak" out (or leak in, in the case of external flow), and fill parts of the domain, which the user did not intend to be meshed.

Hope things got clearer, otherwise post again!

Kalle

Shaney November 27, 2013 16:55

Thanks Kalle,

actually this is surprisingly easy to do. Blender just confused me.

For anyone else that had the same problem (maybe not many!):

when you first go to the patch settings, all of the stl faces will be highlighted as being part of the defaultName.

To make an inlet you input the patch name, say its a patch, but then you need to DESELECT ALL (faces) before choosing the inlet faces you want. Probably obvious to the blenders out there but not to me!

This is the case for all subsequent patches, should you want to make a new patch, you have to deselect the previous faces before choosing those to be in the new patch.

Kalle, I have to say, that one of the biggest problems I've seen with an openfoam workflow, is to take a single STL mesh and define the boundary patches for Openfoam. (In other words, as per the previous posts, break it into non overlapping stl meshes). I now see that you've done this in blender. I've spent a while trying to find a workflow for this, thanks so much.

(PS one reason I had a problem - aside from being a bit thick, is that my ubuntu version of blender is on a virtual machine, and it has terrible problems with windows changing sizes and jumping around a lot. Something to do with 3D acceleration. I've done the above in the windows partition and its easy.)
cheers
Shane

iamacloud December 1, 2013 09:55

Hi Kalle and anybody,
I am a newer for blender and swiftBlock&swiftSnap, My blender is 2.69.2 and my openfoam is 2.2.2. , and I can run your tutorial example such as SwiftBlockExample.tar. But I don't know how "block" is create in your example. In addition, if I have a STL geometric file, could I get blockMeshDist by swiftBlock+blender?
Thank you,
HM, Zhong.

Shaney December 1, 2013 19:09

Hi,

well as I've just been doing this recently then I may answer.

Yes, in swiftsnap you need to tick the box "make base mesh". That writes a blockmesh.dict using the bounding box for the active swiftsnap mesh.

When you write the files you need to put things in the right directories.
So:
blockmesh.dict = constant/polymesh/
snappyHexmesh.dict = system/
trisurface directory should be in constant/

if you have a STL file that you want to mesh inside (like the pipe example) then you can do it all in swiftsnap. if you want to build a big box mesh around your STL (like a wind tunnel), the you could still use swiftsnap, then when blockmesh.dict is written, just go in and change the dimensions to the ones you want. Maybe this is easier in swiftblock, but I've never used that.
cheers
Shane

iamacloud December 3, 2013 00:02

2 Attachment(s)
Hi, Shane,
Thank you for your quick reply.

I re-scanned the thread just now, and notice several key points about creating "block" which are mainly from Kalle:
Quote:

I see. I looks like you have enabled swiftblock for the blender object that actually carries the geometry. You have to have two separate blender objects. One object carries the block structure, and the other object (the one from your CAD software) carries the mesh that will be used to construct the block's edges... I know this is a little confusing, but I had to implement it this way to get a working addon.

If you open the "structural part" example, you can see that there are two blender objects present, and that the object carrying the block structure has ticked the "set edges" and the name of the object carrying the geometry is given there.
You should not click "enable swiftblock" on the geometry object.

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

You need a lot more blocks to mesh this geometry. When two blocks meet, you need to match their faces completely. This is basically the whole trick with block meshing, which makes it difficult, and hard to mesh some geometries. This geometry is however perfect for blockMesh, once you've figured out how to divide it. Please see the attached .blend file how I've split it.
Kalle

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
Well, my main question is how to create a block structure in a separate blender object. My understanding (If not right, please correct) is that this is just a question about blender or a blender's Addon, if so, can you give the details of the operation steps :confused:( I have done search with Google.com, but not get the results I want).

In addition, my interest is wind-turbine simulating in a tunnel, my tunnel includes a nozzle and a collector, not wind-turbine because an ALM method is used. I try to mesh them by using the fluent3DMeshToFoam(get based-Mesh) and snappHexMesh tools, and in my snappHexMeshDist (created manually) there are both STL geometries of the nozzle and collector. But the result seems not correct (see the attachments, checkMesh -allGeometry -allTopology ), and in paraview I found the regions around the nozzle and collector sufaces cannot always refined (maybe this leads to bad results).

Thanks,

HM, Zhong.

JFM January 14, 2014 08:46

swiftBlock usage
 
Good day All

I have been using Pointwise for my meshing until recently and now need to find an alternate method to generate meshes. I have been 'playing' with Salome, enGrid and more recently Blender in combination with swiftBlock / swiftSnap.

Blender and swiftBlock / Snap appear to be the most versatile and I would like to (and need to for study purposes) use these packages for my investigation. I should indicate that I am using Blender 2.69.8 and the latest version of swiftBlock/Snap from git.

However, I am not following the workflow required to generate a mesh using swiftBlock (hex mesh is desired). Based upon forums and my own interpretation I have undertaken the following:
  • import stl file and create single object
  • activate swiftBlock on properties panel
  • convertToMeters 1 (no scaling)
  • resolution set to (preliminary) desired default mesh scale
  • generate material type in swiftBlock
  • assign a patch type to each material
  • set edges (entered object name in tree)

I do not understand what is required with the remainder of the edge settings. I understand that grading etc are required to be set however I cannot see how these grading (etc) are attributed to each boundary as defined by the user specified materials. Could someone please provide some concise points / comments on the remainder of the procedure to generate a mesh.

A copy of the blender file I am using can be downloaded from:
https://skydrive.live.com/redir?resi...92D8AD0%214201

A brief description on how to blockMesh this MEL culvert with, for instance, a higher grading resolution over the weir would be beneficial.

Any assistance will be greatly appreciated, and hopefully I can return the favour one day.

Kind regards
JFM :)

pirsquared January 14, 2014 23:59

Help making swiftBlock/swiftSnap appear in Add-ons Menu
 
1 Attachment(s)
Hi,

I am relatively experienced in 3d modeling but am new to Ubuntu/OpenFOAM/Blender. My challenge is that after copying swiftBlock and swiftSnap files to the blender/2.69/scripts/addons/swiftBlock and /swiftSnap folder, I cannot find the scripts in the Add-ons Community menu. The path up to the swiftBlock and swiftSnap folders is the same as the add-ons that do appear in the window.

I tried this in blender 2.66a and 2.69/Ubuntu 13.10... no luck with either version. What am I doing wrong?

Thanks!

-Richard

kalle January 16, 2014 04:32

John,

it sounds as if you have clicked "enable swiftblock" on your imported STL object. Is so, please have a look at the examples to find out that the geometry/edges carrying object (your stl-object) is a different object than the block-structure-carrying object.

Rickard,

To the left in your screen dump you have the Categories list. Can you find OpenFOAM in that list? If so, the addons should be visible if click it.

Let me know how you progress, guys.

Kalle

pirsquared January 21, 2014 08:48

swiftBlock/swiftSnap installation
 
Kalle,

No luck getting openFoam to appear int eh Categories on Blender versions 2.63, 2.66a and 2.69.

I did successfully install and use the enGrid blender add-ons for v. 2.63. Not sure why I can't see the swift scripts though.

Thanks,

Richard

kalle January 21, 2014 09:44

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

Antech February 26, 2014 02:58

kalle

Thanks for your SwiftSnap scripts. I found them really useful. But may I ask a question?
When I importing STL geometry in Blender (2.68 with upt-to-date swiftsnap) I can assign patch names and write snappyHexMeshDict + STL geometry for OpenFOAM with your tool. But when the meshing with snappy is done I can't load the mesh into paraFoam (OpenFOAM 2.2) because patch names in geometry STL files and in mesh are different (as a result, paraFoam reports several errors). The reason is that STL files generated with script begin with line "solid Exported from Blender-2.68 (sub 0)" instean of just "solid". I've inspected your scripts and have not a clue where this string is generated so I think that Blender generetes it itself when exporting to STL. Is there any workaround to avoid editing STL's "by hand" or the only way is to processing them with "sed" or some other stream editor to remove "Exported..." trails?

pirsquared
Had similar difficulties. Installing add-on from Blender GUI didn't work. I had to copy directories (not just files) with swiftblock and swiftsnap to Blender add-on dir (scripts/addons) to make them work (Blender 2.63, 2.66 and 2.68 tested with corresponding versions of swift tools).

Thanks for attention... Sorry if there are any language problems, my native is russian...

iamacloud March 7, 2014 13:51

Let myself answer the question about "create a block" in floor 128.
In fact, creating a block is the same as creating a geometrical model, just ensure no seperate points and faces in the block. If any, you should remove them with the "fusing" commands in blender.

hope useful to some guys.

iamacloud March 8, 2014 13:32

Hi, Andrew,
You can alter your script files, i.e. several line codes starting from line 190 in "/usr/share/blender/2.69/scripts/addons/io_mesh_stl/stl_utils.py" to what you want. Of course, if you just confront a few files you maybe modify them manually,

zhm

Antech March 11, 2014 01:20

iamacloud
Thanks! I've found the lines around 190 in stl_utils.py and I see that keyword "solid" is followed by a "header" that is a version info of Blender. File slt_utils.py in my case located in other directory, not /usr/share... (because I just unpacked official Blender archive and it is running OK, I didn't "install" it). I'll edit these lines nex time I use Blender for meshing.

romainRH March 12, 2014 08:37

Hi.
I would like to try swiftblock. I have both blender 2.62 and 2.70.
I am just starting with blender so it took me few minutes to found how to activate the addons.
Now i am looking for the swiftblock in the propertie tab of the object but there is nothing.
Could someone post a screenshot to show me where swiftblock is located in blender ?

Thanks

Antech March 13, 2014 01:22

romianRH
If you have activated Swift addons in User preferences, you just need to click on the cube (Object) in the right toolbar in Blender, scroll down and click "Enable SwiftBlock" button.

romainRH March 13, 2014 01:28

Hi Antech.
That is exactly wath I was looking for.
Thank you


All times are GMT -4. The time now is 00:45.