Skip to content

Some bug in neper regarding "planecut" and "crop" #1037

@hdt5kt

Description

@hdt5kt

Describe the bug

Both "planecut" and "crop" command from "-transform" appears to be unable to provide cut for crystal structure with large number of cells

*Minimal working example

For planecut:

$ neper -T -id 42 -dim 3 -domain cube(20.0,20.0,20.0):translate(-10.0,-10.0,-10.0) -oridescriptor euler-bunge -o test -statcell id,vol,w,x,y,z,radeq -format tess,geo,ori -morpho gg(5) -morphooptistop iter=10 -transform planecut(0.0,0.0,0.0,1.0) -n from_morpho

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.10.2-22
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 32 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2024, and GNU GPL'd, by Romain Quey.
Info   : No initialization file found (`/home/tranh/.neperrc').
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -id 42 -dim 3 -domain
         cube(20.0,20.0,20.0):translate(-10.0,-10.0,-10.0) -oridescriptor
         euler-bunge -o
         test -statcell
         id,vol,w,x,y,z,radeq -format tess,geo,ori -morpho gg(5)
         -morphooptistop iter=10 -transform planecut(0.0,0.0,0.0,1.0) -n
         from_morpho
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :       . Number of cells: 86
Info   :   - Setting seeds... 100%
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =2.579489156
Info   :     > Iteration     10: fmin=2.579083127 f=2.579083127
Info   :     > Final   solution: f   =2.579083127
Info   :     > Final solution  : f   =2.579083127 (11 iterations)
Info   :     > Reached `itermax' criterion.
Info   : Generating crystal orientations...
Info   : Transforming tessellation...
Info   :   - Cutting by plane...
Info   : Writing results...
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.tess'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.tess'.
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.geo'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.geo'.
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.ori'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.ori'.
Info   : Writing statistics...
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.stcell'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.stcell'.
Info   : Elapsed time: 7.628 secs.
========================================================================

For crop:

neper -T -id 42 -dim 3 -domain cube(20.0,20.0,20.0):translate(-10.0,-10.0,-10.0) -oridescriptor euler-bunge -o test -statcell id,vol,w,x,y,z,radeq -format tess,geo,ori -morpho gg(5) -morphooptistop iter=10 -transform crop(cube(-10.1,10.1,-10.1,10.1,-1,1)) -n from_morpho

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.10.2-22
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 32 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2024, and GNU GPL'd, by Romain Quey.
Info   : No initialization file found (`/home/tranh/.neperrc').
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -id 42 -dim 3 -domain
         cube(20.0,20.0,20.0):translate(-10.0,-10.0,-10.0) -oridescriptor
         euler-bunge -o
        test -statcell
         id,vol,w,x,y,z,radeq -format tess,geo,ori -morpho gg(5)
         -morphooptistop iter=10 -transform
         crop(cube(-10.1,10.1,-10.1,10.1,-1,1)) -n from_morpho
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :       . Number of cells: 86
Info   :   - Setting seeds... 100%
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =2.579489156
Info   :     > Iteration     10: fmin=2.579083127 f=2.579083127
Info   :     > Final   solution: f   =2.579083127
Info   :     > Final solution  : f   =2.579083127 (11 iterations)
Info   :     > Reached `itermax' criterion.
Info   : Generating crystal orientations...
Info   : Transforming tessellation...
Info   :   - Cropping...
Error  : You have discovered a bug in Neper!  Please file an issue at
         https://github.com/rquey/neper/issues.  Thank you.

However, if I simply reduce number of cells, planecut and crop works correctly (I have confirm this visually)

neper -T -id 42 -dim 3 -domain cube(20.0,20.0,20.0):translate(-10.0,-10.0,-10.0) -oridescriptor euler-bunge -o test -statcell id,vol,w,x,y,z,radeq -format tess,geo,ori -morpho gg(7) -morphooptistop iter=10 -transform planecut(0.0,0.0,0.0,1.0) -n from_morpho

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.10.2-22
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 32 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2024, and GNU GPL'd, by Romain Quey.
Info   : No initialization file found (`/home/tranh/.neperrc').
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -id 42 -dim 3 -domain
         cube(20.0,20.0,20.0):translate(-10.0,-10.0,-10.0) -oridescriptor
         euler-bunge -o
        test -statcell
         id,vol,w,x,y,z,radeq -format tess,geo,ori -morpho gg(7)
         -morphooptistop iter=10 -transform planecut(0.0,0.0,0.0,1.0) -n
         from_morpho
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :       . Number of cells: 31
Info   :   - Setting seeds... 100%
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =11.518479061
Info   :     > Iteration     10: fmin=11.437968869 f=11.437968869
Info   :     > Final   solution: f   =11.437968869
Info   :     > Final solution  : f   =11.437968869 (11 iterations)
Info   :     > Reached `itermax' criterion.
Info   : Generating crystal orientations...
Info   : Transforming tessellation...
Info   :   - Cutting by plane...
Info   : Writing results...
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.tess'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.tess'.
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.geo'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.geo'.
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.ori'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.ori'.
Info   : Writing statistics...
Info   :     [o] Writing file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.stcell'...
Info   :     [o] Wrote file `/home/tranh/projects/cpfe_aps/hedm_study/test/voronoi.stcell'.
Info   : Elapsed time: 3.979 secs.
========================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions