MmgTools / ParMmg

Distributed parallelization of 3D volume mesh adaptation
Other
34 stars 19 forks source link

Edge length errors in anisotropic mode #52

Open lcirrottola opened 2 years ago

lcirrottola commented 2 years ago

I am both encouraging this development and have specific issues. ParMmg develop reports very weird results with Mmg develop in anisotropic mode (check below for nan, inf, and negative edge length), so I hope that once this is merged in develop, ParMmg will behave. I have no such issue with isotropic meshing.

$ '/opt/homebrew/bin/mpiexec' -n 10 /Volumes/Data/repositories/FreeFem-sources-opt/src/mpi/FreeFem++-mpi -nw 'laplace-adapt-dist-3d-PETSc.edp' -v 0 -wg -iMax 2 -verbose 5
  0 KSP Residual norm 5.856778376147e-01 
  1 KSP Residual norm 1.774332796564e-02 
  2 KSP Residual norm 2.013850875238e-03 
  3 KSP Residual norm 1.369002836462e-04 
  4 KSP Residual norm 1.039126769538e-05 
  5 KSP Residual norm 9.117826241568e-07 

  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   MODULE PARMMGLIB_DISTRIBUTED: IMB-LJLL : 1.4.0 (Nov. 05, 2021)
  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
     git branch: HEAD
     git commit: 3972301c607e94e4250aff5cd9c964b1251c7a88
     git date:   2022-02-14 18:05:45 +0100

  -- PMMG: CHECK INPUT DATA
  -- CHECK INPUT DATA COMPLETED.     0.000s

  -- PHASE 1 : ANALYSIS

  -- RESULTING EDGE LENGTHS  1359
     AVERAGE LENGTH               1.5065
     SMALLEST EDGE LENGTH         0.8333      255    248
     LARGEST  EDGE LENGTH         3.2025      159    212 

  -- PARALLEL MESH QUALITY  1981   9072
     BEST   0.743447  AVRG.   0.416806  WRST.   0.149224 (PROC 8 - ELT 542)
     HISTOGRAMM:  100.00 % > 0.12
                   29.20 % >  0.5
       0.6 < Q <   0.8      1623    17.89 %
       0.4 < Q <   0.6      2557    28.19 %
       0.2 < Q <   0.4      4822    53.15 %
       0.0 < Q <   0.2        70     0.77 %
   -- PHASE 1 COMPLETED.     0.062s

  -- PHASE 2 : ANISOTROPIC MESHING
       group splitting                   0.001s

       adaptation: iter 1   cumul. timer 0.000s
       mmg                               0.552s
       metric and fields interpolation   0.001s
       load balancing                    0.158s

       adaptation: iter 2   cumul. timer 0.713s
       mmg                               0.435s
       metric and fields interpolation   0.001s
       load balancing                    0.071s

       adaptation: iter 3   cumul. timer 1.223s
       mmg                               0.192s
       metric and fields interpolation   0.004s
       load balancing                    0.159s

  -- PARALLEL MESH QUALITY  3583   18612
     BEST   0.997267  AVRG.   0.771946  WRST.   0.090815 (PROC 6 - ELT 2035)
     HISTOGRAMM:   99.99 % > 0.12
                   96.62 % >  0.5
       0.8 < Q <   1.0      8467    45.49 %
       0.6 < Q <   0.8      8341    44.82 %
       0.4 < Q <   0.6      1587     8.53 %
       0.2 < Q <   0.4       208     1.12 %
       0.0 < Q <   0.2         9     0.05 %

       mesh packing                      0.192s
       group merging                     0.000s
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-1.603799e-01)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-4.139075e-02)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-1.025905e+00)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-5.619068e-01)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-5.293369e-01)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-3.432190e-02)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-5.751909e-02)
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-1.791615e-01)

  -- RESULTING EDGE LENGTHS (ROUGH EVAL.) 27202 
     AVERAGE LENGTH                  nan
     SMALLEST EDGE LENGTH           -inf      284    277 (PROC 0)
     LARGEST  EDGE LENGTH            inf       18      4 (PROC 0)
     0.71 < L < 1.41     21087   77.52 %  

     HISTOGRAMM:
     0.00 < L < 0.30      3201   11.77 %  
     0.30 < L < 0.60       229    0.84 %  
     0.60 < L < 0.71      1219    4.48 %  
     0.71 < L < 0.90      9094   33.43 %  
     0.90 < L < 1.30     11042   40.59 %  
     1.30 < L < 1.41       951    3.50 %  
     1.41 < L < 2.00       700    2.57 %  
     2.00 < L < 5.00        44    0.16 %  
     5.   < L              722    2.65 %  

     WARNING: unable to compute the length of 23 edges
  -- PHASE 2 COMPLETED.     1.614s

   -- PHASE 3 : MESH PACKED UP
   -- PHASE 3 COMPLETED.     0.001s

   PARMMGLIB_DISTRIBUTED: ELAPSED TIME  1.676s

  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   END OF MODULE PARMMGLIB_DISTRIBUTED: IMB-LJLL 
  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  0 KSP Residual norm 7.699519090787e-01 
  1 KSP Residual norm 4.298789823018e-02 
  2 KSP Residual norm 7.318720576567e-03 
  3 KSP Residual norm 1.180535786134e-03 
  4 KSP Residual norm 2.049118909033e-04 
  5 KSP Residual norm 3.156081226217e-05 
  6 KSP Residual norm 4.175108326620e-06 

  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   MODULE PARMMGLIB_DISTRIBUTED: IMB-LJLL : 1.4.0 (Nov. 05, 2021)
  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
     git branch: HEAD
     git commit: 3972301c607e94e4250aff5cd9c964b1251c7a88
     git date:   2022-02-14 18:05:45 +0100

  -- PMMG: CHECK INPUT DATA
  -- CHECK INPUT DATA COMPLETED.     0.003s

  -- PHASE 1 : ANALYSIS

  -- RESULTING EDGE LENGTHS  2673
     AVERAGE LENGTH               1.4428
     SMALLEST EDGE LENGTH         0.6648      256    255
     LARGEST  EDGE LENGTH         2.9753      161    160 

  -- PARALLEL MESH QUALITY  3583   18612
     BEST   0.987634  AVRG.   0.625663  WRST.   0.036598 (PROC 2 - ELT 630)
     HISTOGRAMM:   99.94 % > 0.12
                   79.81 % >  0.5
       0.8 < Q <   1.0      2376    12.77 %
       0.6 < Q <   0.8      8049    43.25 %
       0.4 < Q <   0.6      7082    38.05 %
       0.2 < Q <   0.4      1082     5.81 %
       0.0 < Q <   0.2        23     0.12 %
   -- PHASE 1 COMPLETED.     0.114s

  -- PHASE 2 : ANISOTROPIC MESHING
       group splitting                   0.014s

       adaptation: iter 1   cumul. timer 0.000s
       mmg                               1.146s
       metric and fields interpolation   0.002s
       load balancing                    0.161s

       adaptation: iter 2   cumul. timer 1.311s
       mmg                               0.461s
       metric and fields interpolation   0.007s
       load balancing                    0.095s

       adaptation: iter 3   cumul. timer 1.875s
       mmg                               0.716s
       metric and fields interpolation   0.003s
       load balancing                    0.200s

  -- PARALLEL MESH QUALITY  6996   37791
     BEST   0.994915  AVRG.   0.676747  WRST.   0.076175 (PROC 3 - ELT 966)
     HISTOGRAMM:   99.98 % > 0.12
                   84.47 % >  0.5
       0.8 < Q <   1.0      9568    25.32 %
       0.6 < Q <   0.8     16838    44.56 %
       0.4 < Q <   0.6      8925    23.62 %
       0.2 < Q <   0.4      2369     6.27 %
       0.0 < Q <   0.2        91     0.24 %

       mesh packing                      0.717s
       group merging                     0.000s
  ## Warning: MMG5_lenEdg: at least 1 negative edge length (-2.183505e-01)

  -- RESULTING EDGE LENGTHS (ROUGH EVAL.) 52195 
     AVERAGE LENGTH                  nan
     SMALLEST EDGE LENGTH           -inf       52      5 (PROC 0)
     LARGEST  EDGE LENGTH            inf        1    120 (PROC 0)
     0.71 < L < 1.41     35549   68.11 %  

     HISTOGRAMM:
     0.00 < L < 0.30      2887    5.53 %  
     0.30 < L < 0.60      2563    4.91 %  
     0.60 < L < 0.71      3310    6.34 %  
     0.71 < L < 0.90     11497   22.03 %  
     0.90 < L < 1.30     21436   41.07 %  
     1.30 < L < 1.41      2616    5.01 %  
     1.41 < L < 2.00      4133    7.92 %  
     2.00 < L < 5.00       554    1.06 %  
     5.   < L             3199    6.13 %  

     WARNING: unable to compute the length of 75 edges
  -- PHASE 2 COMPLETED.     2.886s

   -- PHASE 3 : MESH PACKED UP
   -- PHASE 3 COMPLETED.     0.002s

   PARMMGLIB_DISTRIBUTED: ELAPSED TIME  3.005s

  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   END OF MODULE PARMMGLIB_DISTRIBUTED: IMB-LJLL 
  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Originally posted by @prj- in https://github.com/MmgTools/mmg/issues/120#issuecomment-1066522368

lcirrottola commented 2 years ago

Thanks @prj- for reporting. Is it reproducible with https://github.com/FreeFem/FreeFem-sources/tree/develop, without modifications?

prj- commented 2 years ago

Maybe for good measure use the branch petsc-v3.17.0 instead (without modification). develop may be lagging slightly behind when it comes to Mmg and ParMmg commits, while petsc-v3.17.0 are tracking develop (modulo commits from my forks). Thanks in advance for your time :)

PS: if you use your own PETSc outside of FreeFEM, i.e., don't rely on FreeFEM make petsc-slepc, then this does not matter, you can indeed stick to develop.