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/)
-   -   [Other] HexBlocker a GUI for blockMeshDict, alpha release (https://www.cfd-online.com/Forums/openfoam-community-contributions/114773-hexblocker-gui-blockmeshdict-alpha-release.html)

nsf July 7, 2013 15:41

Hi,

Just wanted to let you guys know that I've committed a fix for bug 1 in Entropetes list.

Best
Nicolas

Entropete July 13, 2013 15:48

Hi Nicolas

Thanks for the update - I confirm that it works.

I've checked my reported bugs a little more carefully:

Bug 2: It happens after defining boundary conditions, in both the GUI and the blockMeshDict file. All gradings are rounded down to the nearest integer (not just those less than 0 - they are just the ones that cause the obvious problem). The work around would be to do cell grading after defining BCs.

Bug 3: I think I may have got this one wrong: although it does reorder arcs, this is not a big deal. I'm not sure it reordered vertices.

Bug 4: The crashes occasionally happen when extruding a face as far as I can tell.

Semi-bug 1: The work around that I now use is to move the vertices that will be duplicated on the adjacent block before extruding, then merge the faces, using the face of the new block as the master. This is much easier than manually editing out the duplicates in the blockMeshDict file.

As for your invitation to help out on the coding, I'm afraid that my coding skills are limited, very out of date and C++ is somewhat out of my skillset - sorry!

Finally, many thanks for your continued work on this.

Peter

nsf July 14, 2013 09:24

Rainy sunday means time for coding
 
1 Attachment(s)
Hi,

Since it's a rainy sunday here I've had time to work with the code.

I've added a vertice editor widget which will allow for manually editing the vertice positions, please see the attached figure. The editor should simplify merging patches after extrude among other things.

As for now I'll have a look at the bugs Peter mentioned, thank you!:D

Best
Nicolas

c_prabal August 21, 2013 07:25

Great!
 
I feel it is a great effort!! I could not use the middle button, as I have a scroll roller, and a bit of tutorial, it will help self learners.

Prabal:)

nsf August 21, 2013 10:24

Quote:

Originally Posted by c_prabal (Post 447116)
I feel it is a great effort!! I could not use the middle button, as I have a scroll roller, and a bit of tutorial, it will help self learners.

Prabal:)

Hi Prabal

I'm glad you like the code. As I do most of the programming and testing on a laptop I've also found it hard to use the middle mouse button. That's why space can be used in its place.

I'll consider a tutorial but I'll be mostly focusing on implementing new functions. If you'd like to create a tutorial please feel free to do so!


I haven't been working a lot with the code since we've had such great summer in Sweden but the fall is soon here and I'll have more time to for coding.


Best
Nicolas

romant September 17, 2013 04:26

error when installing
 
Hej,

I get the following error when I am trying to compile. It downloads the VTK successfully, but it doesn't compile it.

Code:

+ baseDir=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker
+ vtkBuild=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/build/VTK
+ vtkInstall=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/vtk
+ vtkSRC=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/vtkSrc
+ hexBuild=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/build/hexBlocker
+ hexBin=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/bin
+ hexSRC=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/src
+ nprocs=4
+ debug=false
++ which qmake
+ QMAKE=/usr/bin/qmake
++ which moc-qt4 moc
++ head -n1
+ MOC=/usr/bin/moc-qt4
++ which uic-qt4 uic
++ head -n1
+ UIC=/usr/bin/uic-qt4
+ '[' -z /usr/bin/qmake -o -z /usr/bin/moc-qt4 -o -z /usr/bin/uic-qt4 ']'
+ vtkpgk=vtk-5.10.0.tar.gz
+ '[' '!' -f vtk-5.10.0.tar.gz ']'
+ '[' '!' -d /home/roman/OpenFOAM/roman-2.2.1/hexBlocker/vtkSrc ']'
+ '[' '!' -d /home/roman/OpenFOAM/roman-2.2.1/hexBlocker/build/VTK ']'
+ cd /home/roman/OpenFOAM/roman-2.2.1/hexBlocker
+ mkdir -p /home/roman/OpenFOAM/roman-2.2.1/hexBlocker/build/hexBlocker
+ cd /home/roman/OpenFOAM/roman-2.2.1/hexBlocker/build/hexBlocker
+ cmake -DVTK_DIR=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/vtk/lib/vtk-5.10 -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DQT_MOC_EXECUTABLE=/usr/bin/moc-qt4 -DQT_UIC_EXECUTABLE=/usr/bin/uic-qt4 -DCMAKE_INSTALL_PREFIX=/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/bin /home/roman/OpenFOAM/roman-2.2.1/hexBlocker/src
CMake Error at /usr/share/cmake-2.8/Modules/FindVTK.cmake:135 (message):
  VTK not found.  Set the VTK_DIR cmake cache entry to the directory
  containing VTKConfig.cmake.  This is either the root of the build tree, or
  PREFIX/lib/vtk for an installation.  For VTK 4.0, this is the location of
  UseVTK.cmake.  This is either the root of the build tree or
  PREFIX/include/vtk for an installation.
Call Stack (most recent call first):
  CMakeLists.txt:9 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
+ echo 'error in cmake for hexBlocker'
error in cmake for hexBlocker
+ exit 1
+ make -j 4
make: *** No targets specified and no makefile found.  Stop.
+ echo 'error in make for hexBlocker'
error in make for hexBlocker
+ exit 1
+ make install
make: *** No rule to make target `install'.  Stop.
+ '[' false == true ']'
+ exit 0

I am using OpenFOAM 2.2.1 and Ubuntu 13.04 64-bit.

nsf September 17, 2013 12:14

Hi Roman,

It's nice to see you tried the program!

To save, time I made the script so it won't compile VTK if the directory vtkBuild is present. Which you have as
Code:

/home/roman/OpenFOAM/roman-2.2.1/hexBlocker/build/VTK
. From the output I can tell that it didn't try to build VTK.

Check if VTK has been built properly. If not try to remove that directory and rerun the install-script. If that doesn't work try to manually run lines 64 through 80 (which compiles VTK) and see what error messages are present. Post back and I'll see if I can help.

I haven't yet upgraded to 13.04 so I don't know it VTK compiles. Perhaps there is some additional package thats required.

Best
Nicolas

romant September 18, 2013 03:45

Hej,

I double checked the output from the VTK compiling process and it tells me that I am using qt version 5.0.1 and that it needs at 4.5 and higher. I tried installing the qmake 4.x version in Ubuntu, however, it gives me that packages will be broken if I attempt this. I am not able to downgrade to 4.X or install it in parallel. It looks like qmake4 is installed, however when I try to chose my alternative I get that there are no alternatives installed.
Code:

input: sudo update-alternatives --config qmake
output: update-alternatives: error: no alternatives for qmake

Do you have a simple solution, or should I go to trolltechs website, download the latest 4.X version, compile it and see that I get it installed?

The error message from VTK reads
Code:

-- Found unsuitable Qt version "5.0.1" from /usr/bin/qmake
CMake Error at CMakeLists.txt:387 (MESSAGE):
  Qt 4.5.0 or greater not found.  Please check the QT_QMAKE_EXECUTABLE
  variable.

Solution:

The solution to this problem is to go run
Code:

sudo apt-get install qt4-default
which will automatically remove qt5-default and then I was able to compile VTK.

It installs perfectly fine in Ubuntu 13.04 when changing the qt environment to qt4-default.

nsf September 18, 2013 12:27

Hej Roman,

Thank you for posting the solution! Thanks!

I've done a quick search and it seems that support for qt5 in VTK is in progress. Also it would seem I would have to make a couple of changes to hexBlocker as well.

So at the moment the easiest option seems to be to downgrade as Roman suggested.

Of course if one really needs to have both version one can compile a custom version of Qt. I've had to do so on our cluster so if people are interested I could perhaps include it in the install script.


Best
Nicolas

Paulli September 22, 2013 11:29

Quote:

Originally Posted by c_prabal (Post 447116)
I feel it is a great effort!! I could not use the middle button, as I have a scroll roller, and a bit of tutorial, it will help self learners.

Prabal:)

Hi
I installed this magic software today, but I have no idea how to
use it, can you share the tutorial anyway, I would be very grateful.:D

nsf September 22, 2013 12:19

Hi,

As of yet I haven't implemented many functions, so in 10-15 minutes you'll probably have explored the entire program. My intention is to write the program such that no tutorial or manual is needed.

Please keep in mind that the program is intended as a helper in creating blockMeshDict files for OpenFOAM. It's not a GUI for OpenFOAM and is still in alpha release. It's intended for those who already have at least a little experience of using OpenFOAM and blockMesh.

In any case, due to popular (twice) demand, here comes sort of a tutorial or perhaps a description of how to do create a blockMeshDict file using HexBlocker.

Start the program by running the executable in INSTALLDIR/bin/HexBlocker
Optionaly it takes an already existing blockMeshDict as an argument.

Create a hexblock with "Create a new HexBlock" button. Enter values and hit apply.

A block pops up with 6 patches, 8 vertices and 12 edges. The positions of the vertices are shown in the vertices editor. They can manually be edited from the table.

Additional blocks can be created. Or you can extrude a new block from an existing patch. Hit the button "extrude patch", select a patch (hit middle button or space to confirm the selection). Enter a distance in the dialog box hit ok.

You can also merge two block so they share a patch. Click the button "merge two patches", select the master patch with left button, right button to deselect. Select the second patch. Hit middle mouse button when finished. The second patch will be moved to the first. This only works if the vertices in the two patches are close. The vertices must form pairs otherwise the (simple) algorithm won't know how to merge the patches.

Continue until you have your collection of boxes made.

At this stage you might want to edit the number of nodes on each edge. The default is 10 per edge. Click the button named "set the number of cells on each edge". A dialog pops up. Click the button "select edge" and select one edge with left mouse button. Right button to deselect, middle or space to confirm. The selected edge is colored red while all dependent edges are colored blue. The number of nodes is shown in the dialog box. Set the number and hit apply and all dependent edges will also have their number updated. If you want to use grading I recommend using the calculator ("calc" button). It computes the ratio first to last cell length ratio (the only grading parameter blockMesh tages) on other properties such as first cell height, number of cells etc. At most two properties can be selected at the same time. Also please note that all other combinations aside from first to last cell ratio with a fixed number of cells is potentially a ill-posed problem and might not have a solution.

You can also change the edge type. At the moment line and arc are supported. I'm working (not much at the moment) on support for more types, spline, polyLine etc. Hit the button next to "change type". Another dialog pops up. If you change the type you can either enter the arc interpolation point manually or have it computed from a patch and optionally a fixed radius.


Right, when this is done it's time to set up the BC's. Click the button “BCs” and “new” in the dialog that pops up. A row is added with two columns, name and type. Change name and type accordingly. Type is a string matching what ever patch type blockMesh supports, i.e. patch, wall, empty etc. Create different BC's as needed. Next select one row and click the button “select patches”. Select patches that you want in the selected BC. Left mouse button to select, right to deselect and middle or space to confirm. You can view which patches are included by just selecting the bc in the list.

That's about it. Go to file-save and save you blockMeshDict and proceed with the usual stuff. Hopefully blockMesh runs without a problem.

Now, while you are working you might make a misstake. There is no undo but there is a shortcut for saving (ctrl-s) and a shortcut for reverting (ctrl-R).

There we go, a short tutorial on how to use the program. Hope you find it useful!

Best
Nicolas

Paulli September 22, 2013 19:53

Thanks so much
yesterday I clicked everywhere only use the left button, now i know how to confirm.
You are so kind, THANKS again~

best
paul

nsf September 23, 2013 12:41

Hi Pauli,

I should say welcome to the forums!

No worries, I'm glad to hear that people are trying out the code!

Best
Nicolas

Tobi September 27, 2013 06:34

good work
 
Dear Nicolas,

nice work you did. I have not checked it till now because I am using always snappy for complex geometrys. As I see at the Pictures your tool seems to work like ANSYS ICEM :)

Do you know if you are improving your tool to add STL and cap the outside block lines onto the surface?

Regards
Tobi


PS: Keep on working.

nsf September 27, 2013 15:46

Hi Tobi,

Thank you for the kind words. Well it's a long way before hexblocker can be compared to icem. But I have been inspired by icem and ansa in how they do hexa block meshing. At the moment only the most basic of operations has been implemented.

Regarding STL meshes I have some good and bad news. One good news is that it is possible implement a STL reader in HexBlocker since it uses the VTK library from kitware. In there there is support for reading STL-meshes. There is also support (in VTK) for projecting points onto surfaces. I'm not sure though if edges can be extracted from a STL surface.

The bad news is that HexBlocker is not a mesher, merly a GUI for blockMesh which at the time doesn't have support for projecting block faces onto surfaces. So even if one can project the edges of the block that does not mean that the mesh will be consistent with the geometry.

Good news is that Karl-Johan Nogenmyr is working on a body-fit cabable version of blockMesh but it's in development and not yet ready.

Currently my spare time goes to other projects but I hope I'll find time for HexBlocker soon.

Best
Nicolas

aminem January 14, 2015 05:45

Dear Nicolas,

You have done very good work. I have tried it on Ubuntu 14.04 and OF 2.3.0 and it works well. Have you done some new amelioration on HexBlocker. Have you done some tutorials that can help the users. I think it can be a good free alternative solution of ICEM in the future.

Best Regards

nsf January 14, 2015 15:32

Hi Amine thank you for the kind words.

I haven't touch the code in about a year. I've had other spare time projects that have taken up all my time. If I do restart the work on hexblocker I'll most likely rewrite it in python using pyqt and vtk. Maybe, if I have to, some work in C++. Python is just so much easier to work with.

If you find any bugs let me know. If it doesn't take to much time I'll try to fix it.

Best regards
Nicolas

aminem January 23, 2015 06:41

Dear Nicolas,

The modification of edges and arc is very difficult. Selecting an edge remains difficult and its color does not always change to red. I think the change should be displayed edges discontinuous.

Another thing is that you can change the
number of mesh on an existing block (simpleGrading edition).

Best Regards

Amine

nsf February 15, 2015 05:57

Hi,

Yes, I know selecting edges is difficult. I haven't figured out a good way to set the size (radius) of the edges. Thicker radius means easier selection but at the expense of visibility. Say you have a thin 2D structure thick edges will make things really difficult.

Handling the arcs was one of the latest things I did with the code. Sadly I haven't found time lately to work with the code. And it's kind of where I left of.

However you are more than welcome to fork the code and give it a try to fix it. In that case I can help you.

Nicolas

wyldckat March 21, 2015 10:37

Greetings to all!

@Nicolas: I've created a basic wiki page for to help getting hexBlocker even more well known to the community that uses OpenFOAM technology: http://openfoamwiki.net/index.php/Contrib/hexBlocker

May you or anyone else feel free to update that wiki page! Although I guess that it would be best for people to directly provide content to hexBlocker's own wiki: https://github.com/nicolasedh/hexBlocker/wiki

Best regards,
Bruno


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