CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

icoDyMFoam - sclar transport with adaptive mesh refinement

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

Like Tree2Likes
  • 1 Post By yhaomin2007
  • 1 Post By yhaomin2007

Reply
 
LinkBack Thread Tools Display Modes
Old   May 28, 2011, 18:41
Default icoDyMFoam - sclar transport with adaptive mesh refinement
  #1
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Please check http://openfoamwiki.net/index.php/Contrib_icoDyMFoam,
here I submitted a small example (todays between-coffees-made solver)
how to use dynamicRefineFvMesh class in generic applications.

Thanks to developers for such hard work) Your years of designing - our "one click" lines in solver))) Thanks once more!
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   July 3, 2011, 15:21
Default
  #2
New Member
 
Join Date: May 2011
Posts: 2
Rep Power: 0
FlinkFingerFlo. is an unknown quantity at this point
Hi makaveli_lcf,
hi foamers,

based on your example and Anne Kösters example I try to build a solver using the residuum to refine the mesh... but I can't get it running

Thanks,
FlinkFingerFlo.
FlinkFingerFlo. is offline   Reply With Quote

Old   July 17, 2013, 15:05
Default
  #3
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
yhaomin2007 is on a distinguished road
Hi,
I read your solver code, it seems that after mesh.update, you directly goes into U equation and p equation. I also tried this on my solver for steady state.
There is error information like this :

--> FOAM FATAL ERROR:
field does not correspond to level 0 sizes: field = 115185 level = 112000

I looked into the mesh, it seems mesh.update refined the mesh, but when it goes to solve equations, there is an inconsistent. Do you think if there is any additional setting I should do?~

thank you.
yhaomin2007 is offline   Reply With Quote

Old   July 17, 2013, 18:25
Default
  #4
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
there already some standard solvers in OF 2.2.1, please check them, they are more consistent than mine)))
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   July 17, 2013, 21:28
Default
  #5
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
yhaomin2007 is on a distinguished road
Hi, Alex
I think I found out the problem, I should "cacheAgglomeration off;" in fvSolutions file.
But I met a another problem, when it dynamic refine the mesh, it always produce some triangle cells. This also happens in your example case.
I have seen some papers talking about adaptive mesh refinement in OpenFOAM, they can make every cell hexagon. Do you know how to do that in settings?
thank you in advance~
yhaomin2007 is offline   Reply With Quote

Old   July 18, 2013, 02:25
Default
  #6
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Hi,

first you are totally right about aglomeration caching:

1. it should be switched off when doing dynamic refinement
2. no triangles are produced! it is just a postprocessing issue in paraview. Switch on "Use VTKPolyhedron" in Object Inspector. It is because your refined hex becomes a polyhedron, despite it looks still like a hex)))) In paraview it is splitted into pyramids giving you triangles. Please check here https://sites.google.com/site/smmp01...r-a-vakhrushev in Galery my first animation, it is done "properly")))
3. There was some issues (I think I was using OF 1.7) with tet cells: poly cells were excluded from refinement, but tet cells were not! I just patch dynamicRefine lib a little bit to avoid that, bevcause by engeneering geometries has sometimes tet cells... But all in all dynamic refinement is doing actually pure hex refinement

Cheers,
Alex
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at

Last edited by makaveli_lcf; July 18, 2013 at 02:28. Reason: typo
makaveli_lcf is offline   Reply With Quote

Old   July 18, 2013, 10:24
Default
  #7
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
yhaomin2007 is on a distinguished road
Hi, Alex,

thank you for your reply. I think you are right, OpenFOAM did not split those cells. It is just problem of paraview. But I have another question, in my research there is some pentahedral cells. Because I am simulating a axisymmetric geometry. Is there a way to tell OpenFOAM to just refine those hexagon cells, and ignore those pentahedral cells?

thank you.
yhaomin2007 is offline   Reply With Quote

Old   July 18, 2013, 10:34
Default
  #8
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
I think it is already there... It is refining hex only... Look at the dynamicRefineFvMesh.C:

Code:
00951     // Set cells that should not be refined.
00952     // This is currently any cell which does not have 8 anchor points or
00953     // uses any face which does not have 4 anchor points.
00954     // Note: do not use cellPoint addressing
00955 
00956     // Count number of points <= cellLevel
00957     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00958 
00959     labelList nAnchors(nCells(), 0);
00960 
00961     label nProtected = 0;
00962 
00963     forAll(pointCells(), pointI)
00964     {
00965         const labelList& pCells = pointCells()[pointI];
00966 
00967         forAll(pCells, i)
00968         {
00969             label cellI = pCells[i];
00970 
00971             if (!protectedCell_.get(cellI))
00972             {
00973                 if (pointLevel[pointI] <= cellLevel[cellI])
00974                 {
00975                     nAnchors[cellI]++;
00976 
00977                     if (nAnchors[cellI] > 8)
00978                     {
00979                         protectedCell_.set(cellI, 1);
00980                         nProtected++;
00981                     }
00982                 }
00983             }
00984         }
00985     }
00986
Here they check for none hex cells...
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   July 18, 2013, 10:49
Default
  #9
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
yhaomin2007 is on a distinguished road
Yes, you are right, it checked whether the anchor points of this cell. But it only protected the cell whose anchor point number is larger than 8. It will not protect those cells with less than 8 anchor points.

For my case, there are pentahedral cells. The error message is this:

Quote:
--> FOAM FATAL ERROR:
cell 5129 of level 0 does not seem to have 8 points of equal or lower level
cellPoints:6(12234 12235 13288 13289 12284 12285)
pointLevels:6{0}


From function hexRef8::setRefinement(const labelList&, polyTopoChange&)
in file polyTopoChange/polyTopoChange/hexRef8.C at line 3527.

FOAM aborting
I think I should change
if (nAnchors[cellI] > 8) to if( (nAnchors[cellI] > 8)||(nAnchors[cellI] < 8))
to make sure it only refine those hexagon cells.
makaveli_lcf likes this.
yhaomin2007 is offline   Reply With Quote

Old   July 18, 2013, 10:50
Default
  #10
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Yep! Right direction! Just build a new library for dynamicMeshRefine
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   July 18, 2013, 10:51
Default
  #11
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
For tet it didn't work as well, so I modified that condition
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   July 18, 2013, 10:53
Default
  #12
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
yhaomin2007 is on a distinguished road
I will try this.
Thank you very much~
yhaomin2007 is offline   Reply With Quote

Old   July 18, 2013, 15:21
Default
  #13
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
yhaomin2007 is on a distinguished road
Hey,
I think I have figured out how to do that, I will post my code here if other people are interested. We have to judge whether this cell is hex or not. But we cannot just
change "if (nAnchors[cellI] > 8)" to "if( (nAnchors[cellI] > 8)||(nAnchors[cellI] < 8))"

because the anchor number of this cell (nAnchors) is not completely calculated after this whole loop. So we have make a judgement after this loop.
Quote:
// Set cells that should not be refined.
// This is currently any cell which does not have 8 anchor points or
// uses any face which does not have 4 anchor points.
// Note: do not use cellPoint addressing

// Count number of points <= cellLevel
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

labelList nAnchors(nCells(), 0);

label nProtected = 0;

forAll(pointCells(), pointI)
{
const labelList& pCells = pointCells()[pointI];

forAll(pCells, i)
{
label cellI = pCells[i];

if (!protectedCell_.get(cellI))
{
if (pointLevel[pointI] <= cellLevel[cellI]) l
{
nAnchors[cellI]++;

//if (nAnchors[cellI] > 8)
//{
// protectedCell_.set(cellI, 1);
// nProtected++;
//}
}
}
}
}

for(label cellI = 0; cellI < nCells() ; cellI++) // after nAnchors[cellI] is complete caculated, determine whether it should be protect or not. Only hex cells are not protected.
{
if ((nAnchors[cellI] > 8)||(nAnchors[cellI] < 8))
{
protectedCell_.set(cellI, 1);
nProtected++;
}
}
Now, only hex cells are not protected, other non-hex cell are all in protection, and will not cause fatal error.
I hope this will be useful to somebody.
makaveli_lcf likes this.
yhaomin2007 is offline   Reply With Quote

Old   July 19, 2013, 11:38
Default
  #14
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 213
Rep Power: 10
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Great job, this issue was also there, I can remember!
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Reply

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
adaptive meshing clifford bradford Main CFD Forum 13 August 11, 2014 09:10
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Problems scaling down the mesh of a stirred tank (GGI, icoDyMFoam) Tobb OpenFOAM 2 February 7, 2013 14:06
Searching criteria for adaptive mesh refinement Flowee ANSYS Meshing & Geometry 1 August 6, 2010 12:43


All times are GMT -4. The time now is 00:17.