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

[blockMesh] Extend blockMesh with smoothing capability

Register Blogs Community New Posts Updated Threads Search

Like Tree38Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 24, 2015, 16:20
Default
  #21
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Hello,

really promising tool. I recently started playing around with it. I am just wondering how the block stuctures are created? The tutorial consists of several blocks with a quite complex blocking. Are there tools out to create this?

Edit: After first tests I have some issues: extBlockMesh crashes:
Code:
  Analyse features
      - Number of feature points:  14
      - Number of edge points:     1203
      - Number of boundary points: 31357
      - Number of interior points: 312543

Smoother initialized in 21.05 s

Smooth the mesh

| Iteration | Mean qual | Min qual  |    Time   |Smooth type|Nb pts move| Nb relax  |Nb unsnaped|
|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
|         0 |   0.6903  |   0.3521  |    0.00   |    mean   |         0 |         0 |         0 |
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib64/libc.so.6"
#3  Foam::SmootherCell::tetCellQuality(int) const at ??:?
#4  Foam::SmootherCell::computeQuality() at ??:?
#5  Foam::MeshSmoother::analyseMeshQuality(Foam::HashSet<int, Foam::Hash<int> > const&) at ??:?
#6  Foam::MeshSmoother::iterativeNodeRelaxation(Foam::HashSet<int, Foam::Hash<int> >&, Foam::List<double> const&) at ??:?
#7  Foam::MeshSmoother::GETMeSmoothing() at ??:?
#8  Foam::MeshSmoother::runIteration() at ??:?
#9  Foam::MeshSmoother::update() at ??:?
#10  ? at ??:?
#11  __libc_start_main in "/lib64/libc.so.6"
#12  ? at ??:?
blockMesh runs without problems on this case (OF2.3.x). I can provide the blockMeshDict to reconstruct if somebody is interested. Additionally I tried running hexMeshSmother on the same case after running blockMesh. This is not crashing but it ssems to hang around in an endless loop.
bastil is offline   Reply With Quote

Old   January 25, 2016, 02:52
Default
  #22
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Hello Bastil,

Sorry for the delay with my answer.
If it's not confidential, could you share the BlockMeshDict please?

Thanks in advance!

Nathanaël.
nathanael is offline   Reply With Quote

Old   August 25, 2016, 05:04
Default
  #23
Member
 
Petr Furmanek
Join Date: Jan 2012
Location: Faenza, Italy
Posts: 66
Rep Power: 14
petr.f. is on a distinguished road
Very nice tool indeed! Just btw. has anyone tried to compile it under OpenFOAM 3 of 4? So far I haven't been successful - gettin the error

ake/linux64GccDPInt32Opt/Point/Features/SmootherSurface.o Make/linux64GccDPInt32Opt/BoundaryLayer/SmootherBoundaryLayer.o -L/opt/OpenFOAM/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib \
-lblockMesh -lmeshTools -ledgeMesh -lfiniteVolume -ldynamicMesh -o /home/furmanek/OpenFOAM/furmanek-3.0.x/platforms/linux64GccDPInt32Opt/lib/libMeshSmoother.so
g++: error: Make/linux64GccDPInt32Opt/MeshSmoother.o: No such file or directory
g++: error: Make/linux64GccDPInt32Opt/SmootherBoundary.o: No such file or directory
g++: error: Make/linux64GccDPInt32Opt/SmootherControl.o: No such file or directory

...
petr.f. is offline   Reply With Quote

Old   August 25, 2016, 05:20
Default
  #24
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
I compiled it using OpenFoam-dev, 9 months ago. Therefore, I think it should work with OF-3 at least. You can try it.
https://github.com/HIKassem/extBlockMesh
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   August 25, 2016, 06:01
Default
  #25
Member
 
Petr Furmanek
Join Date: Jan 2012
Location: Faenza, Italy
Posts: 66
Rep Power: 14
petr.f. is on a distinguished road
Perfect - this one works. Thanks a lot!
petr.f. is offline   Reply With Quote

Old   February 13, 2017, 14:38
Default
  #26
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14
tiam is on a distinguished road
Seems like a great tool!
For me wmake would not run under OF 3.0.1 until I renamed all .cpp files to .C, then compilcation went without problems. I guess it is best to stick with the OF defaults.

I'm trying to run the hexMeshSmoother on a case, but can't quite get past the first iteration.. Are there any general guidelines for the parameters?

Best,
Timofey
tiam is offline   Reply With Quote

Old   February 13, 2017, 14:39
Default
  #27
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14
tiam is on a distinguished road
Quote:
Originally Posted by hk318i View Post
I compiled it using OpenFoam-dev, 9 months ago. Therefore, I think it should work with OF-3 at least. You can try it.
https://github.com/HIKassem/extBlockMesh
Ah, it seems like Hassan did the same thing .
tiam is offline   Reply With Quote

Old   February 24, 2017, 10:48
Default
  #28
New Member
 
Scotland
Join Date: Dec 2014
Posts: 2
Rep Power: 0
asilva is on a distinguished road
Hi guys,

First extBlockMesh seems to be a great tool.

I'm trying to mesh a geometry similar with a sphere (with an indentation in the front), with a cube in the middle and more six blocks. My initial geometry is a cube inside other, with the second one with curved edges, and then I use the extBlockMesh to intersect the .stl with my final geometry.

If I use the same number of cells in all the directions, it gives me a good result (in the picture mesh1 it has 20 cells in each direction for all the blocks). However I want to have the same length size for the radial direction, or even smaller ones close to the wall. When I try to use simpleGrading for that, it doesn't make any difference, no matter the value I put for the radial direction, in the end I always end up with the same mesh.

So I tried to increase the number of cells in the radial direction to see if I could get smaller cells close to the boundary. Instead of that the cube in the middle got smaller but the size of the cells next to the walls is exactly the same (see picture mesh2).

After several tests I concluded that the simpleGrading in the blockMeshDict, doesn't help me, because no matter what value I use, for the same number of cells I end up with the same mesh.

Do you know if there's something that I can play with in the smotherDict to help me to have cells with the same length in the radial direction? or even with a grade that allows me to have more refined meshes close to the wall?

Thanks in advance!
Attached Images
File Type: jpg mesh1.jpg (146.8 KB, 166 views)
File Type: jpg mesh2.jpg (146.1 KB, 158 views)
asilva is offline   Reply With Quote

Old   January 10, 2018, 18:19
Default MeshSmoother in parallel
  #29
Senior Member
 
Robert Castilla
Join Date: Apr 2009
Location: Spain
Posts: 109
Rep Power: 17
rcastilla is on a distinguished road
Dear all,
This is the tool I was looking for. I need it with a dynamic mesh that is becoming very distorted with the laplacian velocity motion solver. My main problem now is that the MeshSmoother library is not prepared for parallel computation. I am not an expert in OpenFoam programming, so I don't feel really skilled to implement that. Would it be difficult?
With best regards
Robert
rcastilla is offline   Reply With Quote

Old   February 28, 2019, 08:25
Default
  #30
Member
 
Henrik Johansson
Join Date: Oct 2017
Location: Gothenburg
Posts: 38
Rep Power: 8
HenrikJohansson is on a distinguished road
Hi,

Great addition to the blockMesh. Good work!

I have now successfully compiled it with OpenFOAM 5.0. The tutorial case runs great.

But running my mesh I get the following error:
Code:
Initialize smoother algorithm

  smoothControls:
    - Max iterations             : 500
    - Tranformation parameter    : 0.9
    - Mean improvement tolerance : 0.01
    - Max ineffective iteration  : 1
    - Mean relaxation table      : 4(1 0.25 0.125 0)
    - Min relaxation table       : 3(0.25 0.125 0)
    - Snap relaxation table      : 6(1 0.5 0.25 0.1 0.05 0)

  snapControls:
    - Feature angle              : 152
    - Min edges for features     : 0
    - Min feature edge length    : 1e-20
    - Boundary specifications    : 

  Analyse features
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::SmootherBoundary::analyseBoundaryFace(int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > >&, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > >&) at ??:?
#4  Foam::SmootherBoundary::analyseFeatures(Foam::List<Foam::HashSet<int, Foam::Hash<int> > >&, std::set<std::set<int, std::less<int>, std::allocator<int> >, std::less<std::set<int, std::less<int>, std::allocator<int> > >, std::allocator<std::set<int, std::less<int>, std::allocator<int> > > >&) at ??:?
#5  Foam::SmootherBoundary::SmootherBoundary(Foam::dictionary&, Foam::polyMesh*) at ??:?
#6  Foam::MeshSmoother::MeshSmoother(Foam::polyMesh*, Foam::dictionary*, Foam::blockMesh*) at ??:?
#7  ? at ??:?
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9  ? at ??:?
Segmentation fault (core dumped)
After some debugging in the code I found that it's this function that won't work in SmootherBoundary.C:
Code:
iter = p2s.find(f[ptPoly[ptI]]);
Looking into the variable that are passed i get the following:
Code:
 ptI         = 0
 ptPoly      = 3(15990096 15990097 15990098)
 ptPoly[pti] = 15990096
 f           = 4(3320 3325 3355 3350)
Seams like the ptPoly[pti] returns a really large number.
Anyone have any idea to solve this problem?
__________________
/ Henrik Johansson

Last edited by HenrikJohansson; March 4, 2019 at 07:50.
HenrikJohansson is offline   Reply With Quote

Old   March 22, 2019, 08:18
Default
  #31
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
I was quite fond of this meshSmoother. Just a quick note for those trying to compile it under versions 1706 -->1812. It won't work because a constructor in fvMesh was defeatured. You hence need to change the fvMesh class which I wouldn't recommend unless you know what you are doing. It should however be possible to compile with openfoam 5 and 6. You might need to change edgeMesh to surfMesh and the headerOk to typeHeaderOk<....
nathanael likes this.
Bloerb is offline   Reply With Quote

Old   September 17, 2019, 02:55
Question
  #32
New Member
 
Youjiang Wang
Join Date: Apr 2015
Location: Hamburg
Posts: 22
Rep Power: 11
wyj216 is on a distinguished road
Update : solved (by adapting some function names).

Has anyone tried to make this work for the current OpenFoam version. I found the ability in extBlockMesh very useful. But when I compile it with OpenFoam-v1906, I encountered many errors.


To install old version OpenFoam on my computer (openSUSE 15.1) seems also not so easy.


Thanks

Last edited by wyj216; September 17, 2019 at 11:43.
wyj216 is offline   Reply With Quote

Old   September 17, 2019, 03:56
Default
  #33
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Could you please post your compilation output.
nathanael is offline   Reply With Quote

Old   September 17, 2019, 11:43
Default
  #34
New Member
 
Youjiang Wang
Join Date: Apr 2015
Location: Hamburg
Posts: 22
Rep Power: 11
wyj216 is on a distinguished road
Quote:
Originally Posted by nathanael View Post
Could you please post your compilation output.
Thank you for your concern. One experienced colleage has helped me to make it work. Some function names must be updated, but I really do not know the details.


However, I attached the first complilation output after I changed edgeMesh to surfMesh, and also rename *.cpp to *.C (this is necessary on my computer to make wmake work). Hope it helps anyone.



Screenshot_20190917_174547.jpg
wyj216 is offline   Reply With Quote

Old   September 17, 2019, 12:18
Default
  #35
New Member
 
Youjiang Wang
Join Date: Apr 2015
Location: Hamburg
Posts: 22
Rep Power: 11
wyj216 is on a distinguished road
Hi, Nathanaël, I am just try to test it for my case. My case is a 2D foil, the output is quite similar to the errors already encountered by others. As below:


Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Initialize smoother algorithm

  smoothControls:
    - Max iterations             : 500
    - Tranformation parameter    : 0.666
    - Mean improvement tolerance : 0.0001
    - Max ineffective iteration  : 5
    - Mean relaxation table      : 4(1 0.25 0.125 0)
    - Min relaxation table       : 3(0.25 0.125 0)
    - Snap relaxation table      : 6(1 0.5 0.25 0.1 0.05 0)

  snapControls:
    - Feature angle              : 91
    - Min edges for features     : 0
    - Min feature edge length    : 1e-20
    - Boundary specifications    : 

  Analyse features
      - Number of feature points:  10
      - Number of edge points:     1642
      - Number of boundary points: 90254
      - Number of interior points: 0

Smoother initialized in 54.49 s

Smooth the mesh

| Iteration | Mean qual | Min qual  |    Time   |Smooth type|Nb pts move| Nb relax  |Nb unsnaped|
|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
|         0 |   0.1238  |   0.0001  |    0.00   |    mean   |         0 |         0 |         0 |
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in /lib64/libc.so.6
#3  Foam::SmootherCell::tetCellQuality(int) const at ??:?
#4  Foam::SmootherCell::computeQuality() at ??:?
#5  Foam::MeshSmoother::analyseMeshQuality(Foam::HashSet<int, Foam::Hash<int> > const&) at ??:?
#6  Foam::MeshSmoother::iterativeNodeRelaxation(Foam::HashSet<int, Foam::Hash<int> >&, Foam::List<double> const&) at ??:?
#7  Foam::MeshSmoother::GETMeSmoothing() at ??:?
#8  Foam::MeshSmoother::runIteration() at ??:?
#9  Foam::MeshSmoother::update() at ??:?
#10  ? at ??:?
#11  __libc_start_main in /lib64/libc.so.6
#12  ? at /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:122
Floating point exception (core dumped)
Attached are my blockMeshDict and smoothDict. The blockMeshDict was generated by a python script and does not look so nice ~. There is no boundary to snappy.



blockMeshDict.txt
smootherDict.txt

Last edited by wyj216; September 18, 2019 at 02:54.
wyj216 is offline   Reply With Quote

Old   September 18, 2019, 08:10
Default
  #36
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Your setup work well with the latest version which is not shared today. If you give me some mail by pm or so I can send you the polymesh as a tar.gz file (4mo).
nathanael is offline   Reply With Quote

Old   October 2, 2020, 15:29
Default
  #37
New Member
 
anonymous
Join Date: Sep 2017
Posts: 3
Rep Power: 8
Sunsheep is on a distinguished road
Is this still in active development?
BlockMesh/OpenFOAM is really lacking in mesh smoothing functionalities and this tool would greatly resolve the situation.


I know this is an old thread but I can not compile under OF v2006.
Does anyone have a tip or know of any other software (for OpenFOAM) with these capabilities?
Sunsheep is offline   Reply With Quote

Old   October 6, 2020, 14:18
Default
  #38
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Sunsheep View Post
Is this still in active development?
BlockMesh/OpenFOAM is really lacking in mesh smoothing functionalities and this tool would greatly resolve the situation.

I know this is an old thread but I can not compile under OF v2006.
I took a look and can compile with OpenFOAM-v2006 and run the tutorial case. There will still be various warnings about deprecated functions. I left these as-is, to avoid changing even more of the code.

I've placed a merge request: https://github.com/HIKassem/extBlockMesh/pull/1

But on the assumption that it may not receive any attention, I'll also leave up my github fork for a while.
https://github.com/olesenm/extBlockM...e/openfoam-com
hk318i, bjnieuwboer and Sunsheep like this.
olesen is offline   Reply With Quote

Old   October 18, 2020, 17:04
Thumbs up Awesome
  #39
New Member
 
anonymous
Join Date: Sep 2017
Posts: 3
Rep Power: 8
Sunsheep is on a distinguished road
Quote:
Originally Posted by olesen View Post
I took a look and can compile with OpenFOAM-v2006 and run the tutorial case. There will still be various warnings about deprecated functions. I left these as-is, to avoid changing even more of the code.

I've placed a merge request: https://github.com/HIKassem/extBlockMesh/pull/1

But on the assumption that it may not receive any attention, I'll also leave up my github fork for a while.
https://github.com/olesenm/extBlockM...e/openfoam-com

That sounds great.

I will try it out and report how it is working out.

Thank you very much for your efforts!
Sunsheep is offline   Reply With Quote

Old   January 14, 2021, 21:00
Default
  #40
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 6
Ship Designer is on a distinguished road
I tried to compile all three version (Etudes-NG, HIKassem and olesenm) on OpenFoam v8 running in Docker, none of which succeded. olesenm's version gives the least errors, which are the following:

Code:
extBlockMesh.C: In function 'int main(int, char**)':
extBlockMesh.C:154:9: error: 'xferCopy' was not declared in this scope
         xferCopy<pointField>(blocks.points()),
         ^~~~~~~~
extBlockMesh.C:154:9: note: suggested alternative: 'ferror'
         xferCopy<pointField>(blocks.points()),
         ^~~~~~~~
         ferror
extBlockMesh.C:154:28: error: expected primary-expression before '>' token
         xferCopy<pointField>(blocks.points()),
                            ^
In file included from extBlockMesh.C:190:0:
mergePatchPairs.H:122:35: error: 'VISIBLE' is not a member of 'Foam::intersection'
                     intersection::VISIBLE
                                   ^~~~~~~
I don't know what xferCopy (transfer copy?) is. The last error is a difference I think in either attachPolyTopoChanger or slidingInterface if I remember correctly between the two OpenFOAM forks. Any suggestions for fixing the xferCopy error are welcome!
Ship Designer 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] Smoothing options siw ANSYS Meshing & Geometry 3 August 13, 2019 07:40
[snappyHexMesh] Cylindrical blockmesh to Improve snappyHexMesh Results nicholas.jones OpenFOAM Meshing & Mesh Conversion 3 May 16, 2019 09:52
[blockMesh] set of xyz data in blockMesh psk OpenFOAM Meshing & Mesh Conversion 12 August 27, 2013 08:37
[mesh manipulation] Smoothing a mesh from blockMesh vatavuk OpenFOAM Meshing & Mesh Conversion 3 December 24, 2012 13:18
Hexa smoothing (ICEM CFD 10.0) CFDworker CFX 3 November 2, 2005 10:23


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