CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Other] How to delete cells in OF based on CheckMesh? (https://www.cfd-online.com/Forums/openfoam-meshing/68203-how-delete-cells-based-checkmesh.html)

AndTen September 10, 2009 03:38

How to delete cells in OF based on CheckMesh?
 
I have a problem when trying to convert a mesh from starccm to OpenFOAM. The conversion script ccm26ToFoam seems to work fine, but the checkMesh utility is really hard on the mesh that starccm has created. Starccm has probably built-in stuff that deals with this, and the solution is probably good enough since bad cells typically appear in tight corners that will not greatly influence the engineering problem I am looking upon.

Now, the general recommendation is obviously to go back to the mesher and do a better job, but this is a bit tricky to do for each and every case when wrapped surfaces are used for the meshing. I have so far not found any general setting in starccm to remove cells so that the checkMesh error reports disappear (except removing VERY many cells...)

The half-dirty, but in my opinion, good enough solution, would be to let checkMesh identify the problems, and then just delete the cells that are nasty. I have understood that the removeCells utility is primarily working on internal faces (and my problems almost always appear on the surface), so this does not work.

So, has anyone here on the forum figured out how to use the checkMesh utility to remove the entire cells that are connected to the erroneous faces? I would appreciate any help on this!

roth September 12, 2009 10:07

Try subsetMesh
 
Take a look at subsetMesh. If you've got a cellSet called something like badCells, do a cellSet "invert" to point to all the cells not in badCells i.e.goodCells. Then run subSetMesh on goodCells.

Mike

AndTen September 14, 2009 01:49

Thanks Mike,
I suppose you mean that this command should operate on cells, i.e. not faces? What I've got after the checkMesh command in a bunch of face lists. In some way these will need to be converted to cell lists then, and after this use the cellSet command to select these, and after this the subsetMesh?

Anders

roth September 14, 2009 07:18

Right. You can run cellSet on a faceSet of nasty faces to get your nasty cells.

Mike

AndTen September 14, 2009 07:22

Have you got an example of how to use this faceSet and cellSet command?

roth September 14, 2009 07:47

One nice example is in a tutorial:
Code:

OpenFOAM/OpenFOAM-1.5.x/tutorials/interDyMFoam/damBreakWithObstacle
Check the Allrun script which uses setSet which calls a batch file with set commands. This one creates a cellSet of zero cells, inverts it to points to all the cells, and then deletes cells from the cellSet that are in a given box region. It then runs subsetMesh.

Very close to what you want.

Another source is to look at the source codes for faceSet & cellSet which have dictionary files. Take a look at cellSetDict.

Code:

OpenFOAM/OpenFOAM-1.5.x/applications/utilities/mesh/manipulation/cellSet
And in particular, look at the operator "faceToCell".

Mike

phsieh2005 September 14, 2009 15:36

Hi, Mike,

I have a similar question and will highly appreciated if you can shed some light on this.

I created a cellSet using setSet based on boxToCells. There are some external face cells (BC in boundary) that are parts of these cellSet. I would like to detelet this cells from the domain. OK, I can invert this cellSet to a get a new cellSet that contains all the cells I want. But, I read the description of subsetMesh, it does not preserve attached boundary types. Does it mean that I will no longer have the boundary faces in the constant/polyMesh/boundary?

Is there a simple to simply delelte cells (and the assoicated points and faces) from the domain?

Pei

phsieh2005 September 15, 2009 12:02

Hi,

It turned out that I was wrong about subsetMesh. It does keep the original boundary patches in tact.

pei

bigred September 23, 2009 03:11

I'm having a similar problem. I get a few sets of bad faces (zeroFaces, non-orthofaces, etc). To get rid of them can I just use:
setSet
faceSet zeroFaces delete

or must I use:

setSet
faceSet zeroFaces invert
subsetMesh

or do I have to turn the face set into a cell set (faceToCell?) and then use one of the steps above, but with cellSet? Does cellSet and FaceSet have to work in conjunction with their dictionaries?

None of these utilities have very useful help files, except perhaps setSet. Am I correct to get the help file of a utility to type the util followed by -help, e.g.
cellSet -help
when i do this all i get is a one line usage guide with the parameter possiblities ie. [-batch] [-help] etc.

So many questions! I'm confused. It seems simple enough, but I'm not getting any results.

sakro March 22, 2011 08:41

Hi,

I have the same problem and the same question as bigred in a previous post. right now about the removing bad cells from the mesh, and I'm stacked how to do that. Would be very thankful for your help

wyldckat March 22, 2011 17:34

Greetings sakro and welcome to the forum!

Here is the best example I know for removing the faces/cells reported by checkMesh: http://openfoamwiki.net/index.php/SetSet

Best regards and good luck!
Bruno

sakro March 23, 2011 08:56

Quote:

Originally Posted by wyldckat (Post 300617)
Greetings sakro and welcome to the forum!

Here is the best example I know for removing the faces/cells reported by checkMesh: http://openfoamwiki.net/index.php/SetSet

Best regards and good luck!
Bruno

Hello Bruno and thank you very much!
this link is very helpful. I did it yesterday and it worked, at least I could get rid of bad cells.
But then came another problem: subsetMesh created a new boundary (from the deleted cells) with the type 'empty', that is obviously inappropriate. I changed it to symmetryPlane (I also tried wall)
but anyway I've lost the convergence with simpleFoam =(

wyldckat March 23, 2011 17:21

Hi sakro,

Sadly my experience in this subject is very limited, but here are a few threads that might guide you in the right direction:
The last few links are related to autoRefineMesh, because I have a personal untested theory that refining the mesh in damaged areas could fix things... but the general principle seems to be to "simply re-generate the mesh properly, after checking the original geometry at the damaged areas" instead of simply removing damaged cells... Or perhaps, generate a more coarse mesh in the problem areas, then refine the mesh using the methods described with autoRefineMesh...

Best regards and good luck!
Bruno

KateEisenhower June 24, 2015 04:09

Quote:

Originally Posted by sakro (Post 300710)
Hello Bruno and thank you very much!
this link is very helpful. I did it yesterday and it worked, at least I could get rid of bad cells.
But then came another problem: subsetMesh created a new boundary (from the deleted cells) with the type 'empty', that is obviously inappropriate. I changed it to symmetryPlane (I also tried wall)
but anyway I've lost the convergence with simpleFoam =(

Hello sakro,

do you remember if you passed the checkMesh with your changed boundary types? How did you solve this problem?

Best regards,

Kate

Anouk July 27, 2018 06:05

Dear FOAMers,

I was wondering whether it is possible to remove volume cells from a mesh without removing the attached faces? I am generating a mesh in gmsh and in order to have faces for all patches I need to define a physical volume for some parts of the mesh where I actually don't need a volume... So I was trying to find a way to remove the unwanted volume cells. Tried using setSet invert, but then the faces attached to the volume will also be removed..

Anouk July 27, 2018 06:13

I also used subsetMesh after invertion ;)


All times are GMT -4. The time now is 13:08.