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 Community New Posts Updated Threads Search

Like Tree83Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 8, 2017, 06:26
Default
  #261
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi,


@Vignesh, this error is related to NumPy. You have too old version.

@Eero, your testcase works well on my computer. Can you look at the blockMeshDict file and see if the projections are listed there?

Regards, Mikko
Flowkersma is offline   Reply With Quote

Old   November 8, 2017, 09:28
Default
  #262
New Member
 
Eero Kokkonen
Join Date: Nov 2010
Posts: 4
Rep Power: 15
ekeero is on a distinguished road
I finally got it working, but only with blender_2.76.b+dfsg0-3build1, I did not got it working with 2.77, 2.78 or 2.79 Blender versions.

The blockMeshDict is showing the projections.

I saved the mesh with Blender 2.76 and with 2.79 from the same test case.
- both created the very same blockMeshDict (checked with diff)

I ran the blockMesh with the constant/geometry/Sphere.stl for both cases
- case generated with 2.76 succeeded in the projections correctly as the preview mesh in Blender
- case generated with 2.79 did not

So this means that the problem is in the Sphere.stl which 2.79 generates because the BlockMeshDicts are exactly same...

BR.
Eero
ekeero is offline   Reply With Quote

Old   November 8, 2017, 11:00
Default
  #263
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Ok, thanks!

A new argument "use_selection" for the stl export has been introduced in the new Blender versions which was causing the bug. I just pushed a bug fix which resolves this.
Flowkersma is offline   Reply With Quote

Old   November 8, 2017, 11:10
Default
  #264
New Member
 
Eero Kokkonen
Join Date: Nov 2010
Posts: 4
Rep Power: 15
ekeero is on a distinguished road
Great, now it's all good!

Thanks for the very quick fix, the tool is great!

BR.
Eero
Flowkersma likes this.
ekeero is offline   Reply With Quote

Old   November 8, 2017, 16:04
Default
  #265
Member
 
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 14
vigneshTG is on a distinguished road
Quote:
Originally Posted by Flowkersma View Post
Hi,


@Vignesh, this error is related to NumPy. You have too old version.

@Eero, your testcase works well on my computer. Can you look at the blockMeshDict file and see if the projections are listed there?

Regards, Mikko

Hi Mikko,
Thanks for the quick reply, i updated to the latest numpy (1.8.2). I don't get errors when i use Eero's file and i am able to build the mesh succesfully.

But when i try the sphere meshing tutorial from scratch, i get the same error as below.
(when i click build blocks the error starts showing.)

Code:
Traceback (most recent call last):
  File "/home/vignesh/blender/2.79/scripts/addons/swiftBlock/__init__.py", line 396, in invoke
    log, block_verts, block_edges, face_info, all_edges, faces_as_list_of_nodes = blockBuilder.blockFinder(edges, verts, disabled = disabled, numba = ob.useNumba)
  File "/home/vignesh/blender/2.79/scripts/addons/swiftBlock/blockBuilder.py", line 105, in blockFinder
    tmp_v,tmp_e = cycleFinder(edges,range(len(vertices_coord)))
  File "/home/vignesh/blender/2.79/scripts/addons/swiftBlock/blockBuilder.py", line 59, in cycleFinder
    temp, u = np.unique(np.sort(faces), axis=0, return_index=True)
TypeError: unique() got an unexpected keyword argument 'axis'
Attached Files
File Type: gz sphere.tar.gz (96.5 KB, 0 views)
__________________
Thanks and Regards

Vignesh
vigneshTG is offline   Reply With Quote

Old   November 9, 2017, 06:16
Default
  #266
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi Vignesh,

The latest numpy version is 1.13 and only that version has the axis argument for the numpy.unique function. When I have the time I will remove this dependency so that SwiftBlock works also with older versions of numpy.
Flowkersma is offline   Reply With Quote

Old   November 11, 2017, 07:06
Default
  #267
Member
 
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 14
vigneshTG is on a distinguished road
Quote:
Originally Posted by Flowkersma View Post
Hi Vignesh,

The latest numpy version is 1.13 and only that version has the axis argument for the numpy.unique function. When I have the time I will remove this dependency so that SwiftBlock works also with older versions of numpy.
Hi Mikko,

I was finally able to solve the problem and get the mesh done. The error happens even if the numpy is updated to the latest version. It can be rectified by

Code:
copying the numpy folder  from the lib/python3.x/site-packages subdirectory of 
your local Python 3.x installation into the scripts/modules subdirectory of Blender
 (not into the python/lib/python3.2/site-packages subdirectory
This solves the problem.
__________________
Thanks and Regards

Vignesh
vigneshTG is offline   Reply With Quote

Old   November 13, 2017, 04:13
Default
  #268
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi Vignesh,

I am glad to hear that you got SwiftBlock finally working!

I should have been more explicit with the installation. The numpy that Blender uses must be updated to latest version. Depending on your installation, Blender may use local numpy or it may come with its own numpy. The numpy version that Blender uses can be found by writing following to the Blender Python console:

Code:
import numpy; print(numpy.__version__)
Regards, Mikko
Flowkersma is offline   Reply With Quote

Old   April 9, 2019, 07:01
Smile Upgrade SwiftBlock to Blender 2.8?
  #269
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello @Flowkersma and @kalle,

I just tested Mikko's SwiftBlock version on Blender 2.79 with Numpy 1.16.2 and OpenFOAM.org 6. Great work! Does either one of you intend to upgrade your code to Blender 2.8? I recently made a snappyHexMesh GUI addon for Blender 2.8, and I'm thinking about trying to upgrade swiftBlock as well.

BR,
Tuomo
wyldckat likes this.
tkeskita is offline   Reply With Quote

Old   April 11, 2019, 04:41
Default
  #270
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello @Flowkersma and @kalle,


your github repositories seem to lack specification of license for your codes, although some single files include GPL headers. Could you please add an explicit LICENSE file to your repositories to make it clear, thanks!
wyldckat likes this.
tkeskita is offline   Reply With Quote

Old   April 28, 2019, 06:35
Default SwiftBlock upgraded to Blender 2.8 series
  #271
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello all,

I got license confirmation from @kalle, and now also Flowkersma repository has updated explicit LICENSE file (GPL v3). Thanks!

I went ahead and upgraded Flowkersma version of SwiftBlock to Blender 2.8 series (currently Blender 2.80 beta). The add-on source code and documentation is available at https://github.com/tkeskita/swiftBlock.


I hope to finetune a few more things in the add-on, but it should be working OK already now.


Happy meshing!
lourencosm likes this.
tkeskita is offline   Reply With Quote

Old   June 24, 2019, 08:27
Default
  #272
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
FYI: I've fixed one Blender API change in swiftBlock add-on. Since Blender 2.80 is getting ready I hope we will see less of these. You can post here if the add-on seems to be broken, thanks!
tkeskita is offline   Reply With Quote

Old   July 6, 2019, 13:47
Default blockMesh for blade Wind Turbine
  #273
New Member
 
Lazaro Alejandro Guillen Campos
Join Date: Mar 2019
Posts: 4
Rep Power: 7
l.guillen is on a distinguished road
Hello to the CFD community.

I have been understanding and using the SwiftBlock addon of Flowkersma for some time. I think it's really good, a great contribution. thanks to Kelly also for thinking about it.

I have little experience in OpenFOAM. I'm trying to make good meshes.

My job is that I'm trying to make wind turbine blades, a very complicated problem. Making the geometry of a blade carries a deep geometric analysis.

I have achieved with their SwiftBlock addon, do wonders to say it in some way, something that I can not do by hand.

At the moment I am trying to use SwiftBlock, to generate the blocks of a shovel from a Nrel benchmark, the Phase VI case.

I have found that the algorithm is very slow when looking for many blocks. I need to have the domain divided into many blocks because I need to make a mesh smoothing around the profile in each section, this generates hundreds and even more than a thousand blocks in the blade.


smoth profile.jpg

I have thought of several manual solutions, how to use the blocks from the profile to the type O domain, and add splines of the remaining vertices inside blockMeshDict or generate driving surfaces along the blade, from the profile to the domain type O.

I have tried SwiftBlock, for hours to find the blocks of a wind turbine blade but it does not work. It is possible that the algorithm fails when the number of blocks increases. I do not know either programming in python or blender python but it would be good to optimize it for large numbers of blocks.


bladeWindTurbine_many blocks.jpg

My idea is to look in the direction from the center of the figure to the outside, as if climbing, or in my case to start at the bottom of the profile and go up, and save the blocks each section of the blade and so consecutively.


approach.jpg

Sorry to extend, but I would like SwiftBlock addon to generate blocks much faster.

Regards of cuba
l.guillen is offline   Reply With Quote

Old   July 25, 2019, 13:03
Default
  #274
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello @l.guillen,

it seems that the blocking algorithm does get slow when there are many blocks. Have you tried enabling Numba (Python library)? I have not tried it myself, but that should speed up blocking. Sorry I don't know exact steps how to do it.

Otherwise I think your alternative is to generate mesh with SnappyHexMesh or some other mesher.
tkeskita is offline   Reply With Quote

Old   July 25, 2019, 16:24
Default
  #275
New Member
 
Lazaro Alejandro Guillen Campos
Join Date: Mar 2019
Posts: 4
Rep Power: 7
l.guillen is on a distinguished road
I have not tried numba, although if I have it enabled in blender, I have looked for geometries with it, and it is even slower than numpy.

I work with blender 2.79 and OpenFOAM of TurboCFD, all about window 10, the plugin runs well, although it doesn't work at all, the preview mesh gives me the following error:


Traceback (most recent call last):
File "D:\install\Blender\blender\2.79\scripts\addons\sw iftBlock\__init__.py", line 617, in invoke
mesh, cells = writeMesh(ob)
File "D:\install\Blender\blender\2.79\scripts\addons\sw iftBlock\__init__.py", line 588, in writeMesh
mesh = blockMeshMG.PreviewMesh()
File "D:\install\Blender\blender\2.79\scripts\addons\sw iftBlock\blockMeshMG.py", line 12, in __init__
raise RuntimeError('ERROR: No BlockMesh Found!')
RuntimeError: ERROR: No BlockMesh Found!



A friend installed the addon on ubuntu and gave him the geometry to look for the blocks, it turns out that he realized that the search is done in a single thread of the processor, perhaps making a parallel process to the function that Flowkersma describes as slow in blockBuilder.py in line 150 and at the end of the script.

These are ideas that I try to contribute to the improvement of the plugin, I think it's great.

Another problem, is the extrude-block of the Flowkersma addon, is not in its version for bledner 2.80, I would like to see it included, and if I might use the normal extrusion.

Thanks

Last edited by l.guillen; July 29, 2019 at 10:15.
l.guillen is offline   Reply With Quote

Old   July 29, 2019, 02:35
Default
  #276
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hi,


the name of the block extrusion operator in Blender 2.80 is "Extrude Blocks (Retain Internal Edges)". You can run it from operator search panel (press F3 in 3D Viewport).


Parallelization of search algorithm would likely increase speed, if it can be done. I'm now developing other add-ons, but I try to maintain SwiftBlock for Blender 2.8 series. If anyone is interested, please feel free to go ahead and develop SwiftBlock!
tkeskita is offline   Reply With Quote

Old   July 29, 2019, 11:40
Default
  #277
New Member
 
Lazaro Alejandro Guillen Campos
Join Date: Mar 2019
Posts: 4
Rep Power: 7
l.guillen is on a distinguished road
Hello again, thanks for your quick answers.

I found the extrude block option as you said, I was used to seeing it in the extrude optiom menu in the Alt-E shortcut in 2.79. Thanks for the clarification.

I use Window 10 and TCFD OpenFOAM as I'am mentioned before and in Blender 2.8, the addon also does not preview the mesh, throws the following error message in Toggle System Console:


OpenFOAM temp directory: C:\Users\I7\AppData\Local\Temp\tmp58kh73pz
running blockMesh
--> FOAM FATAL ERROR in Foam::findEtcFiles() : could not find mandatory file
'controlDict'


Traceback (most recent call last):
File "C:\Users\I7\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\swiftBlock-master\__init__.py", line 524, in invoke
points, faces = mesh.runMesh()
File "C:\Users\I7\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\swiftBlock-master\blockMeshMG.py", line 216, in runMesh
faces, bcifaces=self.getBCFaces2(internalCells)
File "C:\Users\I7\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\swiftBlock-master\blockMeshMG.py", line 187, in getBCFaces2
startLine, numberofLines = self.readHeader(facesFile)
File "C:\Users\I7\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\swiftBlock-master\blockMeshMG.py", line 104, in readHeader
with open(dicfile) as fin:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\I7\\AppData\\Local\\Temp\\tmp58kh73pz/constant/polyMesh/faces'



If I could review the error in window I would appreciate it, a similar error was already showing me before with Blender 2.79 loading it in from the Cygwin environment of TCFD.

About the parallelization of the addon, I don't know python, I want the programmers who work here to help me, if they achieve anything I share it. But they also have a lot of work and are few.

Thanks again

Regards
l.guillen is offline   Reply With Quote

Old   August 3, 2019, 05:34
Default
  #278
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello l.guillen,

I don't have access to TCFD to test, but judging from FileNotFoundError I guess the issue is hard coded unix path separator. I think I was able to fix issue, can you please download Blender 2.80 and the updated add-on and try again? Thanks.
tkeskita is offline   Reply With Quote

Old   August 5, 2019, 10:35
Default
  #279
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi l.guillen,

The blocking algorithm gets indeed slow with hundreds of blocks. I think the best solution would be to write it the block detection algorithm in Cython which could improve the speed drastically (10-1000x).

Unfortunately, I have no experience with SwiftBlock and Windows. The error "RuntimeError: ERROR: No BlockMesh Found!" means that the blockMesh executable cannot be found. In Linux you have to source the startup file that is found in your OpenFOAM installation path openfoam-XX/etc/bashrc.

Best, Mikko
Flowkersma is offline   Reply With Quote

Old   August 5, 2019, 15:00
Default
  #280
New Member
 
Lazaro Alejandro Guillen Campos
Join Date: Mar 2019
Posts: 4
Rep Power: 7
l.guillen is on a distinguished road
Hello:
takeshita: Thanks for your reply, I'll keep that in mind, I think it would be better to migrate to ubuntu.

Flowkersma: Thank you for answering: I have been proposing some solutions to the algorithm, but I am not a programmer.

1-That the algorithm locate the blocks around two layers of vertices of the object, then go to the next layer and locate the next ones and so on, or doing it from the center of the object outwards, something similar to the algorithm of the Oscurant Tools addon in the mesh option and in the select side tool.

2-I think that parallelizing the slower functions would also help the faster search.

Testing SwiftBlock I have realized that the algorithm does not lock with many blocks when for example:
I add a box, I apply the array modifier, I put 1000 copies and I apply the modifier so that the thousand boxes are real. Then I send a search with the addon and it does it very quickly in a matter of 1 minute, however I apply to remove double vertices and it falls completely at a longer time. I cannot use this type of division because it creates internal faces between the union of the blocks.

Now, if you say that with Cython you increase the block search speed then I hope to see one day the block detection more faster than usual.

I am considering make the rotor blade geometry less automated, although a more complicated one because of the amount of surfaces to project that I am going to have to use.

Thanks everyone.
l.guillen 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



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