|
[Sponsors] |
[blockMesh] BananaSplit helper for OpenFOAM blockMesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 19, 2012, 22:53 |
BananaSplit helper for OpenFOAM blockMesh
|
#1 |
Member
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15 |
I've been using blockMesh for my simulations, but have found that even with m4 scripting, geometry definition can be tedious and error prone. I spent some time last week and put together a MATLAB program (BananaSplit) to generate blockMeshDict files. Right now, it only works for hexahedra with unity cell gradings that are aligned with the principal axes. I know this is pretty restrictive, but it's a start.
BananaSplit reads a definition file where each domain block is defined simply by two corner points, the boundary groups on the six faces (West, North, East, South, Bottom, Top), and number of cells in each direction. An example block line would look like: Code:
block(0,0,0,1,1,1,walls,moving,walls,walls,walls,walls,10,10,1); Code:
BananaSplit('input file name', 'output blockMeshDict file name'); I hope this is helpful to other folks as well. I have attached the code, which is released under the BSD license. Please let me know if you find any bugs, or have added new functionality. Last edited by liquidspoon; October 21, 2012 at 11:46. |
|
October 20, 2012, 10:58 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
Interesting to do this with Matlab, but it is really nice that you're sharing this with the community. Maybe it's worth putting it on the Wiki as well, to be easier found:
http://openfoamwiki.net/index.php/Main_Page Why did you call it BananaSplit? |
|
October 20, 2012, 16:30 |
|
#3 |
Member
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15 |
Maybe MATLAB isn't the optimal choice, since not everyone has licenses. I just used it to get some quick and dirty code working. The code could probably be tweaked to work in Octave.
I could definitely put an entry on the Wiki - I hope it helps other folks too. It's called BananaSplit because it splits up blocks so that they share full faces (banana for no particular reason). |
|
August 1, 2013, 09:46 |
|
#4 |
Member
david
Join Date: Jun 2013
Location: Montreal, Canada
Posts: 62
Rep Power: 12 |
Good Day liquidspoon,
Its possible to incorporate Matlab script with blockmesh by using Banana-split? I have set of data (xyz) in matrix format, i did small script in mat lab, I want to create blockMesh, kindly guide me. please see the attachment for your perusal.
__________________
Million Thanks, David "Small Dream is a Crime" Last edited by psk; August 12, 2013 at 03:33. |
|
August 1, 2013, 11:22 |
Generating blockMeshDict
|
#5 |
Member
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15 |
Hi psk,
I'm not entirely sure what you want to do in blockMesh, but it looks like a triangular domain. This can be tricky because blockMesh generally works in hexahedra, and singularities or poorly quality cells can arise if you try to fit them into a triangular domain. Maybe look at Gmsh for generating triangular prism cells. If you want to stick with blockMesh, take a look at the "WriteBlockMeshDict.m" function in the attached code from the start of the thread. It should be a nice outline for generating a valid blockMesh dict file. |
|
August 1, 2013, 11:55 |
Example domain generated with BananaSplit
|
#6 |
Member
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15 |
By the way: Here is an example domain I generated with BananaSplit that shows when this code could be useful.
This was for a simulation of a manifold/fluid distributer with two rectangular input ports on the left side, and numerous outlet ports along the lower portion. Generating this requires a huge blockMeshDict (230 kb) since every block must be split up to only meet others on full patches. Using BananaSplit, I just worked from a short list of blocks defined by bounding corners (9 kb). |
|
August 1, 2013, 13:07 |
|
#7 |
Member
david
Join Date: Jun 2013
Location: Montreal, Canada
Posts: 62
Rep Power: 12 |
Thanks for your reply & Information Alex,
Sorry I am not telling briefly, that's not domain, it is flapping wing.I will tell you briefly, what i did. My area of interest is flapping flexible wing, for that using camera to capture wing motion by frame by frame, the output is .csv file format with set of xyz data. If you see inside csv file, the 1st row gives first frame[xyz of point 1,2,3 (ie).1st frame image], 2nd row gives 2nd frame [xyz of point 1,2,3(ie).2nd frame image) similarly up to last. I did small program in Matlab to replicate my wing. I don't how to make blockMeshDict for this problem.I am thinking by using these coordinates or script to make loop inside the blockMesh is somewhat easy to replicate the wing.( ie wing is inside the Domain) Kindly guide me how to make blockMeshDict (its something looks like moving/dynamic mesh) Is there any possibility to create blockMeshDict by using Matlab?
__________________
Million Thanks, David "Small Dream is a Crime" |
|
August 1, 2013, 13:26 |
|
#8 |
Member
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15 |
Hi psk,
What you are trying to do is quite a large feat, and I don't think I can just tell you how to do it (blockMesh is definitely insufficient). This sounds like a substantial research project, and I would recommend that you consult the literature on immersed boundary methods or moving mesh interfaces. Maybe you should start a separate thread specifically about your project to get better advice about where to begin. |
|
August 2, 2013, 03:13 |
|
#9 |
Member
david
Join Date: Jun 2013
Location: Montreal, Canada
Posts: 62
Rep Power: 12 |
Thanks Alex
__________________
Million Thanks, David "Small Dream is a Crime" |
|
October 9, 2014, 01:38 |
BananaSplit
|
#10 |
New Member
Zhenquan Li
Join Date: Oct 2012
Location: Australia
Posts: 6
Rep Power: 14 |
Thanks Alex for the sharing the files.
I would like to know if you have a program in Matlab which writes out mesh files (boundary, neighbour, owner, points, faces) in OpenFOAM from a mesh generated in Matlab. I understand this is a BIG job. I have adaptive mesh refinement criteria implemented in Matlab and have achieved positive results for the accuracy verification. My refined meshes are not in structured blocks so cannot use BananaSplit . |
|
October 11, 2014, 12:55 |
|
#11 |
Member
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15 |
Unfortunately I don't have a code that writes out the full mesh definition in the OpenFOAM format. The BananaSplit code just generates a valid blockMeshDict file.
It would be a bit tedious, but not terribly difficult to write your own code to generate an OpenFOAM mesh (list all the points, the face orderings, the cells, the face-owners, and face-neighbors, and boundaries). Alternatively you could try generating your mesh in a simpler file format (e.g. gmsh: http://people.sc.fsu.edu/~jburkardt/...h/t13_data.msh) and using one of the built-in OpenFOAM converters. |
|
Tags |
blockmesh, meshing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] blockMesh issue on openfoam6 startup - ubuntu 16.04 | bjdarrer | OpenFOAM Installation | 7 | August 25, 2020 20:15 |
Is Playstation 3 cluster suitable for CFD work | hsieh | OpenFOAM | 9 | August 16, 2015 15:53 |
[blockMesh] External flow around cube with blockMesh | Woody8 | OpenFOAM Meshing & Mesh Conversion | 0 | March 31, 2015 15:54 |
[blockMesh] set of xyz data in blockMesh | psk | OpenFOAM Meshing & Mesh Conversion | 12 | August 27, 2013 09:37 |
Blockmesh cavity error message | tonitoney | OpenFOAM Installation | 2 | March 17, 2008 12:59 |