mesh = UnitSquareMesh(32, 32)
# Define function spacesP1 = VectorElement("CG", mesh.ufl_cell(), 2)P2 = FiniteElement("CG", mesh.ufl_cell(), 1)element = MixedElement([P1,P2])W = FunctionSpace(mesh, element)
w = Function(W)
solve(a == L, w, bcs) #bcs are the boundary conditions(u, p) = w.split()
#Save result
stokes_file = HDF5File(MPI.comm_world,"data/stokes.h5", "w")stokes_file.write(u, "velocity")stokes_file.write(p, "pressure")stokes_file.close()mesh = UnitSquareMesh(32, 32)
P1 = FiniteElement("CG", mesh.ufl_cell(), 1)P2 = VectorElement("CG", mesh.ufl_cell(), 2)P3 = TensorElement("CG", mesh.ufl_cell(), 2, symmetry = True)element = MixedElement([P1, P2, P3])W = FunctionSpace(mesh, element)V = VectorFunctionSpace(mesh, "CG", 2)Q = FunctionSpace(mesh, "CG", 1)
stokes = HDF5File(MPI.comm_world,"data/stokes.h5", "r")
w = Function(W)
(q, v, psi) = TestFunctions(W)
u = Function(V)p = Function(Q)
#load result from Stokes herestokes.read(u, "velocity")stokes.read(p, "pressure")
#Create Tensorsigma = grad(u)sigma = project(sigma, W.sub(2).collapse())Error: Unable to successfully call PETSc function 'MatSetValuesLocal'. *** Reason: PETSc error code is: 63 (Argument out of range).
I also tried to assign those values to my function, like this:
assign(w, [p,u,sigma])
But I get the same error. Can someone point me towards a solution to this problem?
Thank you!