sampotter/fluxpy

assertion error in CompressedFormFactorMatrix.assemble_using_quadtree

Closed this issue · 9 comments

~/Thermal/Potter2/python-flux/examples$ generate_FF_from_grd.py  
x_min: -100.0 x_max: 100.0 x_inc: 2.5 n_columns: 81 
y_min: -100.0 y_max: 100.0 y_inc: 2.5 n_rows: 81
loaded ./ingersoll81.grd
created mesh with 12800 triangles
wrote mesh12800.obj to disk
wrote topo2.png
Traceback (most recent call last):
  File "./generate_FF_from_grd.py", line 91, in <module>
    FF = CompressedFormFactorMatrix.assemble_using_quadtree(
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 579, in assemble_using_quadtree
    return CompressedFormFactorMatrix(
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 558, in __init__
    self._root = RootBlock(self, shape_model, *args, **kwargs)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 483, in __init__
    super().__init__(*args, **kwargs)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 419, in __init__
    block = self.make_block(shape_model, I, J, is_diag, spmat)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 254, in make_block
    block = self.make_child_block(shape_model, spmat, I, J)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 486, in make_child_block
    return self.root.make_quadtree_block(*args)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 635, in make_quadtree_block
    return FormFactorQuadtreeBlock(self, *args)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 483, in __init__
    super().__init__(*args, **kwargs)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 419, in __init__
    block = self.make_block(shape_model, I, J, is_diag, spmat)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 252, in make_block
    block = self.make_compressed_sparse_block(spmat)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/compressed_form_factors.py", line 271, in make_compressed_sparse_block
    assert tol != 0
AssertionError```

I also got into the same issue with my tests: I directly commented it and everything worked fine, but I'm not sure if in some cases that's a legit test. The comment of that line might be in one of my PR, by the way...

Thanks for the fix! That got me further.

(Potter2) (base) norbert@arsia:~/Thermal/Potter2/python-flux/examples$ generate_FF_from_grd.py 
x_min: -100.0 x_max: 100.0 x_inc: 2.5 n_columns: 81
y_min: -100.0 y_max: 100.0 y_inc: 2.5 n_rows: 81
loaded ./ingersoll81.grd
created mesh with 12800 triangles
wrote mesh12800.obj to disk
wrote topo2.png
assembled form factor matrix in 113.200044 sec (16.12 MB)
saved compressed form factor matrix to FF.bin
Traceback (most recent call last):
  File "./generate_FF_from_grd.py", line 106, in <module>
    fig, ax = plot_blocks(FF._root)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/plot.py", line 75, in plot_blocks
    add_rects(block)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/plot.py", line 69, in add_rects
    add_rects(child, c, w, h)
  File "/home/norbert/Thermal/Potter2/python-flux/flux/plot.py", line 48, in add_rects
    facecolor = 'cyan' if child.compressed else 'orange'
AttributeError: 'FormFactorSvdBlock' object has no attribute 'compressed'

do you REALLY want to plot the compression scheme/blocks of the FF? If yes, there is some conflict with the latest mods Sam applied to the compression scheme (some compressed property of the FF blocks has been removed?) - you could change line 48 of flux/plot.py to facecolor = 'cyan' #if child.compressed else 'orange' (i.e., commenting after 'cyan');
if not, simply comment out lines 106-109 of generate_FF_from_grd.py and it will end successfully.

Okay - sorry.

No problem at all (maybe that sounded harsh, sorry)! :) Actually it is weird that child blocks lost their compressed property ... I tried but couldn't trace that back to a specific commit. It will mess up with the code in several places though, definitely worth an issue.

Note: Bug remains - it's just not an important one.

@nschorgh Is this still causing problems for you?

Solved by bf2b0db