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

[Other] 2D adaptive Mesh Refinement

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

Like Tree26Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 29, 2019, 04:06
Default 2D refinement
  #61
New Member
 
Karthik Thyagarjan
Join Date: Jul 2019
Posts: 3
Rep Power: 2
kbeat is on a distinguished road
Hey guys

I did manage to build 2D refinement for OF6, ill clean up the sources and tar the files here soon.
But there seems to significant mesh effects, in case of reactingFoam( modified to include dynamic mesh), I have tested it and the flow field changes quite a bit from non dynamic meshes.

P.S thanks Luca, the sources were quite helpful.
kbeat is offline   Reply With Quote

Old   September 1, 2019, 05:52
Default
  #62
Senior Member
 
Join Date: Jan 2013
Posts: 368
Rep Power: 10
openfoammaofnepo is on a distinguished road
Dear Luca,



Thank you very much for your work. It can work very well in our case. BTW, is it possible modify the code in order to be used for 1D AMR modelling? Thanks a lot.



Quote:
Originally Posted by Luca Cornolti View Post
Dear all,

after some time I was able to work again on this topic and I completed a class which is able to refine 2D cases for both planar and axis symmetric (wedge) configurations.

Attached you can find the developed classes for OpenFOAM-6, foam-extend-4.0 and OpenFOAM-v1806.

The folders are arranged to be copied into the user directory ($WM_PROJECT_USER_DIR).

In the OpenFOAM-6 version there are also two tests for planar and wedge configurations.

I tested quite extensively the foam-extend-4.0 version.
The OpenFOAM-6 version should work as well as the code is almost the same, but I tested it only with the attached two tests as I don’t use the foundation version a lot.
The same is true for the v1806 version.


I hope that everything will work properly.

Note that a problem reported previously by me in this thread regarding mapping was solved by following the suggestion given in:

mapFields major bug
openfoammaofnepo is offline   Reply With Quote

Old   September 4, 2019, 06:22
Default
  #63
Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 83
Rep Power: 7
ndtrong is on a distinguished road
Quote:
Originally Posted by Luca Cornolti View Post
Dear all,

after some time I was able to work again on this topic and I completed a class which is able to refine 2D cases for both planar and axis symmetric (wedge) configurations.

Attached you can find the developed classes for OpenFOAM-6, foam-extend-4.0 and OpenFOAM-v1806.

The folders are arranged to be copied into the user directory ($WM_PROJECT_USER_DIR).

In the OpenFOAM-6 version there are also two tests for planar and wedge configurations.

I tested quite extensively the foam-extend-4.0 version.
The OpenFOAM-6 version should work as well as the code is almost the same, but I tested it only with the attached two tests as I don’t use the foundation version a lot.
The same is true for the v1806 version.


I hope that everything will work properly.

Note that a problem reported previously by me in this thread regarding mapping was solved by following the suggestion given in:

mapFields major bug
Dear Luca

Have you tried to compile your source with OpenFOAM v5? I would like to know the suitability of your code with OpenFOAM v5.
ndtrong is offline   Reply With Quote

Old   September 10, 2019, 10:19
Default
  #64
Senior Member
 
Join Date: Jan 2013
Posts: 368
Rep Power: 10
openfoammaofnepo is on a distinguished road
For the current version of AMR in openfoam, how does it deal with the parallel load balancing? Because when the mesh is refined, the number of the cells in each processor will be different. Finally, one of the processors may take longer time for each time step than others. Any comments?



Quote:
Originally Posted by openfoammaofnepo View Post
Dear Luca,



Thank you very much for your work. It can work very well in our case. BTW, is it possible modify the code in order to be used for 1D AMR modelling? Thanks a lot.
Quote:
Originally Posted by Luca Cornolti View Post
In the 3D case the original hex cell is cut into 8 smaller ones, new faces, edges and points are created.
One problem is how to link all these new features together and how to keep a track of them in order to remove all of them during the unrefinement step.
The second one is how to use these information.



In 3D, for every cut cell a new point is created in its centre.

This point is shared by the 8 daughter cells.


The original 3D code employs a list of these points to get all the information related the features created during the cutting process in a cascade process.

In short: 1) this central point is shared by 6 central edges, 2) the point of the other side of these edges is in the centre of the cut faces and is shared by 3) the four created faces for each original face. 4) The vertexes of these faces are the corners of the original cell and the points in the middle of the original edges.
To reproduce this cascade process in 2D and reuse most of the functions of the original code, the main trick of my code was to replace this list of points with a list of central edges, as in 2D we cut the cell into four smaller cells which shares an edge in the centre. Then, by simply skipping the first step of the 3D cascade process, we get all the information needed in the same way.


In 1D you have fewer new features. Following the same logic, you could use a list of central faces which is formed by the four created points in the middle of the original edges.


This is just a way to link information, then you have to change all the functions which uses them. For example in 1D you cut 2 of the original faces into 2 and the new face are formed by 2 original corners and 2 created points in the middle of the original edges, while in 2D and 3D the new faces have 1 original corner and 3 created points.



In other words there is some work to do…

I saw that the main developers of foam-extend very recently worked on this topic too. From What I saw they developed a new class which is able to handle both 2D and 3D cases, but not 1D.
openfoammaofnepo is offline   Reply With Quote

Old   September 11, 2019, 08:03
Default
  #65
Member
 
M Malik
Join Date: Jan 2019
Posts: 39
Rep Power: 3
mmalik is on a distinguished road
Quote:
Originally Posted by e1905 View Post
Hi,Moritz

I have the same problem with you, did you finally solve it?

Best
Yang
Quote:
Originally Posted by MSF View Post
Hi,

I tried to compile the library from Ahmad but I get the following error message(OF 2.2.2):

Code:
g++: error: unrecognized command line option ‘-fvMotionSolver’
Anyone an idea what that means?

Best,
Moritz

Did anyone manage to overcome this issue?
Thanks in advance!
mmalik is offline   Reply With Quote

Old   November 27, 2019, 10:24
Default supercool
  #66
Member
 
Join Date: Sep 2013
Posts: 42
Rep Power: 8
ma-tri-x is on a distinguished road
Hello Luca!


Amazing work! Is it now inside foam-extend-4.1? Because that's what was missing the last 6 years. I tried it once myself, but didn't get far. Now my bubbles might work with AMR!! Nice! Now [two things] one thing:


- How can I cite you?


second thing was:

- Do you have an idea, why the solver complains with
Code:
[5] --> FOAM FATAL ERROR: 
[5] Number of cells in mesh:2103 does not equal size of cellLevel:12668
This might be because of a restart with inconsistent cellLevel.
when I use 2D-AMR on a snappyHexedMesh? The 12668 cells are the total amount of the cells concerning checkMesh. The 2103 cells are the ones for one processor. Why is it a problem and how can I change it?
----
I got this solved by deleting the *.gz files in the basedir/constant/polyMesh. Then The AMR takes the correct ones.



Best regards from the cavitation working group in Göttingen, Germany



Quote:
Originally Posted by Luca Cornolti View Post
Dear all,

after some time I was able to work again on this topic and I completed a class which is able to refine 2D cases for both planar and axis symmetric (wedge) configurations.

Attached you can find the developed classes for OpenFOAM-6, foam-extend-4.0 and OpenFOAM-v1806.

The folders are arranged to be copied into the user directory ($WM_PROJECT_USER_DIR).

In the OpenFOAM-6 version there are also two tests for planar and wedge configurations.

I tested quite extensively the foam-extend-4.0 version.
The OpenFOAM-6 version should work as well as the code is almost the same, but I tested it only with the attached two tests as I don’t use the foundation version a lot.
The same is true for the v1806 version.


I hope that everything will work properly.

Note that a problem reported previously by me in this thread regarding mapping was solved by following the suggestion given in:

mapFields major bug

Last edited by ma-tri-x; November 27, 2019 at 11:40.
ma-tri-x is offline   Reply With Quote

Old   November 29, 2019, 06:00
Default
  #67
New Member
 
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 5
Luca Cornolti is on a distinguished road
Thank you,

sharing the code was a good way to make the time I spent on it more meaningful.
Obviously, I didn't write articles about it and I don't need to be cited for this, but collaborations on modeling multiphase flows are always welcome.


The code of the dynamic mesh refinement is quite messy, it seems that it was written a lot of years ago and never updated.
In fact, the style of this code is far from the object oriented one which characterizes most of other OpenFOAM classes, I mean the hexRef8.C file has about 5400 lines!
Moreover, there were comments like "crappy way to do ..." (in the 1706 version) and some checking loops which seem redundant in my opinion.
Even Weller once answered to a request about the dynamic mesh refinement algorithm with something like: I didn't write this class, so I won't touch it.


Some months ago , the developers of foam-extend (essentially Dr. Vukčević) rewrote this part of the code completely in a more object oriented style. You can find this development in the nextRelease branch of the git repository of foam-extend 4.

I Attached an example of the setup which use this new refinement class (dynamicPolyRefinementFvMesh) for the interDyFoam solver of foam-extend.

Unlike my developments, this class is not able to handle wedge cells, but overall it is written in a much better way, as I just modified the original code instead of rewriting it as they did and it should be done. I don't known if there are also benefits with respect to the computation time, you could check and tell us.


The porting of the new developments of foam-extend to the other version of OpenFOAM is not straightforward, but it would be nice to do that and to try to extend the algorithm capability to allow mesh refinement only in the directions of high gradients instead of all directions.


Quote:
Originally Posted by ma-tri-x View Post
Hello Luca!


Amazing work! Is it now inside foam-extend-4.1? Because that's what was missing the last 6 years. I tried it once myself, but didn't get far. Now my bubbles might work with AMR!! Nice! Now [two things] one thing:


- How can I cite you?


second thing was:

- Do you have an idea, why the solver complains with
Code:
[5] --> FOAM FATAL ERROR: 
[5] Number of cells in mesh:2103 does not equal size of cellLevel:12668
This might be because of a restart with inconsistent cellLevel.
when I use 2D-AMR on a snappyHexedMesh? The 12668 cells are the total amount of the cells concerning checkMesh. The 2103 cells are the ones for one processor. Why is it a problem and how can I change it?
----
I got this solved by deleting the *.gz files in the basedir/constant/polyMesh. Then The AMR takes the correct ones.



Best regards from the cavitation working group in Göttingen, Germany
Attached Files
File Type: zip foam-extend-4.x_dynamicRefinementMesh_damBreak.zip (92.3 KB, 6 views)
Luca Cornolti is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 09:54
[Workbench] mesh refinement of vortex tube using workbench aqsa1590 ANSYS Meshing & Geometry 3 December 25, 2014 09:57
[snappyHexMesh] snapEdge - failure Tobi OpenFOAM Meshing & Mesh Conversion 33 March 18, 2014 04:58
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 07:21
Icemcfd 11: Loss of mesh from surface mesh option? Joe CFX 2 March 26, 2007 19:10


All times are GMT -4. The time now is 15:51.