Hi!
Recently, I encountered a bug when working with flowknots in 3DEC: any access to groups through the Python flowknotarray
API makes the session crash.
I provide a demo Python script below.
Hopefully, this correction could be integrated in future updates?
Note that it is not a blocking bug since we can still manipulate flowknots through Fish, but the array-wise Python control logic feels handier to me!
Thanks!
Théophile
PS: flowplanearray
raises the same issue, while other arrays work fine.
""" A test case demonstrating flowknotarray buggy behavior """
import numpy as np
import itasca as it
it.command("""
model config fluid
block create brick test
block cut joint-set
block zone gen edge 0.5
block zone cmodel assign elastic
block zone property density 2600 young 5.e9 poisson 0.25
block fluid property density 1000 bulk 2.e9 viscosity 1.e-3
flowknot group 'side=xmax' range position-x 0.99, 1.01
""")
fkids = it.flowknotarray.ids()
# Extras API works fine
demo = np.ones_like(it.flowknotarray.ids(), dtype=float)
it.flowknotarray.set_extra(1, demo)
assert (it.flowknotarray.extra(1)==demo).all()
# # Groups API makes 3DEC session crash
# # - Reading
# side_xmax = it.flowknotarray.in_group('xmax', 'side')
# # - Writing
# dummy_group = fkids < 10
# it.flowknotarray.set_group(dummy_group, 'true', 'dummy')
# The same goes with flowplanes: extras ok but groups crash session