neperfepx / neper

Polycrystal generation and meshing
http://neper.info
GNU General Public License v3.0
205 stars 53 forks source link

mode -1 in `.stcell` file for single-phase tesselations #374

Closed MiguelVCarvalho closed 2 years ago

MiguelVCarvalho commented 2 years ago

Description

Considering -statcell mode, area, when creating a 2-phase tesselation (0.3 and 0.7 volume fractions) with:

-group mode -morpho "diameq:0.3*lognormal(1,0.35)+0.7*lognormal(1,0.35),sphericity:lognormal(0.145,0.03,1-x)"

the first column of the .stcell file describes the phase associated with each element.

image

However, if the -morpho argument is replaced by graingrowth to obtain a single-phase tesselation:

-group mode -morpho graingrowth

the first column of the .stcell gives the value -1 instead of the expected 1 (related to phase 1) (??).

image

Probably I am misunderstanding something.. I want to use the same -statcell arguments and get the correct element phase in the .stcell file, regardless of requesting a single or multi-phase tesselation.

Reproduce

Single-phase

neper --rcfile none -T -n 5 -id 1 -dim 2 -group mode -morpho graingrowth -ori uniform -oricrysym cubic -regularization 1 -mloop 100 -o 1-phase_5-grain -format tess,ori,geo -oridescriptor e -statcell mode,area

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.2.1-27
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 12 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2021, and GNU GPL'd, by Romain Quey.
Info   : Ignoring initialization file.
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -n 5 -id 1 -dim 2 -group mode -morpho graingrowth
         -ori uniform -oricrysym cubic -regularization 1 -mloop 100 -o
         1-phase_5-grain -format tess,ori,geo -oridescriptor e -statcell
         mode,area
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :   - Setting seeds... 100%
Info   :   - Generating crystal orientations...
Info   :     > Crystal symmetry: cubic, no cut-off
Info   :     > Initial solution: f   =1.000000000
Info   :     > Iteration     51: fmin=0.000790707, f=0.000790707
Info   :     > Final solution  : f   =0.000790707 (51 iterations)
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =34.442621891
Info   :     > Iteration   1788: fmin=0.035538763 f=0.035539190  
Info   :     > Final solution  : f   =0.035538763 (1788 iterations)
Info   :     > Reached `eps' criterion.
Info   : Regularizing tessellation...
Info   :   - 
Info   : Computing cell groups...
Info   : Writing results...
Info   :     [o] Writing file `1-phase_5-grain.tess'...
Info   :     [o] Wrote file `1-phase_5-grain.tess'.
Info   :     [o] Writing file `1-phase_5-grain.geo'...
Info   :     [o] Wrote file `1-phase_5-grain.geo'.
Info   :     [o] Writing file `1-phase_5-grain.ori'...
Info   :     [o] Wrote file `1-phase_5-grain.ori'.
Info   : Writing statistics...
Info   :     [o] Writing file `1-phase_5-grain.stcell'...
Info   :     [o] Wrote file `1-phase_5-grain.stcell'.
Info   : Elapsed time: 0.988 secs.
========================================================================

Multi-phase (2 phases)

neper --rcfile none -T -n 5 -id 10 -dim 2 -group mode -morpho "diameq:0.3*lognormal(1,0.35)+0.7*lognormal(1,0.35),sphericity:lognormal(0.145,0.03,1-x)" -ori uniform -oricrysym cubic -regularization 1 -mloop 100 -o 2-phase_5-grain -format tess,ori,geo -oridescriptor e -statcell mode,area -statgroup id,area

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.2.1-27
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 12 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2021, and GNU GPL'd, by Romain Quey.
Info   : Ignoring initialization file.
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -n 5 -id 10 -dim 2 -group mode -morpho
         diameq:0.3*lognormal(1,0.35)+0.7*lognormal(1,0.35),sphericity:lognormal(0.145,0.03,1-x)
         -ori uniform -oricrysym cubic -regularization 1 -mloop 100 -o
         2-phase_5-grain -format tess,ori,geo -oridescriptor e -statcell
         mode,area -statgroup id,area
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :   - Setting seeds... 100%
Info   :   - Generating crystal orientations...
Info   :     > Crystal symmetry: cubic, no cut-off
Info   :     > Initial solution: f   =1.000000000
Info   :     > Iteration     64: fmin=0.000925562, f=0.000925562
Info   :     > Final solution  : f   =0.000925562 (64 iterations)
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =97.459960812
Info   :     > Iteration   1199: fmin=58.395588603 f=58.395589719 
Info   :     > Final solution  : f   =58.395588603 (1199 iterations)
Info   :     > Reached `eps' criterion.
Info   : Regularizing tessellation...
Info   :   - 
Info   : Computing cell groups...
Info   : Writing results...
Info   :     [o] Writing file `2-phase_5-grain.tess'...
Info   :     [o] Wrote file `2-phase_5-grain.tess'.
Info   :     [o] Writing file `2-phase_5-grain.geo'...
Info   :     [o] Wrote file `2-phase_5-grain.geo'.
Info   :     [o] Writing file `2-phase_5-grain.ori'...
Info   :     [o] Wrote file `2-phase_5-grain.ori'.
Info   : Writing statistics...
Info   :     [o] Writing file `2-phase_5-grain.stcell'...
Info   :     [o] Wrote file `2-phase_5-grain.stcell'.
Info   :     [o] Writing file `2-phase_5-grain.stgroup'...
Info   :     [o] Wrote file `2-phase_5-grain.stgroup'.
Info   : Elapsed time: 0.842 secs.
========================================================================
MiguelVCarvalho commented 2 years ago

Currently, for single-phase tesselations, I am using -group 1 -morpho graingrowth with -statcell group, area to obtain a column with the value 1 for each element.

rquey commented 2 years ago

Thanks @MiguelVCarvalho for the bug report. Now fixed. It will also be up in the next release, to come soon.