Getting zero determinant for the stokes problem

63 views
Skip to first unread message

Abbas Ballout

unread,
Oct 28, 2024, 5:26:38 PM10/28/24
to deal.II User Group
Hello everyone, 

I wanted to look at the determinant that results from discritizng the stokes problem so I started out with step22 and added this line right at the end of the assembly: 
{
std::ofstream out("matrix.txt");
system_matrix.print(out);
out.close();
}
After writing out the matrix I read the file with a Julia code (I can attach it below if anyone wants to see) and it turns out the determinant is zero. Is that normal? The BCs should have been applied at the point right?  

Things I have tried: 
1) I tried the stokes from step 57 as well. Same thing
2) I plotted the sparsity pattern (attached below) and it's the same one  I got from gnuplot with a big zero block in the lower right corner. 
3) I did the same thing with a laplace and I got the right determinant. 

I am doing this because I want to to get the corcivity/LBB constant which is the smallest eigen/SVD value of the system. (mostly for the lols) 

sparsity.svg

Wolfgang Bangerth

unread,
Oct 28, 2024, 5:57:05 PM10/28/24
to dea...@googlegroups.com
The determinant of large matrices can not be computed in a reasonable
way. Take the matrix 0.1*I, for example. If the identity matrix I is of
size n times n, then the determinant det(0.1*I)=0.1^n, which you cannot
compute if n>310 because the smallest floating point number that can be
represented is around 1e-308. Of course n=310 is a pretty small matrix.

There is of course also the issue that computing the determinant is an
exceptionally expensive operation (at least n^3).

If you're interested in the smallest eigenvalue, compute that rather
than the determinant.

Best
W.

Abbas Ballout

unread,
Oct 30, 2024, 10:25:38 AM10/30/24
to deal.II User Group
As always, thanks for the reply W. 

Yeah I was aiming to compute the smallest eigenvalue. 
I guess my tittle was off. I was just trying to aim to the fact that the stiffness matrix 
I wrote to an output file and then I read was singular. Could a problem on my part but I was still just checking since my changes
were minimal to the step example.
I'll double check what I did later too. 


best,
Abbas


Wolfgang Bangerth

unread,
Oct 30, 2024, 1:02:45 PM10/30/24
to dea...@googlegroups.com


On 10/30/24 08:25, Abbas Ballout wrote:
>
> Yeah I was aiming to compute the smallest eigenvalue.
> I guess my tittle was off. I was just trying to aim to the fact that the
> stiffness matrix
> I wrote to an output file and then I read was singular.

Abbas:
what I wanted to point out is that it's hard to establish what
"singular" actually means. *Mathematically*, singular means (or is
equivalent to) that the matrix has zero determinant. *In practice*, this
is not a criterion that can be tested numerically because floating point
numbers cannot distinguish whether the determinant is (0.1)^1000 or in
fact zero.

Best
W.

Abbas Ballout

unread,
Oct 30, 2024, 4:53:38 PM10/30/24
to deal.II User Group
Oh okay I get it now. I also realised I wasn't reading the matrix correctly.
I made my system super small, and got non small values of the eigen values and determinant so it should be smooth sailing at this point.

Thanks 
Abbas  
Reply all
Reply to author
Forward
0 new messages