View Issue Details

IDProjectCategoryView StatusLast Update
0001960OpenFOAM[All Projects] Bugpublic2016-01-03 11:46
ReporterwyldckatAssigned Tohenry 
PrioritylowSeverityfeatureReproducibilitysometimes
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0001960: Partial revision of comments in "src/dynamicMesh/meshCut" and added warning for "cellCuts::setFromCellCutter"
DescriptionMore details on how this report came to be are in the section "Additional Information".

Attached are the following proposition/revised files for OpenFOAM 3.0.x and dev:

  - OpenFOAM 3.0.x
    - cellCuts_30x.C - for replacing "src/dynamicMesh/meshCut/cellCuts/cellCuts.C"
    - cellCuts_30x.H - for replacing "src/dynamicMesh/meshCut/cellCuts/cellCuts.H"
    - refinementIterator_30x.C - for replacing "src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C"

  - OpenFOAM dev
    - cellCuts_dev.C - for replacing "src/dynamicMesh/meshCut/cellCuts/cellCuts.C"
    - cellCuts_dev.H - for replacing "src/dynamicMesh/meshCut/cellCuts/cellCuts.H"
    - refinementIterator_dev.C - for replacing "src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C"

The changes provided are as follows:

  1- For the class "cellCuts", several updates for the current code clean up strategy are provided, namely where the descriptions at the top of each method should either be omitted or inside the method itself. The header file "cellCuts.H" was also updated for the comments that were removed in the source code file "cellCuts.C".

  2- This warning chunk was added in "cellCuts" (diff formatted):

        @@ -2276,6 +2248,17 @@ void Foam::cellCuts::setFromCellCutter
                    {
                        cellLoops_[cellI].setSize(0);
        
        + WarningIn("Foam::cellCuts::setFromCellCutter")
        + << "Found loop on cell " << cellI
        + << " that resulted in an unexpected bad cut."
        + << " Suggestions:" << nl
        + << " - Turn on the debug switch for 'cellCuts' to get"
        + << " geometry files that identify this cell." << nl
        + << " - Also keep in mind to check the defined"
        + << " reference directions, as these are most likely the"
        + << " origin of the problem."
        + << nl << endl;
        +

    The reason is a result of the debugging session outlined in the section "Additional Information". Although this kind of "hand holding" isn't common in OpenFOAM, this is a suggestion on the kind of information it should be provided in this scenario. Namely that when the user doesn't use good enough directions for the cell cutting, there will be cells that are incorrectly cut and that could end up being a "needle in a haystack" that leads to a very bad mesh. Keep in mind that checkMesh might not complain about these unexpected incorrect cuts.

    If the suggestions should not be presented to the user, then at least the indication of the "unexpected bad cut" should be done. The remaining details could be provided as coded comments:

      // Turn on the debug switch for 'cellCuts' to get geometry files that identify this cell.
      // Check the defined reference directions, as these are most likely the origin of the problem.

    The remaining bread-crumb will be the trail to the commit where this was added and the respective reference to this report.


  3- In "refinementIterator.C" the name "refCells" is redefined to "refCellsDebug" within an "if(debug)" block in the method "setRefinement". If the line where the variable is redefined right now is accidentally deleted, it can have catastrophic results.
Steps To ReproduceAttached is the case "refineMeshTestCase.tar.gz" is adapted from the thread mentioned in "Additional Information". To run the case:

  blockMesh
  topoSet -dict system/topoSetDict_refine
  refineMesh -dict system/refineMeshDict
Additional InformationThis bug report and attached proposition files rose from the debugging session I went through for the following thread on the forum: http://www.cfd-online.com/Forums/openfoam-meshing/164309-refinemesh-problems-strange-cells-cuts-were-added.html

In summary, it was a user error, but it was rather annoying and lengthy to diagnose that it was in fact user error and what exactly it was due to. The problem is that if we use the following kind of setting in "refineMeshDict":

  //...

  coordinateSystem patchLocal;

  //...

  patchLocalCoeffs
  {
      // Normal direction is face normal of zero'th face of patch
      patch front;
      tan1 ( 1 0 0 );
      tan2 ( 0 1 0 );
  }

  directions
  (
      tan1
      tan2
  );

  //...

  useHexTopology yes;

  //...

But if the mesh has cells that have somewhat different orientations, then the resulting local cutting directions that are calculated by the class "dynamicMesh/meshCut/directions" can result in inconsistent cell cuts. The issue is shown in the following images:

  - "side_by_side_direction1.png" - This is what happens when we only define "tan1" inside the block "directions". The next image shows a bit better which two cells are meant to be cut.

  - "Number_2D_points_result.png" - This is the comparison of the previous image, that counts the number of vertexes per face, versus the resulting refinement when using the two directions "tan1" and "tan2".

The two cells that were refined demonstrate the smallest cellSet needed for reproducing this problem. The solution is rather simple:

  patchLocalCoeffs
  {
      // Normal direction is face normal of zero'th face of patch
      patch front;
      tan1 ( 1 1 0 );
      tan2 ( -1 1 0 );
  }

By using these two directions we get better results, because the local cutting directions are consistent for these trapezoid cells.
As for the other cells that are aligned with the major axis, the local cutting directions are not consistent, but any non-hex cells will get consistent geometrical cuts, since the centres are not misaligned.
TagsNo tags attached.

Activities

wyldckat

2016-01-02 16:12

updater  

cellCuts_30x.C (75,171 bytes)

wyldckat

2016-01-02 16:12

updater  

cellCuts_30x.H (19,836 bytes)

wyldckat

2016-01-02 16:12

updater  

cellCuts_dev.C (74,100 bytes)

wyldckat

2016-01-02 16:12

updater  

cellCuts_dev.H (19,836 bytes)

wyldckat

2016-01-02 16:12

updater  

refinementIterator_30x.C (7,806 bytes)

wyldckat

2016-01-02 16:12

updater  

refinementIterator_dev.C (7,778 bytes)

wyldckat

2016-01-02 16:12

updater  

refineMeshTestCase.tar.gz (2,836 bytes)

wyldckat

2016-01-02 16:13

updater  

wyldckat

2016-01-02 16:13

updater  

henry

2016-01-03 11:45

manager   ~0005794

Thanks Bruno, I have applied these changes. For future reference you can use the new "InFunction" macros in both dev and 3.0.x; I added support for these macros in 3.0.x specifically to make it easier to apply fixes to both versions.

henry

2016-01-03 11:46

manager   ~0005795

Resolved in OpenFOAM-dev by commit 1c693aa44e9210cc9b00cd5dd71c6f1daf79dd08
Resolved in OpenFOAM-3.0.x by commit e425e79485818dcb20c9cc3bd82cee73673d7e83

Issue History

Date Modified Username Field Change
2016-01-02 16:11 wyldckat New Issue
2016-01-02 16:11 wyldckat Status new => assigned
2016-01-02 16:11 wyldckat Assigned To => henry
2016-01-02 16:12 wyldckat File Added: cellCuts_30x.C
2016-01-02 16:12 wyldckat File Added: cellCuts_30x.H
2016-01-02 16:12 wyldckat File Added: cellCuts_dev.C
2016-01-02 16:12 wyldckat File Added: cellCuts_dev.H
2016-01-02 16:12 wyldckat File Added: refinementIterator_30x.C
2016-01-02 16:12 wyldckat File Added: refinementIterator_dev.C
2016-01-02 16:12 wyldckat File Added: refineMeshTestCase.tar.gz
2016-01-02 16:13 wyldckat File Added: side_by_side_direction1.png
2016-01-02 16:13 wyldckat File Added: Number_2D_points_result.png
2016-01-03 11:45 henry Note Added: 0005794
2016-01-03 11:46 henry Note Added: 0005795
2016-01-03 11:46 henry Status assigned => resolved
2016-01-03 11:46 henry Resolution open => fixed