jorgensd / dolfinx-tutorial

A reimplementation of the Springer book: https://github.com/hplgit/fenics-tutorial/, covering new topics as well as transitioning from dolfin to dolfinx
https://jorgensd.github.io/dolfinx-tutorial/
103 stars 60 forks source link

AttributeError: 'int' object has no attribute 'append' while adding boundary #104

Closed jiangzhangze closed 1 year ago

jiangzhangze commented 1 year ago

I’m trying to follow the https://github.com/jorgensd/dolfinx-tutorial/blob/dokken/jupyterbook/chapter2/ns_code2.py,but I met the following error: Traceback (most recent call last): File "/home/cots/Documents/fenicsx/cylinder.py", line 54, in <module> obstacle.append(boundary[1]) AttributeError: 'int' object has no attribute 'append' In addition,I use dolfin 0.4.1 in Ubuntu20.04.Any advises would be appreciated.

jorgensd commented 1 year ago

It seems to be that you have modified the code, as obstacle is defined here: https://github.com/jorgensd/dolfinx-tutorial/blob/dokken/jupyterbook/chapter2/ns_code2.py#L98 I admit that overwriting the obstacle int from gmsh is bad coding style (and will be rectified in a later release), but it should not cause any errors. Please also note that since you are using v0.4.1, you should follow: https://github.com/jorgensd/dolfinx-tutorial/blob/v0.4.0/chapter2/ns_code2.ipynb as there are differences in syntax between v0.5.0 and v0.4.1

jiangzhangze commented 1 year ago

ok,thank you very much.