@@ -31,7 +31,9 @@ def solve_laplace_2d(V: fem.FunctionSpace,
3131 a = ufl .dot (ufl .grad (u ), ufl .grad (v )) * ufl .dx
3232 L = f * v * ufl .dx
3333
34- problem = LinearProblem (a , L , bcs = bcs , petsc_options = {"ksp_type" : "preonly" , "pc_type" : "lu" })
34+ problem = LinearProblem (a , L , bcs = bcs ,
35+ petsc_options_prefix = "laplace_2d_linear_problem" ,
36+ petsc_options = {"ksp_type" : "preonly" , "pc_type" : "lu" })
3537 uh = problem .solve ()
3638
3739 return uh
@@ -48,7 +50,9 @@ def compute_gradient(uh, W, bcs=[]):
4850 a = ufl .inner (u , v ) * dx
4951 L = ufl .inner (f , v ) * dx
5052
51- problem = LinearProblem (a , L , bcs = bcs , petsc_options = {"ksp_type" : "preonly" , "pc_type" : "lu" })
53+ problem = LinearProblem (a , L , bcs = bcs ,
54+ petsc_options_prefix = "compute_gradient_linear_problem" ,
55+ petsc_options = {"ksp_type" : "preonly" , "pc_type" : "lu" })
5256 grad_uh = problem .solve ()
5357
5458 return grad_uh
@@ -132,8 +136,9 @@ def generate_laplace_field(top_line: List[Tuple],
132136 facet_markers = mesh_data .facet_tags
133137
134138 # Create variational space
135- V = fem .FunctionSpace (domain , ("CG" , 1 ))
136- W = fem .VectorFunctionSpace (domain , ("CG" , 1 ))
139+ V = fem .functionspace (domain , ("CG" , 1 ))
140+ gdim = domain .geometry .dim
141+ W = fem .functionspace (domain , ("CG" , 1 , (gdim , )))
137142
138143 # Create boundary conditions
139144 top_ls = geo .LineString (top_line )
0 commit comments