CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Meshing & Mesh Conversion

HexBlocker a GUI for blockMeshDict, alpha release

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree9Likes
  • 8 Post By nsf
  • 1 Post By nsf

Reply
 
LinkBack Thread Tools Display Modes
Old   March 17, 2013, 14:30
Default HexBlocker a GUI for blockMeshDict, alpha release
  #1
nsf
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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, 76 views)
File Type: jpg setEdges.jpg (54.6 KB, 76 views)
File Type: jpg cylinderBCs.jpg (57.4 KB, 83 views)
hannes, linnemann, elvis and 5 others like this.
nsf is offline   Reply With Quote

Old   March 18, 2013, 07:40
Default
  #2
Member
 
Håkon Strandenes
Join Date: Dec 2011
Location: Norway
Posts: 53
Rep Power: 3
haakon is on a distinguished road
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, 13:59
Default
  #3
nsf
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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 17: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
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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:
    BlockMesh grading calculator
  • 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, 43 views)
JR22 likes this.
nsf is offline   Reply With Quote

Old   April 15, 2013, 14:36
Default
  #5
New Member
 
Join Date: Feb 2010
Posts: 23
Rep Power: 5
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, 1 views)
Pekka is offline   Reply With Quote

Old   April 15, 2013, 15:13
Default Possible fix commited
  #6
nsf
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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
New Member
 
Join Date: Nov 2012
Posts: 24
Rep Power: 2
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
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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
New Member
 
Join Date: Nov 2012
Posts: 24
Rep Power: 2
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: 23
Rep Power: 5
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, 9 views)
Pekka is offline   Reply With Quote

Old   April 16, 2013, 16:01
Default
  #11
nsf
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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
Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 36
Rep Power: 5
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
New Member
 
Join Date: Nov 2012
Posts: 24
Rep Power: 2
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

Reply

Tags
blockmesh, gui, mesh, pre-processing

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANSYS Workbench on "Uncertified" Linux Distros hsr CFX 212 April 13, 2013 05:24
Openfoam Ubuntu 12.04 Unmet dependencies slls33 OpenFOAM Installation 10 April 9, 2013 04:16
New CastNet release: GUI environment for OpenFOAM® ulli OpenFOAM Announcements from Other Sources 0 January 8, 2013 15:14
alphaEqn.H in twoPhaseEulerFoam cheng1988sjtu OpenFOAM Bugs 14 September 18, 2011 13:46
Alpha to be phased out Heiko Gerhauser Main CFD Forum 17 July 25, 2001 14:40


All times are GMT -4. The time now is 21:28.