CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[Other] HexBlocker a GUI for blockMeshDict, alpha release

Register Blogs Community New Posts Updated Threads Search

Like Tree52Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2013, 13:30
Default HexBlocker a GUI for blockMeshDict, alpha release
  #1
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Foamers!

I've been developing a GUI for blockMesh and I think it's ready for an early alpha release (under GPL). For now it goes under the name of hexBlocker. It's written in C++ and is based on Qt and VTK. I've attached a couple of screenshots. As of now hexBlocker has the following features and limitations
  • Reading and writing blockMeshDict files. It uses it's own import/export functions and hence doesn't support parameters nor coded blocks.
  • There's a “revert action” (ctrl-R) that rereads the blockMeshDict from a file. This makes it easy to simultaneously edit via a text-generator.
  • Create hexagonal blocks(wedges are not supported) from two points or through extruding a patch.
  • Set boundary conditions by selecting patches.
  • Move vertices and setting their position,
  • Setting the number of cells on each parallel (or dependent) edge. Grading is not yet supported but is one of the top things on the todo-list.

If you'd like to try it out you'll need to clone it with git and compile. Don't worry there's a script included. If you can compile OpenFOAM and ParaView then you have all the required dependencies. Listed below are the packages I needed on a more or less clean install of Ubuntu 12.04.

Code:
sudo apt-get install git cmake qt4-dev-tools libqt4-dev libxt-dev
To install open up a terminal and go to some directory where you want it.
Code:
git clone git://github.com/nicolasedh/hexBlocker
cd hexBlocker
./install.sh
The install.sh script will download and compile vtk-5.10.0 and then proceed to compiling hexBlocker. I really recommend that you review the script before running it. It should work for Ubuntu 12.04 but I take no responsibility if this causes your computer to crash, the international bank system to collapse or wastes your time.

Bear in mind that this is a spare time project. The intention was for me to learn some C++ outside OpenFOAM nevertheless I think hexBlocker might evolve to something useful. If you'd like to chip in just send me an PM or email.

HexBlocker is not not endorsed by, approved by nor affiliated with anyone but me. OpenFOAM(R) is a trademark of OpenCFD.
Attached Images
File Type: jpg hexBlockerWithGedit.jpg (67.8 KB, 1251 views)
File Type: jpg setEdges.jpg (54.6 KB, 1071 views)
File Type: jpg cylinderBCs.jpg (57.4 KB, 1103 views)
hannes, lakeat, linnemann and 31 others like this.
nsf is offline   Reply With Quote

Old   March 18, 2013, 06:40
Default
  #2
Senior Member
 
Join Date: Dec 2011
Posts: 111
Rep Power: 19
haakon will become famous soon enough
Wow, this looks really nice. This is a really useful tool, because you can make a lot of different high-quality meshes with blockMesh, but it's not very user-friendly. However, I get a build error:

Code:
[ 48%] Building CXX object CMakeFiles/HexBlocker.dir/HexPatch.cpp.o
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp: In member function ‘void HexBlock::initPatches()’:
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp:382:32: error: taking address of temporary array
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp:384:32: error: taking address of temporary array
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp:386:32: error: taking address of temporary array
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp:388:32: error: taking address of temporary array
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp:390:32: error: taking address of temporary array
/home/haakon/Downloads/hexBlocker/src/HexBlock.cpp:392:32: error: taking address of temporary array
make[2]: *** [CMakeFiles/HexBlocker.dir/HexBlock.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/HexBlocker.dir/all] Error 2
make: *** [all] Error 2
error in make for hexBlocker
I have not yet looked into it myself, but I thought you wanted to know. The system is Linux mint 14, which is the same codebase as Ubuntu 12.10.
haakon is offline   Reply With Quote

Old   March 18, 2013, 12:59
Default
  #3
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi,

Thank you for trying out the code!

I would seem that newer gcc version don't like the way I was calling the initPatches function. I've pushed a change which I think fixes that issue. I would appreciate if you could pull it and try to recompile. Since my only machine with 12.10 is an old Asus eee. I suspect it will take one day or more to compile vtk on that one.

I was doing

Code:
initPatch((int[4]){0,3,2,1});
Which is not supported and perhaps is not good practice. So instead of sending an temporary array I just changed the code to use four ints.

Code:
initPatch(0,3,2,1);
Please let me know if you have any other issues!

Best

Nicolas

Edit: I just noted Hĺkon already had submited a patch on gitHub. I noticed it after I submited the same fix. Thanks again Hĺkon!

By the way, I found a bug which caused extrude patch to misbehave. I've submitted a fix and also added the possibility to load a blockMeshDict from the commandline.

Last edited by nsf; March 18, 2013 at 16:15. Reason: noted a Hĺkons pull request on gitHub
nsf is offline   Reply With Quote

Old   April 10, 2013, 15:40
Lightbulb New features
  #4
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi all,

Just wanted to let you know that I've implemented a couple of new features.
  • It's now possible to set grading on edges.
  • There's a calculator button which calculates the cell sizes on the edge. It uses the tool by Markus Hartinger which he posted here:
    http://www.cfd-online.com/Forums/ope...alculator.html
  • It's possible to delete blocks.
  • It's possible to change the visibility of block, patches and edges.

I have no experience with packaging, if anybody would like to chip in please send a pm or reply to this thread.

Best
Nicolas
Attached Images
File Type: jpg gradingAndCalc.jpg (42.0 KB, 569 views)
JR22, Paulli and agnip like this.
nsf is offline   Reply With Quote

Old   April 15, 2013, 14:36
Default
  #5
New Member
 
Join Date: Feb 2010
Posts: 28
Rep Power: 16
Pekka is on a distinguished road
Cool !

Thanks for your efforts developing very useful tool. Unfortunately I cannot compile it, pls. find the attached log file, maybe it helps find reason for the error.

BR/Pekka
Attached Files
File Type: zip log.zip (52.8 KB, 19 views)
Pekka is offline   Reply With Quote

Old   April 15, 2013, 15:13
Default Possible fix commited
  #6
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Pekka!

Thanks for trying out the program and the comment!.
I've built and tested hexBlocker with qt-2.8.1 I see from the log file that you are using qt-4.7.4.

The first error you're getting is

Code:
/home/Pekka/OpenFOAM/Pekka-1.6-ext/applications/hexBlocker/src/GradingCalculatorDialog.cpp: In constructor ‘GradingCalculatorDialog::GradingCalculatorDialog(QWidget*)’:
/home/Pekka/OpenFOAM/Pekka-1.6-ext/applications/hexBlocker/src/GradingCalculatorDialog.cpp:38: error: no matching function for call to ‘QDoubleValidator::QDoubleValidator(double, double, int)’
/home/Pekka/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/qt-everywhere-opensource-src-4.7.4/platforms/linux64GccDPOpt/include/QtGui/qvalidator.h:174: note: candidates are: QDoubleValidator::QDoubleValidator(const QDoubleValidator&)
/home/Pekka/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/qt-everywhere-opensource-src-4.7.4/platforms/linux64GccDPOpt/include/QtGui/qvalidator.h:169: note:                 QDoubleValidator::QDoubleValidator(double, double, int, QObject*, const char*)
/home/Pekka/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/qt-everywhere-opensource-src-4.7.4/platforms/linux64GccDPOpt/include/QtGui/qvalidator.h:168: note:                 QDoubleValidator::QDoubleValidator(QObject*, const char*)
/home/Pekka/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/qt-everywhere-opensource-src-4.7.4/platforms/linux64GccDPOpt/include/QtGui/qvalidator.h:145: note:                 QDoubleValidator::QDoubleValidator(double, double, int, QObject*)
/home/Pekka/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/qt-everywhere-opensource-src-4.7.4/platforms/linux64GccDPOpt/include/QtGui/qvalidator.h:144: note:                 QDoubleValidator::QDoubleValidator(QObject*)
It would seem that the constructor I'm using doesn't exists in qt-4.7.4. From what I can find QDoubleValidator also needs an reference to it's parent in qt-4.7. I've added that and commited and pushed. Since I don't have an older version of qt here it gets difficult to test that this fixes all issues with qt-4.7. Could you please try again and see if that fixes everything? Just run

Code:
git pull
from the hexBlocker directory. Then you can rerun the install.sh. (or just the relevant part of the script.)

If you'd like to chip in I recommend installing qt-creator. And then just go to open project and select the file CMakeLists.txt. Qtcreator will ask you to run cmake (which you'll need to install). It will also prompt you for extra variables. Add
Code:
-DVTK_DIR=pathtoHexBlocker/vtk
Best
Nicolas

Last edited by nsf; April 15, 2013 at 15:13. Reason: typo
nsf is offline   Reply With Quote

Old   April 16, 2013, 05:13
Default
  #7
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
Looks like a great tool! But unfortunately I am stuck in the installation process.
Please pardon my low linux skills.

For those of you using OpenSUSE 12.3 and being as ignorant as I was, here are some minor changes that helped me.

1) Some package names mentioned in README-install.txt are different
libqt4-dev ---> libqt4-devel
zlib1g-dev ---> zlib-devel
libreadline-dev ---> readline-devel
libncurses-dev ---> ncurses-devel
libxt-dev ---> libXt-devel

2) In install.sh change
MOC=$(which moc-qt4) ---> MOC=$(which moc)
UIC=$(which uic-qt4) ---> UIC=$(which uic)

No problems occured during the compilation of vtk.
However, I tried running bin/HexBlocker but I got the message

Code:
./bin/HexBlocker: error while loading shared libraries: libvtkftgl.so.5.10: cannot open shared object file: No such file or directory
What do I need to change to detect the fresh compiled library? Thanks in advance.
startingWithCFD is offline   Reply With Quote

Old   April 16, 2013, 13:09
Default
  #8
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hey,

Thank you for the note about the required packages! I'll add them to the README-file.

I'll also improve the install script. I've made the following changes:
Code:
MOC=$(which moc-qt4 moc | head -n1)
UIC=$(which uic-qt4 uic | head -n1)
This way it will take moc-qt4 if it finds one. Else it will take moc. Hopefully it finds qt on OpenSUSE as well.

As for the third point. Are you sure that vtk compiled? Is the missing library present? What does
Code:
find -name libvtkftgl.so.5.10
tell you? (run it from the install dir).

If the library is present then cmake probably hasn't done it's job or something else went wrong. Maybe you moved the executable after compilation? The location of the vtk libraries used by HexBlocker are relative to the executable. You may move the entire install directory but you can't move HexBlocker with respect to the vtk folder.

If the library is present you can try to set LD_LIBRARY_PATH or LD_PRELOAD with the absolute path to the vtk libraries.

Code:
 LD_LIBRARY_PATH=/absolute/path/to/vtk/lib/vtk-5.10 HexBlocker
You would use LD_PRELOAD with the same syntax but you would have to set all libraries that can be found.

If the library isn't present then VTK did not compile. You'll have to investigate that.

I'll go on a two week vacation now so I'll be "afk". I might have time to answer a question or two but don't count on it. I'll be back the 2nd of May.

Best

Nicolas
nsf is offline   Reply With Quote

Old   April 16, 2013, 13:25
Default
  #9
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
Are you still there?? I hope I caught you before leaving! :-D

The find command returns:
./vtk/lib/vtk-5.10/libvtkftgl.so.5.10
./build/VTK/bin/libvtkftgl.so.5.10
./build/VTK/Utilities/ftgl/CMakeFiles/CMakeRelink.dir/libvtkftgl.so.5.10

I did not move anything. I will check the rest tomorrow.
Thanks for the answer!
startingWithCFD is offline   Reply With Quote

Old   April 16, 2013, 15:06
Default
  #10
New Member
 
Join Date: Feb 2010
Posts: 28
Rep Power: 16
Pekka is on a distinguished road
Hi Nicolas !

Thanks for your quick reply. Now it compile by using "install.sh" and I can tested it. I tried also build project with QT Creator 2.4.1 and found the following type of problem:

BR/Pekka
Attached Images
File Type: jpg QT_error.jpg (24.3 KB, 196 views)
Pekka is offline   Reply With Quote

Old   April 16, 2013, 16:01
Default
  #11
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi,

I'm backing the bags so be out soon but I'm still here.

I can't be sure what the problem is. Are you using an older version of cmake?

You could try to compare the output of
Code:
ldd bin/HexBlocker | grep ibvtkftgl.so.5.10
Is the path correct? If not try setting LD_LIBRARY_PATH.

Best
Nicolas
nsf is offline   Reply With Quote

Old   April 16, 2013, 16:08
Default
  #12
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Pekka,

I'm also using qtcreator 2.4.1 so that shouldn't be the problem. If you go to help->about Qtcreator. What Qt-version is it using?

From the documentation I see that "setPlaceholderText()" was introduced in Qt4.7. Most likely your qt-creator has not found the custom compiled qt you are using when you compile HexBlocker. It's probably possible to "point" QtCreator to a custom compilation of Qt. I don't know how though.

Best
Nicolas
nsf is offline   Reply With Quote

Old   April 17, 2013, 03:15
Default
  #13
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
Ok, I updated my LD_LIBRARY_PATH variable by adding the following line to ~/.bashrc:

Code:
export LD_LIBRARY_PATH=/home/username/OpenFOAM/hexBlocker/vtk/lib/vtk-5.10:$LD_LIBRARY_PATH
Now the executable works! Thanks for the help!
I will provide feedback about the program as soon as I get a bit more familiar with it.
startingWithCFD is offline   Reply With Quote

Old   June 11, 2013, 09:11
Default Installation
  #14
New Member
 
Join Date: Sep 2012
Posts: 1
Rep Power: 0
lksz is on a distinguished road
Hi,
Use Ubuntu 12.04 LTS and during the installation process after the command:

Code:
./install.sh
I got:

Code:
/bin/bash^M: bad interpreter:     no such file or director
It can be easily fixed by:

Code:
dos2unix install.sh
nsf and holodeck10 like this.
lksz is offline   Reply With Quote

Old   June 11, 2013, 17:18
Default
  #15
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Quote:
Originally Posted by lksz View Post
Hi,
Use Ubuntu 12.04 LTS and during the installation process after the command:

Code:
./install.sh
I got:

Code:
/bin/bash^M: bad interpreter:     no such file or director
It can be easily fixed by:

Code:
dos2unix install.sh
Hi, lksz and congratulations on your first post!

I played around with some settings with git and it borked end of line characters.

I've fixed it in the latest commit (hopefully). Your welcome to try it out.

Best
Nicolas
nsf is offline   Reply With Quote

Old   June 11, 2013, 17:22
Default New Features
  #16
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi all,

I've implemented a couple of more features.

It's now possible to create arcs on edges. HexBlocker will read and write arc and line but will ignore polyLines, simpleSpline and polySpline.

You can select a patch and optionally a radius and HexBlocker will calculate the third arc point for you.

Just update with git clone or follow the steps in the first post.

Best
Nicolas
nsf is offline   Reply With Quote

Old   June 24, 2013, 05:59
Default blockMeshDict format
  #17
New Member
 
Peter Reupke
Join Date: Jun 2013
Posts: 3
Rep Power: 12
Entropete is on a distinguished road
Hi Nicolas

As a newcomer to OpenFoam (and returning to CFD after many years) I've found your GUI very useful - initially for debugging meshes and then for creating them. Many thanks for your efforts.

I have just one little request: when writing the blockMeshDict file, it would be help readability and text editing if a CR or LF (as appropriate) were inserted after each hex () declaration. On my system (Ubuntu 12.04, OF 2.2) all the blocks are on one line.

Peter
nsf likes this.
Entropete is offline   Reply With Quote

Old   June 24, 2013, 12:18
Default
  #18
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Peter and welcome to the forums!

Thank you for trying out the code and giving feed back.

I'v committed and pushed a change which adds line breaks between blocks.

Recently I've been busy with other spare time projects so there has been little activity. My plan is to add support for splines and lines. After that I'll look in to splitting blocks. I'll just have to find the time. There is summer time in Sweden so there are other activities with higher priorities right now =)

Let me know if you encounter other issues.

Best

Nicolas

Ps to update just run

Code:
git pull
./install.sh
And everything should be recompiled.
Entropete likes this.

Last edited by nsf; June 24, 2013 at 12:19. Reason: Note on how to update
nsf is offline   Reply With Quote

Old   July 5, 2013, 10:04
Thumbs up Feedback
  #19
New Member
 
Peter Reupke
Join Date: Jun 2013
Posts: 3
Rep Power: 12
Entropete is on a distinguished road
Nicolas

Many thanks for that little change - it makes it a lot easier to use a text editor alongside the GUI.

Enjoy your Swedish summer and don't spend too much time at the computer!

I know it's an Alpha release, but I hope you won't mind if I report a few bugs and observations about the program's behaviour, in case you haven't found them yourself. (all these relate to the latest version with OF 2.2 and Ubuntu 12.04).

Bugs
----
1. Edges on the slave block don't move to the correct position after patches are merged. Work around: save and reload file.
2. Simplegrading values of less than 1 often get overwritten as 0. I haven't yet worked out when this behaviour occurs.
3. On one occasion, the program reordered the vertices in a file that I had started in a text editor. I haven't had a repeat, but I haven't been trying to recreate it.
4. Occasional crashes (but very rare).

Problems that aren't strictly bugs
--------------------------------
1. Extruding adjacent patches to create adjacent blocks creates duplicate vertices even if the patches are extruded by the same distance. This creates non-empty internal patches (i.e. baffles) that are tricky to remove. If it is possible to code it easily, it would be great to be able to extrude a multiple selection of patches at one go to avoid this problem.
2. No delete vertices tool (this might help solve the first problem), but would also need vertices to be renumbered throughout.
3. Manually entered comments are lost when saving from hexBlocker.

And to finish on a positive note:
Things that are brilliant!
-----------------------
1. Being able to select all the dependent edges in one go and change the mesh size and grading for all of them.
2. Defining boundary conditions for multiple patches by clicking on them - no more trying to think inside the box!

Peter
nsf likes this.
Entropete is offline   Reply With Quote

Old   July 5, 2013, 12:39
Default
  #20
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Peter, thanks for the feedback, I do appreciate it!

I was aware of bugs 1 and 4. I can't recreate number 4 it could be a race condition where the code starts a rerender and then starts a second rerender before the first completes. If you find a way to recreate the crashes please let me know. The first was introduced when I enabled arcs I haven't found the time to work on it. The fix should be easy.

Bug 2 is interesting. I haven't seen it before, does it get replaced in the GUI or in the blockMeshDict or both?

If you can find a way to repeat bug 3 I'm interested. I'll keep an eye out for it. There is no intentional reordering of vertices, the Ids are only changed when merging patches. It could perhaps be related to bug 1.

Semi bug 1: I've noticed this as well when I coded the extrude algorithm. I can't really get my head around how one would extrude them simultaneously. One would have to search all other patches that also extruded and check if they share a vertice. And then I'm not sure how to continue.

Semi bug2: This is intentional, the idea is to simplify block creation by eliminating the need to manually create (or delete) patches, edges and vertices. The code should do this for you.

Semibug3: Well, currently the entire file is rewritten and comments are filtered out. I think it would take quite a bit of coding to be able to save all comments. Also polyLines, simpleSplines and polySplines will be overridden.

I could create a table of vertices, where there position is edited manually. This would provide a work around for semibugs 1:3. No real need to work simultaneously with a text editor

If you have ideas and wan't to help out I'm willing to help and explain what the code does. I've put some effort in keeping the code well documented so others could chip in.

And thanks for the positive feedback! I'm glad you find hexBlocker use full!

Best
Nicolas
nsf is offline   Reply With Quote

Reply

Tags
blockmesh, gui, mesh, pre-processing


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANSYS Workbench on "Uncertified" Linux Distros hsr CFX 289 April 20, 2023 09:23
New CastNet Release: GUI Environment for OpenFOAM and CalculiX MartinB OpenFOAM Announcements from Other Sources 0 January 13, 2017 10:27
alphaEqn.H in twoPhaseEulerFoam cheng1988sjtu OpenFOAM Bugs 15 May 1, 2016 16:12
New CastNet release: GUI environment for OpenFOAM® ulli OpenFOAM Announcements from Other Sources 1 July 31, 2013 06:25
Openfoam Ubuntu 12.04 Unmet dependencies slls33 OpenFOAM Installation 10 April 9, 2013 04:16


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