Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(example/ft03_heat): update to work with fenics 2019.1.0 #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(example/ft03_heat): updated to work with fenics 2019.1.0
Uses fixes from #42 (comment) and #52 (comment)
  • Loading branch information
mlaradji committed Mar 2, 2020
commit c3c714e355d32bc137892226de6e1d490a439a87
11 changes: 7 additions & 4 deletions pub/python/vol1/ft03_heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()