Mesh Refinement
Has anyone done mesh refinement in FOAM?
Can someone tell me what are the steps involved? (Once I generated a refined mesh, but it was written separetely in a "time" dir, and I did not know what to do next to incorporate that in the original one. I just come back to this problem again, so if someone can tell me the general steps...) I am particularly interested in refining a region of my domain, preserving hex volumes topology, so that I will have some hanging nodes in the end... Best Regards, Luiz |
The old stuff and examples of
The old stuff and examples of application, together with error estimates, solution mapping etc. is in my PhD thesis (google for Hrvoje Jasak PhD). Mattijs has recently re-implemented hex refinement using toplogical modifiers and this will do most of the job for you. However, I am not sure if there are any examples you can start from...
Enjoy, Hrv |
Just move the refined mesh (i
Just move the refined mesh (i.e. the 'polyMesh' directory) from the time directory to the constant/ directory (after backing up the original)
Mattijs |
Hi Mattijs,
I did it, but I
Hi Mattijs,
I did it, but I could not see the effect of refineMesh (using extract edges) in paraview... What is the right way to check the mesh in paraview? (paraFoam is not working for me. It crashes). Cause either I did something wrong in refine mesh or I am not confortable enough with paraview, and I am not checking it the right way. (I can see the modified directory - now copied to original "constant" dir - but there are other files like refinedCells, and cellMap that make me unsecure if I ve done the right thing...) Thanks, Luiz |
Hi Luiz,
you can run check
Hi Luiz,
you can run checkMesh. It will print statistics on the number of cells and also the cell types. (note that any unrefined cell sharing an edge or face with a refined cell will become a polyhedral cell) Visualization is a bit hard since - paraview only shows the wireframe of the surface - the foamToVTK converter decomposes any polyhedral cell into tets and prisms since VTK cannot handle them. - if your case is 2D look at the patch files for the front and back patch. - the foamToVTK converter writes a cellID field. You can use that in the paraview threshold filter. The newly created cells will be the highest numbered ones. Mattijs |
Hi Foamers,
I was trying to
Hi Foamers,
I was trying to run refineMesh with a cellSet using the default refineMeshDict (from $HOME/OpenFOAM/OpenFOAM-1.0.2/src/meshTools/meshTools) Somehow it didn't work, I get the followin error message: Exec : refineMesh . paranovtetra316kengstumpfinVAVBRL100 -dict Date : Aug 15 2005 Time : 13:00:56 Host : cci00150 PID : 20125 Root : /usr2/tmp/ccgrueni/OpenFOAM/kloster-1.0.2/run/tutorials/interFoamCICSAM Case : paranovtetra316kengstumpfinVAVBRL100 Nprocs : 1 Create database Create polyMesh for time = 0.00150601 Mesh edge statistics: x aligned : number:17374 minLen:5.84277e-06 maxLen:9.76456e-05 y aligned : number:17292 minLen:5.84277e-06 maxLen:0.000100269 z aligned : number:90005 minLen:2.6242e-05 maxLen:0.00010141 other : number:861886 minLen:5.46684e-06 maxLen:0.000151547 Refining according to refineMeshDict Read 994 cells from cellSet "constant/polyMesh/sets/subset" --> FOAM FATAL ERROR : Specified zone flip for a face that does not belong to zone. This is not allowed. Face: 4(48703 342518 335727 342523) masterPointID:-1 masterEdgeID:-1 masterFaceID:200513 patchID:-1 owner:68770 neighbour:323819 Function: polyAddFace ( const face& f, const label owner, const label neighbour, const label masterPointID, const label masterEdgeID, const label masterFaceID, const label patchID, const label zoneID, const bool zoneFlip ) in file: /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/src/OpenFOAM/lnInclude/polyAddFace.H at line: 299. FOAM aborting Abort (core dumped) Is the above mentioned refineMeshDict only for 2 d cases? Any sugestions why I get this error? Thanks! Best regards Jens |
polyAddFace constructor, which
polyAddFace constructor, which describes one of the actions you're doing when changing mesh topology, has an option for faces in zone to change the face orientation - this is needed such that a 2-D surface defined by a face zone has a front and a back:
polyAddFace ( const face& f, const label owner, const label neighbour, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip ) As the error tells you, someody has called polyAddFace specifying the flip for tha face which is not in a zone, which is not allowed. Beforre digging any further, i would switch to the latest version of FOAM you can get your hands on and try again. Enjoy, Hrv |
Hi Hrv,
Unfortunately it is
Hi Hrv,
Unfortunately it is not possible to switch to the latest version of FOAM on this machine. But anyways I suspect it is because of the refineMeshDict (which was maybe made for a 2D case??). There are many question regarding this file: What means: -globalCoeffs -patchLocalCoeffs -Why are the directions there tan1 tan2 normal? the others seem to make sense to me. Thanks Jens |
refineMesh can refine in 1,2 o
refineMesh can refine in 1,2 or 3 directions in one go. These directions are given the symbolic names 'tan1', 'tan2', 'normal'
Usually one uses the global x,y,z coordinate system as these directions (globalCoeffs). But e.g. if you want to refine a circular pipe you want to have a local coordinate system per cell. patchLocalCoeffs allows you to define one of the refinement directions as normal to the wall. Anything more complex you have to code yourself. |
Hi Hrv and Mattijs,
Thank
Hi Hrv and Mattijs,
Thank you for your replies. To Hrv: The error message is the same in OpenFoam1.1, (I tried it on a different Computer.) To Mattijs: Do the cell edges, which I want to refine need to be aligned with axis of the coordinate system? What is the patchname in patchLocalCoeffs? Best regards Jens |
- can you do a traceback ('whe
- can you do a traceback ('where' in gdb) of the core and post it?
- the cell edges need to be aligned to within 45 degrees, i.e. it needs to be clear from the coordinate system which set of edges you want to cut. - patchname is the patch name. Please consult the sample refineMeshDict in the refineMesh directory. |
I don't think it is a bug in t
I don't think it is a bug in the code. I think it is because I am using not the refineMeshDict correct. I was actually using sample refineMeshDict in the refineMesh directory, just changing the globalcoeffs to
globalCoeffs { tan1 (1 0 0); tan2 (0 1 0); normal (0 0 1); } . My case is actually a case containing a circular pipe. Is there a way to look at the cell from the subset with paraview? Here is the traceback anyway: cci00150 - ccgrueni - /usr2/tmp/ccgrueni/OpenFOAM/kloster-1.0.2/run/tutorials/interFoamCICSAM: 133 -> gdb refineMesh core.8661 GNU gdb Red Hat Linux (5.2.1-4) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... Core was generated by `refineMesh . paranovtetra316kengstumpfinVAVBRL100 -dict'. Program terminated with signal 6, Aborted. Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so...done . Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libmeshTools.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libmeshTools.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libOpenFOAM.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libOpenFOAM.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/linux/gcc-3.4.3/lib/libstdc++.so.6...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/linux/gcc-3.4.3/lib/libstdc++.so.6 Reading symbols from /lib/i686/libm.so.6...done. Loaded symbols for /lib/i686/libm.so.6 Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/linux/gcc-3.4.3/lib/libgcc_s.so.1...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/linux/gcc-3.4.3/lib/libgcc_s.so.1 Reading symbols from /lib/i686/libpthread.so.0...done. Loaded symbols for /lib/i686/libpthread.so.0 Reading symbols from /lib/i686/libc.so.6...done. Loaded symbols for /lib/i686/libc.so.6 Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libtriSurface.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libtriSurface.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libfaceDecompFiniteEleme nt.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libfaceDecompFiniteEleme nt.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/liblagrangian.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/liblagrangian.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/mpich-1.2.6/libPstream.s o...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/mpich-1.2.6/libPstream.s o Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libfoamUser.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libfoamUser.so Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libz.so...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libz.so Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/src/mpich-1.2.6/platforms/linuxOpt/li b/libmpich.so.1.0...done. Loaded symbols for /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/src/mpich-1.2.6/platforms/linuxOpt/li b/libmpich.so.1.0 #0 0x42028cc1 in kill () from /lib/i686/libc.so.6 (gdb) bt #0 0x42028cc1 in kill () from /lib/i686/libc.so.6 #1 0x40bcf07d in raise () from /lib/i686/libpthread.so.0 #2 0x4202a019 in abort () from /lib/i686/libc.so.6 #3 0x403ee081 in Foam::error::abort() () from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libOpenFOAM.so #4 0x4004f352 in Foam::polyAddFace::polyAddFace(Foam::face const&, int, int, int, int, int, bool, int, int, bool) () from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so #5 0x400ea6cb in Foam::hexRef8::addFace(Foam::polyTopoChange&, int, Foam::face const&, int, int) const () from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so #6 0x400edeab in Foam::hexRef8::setRefinement(Foam::List<int> const&, Foam::polyTopoChange&) () from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so #7 0x400e812f in Foam::multiDirRefinement::refineHex8(Foam::morphMe sh&, Foam::List<int> const&, bool) () from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so #8 0x400e8e9f in Foam::multiDirRefinement::multiDirRefinement(Foam: :morphMesh&, Foam::List<int> const&, Foam::dictionary const&) () from /usr2/tmp/ccgrueni/OpenFOAM/OpenFOAM-1.0.2/lib/linuxOpt/libdynamicMesh.so #9 0x0804e7b5 in main () #10 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 (gdb) quit |
- Do you have any faceZones in
- Do you have any faceZones in your polyMesh/ directory/directories? Does it work if you remove these?
- cellSet plotting is option to foamToVTK. Just type foamToVTK without any args to see syntax. |
I will try next Monday because
I will try next Monday because I am not able to get to my case now. Thank you for the hint!
|
Hi Mattjis,
Yes I had face
Hi Mattjis,
Yes I had faceZones in the mentioned directory. Yes it worked if I remove them. Thank you for your help Jens |
I have a case containing a cir
I have a case containing a circular pipe. I wanted to refine a portion of cell, starting from the pipe edge up to 3-4 dimaters downsteam.
This is the base grid: http://www.cfd-online.com/OpenFOAM_D...ges/1/1095.jpg Then, I chose the cells having an x-value in the range, using "cellSet", then I refined using "coordinateSystem global;" in both x and y directions. Here is the refined grid: http://www.cfd-online.com/OpenFOAM_D...ges/1/1096.jpg I even tried "coordinateSystem patchLocal;" patchLocalCoeffs { patch leftBoundary; tan1 (1 0 0); } directions ( tan1 ); and here's the final grid http://www.cfd-online.com/OpenFOAM_D...ges/1/1097.jpg What should I do to get a decent refined mesh as similar to vortex shedding example in Hrv's thesis. (the refined cells should be aligned with coarse grid not just with x and y)? |
you'll need to use
- patchL
you'll need to use
- patchLocalCoeffs - useHexTopology true - geometricCut false And switch on the debug switch for hexCellLooper. Is your mesh pure hex? |
It's working. Thank you Mattij
It's working. Thank you Mattijs.
Yes the mesh is pure hex. BTW, about the "foamToTecplot" issue in the other thread, the base case can be easily converted to tecplot format, but the new mesh cannot be converted. Is it because in the new mesh, some cells have even 9 faces? It is interesting that only dx (from what I remember in old foam version) and Ensight show the real grid nicely. Others such as paraview show some wrong grid lines. http://www.cfd-online.com/OpenFOAM_D...ges/1/1104.jpg |
Hi, Ali
I wrote a very simp
Hi, Ali
I wrote a very simple mesh viewer, only works for 2D. It can correctly show the refined mesh. You need to have OpenGL to compile it.Here is the source code. Best regards, Yingfeng |
Sorry, the file seems not uplo
Sorry, the file seems not uploaded, just another try . If failed again i have to send to the webmaster.
|
All times are GMT -4. The time now is 15:55. |