CNR-Engineering / PyTelTools

Python Telemac Tools for post-processing tasks (includes a workflow)
https://github.com/CNR-Engineering/PyTelTools/wiki
GNU General Public License v3.0
32 stars 15 forks source link

Error in Vertical Cross Section #20

Closed krober10nd closed 1 year ago

krober10nd commented 1 year ago

Hi, I have configured the following workflow, the node Vertical Cross Section indicates the line is outside of the mesh but the node Locate Open Lines shows it inside. Any idea what may be incorrect or missing here? Thanks!

Screenshot 2023-02-25 at 9 57 44 AM Screenshot 2023-02-25 at 9 57 57 AM
lucduron commented 1 year ago

Dear Keith, If the displayed error is "no continuous intersection between the mesh and the line" altough the locate operator is OK, it is strange! I already noticed problem if the line is located exactly along mesh edges, it could trouble the function which determines the intersection points. Could you provide us your files (mesh and line)? Best Regards, Luc

krober10nd commented 1 year ago

Hey Luc,

Sure in the zip file you'll find an example workflow (testing) with one snap of a 3d SLF result that I'd like to extract a cross section for. The cross_section_6.shp profile instantly force closes the GUI with the following error. If you reduce its lateral extent by a little, then it says the line doesn't intersect with the domain. Thanks for any help you can provide!

Reading the input file: "/Users/keithroberts/Desktop/flume_test/r3d_flume_test_subset_result.slf" of size 25311540 bytes
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/workflow/mono_gui.py", line 529, in run_all
    self.view.scene().run_all()
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/workflow/mono_gui.py", line 250, in run_all
    self.nodes[root].run_downward()
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/workflow/Node.py", line 514, in run_downward
    child.parentItem().run_downward()
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/workflow/Node.py", line 258, in run_downward
    self.run()
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/workflow/nodes_vis.py", line 1040, in run
    if not self._prepare():
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/workflow/nodes_vis.py", line 1014, in _prepare
    mesh.get_line_interpolators(sections)
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/slf/interpolation.py", line 157, in get_line_interpolators
    line_interpolator, distance, line_interpolator_internal, distance_internal = self._get_line_interpolators(line)
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/slf/interpolation.py", line 77, in _get_line_interpolators
    interpolator = Interpolator(t)
  File "/opt/homebrew/lib/python3.9/site-packages/pyteltools/slf/interpolation.py", line 23, in __init__
    self.inv_norm_z = 1 / norm_z
ZeroDivisionError: float division by zero

example.zip

lucduron commented 1 year ago

Dear Keith,

The crash is probably due to presence of empty mesh elements (or flat triangle), PyTelTools assumes the 2D mesh is OK. Indeed, this could be a problem for a calculation with openTelemac. I extracted the 2D mesh of your 3D file and have a look with BlueKenue and it displays: "Minimum Element Area: 0.000000 m²". You should try to fix your mesh?

Empty_element

Regards, Luc

krober10nd commented 1 year ago

Thank you Luc, I will fix the mesh and try again.

lucduron commented 1 year ago

Did you manage to fix your mesh and use this tool?

krober10nd commented 1 year ago

Yep it's all good. Thanks!

As an aside, I'm working on writing some code to visualize 3D binary boundary files.