CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[mesh manipulation] Mesh Refinement

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

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 2, 2005, 14:44
Default Mesh Refinement
  #1
Luiz Eduardo Bittencourt Sampaio (Sampaio)
Guest
 
Posts: n/a
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
  Reply With Quote

Old   March 2, 2005, 14:48
Default The old stuff and examples of
  #2
Hrvoje Jasak (Hjasak)
Guest
 
Posts: n/a
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
  Reply With Quote

Old   March 2, 2005, 15:07
Default Just move the refined mesh (i
  #3
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
Just move the refined mesh (i.e. the 'polyMesh' directory) from the time directory to the constant/ directory (after backing up the original)

Mattijs
  Reply With Quote

Old   March 4, 2005, 13:46
Default Hi Mattijs, I did it, but I
  #4
Luiz Eduardo Bittencourt Sampaio (Sampaio)
Guest
 
Posts: n/a
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
  Reply With Quote

Old   March 4, 2005, 13:55
Default Hi Luiz, you can run check
  #5
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
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
  Reply With Quote

Old   August 15, 2005, 07:39
Default Hi Foamers, I was trying to
  #6
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 17
duderino is on a distinguished road
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
duderino is offline   Reply With Quote

Old   August 15, 2005, 08:28
Default polyAddFace constructor, which
  #7
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 15, 2005, 09:23
Default Hi Hrv, Unfortunately it is
  #8
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 17
duderino is on a distinguished road
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
duderino is offline   Reply With Quote

Old   August 15, 2005, 13:24
Default refineMesh can refine in 1,2 o
  #9
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
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.
hua1015 likes this.
mattijs is offline   Reply With Quote

Old   August 16, 2005, 05:42
Default Hi Hrv and Mattijs, Thank
  #10
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 17
duderino is on a distinguished road
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
duderino is offline   Reply With Quote

Old   August 16, 2005, 05:56
Default - can you do a traceback ('whe
  #11
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
- 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.
mattijs is offline   Reply With Quote

Old   August 16, 2005, 08:57
Default I don't think it is a bug in t
  #12
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 17
duderino is on a distinguished road
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


duderino is offline   Reply With Quote

Old   August 16, 2005, 09:16
Default - Do you have any faceZones in
  #13
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
- 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.
mattijs is offline   Reply With Quote

Old   August 17, 2005, 17:48
Default I will try next Monday because
  #14
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 17
duderino is on a distinguished road
I will try next Monday because I am not able to get to my case now. Thank you for the hint!
duderino is offline   Reply With Quote

Old   August 22, 2005, 05:58
Default Hi Mattjis, Yes I had face
  #15
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 17
duderino is on a distinguished road
Hi Mattjis,

Yes I had faceZones in the mentioned directory. Yes it worked if I remove them.

Thank you for your help

Jens
duderino is offline   Reply With Quote

Old   September 11, 2005, 00:10
Default I have a case containing a cir
  #16
ali
Member
 
Ali Heidari
Join Date: Mar 2009
Location: Surrey, London, United Kingdom
Posts: 39
Rep Power: 17
ali is on a distinguished road
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:



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:



I even tried "coordinateSystem patchLocal;"

patchLocalCoeffs
{
patch leftBoundary;
tan1 (1 0 0);
}

directions
(
tan1
);

and here's the final grid




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)?
Pagoda likes this.
ali is offline   Reply With Quote

Old   September 12, 2005, 14:04
Default you'll need to use - patchL
  #17
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
you'll need to use

- patchLocalCoeffs
- useHexTopology true
- geometricCut false

And switch on the debug switch for hexCellLooper.

Is your mesh pure hex?
Pagoda likes this.
mattijs is offline   Reply With Quote

Old   September 12, 2005, 15:05
Default It's working. Thank you Mattij
  #18
ali
Member
 
Ali Heidari
Join Date: Mar 2009
Location: Surrey, London, United Kingdom
Posts: 39
Rep Power: 17
ali is on a distinguished road
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.


ali is offline   Reply With Quote

Old   October 13, 2005, 18:40
Default Hi, Ali I wrote a very simp
  #19
New Member
 
Yingfeng Shen
Join Date: Mar 2009
Location: Finland
Posts: 8
Rep Power: 17
yingfeng is on a distinguished road
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
yingfeng is offline   Reply With Quote

Old   October 13, 2005, 19:28
Default Sorry, the file seems not uplo
  #20
New Member
 
Yingfeng Shen
Join Date: Mar 2009
Location: Finland
Posts: 8
Rep Power: 17
yingfeng is on a distinguished road
Sorry, the file seems not uploaded, just another try . If failed again i have to send to the webmaster.
yingfeng 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 sticking point natty_king OpenFOAM Meshing & Mesh Conversion 11 February 20, 2024 09:12
y+ = 1 boundary layer mesh with snappyHexMesh Arzed23 OpenFOAM Running, Solving & CFD 6 November 23, 2022 15:15
[snappyHexMesh] Edge Refinement fracasce OpenFOAM Meshing & Mesh Conversion 3 December 2, 2017 13:30
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 08:54
[snappyHexMesh] problems using snappyHexMesh 2.1.0 on a supercomputer Sunxing OpenFOAM Meshing & Mesh Conversion 9 September 20, 2014 09:30


All times are GMT -4. The time now is 23:02.