Skip to content

Fix typos in chapter 1#11

Open
KGHustad wants to merge 1 commit intohplgit:masterfrom
KGHustad:typos-ch1
Open

Fix typos in chapter 1#11
KGHustad wants to merge 1 commit intohplgit:masterfrom
KGHustad:typos-ch1

Conversation

@KGHustad
Copy link
Contributor

This PR fixes two minor typos in chapter 1.

Additionally, I noticed that the "complete" program listed at the end of the chapter does not work because f is not defined. It would make sense to either define f to make the program run, or to state that the program is lacking the definition of f and therefore will not run as is.

from fenics import *
mesh = RectangleMesh(Point(-1, -1), Point(1, 1), 10, 10)
V = FunctionSpace(mesh, 'P', 2)  # quadratic polynomials
bc = DirichletBC(V, 0, 'on_boundary')
u = TrialFunction(V)
v = TestFunction(V)
a = dot(grad(u), grad(v))*dx
L = f*v*dx
u = Function(V)  # unknown FEM function to be computed
solve(a == L, u, bc)
vtkfile = File('poisson.pvd'); vtkfile << u  # store solution

is connected to information about the triangulation, the *mesh*.
Assuming $u=0$ on the boundary, we can in FEniCS generate a triangular
mesh over a rectangular domain $[-1,-1]\times [-1,1]$ as follows:
mesh over a rectangular domain $[-1,1]\times [-1,1]$ as follows:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be [-1,-1] \times [1,1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they're intervals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants