I am learning from a source of Bitbucket. They are the source code of the book, Introduction to Automated Modeling using FEniCS.
But the code import Dolfin, not Fenics, and it has errors like
Does anyone know what to do with this?
I am learning from a source of Bitbucket. They are the source code of the book, Introduction to Automated Modeling using FEniCS.
But the code import Dolfin, not Fenics, and it has errors like
Fenics and dolfin is the same (different name but same modules). The reason for you getting such errors is that the book is almost 4 years old, and the API as changed since it got published. If you want to stick with the code as in the book, you should probably use the 2016.2.0 release: Bitbucket
(Which can be easily obtained with docker, Quay). You could also consider having a look at the changelog, Change log — DOLFIN 2018.1.0 documentation
or the documented demos for the latest version:
Demos — DOLFIN documentation
For your particular error, you Need to add the keyword argument degree to your expression, to tell dolfin what degree should be used when interpolating it during assembly, i.e
Expression("x[0]+2", degree=1)
for linear interpolation
Thank you so much, dokken.
I also want to know, for Dolfin and Fenics, what are the best documents for the syntax of API or functions, so I can check?
and do you know where I can find an updated wave equation source code?
For the development version of fenics, dolfin-x, you can find a demo here: dolfinx/demo_helmholtz_2d.py at master · FEniCS/dolfinx · GitHub
Note that the syntax in dolfin-x is very different from the omder versions.