Howdy,
So I tried to assemble the matrix associated with \int_{\Omega} \phi_i \phi_j d\Omega
I then do steps to do, what I considered, was converting that matrix to a numpy array so I could use it in linear algebra things. When I tried to use it in solving a linear system of equations, I was told it was singular. Closer inspection indeed shows the determinate is 7.778782089002342e-58. However the matrix from the eyeball norm, looks diagonally dominate i.e
[[0.01041667 0.00520833 0. ... 0. 0. 0. ]
[0.00520833 0.02083333 0.00520833 ... 0. 0. 0. ]
[0. 0.00520833 0.02083333 ... 0. 0. 0. ]
...
[0. 0. 0. ... 0.02083333 0.00520833 0. ]
[0. 0. 0. ... 0.00520833 0.02083333 0.00520833]
[0. 0. 0. ... 0. 0.00520833 0.01041667]]
So then it cannot be singular. Have I’ve converted the matrix incorrectly somehow and thats causing this issue? Tips would be helpful. Here is a small code reproducing the event.
from fenics import *
import numpy as np
import math
from numpy.linalg import inv
from scipy.integrate import odeint
from scipy import *
import scipy
spatial_mesh= IntervalMesh(32,0.0,1.0)
tree = BoundingBoxTree()
tree.build(spatial_mesh)
V = FunctionSpace(spatial_mesh,"CG",1)
phi_i=TestFunction(V)
phi_j = TrialFunction(V)
m1=phi_i*phi_j*dx
M = PETScMatrix()
assemble(m1, tensor=M)
Mmat = M.mat()
Mmat_dense = Mmat.convert("dense")
print("Dense")
M1=Mmat_dense.getDenseArray()
print(M1)
print(np.linalg.det(M1))