From c3c714e355d32bc137892226de6e1d490a439a87 Mon Sep 17 00:00:00 2001 From: Mohamed Laradji Date: Sun, 1 Mar 2020 19:52:59 -0800 Subject: [PATCH] fix(example/ft03_heat): updated to work with fenics 2019.1.0 Uses fixes from https://github.com/hplgit/fenics-tutorial/issues/42#issuecomment-418082406 and https://github.com/hplgit/fenics-tutorial/issues/52#issuecomment-586335707 --- pub/python/vol1/ft03_heat.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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()