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   April 3, 2014, 10:58
Default Extend blockMesh with smoothing capability
  #1
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Hello,

For some time I have been working on writing an add-on in blockMesh in order to smooth the mesh.
After compilation of the code located at Github link you simply need to add the following in your blockMeshDict:
Code:
smoother
{    
    elemTransformParameter    0.666;
    maxGETMeIter                1000;
    improvementTolerance        1e-4;
    qMeanRelaxationTable        (1 0.25 0.125 0);
    qMinRelaxationTable         (0.1 0.05 0.01 0);
    maxIneffectiveIteration     5;
    
    features
    {
        featureAngle            30;
        minEdgeForFeature       10;
    }
};
Example and explaination are availlable at link to explaination.




I encourage people to suggests improvements and make own versions.

Nathanaël
ngj, snak, linnemann and 16 others like this.

Last edited by nathanael; April 4, 2014 at 09:39.
nathanael is offline   Reply With Quote

Old   April 6, 2014, 03:48
Default
  #2
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
I updated the installation instructions :
Code:
# If needed source your Open FOAM bashrc
source OpenFOAM/OpenFOAM-2.2.x/etc/bashrc

# Download the extBlockMesh source and move inside downloaded directory
git clone https://github.com/Etudes-NG/extBlockMesh
cd extBlockMesh

# Copy patch in OpenFOAM source and patch it
cp OF-extBlockMesh-2.x.x.patch $WM_PROJECT_DIR
cd $WM_PROJECT_DIR
patch -p1 < OF-extBlockMesh-2.x.x.patch

# Go back in the directory where you download the extBlockMesh source
cd extBlockMesh

# Run the installation script
./Allwmake.sh

# Run extBlockMesh in place of blockMesh
Hope this will help.
snak, wyldckat, waku2005 and 3 others like this.

Last edited by nathanael; April 10, 2014 at 11:51. Reason: Correct installation instructions
nathanael is offline   Reply With Quote

Old   July 27, 2014, 09:05
Default
  #3
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18
fumiya is on a distinguished road
Hi nathanael,

Thank you for sharing the useful tool and pointing out the GETMe smoothing approach.
I'm learning this method from your code and I have one question.

According to the paper(http://cames.ippt.gov.pl/pdf/CAMES_20_1_4.pdf),
the new mesh node positions are calculated using the formula (9).
I think the weighting coefficients are calculated differently in your code.

Could you look at the attached file and answer my question?

Best regards,
Fumiya
Attached Images
File Type: png Question_GETMe1.PNG (31.2 KB, 468 views)
File Type: png Question_GETMe2.PNG (8.8 KB, 234 views)
__________________
[Personal]
fumiya is offline   Reply With Quote

Old   August 3, 2014, 12:26
Default
  #4
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Hi Fumiya

From the same document on page 59 I read:
<Here N_j denotes the index set of the neighbor elements of E_j, i.e., elements, which share at least one node with E_j>
I understand all red cells in your picture.

There is one error in this part of the code, I correct it for the next release, but unfortunately my hard drive crash and I lost all the git history for this project... So I cannot give you the exact location. (Missing divides by the number of cells somewhere).

The next release is ready for public release in a few weeks.
This release gives a lot of improving in term of speed and some extra stuff... I would not say that blockMeshDict become easy to make but at least less to do with complex edges

Best regards,

Nathanaël.
nathanael is offline   Reply With Quote

Old   August 3, 2014, 12:52
Default
  #5
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Oups I was to fast... Yes you are true: I need to compute the weight for the cell and not the point. I will correct that.
nathanael is offline   Reply With Quote

Old   August 4, 2014, 04:29
Default
  #6
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Hello Fumiya,

Here is a comparison between the two algo, colored using skew quality from paraview (lower is better):



For me this is better with old code (avg quality = 0.8904 vs 0.8896, min quality = 0.7429 vs 0.7201).
And a bit faster with old code, no need to store or compute the list of neighboring cells.

What is your opinion? Have you done some test on your side?

Best regards,

Nathanaël.

Last edited by nathanael; August 7, 2014 at 03:28.
nathanael is offline   Reply With Quote

Old   August 7, 2014, 04:27
Default Thank you
  #7
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 339
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Hi,

I installed and tested extBlockMesh. Attached you see a simple mesh of a pipe, nothing fancy. I played around with block and vertex arrangement to create a nice mesh. However, without modifying individual cells, you always reach some limit in terms of mesh beauty.

Attached are some pics and the output of checkMesh.

Great tool.
Attached Images
File Type: jpg pipeBlockMesh.jpg (85.0 KB, 615 views)
File Type: jpg pipeExtBlockMesh.jpg (76.3 KB, 610 views)
Attached Files
File Type: txt checkAllBlockMesh.txt (3.3 KB, 95 views)
File Type: txt checkAllExtBlockMesh.txt (3.4 KB, 87 views)
emjay likes this.
GerhardHolzinger is offline   Reply With Quote

Old   August 7, 2014, 04:51
Default Smoothing operation
  #8
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 339
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
What I understand up to this point, is this is an enhanced version of blockMesh.
Is there a possibility to call the smoothing seperately?

In some cases I do some mesh-magic after blockMesh has finished, e.g. combine mesh regions, partial refinement.
So, I am wondering if it is possible to do the smoothing after this stuff I just descibed.
GerhardHolzinger is offline   Reply With Quote

Old   August 18, 2014, 10:47
Default
  #9
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18
fumiya is on a distinguished road
Hi nathanael,

Thank you for your test!

I'm considering using your code for mesh morphing operations.
The displacements of the points on the boundaries are prescribed
and the new positions of the interior points are calculated using GETMe algorithm.

Do you think this is a reasonable approach?

Best regards,
Fumiya
__________________
[Personal]
fumiya is offline   Reply With Quote

Old   August 19, 2014, 07:01
Smile extBlockMesh release v0.2
  #10
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Hi all,

I'm pleased to announce the new release for extBlockMesh!

Major's change:
  • Snapping capability.
  • Run faster.
  • Construct from polymesh, easy to connect with other app.
    Code:
    MeshSmoother meshSmoother(&mesh, &smootherDict);
    meshSmoother.update();
  • hexMeshSmoother app added for smoothing of existing mesh.
  • Both hexMeshSmoother and extBlockMesh look in system folder for the dictionary "smootherDict" which contain all settings. For explanation about this dictionary see link to explanations.
  • No change in OpenFOAM code needed.



Best regards,

Nathanaël.
snak, bigphil, wyldckat and 4 others like this.

Last edited by nathanael; August 30, 2014 at 12:14.
nathanael is offline   Reply With Quote

Old   August 30, 2014, 12:13
Default
  #11
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Just to show some of the possibilities with a complex block topology:

nathanael is offline   Reply With Quote

Old   February 10, 2015, 19:14
Default
  #12
Member
 
Join Date: Nov 2009
Posts: 65
Rep Power: 16
waku2005 is on a distinguished road
Dear all

First of all, great thanks to Nathanael for this useful tool.
I tested the tutorial attached with the latest git ver. of extBlcokMesh, but in difficulty for my own simple test case of the 2-D O-mesh of NACA4 wing section attached.

It seemed to be OK after blockMesh command (checked by checkMesh command and Paraview), the mesh has only 20000 cells.
After that I ran extBlockMesh command but no response returns even after 1 night.
What's wrong with my mesh (blockMeshDict or smootherDict).
Any comments and suggestions are highly appreciated.



Best regards,
waku2005
Attached Files
File Type: gz NACA4_Omesh.tar.gz (5.4 KB, 56 views)
waku2005 is offline   Reply With Quote

Old   February 12, 2015, 03:23
Default
  #13
New Member
 
Nathanaël Geng
Join Date: May 2012
Posts: 18
Rep Power: 13
nathanael is on a distinguished road
Hello Waku2005,

The problem is located in your blockMeshDict, just comment the boundary blade. I don't understand the reason...
After your mesh is smoothed, just change the name of defaultFaces to blade in the file constant/polyMesh/boundary.

Note: your mesh is very stiff for the smoother, I recommand to reduce the transformParameter to 0.02 or less.

Best regards,

Nathanaël.
nathanael is offline   Reply With Quote

Old   February 12, 2015, 04:20
Default
  #14
Member
 
Join Date: Nov 2009
Posts: 65
Rep Power: 16
waku2005 is on a distinguished road
Quote:
Originally Posted by nathanael View Post
Hello Waku2005,

The problem is located in your blockMeshDict, just comment the boundary blade. I don't understand the reason...
After your mesh is smoothed, just change the name of defaultFaces to blade in the file constant/polyMesh/boundary.

Note: your mesh is very stiff for the smoother, I recommand to reduce the transformParameter to 0.02 or less.

Best regards,

Nathanaël.
Dear Nathanaël

Thanks to your suggestion! It works well after I changed the boundary name and reduced the transformParameter to 0.02.

I also found that the convertToMeters parameter in the blockMeshDict affects the smoothing iteration,
i.e., without two changes suggested in your reply, smoothing iteration had successfully continued after I changed the convertToMeters of 1.0 to 0.1 with no change in smootherDict.
I don't know why it works even only the mesh scale was changed.

Best regards,
waku2005
waku2005 is offline   Reply With Quote

Old   February 17, 2015, 02:08
Default Gridpro topology to blockMeshDict
  #15
pad
New Member
 
PA
Join Date: Mar 2009
Posts: 25
Rep Power: 17
pad is on a distinguished road
Hi,

This looks like a promising tool.

I know of the gridpro2Foam mesh converter but does anyone know if a utility exists that can convert a GridPro topology (*.fra files) to a blockMeshDict file?
__________________
Regards,
Per
pad is offline   Reply With Quote

Old   April 20, 2015, 10:19
Default
  #16
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
Update: problem solved!

I am trying to use extBlockMesh but I getting the following errors;

when I tried to compile it using OpenFoam 2.2.x, I got an error

SmootherBoundary.h:32:30: fatal error: extendedEdgeMesh.H: No such file or directory
#include "extendedEdgeMesh.H"

Then I tried OpenFoam 2.3.x, I managed to compile it without errors and run the tutorial as well. But, when I checked the points and faces files, I found very strange characters like binary files and I could not view the mesh in paraview.


the beginning of points file
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       vectorField;
    location    "constant/polyMesh";
    object      points;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


61776
(l/��a@���Pم*��YJH�;f@W�&�
<f@��n$��� 'A,f@i�'�La@[���0��A���Hf@1Y�^L[a@p�l��V���V�Vf@K8^L\�Za@�9�'�w@�$@�cf@�����Ka@P��ٻ�@}ҫpf@nx�0a@�	�� v$@��Q��,f@�!p\a@P� F��*@�
,�P���f@��7�.L`@7�՞G$�'�����f@�S��R`@u�e�������}��f@Wʼ3�U`@™����NL-2d�f@����U`@tØ���?e�L�p�f@4,?��Q`@�����@�3����f@��!��K`@64�$@K;�B�f@`7�H`@��|6�^,@E%�[D�f@���X�_@�^,��Y/ldg@�o
��g@�8�]@^�:�wV@More��î�g@J-I�|�]@��%d�@�����g@��2ab�]@��Cn$@V����g@z<�A�^@Q$Pօ*@�$���g@�6���ea@�@LJ�*������f@�IL�o�a@X��h�$�Nܙ���f@FQ[C��a@�,	:W��Uڲ��f@:�ʆ��a@�k����8�lܕf

Last edited by hk318i; April 22, 2015 at 09:10. Reason: problem solved
hk318i is offline   Reply With Quote

Old   July 23, 2015, 13:07
Default Someone knows what is wrong?
  #17
New Member
 
Lorenzo Bartolucci
Join Date: Oct 2012
Location: Rome - University of Tor Vergata
Posts: 5
Rep Power: 13
Barlo is on a distinguished road
Hi all,
I have just started to use extBlockMesh and I was trying to build a simpleMesh but it seems that I have done some mistakes at some point. Someone knows what is happened?
Thanks in advance,
Lorenzo
Attached Files
File Type: zip prova1.zip (11.7 KB, 17 views)
Barlo is offline   Reply With Quote

Old   August 20, 2015, 16:28
Default
  #18
New Member
 
Amanda Mattos Charin
Join Date: Mar 2013
Posts: 6
Rep Power: 13
amattosc is on a distinguished road
Quote:
Originally Posted by GerhardHolzinger View Post
Hi,

I installed and tested extBlockMesh. Attached you see a simple mesh of a pipe, nothing fancy. I played around with block and vertex arrangement to create a nice mesh. However, without modifying individual cells, you always reach some limit in terms of mesh beauty.

Attached are some pics and the output of checkMesh.

Great tool.
This looks awesome! I really want to use this add-on to improve my mesh but in what version of openfoam does it work? I tried compiling in foam-extend-3.1 and some libraries were missing.
amattosc is offline   Reply With Quote

Old   August 20, 2015, 16:31
Default
  #19
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
I tried it before, it works with OpenFOAM-2.3
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   August 22, 2015, 12:16
Default
  #20
New Member
 
Amanda Mattos Charin
Join Date: Mar 2013
Posts: 6
Rep Power: 13
amattosc is on a distinguished road
Quote:
Originally Posted by hk318i View Post
I tried it before, it works with OpenFOAM-2.3
Thank you Hassan! I was able to compile in foam2.3
hk318i likes this.
amattosc 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 18:46.