@wwshunan I’ve been able to reduce your example to a way smaller code:
import numpy as np
import pygmsh
import meshio
from dolfinx.io import XDMFFile
from dolfinx import (MPI, FunctionSpace,
cpp, UnitSquareMesh)
from dolfinx.fem.assemble import assemble_matrix
from dolfinx.fem import locate_dofs_topological
from ufl import (TestFunctions, TrialFunctions, inner,
FiniteElement, dx, TrialFunction, TestFunction)
import dolfinx
mesh = UnitSquareMesh(MPI.comm_world, 35, 35)
V = FiniteElement('N1curl', mesh.ufl_cell(), 2)
Q = FiniteElement('P', mesh.ufl_cell(), 3)
W = FunctionSpace(mesh, V*Q)
u,p = TrialFunctions(W)
v,q = TestFunctions(W)
a = inner(u, v)*dx + inner(p, q)*dx
A = assemble_matrix(a)
A.assemble()
print(W.dim())
C = A.convert('dense')
print(C.getDenseArray())
This works code runs for a 30 x 30 UnitSquareMesh, but not a 35x35 UnitSquareMesh, indicating that there are memory issues when converting large systems (The matrix will be ~40 000x40 000). Which is a crazy large matrix to store in python.