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/)
-   -   [mesh manipulation] checkMesh Erros after refineMesh (https://www.cfd-online.com/Forums/openfoam-meshing/105293-checkmesh-erros-after-refinemesh.html)

mgdenno July 26, 2012 22:42

checkMesh Erros after refineMesh
 
Hello,

I have a mesh that was created using snappyHexMesh that I am trying to refine using refineMesh, but after running refineMesh, checkMesh gives me errors. I am running an interFoam simulation and am trying to refine the mesh near the air/water interface. In order to use refineMesh, I first created a cellSet using topoSet based on the value of alpha and then used that to define which cells need to be refined. refineMesh completes without errors and based on visual inspection the correct locations seem to be refined. However, when I run checkMesh I get errors. My refineMeshDict and checkMesh output are below.

I have tried to use patchLocal coordinates and geometricCut instead, but neither fixed the problem (although the results were different). If I change the directions so that it doesn't refine in the normal direction, checkMesh does not give errors but the refinement is not what I need (i.e. not refined in the z direction).

I have also tried to visualize were the problems might be using foamToVTK but don't seem to be able to see the faces in paraFoam, I am guessing because maybe they are too small and spreadout.

At this point I am stuck. There don't seem to be very many input parameters to change for refineMesh, so I am not sure what to do next. Thoughts?

I have tried it in both 2.1.0 and 2.1.x with the same results.

refineMeshDict:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
// Cells to refine; name of cell set
set c0;
 
// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
//  x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
//  patchLocalCoeffs section below.
coordinateSystem global;
//coordinateSystem patchLocal;
 
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
globalCoeffs
{
    tan1 (1 0 0);
    tan2 (0 1 0);
}
 
patchLocalCoeffs
{
    patch outside;  // Normal direction is facenormal of zero'th face of patch
    tan1 (1 0 0);
}
 
// List of directions to refine
directions
(
    tan1  //x
    tan2  //y
    normal //z
);
 
// Whether to use hex topology. This will
// - if patchLocal: all cells on selected patch should be hex
// - split all hexes in 2x2x2 through the middle of edges.
useHexTopology  true;
 
// Cut purely geometric (will cut hexes through vertices) or take topology
// into account. Incompatible with useHexTopology
geometricCut    false;
 
// Write meshes from intermediate steps
writeMesh      false;
 
// ************************************************************************* //

checkMesh output:
Code:

hydro@Bass:rasWES-WithPier-Refined2$ checkMesh -time 0.001
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.x-2ddb0f183f86
Exec  : checkMesh -time 0.001
Date  : Jul 26 2012
Time  : 22:16:52
Host  : "Bass"
PID    : 5559
Case  : /home/hydro/OpenFOAM/hydro-2.1.0/run/wes/rasWES-WithPier-Refined2
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
 
Create polyMesh for time = 0.001
 
Time = 0.001
 
Mesh stats
    points:          221480
    faces:            597334
    internal faces:  560780
    cells:            188271
    boundary patches: 6
    point zones:      0
    face zones:      0
    cell zones:      0
 
Overall number of cells of each type:
    hexahedra:    176891
    prisms:        1590
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    9790
 
Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).
 
Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    top                2050    2271    ok (non-closed singly connected) 
    walls              19801    20838    ok (non-closed singly connected) 
    outlet              960      1055    ok (non-closed singly connected) 
    inlet              819      907      ok (non-closed singly connected) 
    bottom              1586    1757    ok (non-closed singly connected) 
    wes                11338    11835    ok (non-closed singly connected) 
 
Checking geometry...
    Overall domain bounding box (-40 0 0) (40 6.33 30)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (5.55089e-16 -9.55142e-16 -1.45354e-15) OK.
    Max cell openness = 4.41608e-16 OK.
    Max aspect ratio = 4.53029 OK.
 ***Zero or negative face area detected.  Minimum area: 0
  <<Writing 4 zero area faces to set zeroAreaFaces
    Min volume = 0.000624369. Max volume = 0.13697.  Total volume = 12956.9.  Cell volumes OK.
    Mesh non-orthogonality Max: 149.508 average: 6.90896
  *Number of severely non-orthogonal faces: 2.
 ***Number of non-orthogonality errors: 46.
  <<Writing 48 non-orthogonal faces to set nonOrthoFaces
 ***Error in face pyramids: 66 faces are incorrectly oriented.
  <<Writing 33 faces with incorrect orientation to set wrongOrientedFaces
    Max skewness = 2.66863 OK.
    Coupled point location match (average 0) OK.
 
Failed 3 mesh checks.
 
End


ic3wall August 17, 2012 11:31

I would also be interested in the solution regarding this. I'm trying to refine a structured purely hex mesh, and when refining in the z-direction checkMesh complains about non-ortho faces.

The smallest cells I'm trying to cut in the normal direction are 1-2m, which is not that small ...

mgdenno August 17, 2012 11:41

Unfortunately I have not been able to figure out what is happening or what is causing the problem.

As a workaround, since I am using snappyHexMesh to generate my mesh, I defined refinement regions in my SHM dictionary. The results in more cells being refined than really need to be but it worked OK.

I would definitely still be interested in knowing how to resolve this if you figure it out.

ic3wall August 17, 2012 12:10

But snappy refinement region's feature does the same thing as refineMesh, so it's weird you're not getting errors also with SHM. It splits cells 2x2x2...

mgdenno August 17, 2012 13:24

I agree that it is weird. The extent of the areas being refined are different between SHM and refineMesh because when using refinedMesh I selected my cells using topoSet to select the ones that had alpha1 between 0.001 and 0.999. When using SHM I made a series of boxes that encompass those same cells, which results in many cells more being refined. Could you try and use SHM without an stl file, or an stl file that is outside your mesh? How were you creating your cellSet for refineMesh?

ic3wall August 17, 2012 14:11

I'm using SHM without STL file:

// Which of the steps to run
castellatedMesh true;
snap false;
addLayers false;

When using refineMesh, I select the cells with cellSet using the cellSetDict:

boxToCell (400 400 40) (600 600 120)

which is exactly the same principle in SHM with

geometry
{
box
{
type searchableBox;
min (400 400 40);
max (600 600 120);
}
};

mgdenno August 17, 2012 14:19

I am not 100% sure as I have an STL file in mine. I am actually running my analysis on my unrefined mesh that was generated using SHM, then running SHM again to generate a new mesh that has refinement regions specified, then mapping the first results to the refined mesh and running again. However, I would guess that what you have "castellatedMesh true;" would be fine - I don't expect that it will do anything as you aren't specifying a surface...hopefully it will still refine the refinement regions.

ic3wall August 17, 2012 15:44

Quote:

Originally Posted by mgdenno (Post 377539)
I am not 100% sure as I have an STL file in mine. I am actually running my analysis on my unrefined mesh that was generated using SHM, then running SHM again to generate a new mesh that has refinement regions specified, then mapping the first results to the refined mesh and running again. However, I would guess that what you have "castellatedMesh true;" would be fine - I don't expect that it will do anything as you aren't specifying a surface...hopefully it will still refine the refinement regions.

It does refine correctly, there is no problem using SHM for refinement only as long as you put false to snapping and addLayers.

The problem is that when it refines normally (z-direction), checkMesh complains about non ortho faces. Samething happens with refineMesh, which I dont understand since it's only cutting hex in 2x2x2 and it uses polyhedra for the transition between refinement levels.

In refineMesh, when normal direction is commented, no problem in checkMesh!

mgdenno August 19, 2012 11:30

Just to follow-up on this, I have come up with a slightly better work around using SHM that doesn't result in refining more cells than needed as was the case when using refinement boxes. First create a cell set as if you were going to use refineMesh. Next, convert the cellSet to VTK using foamToVTK, then convert that to STL using the script in the post linked below. This STL can then be added to the SHM dict and used as a refinement region using mode inside.

http://www.cfd-online.com/Forums/ope...-openfoam.html

Hope this helps someone else.

roenby August 25, 2013 11:10

What writePrecision do you have in system/controlDict?
 
I got similar errors after doing topoSet and refineMesh on a simple blockMesh.
Turned out I was running with too low writePrecision (= 3 because I need to write out A LOT of data and don't need all those decimals) in system/controlDict.

Changing writePrecision to 4 removed all errors in the checkMesh.

Hope this helped.

sandy13 October 14, 2014 05:16

Quote:

Originally Posted by roenby (Post 447931)
I got similar errors after doing topoSet and refineMesh on a simple blockMesh.
Turned out I was running with too low writePrecision (= 3 because I need to write out A LOT of data and don't need all those decimals) in system/controlDict.

Changing writePrecision to 4 removed all errors in the checkMesh.

Hope this helped.

Dear roenby,
I saw your post and wish if you can help me. I want to refine a specific region(small box shape) inside my original region(big box). I am using OpenFOAM 2.1.1. I used toposet dict to set up the cellSet as a box. so basically I ran blockMesh, topoSet, then refineMesh. But the problem now I get all the domain refined including the small box which I want to just refine it. couled you please direct me? do I need to use another utility?
Regards,
Sandy13,


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