diff --git a/pub/python/vol1/ft03_heat.py b/pub/python/vol1/ft03_heat.py index 66705c71..fab7383b 100644 --- a/pub/python/vol1/ft03_heat.py +++ b/pub/python/vol1/ft03_heat.py @@ -11,8 +11,11 @@ """ from __future__ import print_function -from fenics import * + +# Hold plot +import matplotlib.pyplot as plt import numpy as np +from fenics import * T = 2.0 # final time num_steps = 10 # number of time steps @@ -63,11 +66,11 @@ def boundary(x, on_boundary): # Compute error at vertices u_e = interpolate(u_D, V) - error = np.abs(u_e.vector().array() - u.vector().array()).max() + error = np.abs(np.array(u_e.vector()) - np.array(u.vector())).max() print('t = %.2f: error = %.3g' % (t, error)) # Update previous solution u_n.assign(u) -# Hold plot -interactive() +plot(u) +plt.show()