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/
110 stars 63 forks source link

Issue on page /chapter1/fundamentals_code.html #175

Closed phkonzen closed 9 months ago

phkonzen commented 9 months ago

Hi, First, thank you very much for the dolfinx-tutorial. In the first line of the following code region:

error_max = numpy.max(numpy.abs(uD.x.array-uh.x.array))
# Only print the error on one process
if domain.comm.rank == 0:
    print(f"Error_L2 : {error_L2:.2e}")
    print(f"Error_max : {error_max:.2e}")

Should it be uex instead of uD, isn't it?

jorgensd commented 9 months ago

No, as uex is in a higher order function space, you cannot compare it dof by dof. ud has the exact solution interpolated into the same space as uh, and is Therefore used for the Max error at vertices