sampotter / fluxpy

Fast thermal modeling and radiosity in Python.
11 stars 4 forks source link

assertion error in CompressedFormFactorMatrix.assemble_using_quadtree #29

Closed nschorgh closed 2 years ago

nschorgh commented 3 years ago

~/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```
steo85it commented 3 years ago

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...

nschorgh commented 3 years ago

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'
steo85it commented 3 years ago

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.

nschorgh commented 3 years ago

Okay - sorry.

steo85it commented 3 years ago

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.

nschorgh commented 3 years ago

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

sampotter commented 2 years ago

@nschorgh Is this still causing problems for you?

steo85it commented 2 years ago

Solved by bf2b0db5

nschorgh commented 2 years ago

I never finished my installation of CGAL, so I can't run anything.

On Tue, Dec 21, 2021 at 10:15 AM Sam Potter @.***> wrote:

@nschorgh https://github.com/nschorgh Is this still causing problems for you?

— Reply to this email directly, view it on GitHub https://github.com/sampotter/python-flux/issues/29#issuecomment-999065564, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRCVLCIPIESIHRPAPFRVPTUSDN4NANCNFSM42RP6B7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>