# Code in this cell makes plots appear an appropriate size and resolution in the browser window %matplotlib widget %config InlineBackend.figure_format = 'svg' import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (11, 6) from firedrake import * mesh = UnitSquareMesh(10, 10) V = FunctionSpace(mesh, "Lagrange", 1) x, y = SpatialCoordinate(mesh) u_exact = sin(pi*x)*sin(pi*y) f = 2*pi**2*u_exact u = TrialFunction(V) v = TestFunction(V) a = dot(grad(u), grad(v))*dx L = f*v*dx ?DirichletBC boundary_ids = (1, 2, 3, 4) bcs = DirichletBC(V, 0, boundary_ids) uh = Function(V) solve(a == L, uh, bcs=bcs, solver_parameters={"ksp_type": "cg", "pc_type": "none"}) # NBVAL_IGNORE_OUTPUT from firedrake.pyplot import tripcolor fig, axes = plt.subplots() collection = tripcolor(uh, axes=axes) fig.colorbar(collection);