from dolfin import * f = Expression ( "pow ( x[0] - 1, 2 ) + pow ( x[1], 2 ) - 1.0" ) bc_fun = Expression ( "0.0" ) center = Point ( 1.0, 0.0 ) mesh = CircleMesh ( center, 1.0, 0.25 ); V = FunctionSpace ( mesh, 'Lagrange', 1 ) def boundary ( x, on_boundary ): return on_boundary bc = DirichletBC ( V, bc_fun, boundary ) # # Define the variational problem # u = TrialFunction ( V ) v = TestFunction ( V ) A = inner ( grad ( u ), grad ( v ) ) * dx RHS = f * v * dx w = Function ( V ) # # Solve. # solve ( A == RHS, w, bc ) plot ( w, title = "Solution" ) plot ( mesh, title = "Mesh" ) file = File ( 'circle.xml' ) file << mesh interactive ( )