|
[Sponsors] |
Adaptive Mesh Refinement in Arbitary Direction |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 18, 2012, 11:50 |
Adaptive Mesh Refinement in Arbitary Direction
|
#1 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear All
I have started Working on Adding Adaptive Mesh Refinement to my Code. But As I have searched and see , The DynamicMeshRefinment in OpenFoam is not working in 1D or 2D Cases. But There is Multidirectionrefinment code that is supposed to do the code , but it is said to have some issues with mapping results from the previous Mesh to the new Mesh. Please Share your experiences to help me and other Foamers enjoying the open source codes. Best Mahdi |
|
October 18, 2012, 13:14 |
|
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
nice Try, i think, the first step would be to read the existing code, you can post the pieces of code here, and your comments on each part of code here, so by discussion, a good references, would be available for all
|
|
October 24, 2012, 09:48 |
|
#3 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear All
As I see at the moment there are some utility and applications for mesh refinement in openFoam. utilities: 1-RefineMesh Applications: 1-multiDirRefinement 2-dynamicRefineFvMesh 3-meshRefinement There is some common Header file between these applications and utilities: #include "polyMesh.H" #include "hexRef8.H" #include "surfaceInterpolate.H" #include "polyTopoChange.H" #include "syncTools.H" #include "mapPolyMesh.H" #include "meshTools.H" So All the main refinement process and mapping should be inside these codes. In Fact the library which is responsible is "dynamicMesh" library. Last edited by mm.abdollahzadeh; October 24, 2012 at 10:12. |
|
October 27, 2012, 02:35 |
|
#4 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
it seems the first pieces of code you should look at, is "dynamicRefineFvMesh.H" and
"dynamicRefineFvMesh.C", in this code is defined how to mark cell for refinement, how to gather cells and how to cut them |
|
October 29, 2012, 09:28 |
|
#5 | |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Quote:
I have checked the dynamicRefineFvMesh . in this code the are using a mesh cutter with is called hexref8 . the problem related to that is that it will divide each cell in all direction. each cell to 8 cell. so it can not be used for 2D cases. but there is another application multiDirRefinement which has two different cutter. if u choose splitting in all direction it will use hexr8 but if you give direction it will use undoabalemeshcutter. so till the moment using multiDirRefinement or making a new application similar to this is the idea. but what is the problem? the problem is mapping the data. in dynamicRefineFvMesh and hexr8 there is a class member called meshupdate which actually do the refinement and mapping. but there is no class member in multiDirRefinement. moreover in dynamicfvmesh there is the same class member but in fvmesh the update member is not existed. Best Mahdi |
||
October 29, 2012, 09:41 |
|
#6 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Nima
So the thing that I have done for the step was a simple test with icoFoam. 1-defining two mesh. one as main for the calculation. second just for helping the mapping of data with fvmesh 2-I use the error-estimate application which is openfoam 1.7 and openfoam extended 1.6 to calculate a errorfield 2- Then marking the cell for refinement 3- Doing the mesh refinement on the second mesh. 4- mapping the data s from the first mesh to the second mesh by meshtomeshinterpolation 5-then refine the first mesh. 6-mappinmg the data from the second mesh to the first mesh 7- start again the computation I know that is not good but it is my first try. the code is compiled . but when running it gives a segmentation error. I have attached the code and the case. please have a look if you have time. Best Mahdi |
|
October 30, 2012, 03:45 |
|
#7 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
i would like this discussion will be continued, so for who interested some description, how compile above file:
1) download errorEstimation.zip 2) unzip and compile it with wmake libso 3)download myIcoFoam.zip and unzip it 4) in Make folder, options file, then add library and header files path address like this: Code:
EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I/home/nimasam/Desktop/errorEstimation/lnInclude \ (path address) -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -lfiniteVolume \ -ldynamicMesh \ -ldynamicFvMesh \ -L$(FOAM_USER_LIBBIN)\ (lilibrary path address) -lerrorEstimation \ -lsampling
__________________
My Personal Website (http://nimasamkhaniani.ir/) Telegram channel (https://t.me/cfd_foam) |
|
October 30, 2012, 07:53 |
|
#8 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Nima
Actually I have tried to adopt the map-field utility in the code for the step 4 and 6. But As I check now my code is blowing in step 6 . but although I am writing the mapped values ... there is no change in the objects in time folder. there is also four post related to adding mapfields: http://www.cfd-online.com/Forums/ope...ded-cells.html http://www.cfd-online.com/Forums/ope...time-step.html http://www.cfd-online.com/Forums/ope...y-changes.html http://www.cfd-online.com/Forums/ope...wo-meshes.html Best Mahdi Last edited by mm.abdollahzadeh; October 30, 2012 at 09:46. |
|
October 30, 2012, 13:05 |
|
#9 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
Hi mehdi
i check the code, ofcourse i need to look deeply to find what you are going to do i make these two headers (//#include "MapfromMeshnew.H" , #include "MaptomeshNew.H") comment , then it runs fine, tell me how do you show the result in paraview?
__________________
My Personal Website (http://nimasamkhaniani.ir/) Telegram channel (https://t.me/cfd_foam) |
|
October 31, 2012, 08:31 |
|
#10 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Hi Nima
Thanks again for help. With paraFoam its possible . paraFoam -touchAll or paraFoam -touch -region MainMesh paraFoam -touch -region HelpMesh Best Mahdi |
|
October 31, 2012, 11:50 |
|
#11 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
mehdi could you put more description in each part of you algorithm or your code, i can not understand what you are going to do?
i guess some algorithm like this: 1-defining two mesh (MainMesh, HelpMesh) 2-use the error-estimate application to calculate a errorfield 2- Then marking the cell for refinement 3- Doing the mesh refinement on the second mesh. 4- mapping the data s from the first mesh to the second mesh by meshtomeshinterpolation 5-calculate fields (pn,Un) 6-mappinmg the data from the second mesh to the first mesh 7- start again the computation your step 5 is vague for me
__________________
My Personal Website (http://nimasamkhaniani.ir/) Telegram channel (https://t.me/cfd_foam) |
|
November 2, 2012, 05:26 |
|
#12 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Nima
Your guess is right. Pn and Un are mutual values on the second grid for p and U. Best Mahdi |
|
November 3, 2012, 13:28 |
|
#13 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Nima
The thing is that I dont why meshtomesh interpolation is not changing anything in the objects p and u in the time folder. if u replace the fieldtarget varalbele to p or pn and fieldsource to p or pn . depending on the mapping from which mesh. there will be error that is saying that the mesh and the field are not matched. the reason is that the field is created in createfeild but the mesh is replacing so the objects should be updated also according the mesh that they are registered to. so I have checked the fvMesh.C and fvMesh.H. there are two members that are used for updating the mesh and mapping of the field according to the map of the added cells to the mesh. Best Mahdi |
|
November 6, 2012, 07:07 |
|
#14 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear All
There is a problem using meshtomeshinterpolation .... meshtomesh can not handel mapping of surfacescalarfields so its not complete. for mapping a volvector or volscalar my problem was that it was renewing the numeber of points of the objects in time folder.... so I just initialize the target objects by a uniform value to reset the number of points. then it works and the data was mapped. but I think the solution is in some updateMesh member : //Foam::fvMesh::updateMesh(morphMap); //Foam::hexRef8::updateMesh //Foam:olyTopoChanger::update(const mapPolyMesh& m) // Foam:olyMesh::updateMesh //Foam::dynamicRefineFvMesh::update() ****************************** any idea? best Mahdi |
|
November 9, 2012, 11:36 |
|
#15 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Some part of discussion is continuing in the following thread also:
http://www.cfd-online.com/Forums/ope...y-changes.html |
|
December 2, 2012, 05:38 |
|
#16 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
hi mahdi
what is the recent progress? i was too busy to follow the progress
__________________
My Personal Website (http://nimasamkhaniani.ir/) Telegram channel (https://t.me/cfd_foam) |
|
January 9, 2013, 15:23 |
|
#17 |
Member
Pablo Caron
Join Date: Nov 2009
Location: Buenos Aires, Argentina
Posts: 75
Rep Power: 17 |
Hello everybody
I would like to use this feature in my PhD thesis. I do not want to start coding from scratch. Please tell me what can I do to help you. Pablo |
|
January 12, 2013, 09:35 |
|
#18 | |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Quote:
Sorry for my late update. I got busy with some other extra works. I have managed to make my code running. I have tested for a case IcoFoam tutorial and its run well and did the refinement and mapping. I have attached the code needed for refinement and mapping. Just its needed to change the criteria of refinement and the variables that you want to the mapping. Just I should mention that I have tried to use it in my real test case but it give me divergence ( possible to be related to my case ). if you had time and you have test it, let me know that it works or not? Cheers Mahdi |
||
January 12, 2013, 09:37 |
|
#19 | |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Quote:
I have attached the code. if you had time, test it and let me know about the results. Best Mahdi |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] Weird snapping outside a refinement region | jasimpson89 | OpenFOAM Meshing & Mesh Conversion | 0 | July 29, 2012 21:46 |
killed "snappyHexMesh" | parkh32 | OpenFOAM Pre-Processing | 2 | April 8, 2012 18:12 |
[Technical] Local adaptive mesh refinement with hybrid meshes | holger_marschall | OpenFOAM Meshing & Mesh Conversion | 5 | December 21, 2010 14:38 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |
basic of mesh refinement | arya | CFX | 4 | June 19, 2007 13:21 |