Skip to content

Conversation

@MattiaMontanari
Copy link

New pull request which addes openGJK 1.1 to Neper devel branch

@rquey
Copy link
Member

rquey commented Sep 25, 2019

@MattiaMontanari, it does not seem to work as well as the original code.

Sample tesr:
neper -T -n 2 -for tesr

The original code (c3dd37d) converges to f=0:

$ neper -T -n from_morpho -morpho "tesr:file(n2-id1.tesr)" 

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 3.4.1-46
Info   : Built with: gsl nlopt libscotch openmp
Info   : Running on 8 threads.
Info   : <http://neper.sourceforge.net>
Info   : Copyright (C) 2003-2019, and GNU GPL'd, by Romain Quey.
Info   : Comments and bug reports: <[email protected]>.
Info   : Loading initialization file `/home/rquey/.neperrc'...
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] -format tess -tesrformat ascii
Info   : [com line] -n from_morpho -morpho tesr:file(n2-id1.tesr)
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :     [i] Parsing file `n2-id1.tesr'...
Info   :     [i] Parsed file `n2-id1.tesr'.
Info   :       . Number of cells: 2
Info   :   - Setting seeds... 100%
100%
Info   :   - Generating crystal orientations...
Info   :       . Listing cell voxels... 100.0%
Info   :       . Sampling factor along x = 3.938980.
Info   :       . Sampling factor along y = 3.938980.
Info   :       . Sampling factor along z = 3.938980.
Info   :       . Number of voxels per cell: min = 43, avg = 43, max = 43.
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =0.001130725
Info   :     > Iteration    729: fmin=0.000000000 f=0.000000000
Info   :     > Reached `x(r)eps' criterion.
Info   : Writing results...
Info   :     [o] Writing file `nfrom_morpho-id1.tess'...
Info   :     [o] Wrote file `nfrom_morpho-id1.tess'.
Info   : Elapsed time: 0.203 secs.
========================================================================

The pull-request code generates "Initial solution: f =nan" and does not converge to 0:

./neper -T -n from_morpho -morpho "tesr:file(n2-id1.tesr)" 

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 3.4.1-46
Info   : Built with: gsl nlopt libscotch openmp
Info   : Running on 8 threads.
Info   : <http://neper.sourceforge.net>
Info   : Copyright (C) 2003-2019, and GNU GPL'd, by Romain Quey.
Info   : Comments and bug reports: <[email protected]>.
Info   : Loading initialization file `/home/rquey/.neperrc'...
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] -format tess -tesrformat ascii
Info   : [com line] -n from_morpho -morpho tesr:file(n2-id1.tesr)
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :     [i] Parsing file `n2-id1.tesr'...
Info   :     [i] Parsed file `n2-id1.tesr'.
Info   :       . Number of cells: 2
Info   :   - Setting seeds... 100%
100%
Info   :   - Generating crystal orientations...
Info   :       . Listing cell voxels... 100.0%
Info   :       . Sampling factor along x = 3.938980.
Info   :       . Sampling factor along y = 3.938980.
Info   :       . Sampling factor along z = 3.938980.
Info   :       . Number of voxels per cell: min = 43, avg = 43, max = 43.
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =nan
Info   :     > Iteration    102: fmin=0.001267651 f=0.001267651
Info   :     > Reached `eps' criterion.
Info   : Writing results...
Info   :     [o] Writing file `nfrom_morpho-id1.tess'...
Info   :     [o] Wrote file `nfrom_morpho-id1.tess'.
Info   : Elapsed time: 0.024 secs.
========================================================================

@MattiaMontanari
Copy link
Author

I have pushed a new version as I couldn't find the bug in the previous one... This seems to work now.

@rquey
Copy link
Member

rquey commented Oct 14, 2019

It works for the previous case (n=2, id=1) but unfortunately not in general. Here is an example with n=4:

Sample tesr:
neper -T -n 4 -for tesr

Version 3.5.0 converges to f=0:

$ neper -T -n from_morpho -morpho "tesr:file(n4-id1.tesr)" -morphooptistop "val=1e-9"

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 3.5.0             
Info   : Built with: gsl, nlopt, openmp
Info   : Running on 8 threads.
Info   : <http://neper.info> <http://neper.info/community>
Info   : Copyright (C) 2003-2019, and GNU GPL'd, by Romain Quey.
Info   : Loading initialization file `/home/rquey/.neperrc'...
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:          
Info   : [ini file] -format tess,geo -tesrformat ascii                    
Info   : [com line] -n from_morpho -morpho tesr:file(n4-id1.tesr)
         -morphooptistop val=1e-9                
Info   : ---------------------------------------------------------------
Info   : Reading input data...               
Info   : Creating domain...
Info   : Creating tessellation...                       
Info   :     [i] Parsing file `n4-id1.tesr'...      
Info   :     [i] Parsed file `n4-id1.tesr'.            
Info   :       . Number of cells: 4                
Info   :   - Setting seeds... 100%
100%                                                                    
Info   :   - Generating crystal orientations...
Info   :       . Listing cell voxels... 100.0%    
Info   :       . Sampling factor along x = 3.126371.
Info   :       . Sampling factor along y = 3.126371.
Info   :       . Sampling factor along z = 3.126371.
Info   :       . Number of voxels per cell: min = 33, avg = 62, max = 100.
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =0.002251995
Info   :     > Iteration   5866: fmin=0.000000000 f=0.000000000
Info   :     > Reached `val' criterion.
Info   : Writing results...
Info   :     [o] Writing file `nfrom_morpho-id1.tess'...
Info   :     [o] Wrote file `nfrom_morpho-id1.tess'.
Info   :     [o] Writing file `nfrom_morpho-id1.geo'...
Info   :     [o] Wrote file `nfrom_morpho-id1.geo'.
Info   : Elapsed time: 2.738 secs.
========================================================================

The pull-request code does not converge to 0:

$ neper -T -n from_morpho -morpho "tesr:file(n4-id1.tesr)" -morphooptistop "val=1e-9"

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 3.4.1-46
Info   : Built with: gsl nlopt openmp
Info   : Running on 8 threads.
Info   : <http://neper.sourceforge.net>
Info   : Copyright (C) 2003-2019, and GNU GPL'd, by Romain Quey.
Info   : Comments and bug reports: <[email protected]>.
Info   : Loading initialization file `/home/rquey/.neperrc'...
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] -format tess,geo -tesrformat ascii
Info   : [com line] -n from_morpho -morpho tesr:file(n4-id1.tesr)
         -morphooptistop val=1e-9
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :     [i] Parsing file `n4-id1.tesr'...
Info   :     [i] Parsed file `n4-id1.tesr'.
Info   :       . Number of cells: 4
Info   :   - Setting seeds... 100%
100%
Info   :   - Generating crystal orientations...
Info   :       . Listing cell voxels... 100.0%
Info   :       . Sampling factor along x = 3.126371.
Info   :       . Sampling factor along y = 3.126371.
Info   :       . Sampling factor along z = 3.126371.
Info   :       . Number of voxels per cell: min = 33, avg = 62, max = 100.
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =0.002251996
Info   :     > Iteration  82821: fmin=0.000009213 f=0.000009213
Info   :     > Reached `x(r)eps' criterion.
Info   : Writing results...
Info   :     [o] Writing file `nfrom_morpho-id1.tess'...
Info   :     [o] Wrote file `nfrom_morpho-id1.tess'.
Info   :     [o] Writing file `nfrom_morpho-id1.geo'...
Info   :     [o] Wrote file `nfrom_morpho-id1.geo'.
Info   : Elapsed time: 8.725 secs.
========================================================================

@MattiaMontanari
Copy link
Author

Somehow I'm not able to reproduce the results you're showing from this repository (I tried both master v3.5.0 and devel V3.5.1-3). This is what I get from master:

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 3.5.0
Info   : Built with: gsl, nlopt, openmp
Info   : Running on 24 threads.
Info   : <http://neper.info> <http://neper.info/community>
Info   : Copyright (C) 2003-2019, and GNU GPL'd, by Romain Quey.
Info   : No initialization file found (`/home/mmontanari/.neperrc').
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -n from_morpho -morpho tesr:file(n4-id1.tesr)
         -morphooptistop val=1e-9
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :     [i] Parsing file `n4-id1.tesr'...
Info   :     [i] Parsed file `n4-id1.tesr'.
Info   :       . Number of cells: 4
Info   :   - Setting seeds... 100%
100%
Info   :   - Generating crystal orientations...
Info   :       . Listing cell voxels... 100.0%
Info   :       . Sampling factor along x = 3.126371.
Info   :       . Sampling factor along y = 3.126371.
Info   :       . Sampling factor along z = 3.126371.
Info   :       . Number of voxels per cell: min = 33, avg = 62, max = 100.
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =0.002251995
Info   :     > Iteration   698184: fmin=0.000000855 f=0.000000855
Warning:     > Stopping on Ctrl+C invocation.
Info   : Writing results...
Info   :     [o] Writing file `nfrom_morpho-id1.tess'...
Info   :     [o] Wrote file `nfrom_morpho-id1.tess'.
Info   : Elapsed time: 81.011 secs.
========================================================================

If I run openGJK in the new devel branch I get the initial f and final fmin:

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 3.5.1-3
Info   : Built with: gsl, nlopt, openmp
Info   : Running on 24 threads.
Info   : <http://neper.info> <http://neper.info/community>
Info   : Copyright (C) 2003-2019, and GNU GPL'd, by Romain Quey.
Info   : No initialization file found (`/home/mmontanari/.neperrc').
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -n from_morpho -morpho tesr:file(n4-id1.tesr)
         -morphooptistop val=1e-9
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :     [i] Parsing file `n4-id1.tesr'...
Info   :     [i] Parsed file `n4-id1.tesr'.
Info   :       . Number of cells: 4
Info   :   - Setting seeds... 100%
100%
Info   :   - Generating crystal orientations...
Info   :       . Listing cell voxels... 100.0%
Info   :       . Sampling factor along x = 3.126371.
Info   :       . Sampling factor along y = 3.126371.
Info   :       . Sampling factor along z = 3.126371.
Info   :       . Number of voxels per cell: min = 33, avg = 62, max = 100.
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =0.002251995
Info   :     > Iteration  24977: fmin=0.000000001 f=0.000000001
Info   :     > Reached `val' criterion.
Info   : Writing results...
Info   :     [o] Writing file `nfrom_morpho-id1.tess'...
Info   :     [o] Wrote file `nfrom_morpho-id1.tess'.
Info   : Elapsed time: 98.156 secs.
========================================================================

To get these, I relaxed some of the tollerances (see d605eee).

Perhaps I need to configure cmake differently?

@rquey
Copy link
Member

rquey commented Oct 15, 2019

Not sure about your not reproducing the 3.5.0 results.
Your implementation now appears to give much better results and is faster than mine - great!
In the below example, openGJK complains * * OPENGJK REACHED MAXIMUM ITERATION NUMBER ! * * * * * * * *. Could it be fixed (muted?)?

$ neper -T -n 100 -morpho gg -for tesr
$ neper -T -n from_morpho -morpho "tesr:file(n100-id1.tesr)" -morphooptistop "val=1e-9"

@MattiaMontanari
Copy link
Author

Not sure about your not reproducing the 3.5.0 results.
Your implementation now appears to give much better results and is faster than mine - great!
In the below example, openGJK complains * * OPENGJK REACHED MAXIMUM ITERATION NUMBER ! * * * * * * * *. Could it be fixed (muted?)?

$ neper -T -n 100 -morpho gg -for tesr
$ neper -T -n from_morpho -morpho "tesr:file(n100-id1.tesr)" -morphooptistop "val=1e-9"

All done!

@rquey rquey merged commit bc6dbbe into neperfepx:devel Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants