Hi everyone,
I am trying to solve a pure neumann elasticity problem in 2D. I would like to set a NullSpace to get rid of rigid body motions. The problem is Nullspace.view() returns nan values.
Here is a snippet of how i define the nullspace :
from mpi4py import MPI
from dolfinx import fem, mesh
import dolfinx
import numpy as np
import petsc4py
comm = MPI.COMM_WORLD
domain = mesh.create_rectangle(comm, [(0.0, 0.0), (100, 200)], [400,400],mesh.CellType.quadrilateral,np.float64)
V = fem.functionspace(domain, ("P", 1, (2,)))
c1 = dolfinx.fem.Function(V)
c1.interpolate(lambda x: np.array([[1],[0]]))
C1 = c1.x.petsc_vec
C1.scale(1/C1.norm())
c2 = dolfinx.fem.Function(V)
c2.interpolate(lambda x: np.array([[0],[1]]))
C2 = c2.x.petsc_vec
C2.scale(1/C2.norm())
c3 = dolfinx.fem.Function(V)
c3.interpolate(lambda x: np.array((-x[1],x[0])))
C3 = c3.x.petsc_vec
C3.scale(1.0/C3.norm())
ns = petsc4py.PETSc.NullSpace().create(vectors=[C1, C2, C3], comm=domain.comm)
ns.view()
The ouptut of the view() method returns
MatNullSpace Object: 1 MPI process
type not yet set
Contains 3 vectors
Vec Object: 1 MPI process
type: mpi
Process [0]
-nan.
-nan.
-nan.
-nan.
-nan.
-nan.
-nan.
Thank you very much for your help!
Regards