lanl / LaGriT

Los Alamos Grid Toolbox (LaGriT) is a library of user callable tools that provide mesh generation, mesh optimization and dynamic mesh maintenance in two and three dimensions.
https://lanl.github.io/LaGriT/
Other
122 stars 49 forks source link

quality/edge_max bug #169

Closed millerta closed 5 years ago

millerta commented 5 years ago

quality/edge_max is not reporting the binned edge lengths correctly:

quality/edge_max/y                                                              
cmo/addatt//edgemax/VDOUBLE/scalar/nelements 

--------------------------------------------                                    
element norm max edge length < .01:                    0                        
element norm edge length b/w .01 and .02:          0                            
element norm edge length b/w .02 and .05:          0                            
element norm edge length b/w .05 and .1 :          0                            
element norm edge length b/w .1  and .2 :          0                            
element norm edge length b/w .2  and .5 :          0                            
element norm edge length b/w .5  and 1. :         12                            
min max edge length =  0.1414E+01  max max edge length =  0.1855E+01            
-----------------------------------------------------------                    
millerta commented 5 years ago

The bin values for these values are correct, they have been normalized to values between 0 and 1 by dividing all values by the max value so that max value becomes 1 in the bins. Add an extra line to output to clarify when this is done.

Values are normalized by dividing by max value.

millerta commented 5 years ago

Checking other quality options, it appears that all options are normalized for the bins. But this is incorrect for the aspect ratios which are already numbers between 0 an 1. This is an error and needs to be fixed.

millerta commented 5 years ago

Bins using log scale between 1 and 0 are aspect, edge_ratio, edge_min, edge_max. Changed quality.f so aspect and edge_ratio are not normalized and a line added where normalized. This changes reporting slightly, for instance these are quality reports on the tet wedge. See https://lanl.github.io/LaGriT/pages/docs/QUALITY_sliver_cap_needle_wedge.html

quality/aspect/y
--------------------------------------------
elements with aspect ratio < .01:                    0
elements with aspect ratio b/w .01 and .02:          0
elements with aspect ratio b/w .02 and .05:          0
elements with aspect ratio b/w .05 and .1 :          0
elements with aspect ratio b/w .1  and .2 :          0
elements with aspect ratio b/w .2  and .5 :          1
elements with aspect ratio b/w .5  and 1. :          0
min aspect ratio =  0.2617E+00  max aspect ratio =  0.2617E+00
-----------------------------------------------------------
         1 total elements evaluated.

quality/edge_ratio/y
--------------------------------------------
elements with min/max edge ratio  <  .01:                    0
elements with min/max edge ratio b/w .01 and .02:          0
elements with min/max edge ratio b/w .02 and .05:          0
elements with min/max edge ratio b/w .05 and .1 :          1
elements with min/max edge ratio b/w .1  and .2 :          0
elements with min/max edge ratio b/w .2  and .5 :          0
elements with min/max edge ratio b/w .5  and 1. :          0
min edge ratio =  0.1000E+00  max edge ratio =  0.1000E+00
-----------------------------------------------------------
         1 total elements evaluated.

quality/edge_min/y

--------------------------------------------
Edge min normalized by dividing with max value.
element norm min edge length < .01:                    0
element norm edge length b/w .01 and .02:          0
element norm edge length b/w .02 and .05:          0
element norm edge length b/w .05 and .1 :          0
element norm edge length b/w .1  and .2 :          0
element norm edge length b/w .2  and .5 :          0
element norm edge length b/w .5  and 1. :          1
min min edge length =  0.2000E+00  max min edge length =  0.2000E+00
-----------------------------------------------------------
         1 total elements evaluated.

quality/edge_max/y
--------------------------------------------
Edge max normalized by dividing with max value.
element norm max edge length < .01:                    0
element norm edge length b/w .01 and .02:          0
element norm edge length b/w .02 and .05:          0
element norm edge length b/w .05 and .1 :          0
element norm edge length b/w .1  and .2 :          0
element norm edge length b/w .2  and .5 :          0
element norm edge length b/w .5  and 1. :          1
min max edge length =  0.2000E+01  max max edge length =  0.2000E+01
-----------------------------------------------------------
         1 total elements evaluated.
millerta commented 5 years ago

Fixed incorrect values reported for volumes by using mpno and mpary. Changed aspect and edge_ratio so values are not normalized for bin numbers. Added line to report if values are normalized for the bin values. Add directory test/level01/quality These changes will require updated reference files for many of the tests using quality.

millerta commented 5 years ago

During testing discovered quality aspect ratio is reporting errors of values gt than 1. This was avoided in old code because dividing by max value to normalize made values equal to 1 rather than an epsilon greater: With normalize removed, there is an epsilon difference that should be avoided.

gt 1 aspect ratio for elem         20 is  0.1000E+01                            
srat > 1:    1.0000000000000002        1.0000000000000000   
millerta commented 5 years ago

Note on test suite, many reference files had to be updated since most tests call quality. This does not change the correctness of the code, simply the reporting of quality bin counts.

The quality reports on min and max values are unchanged, but the bin distributions for aspect ratio and edge ratio are now correct with distribution reflected by min max values. For instance, with normalized values most bin fall into the values near 1:

--------------------------------------------                                    
elements with aspect ratio < .01:                    0                          
elements with aspect ratio b/w .01 and .02:          0                          
elements with aspect ratio b/w .02 and .05:          0                          
elements with aspect ratio b/w .05 and .1 :          0                          
elements with aspect ratio b/w .1  and .2 :          0                          
elements with aspect ratio b/w .2  and .5 :          0                          
elements with aspect ratio b/w .5  and 1. :        879                          
min aspect ratio =  0.3876E+00  max aspect ratio =  0.5013E+00        

Without normalize of values, we get a more accurate distribution with respect to min/max:

--------------------------------------------                                    
elements with aspect ratio < .01:                    0                          
elements with aspect ratio b/w .01 and .02:          0                          
elements with aspect ratio b/w .02 and .05:          0                          
elements with aspect ratio b/w .05 and .1 :          0                          
elements with aspect ratio b/w .1  and .2 :          0                          
elements with aspect ratio b/w .2  and .5 :        549                          
elements with aspect ratio b/w .5  and 1. :        330                          
min aspect ratio =  0.3876E+00  max aspect ratio =  0.5013E+00