Hello,
I’m trying to compare the matrix generated from the following code with another code I have that solves the same problem
mesh Th=square(2, 2);
fespace Xh(Th,P1);
fespace Mh(Th,P0);
fespace XhxXhxMh(Th,[P1,P1,P0]);
varf vfStokes ([u1,u2,p],[v1,v2,q]) =
int2d(Th)(
alpha*( u1*v1 + u2*v2)
+ nu * ( dx(u1)*dx(v1) + dy(u1)*dy(v1)
+ dx(u2)*dx(v2) + dy(u2)*dy(v2) )
+ p*q*(1e-4)
- p*dx(v1) - p*dy(v2)
- dx(u1)*q - dy(u2)*q
);
varf b([u1,u2,p],[v1,v2,q]) = int2d(Th)( u1*v1+u2*v2+p*q*0.) ;
matrix A= vfStokes(XhxXhxMh, XhxXhxMh, solver="SPARSESOLVER", factorize=0);
matrix B= b(XhxXhxMh, XhxXhxMh, solver=CG, eps=1e-20);
Here the A matrix is:
0: 1 0 0.25 -0.5 0 0 0 0 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1: 0 1 -0.25 0 -0.5 0 0 0 0 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2: 0.25 -0.25 1.25e-05 -0.25 0 0 0 0 0 0.25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3: -0.5 0 -0.25 2 0 0.25 0 0 0 0 0 -0.5 0 -1 0 0 0 0 0 0 0 0 0 0 0 0
4: 0 -0.5 0 0 2 -0.25 -0.25 0 0 0 0 0 -0.5 0 -1 0 0 0 0 0 0 0 0 0 0 0
5: 0 0 0 0.25 -0.25 1.25e-05 0 0 0 0 0 -0.25 0 0 0.25 0 0 0 0 0 0 0 0 0 0 0
6: 0 0 0 0 -0.25 0 1.25e-05 0 0.25 0 0 0 0 -0.25 0.25 0 0 0 0 0 0 0 0 0 0 0
7: 0 0 0 0 0 0 0 1.25e-05 0.25 -0.25 0 0 0 -0.25 0 0 0.25 0 0 0 0 0 0 0 0 0
8: -0.5 0 0 0 0 0 0.25 0.25 2 0 0 0 0 -1 0 -0.5 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.5 0 -0.5 0 1 0.25
25: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.25 0.25 0 -0.25 0.25 1.25e-05
I’m trying to understand the order of the u1, u2, p variables in this matrix. Because I had thought it would be ordered like [u1_1, u1_2, u1_3, …, u1_NV, u2_1, u2_2, u2_3, …, u2_NV, p_1, p_2, …, p_NT] but that’s not the case.
here is the matrix when I generated it using this order:
1 -0.5 0 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0 0 0 0 0 0 0
-0.5 2 -0.5 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.25 0 0.25 0 0 0 0 0
0 -0.5 1 0 0 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.25 0 0 0 0 0
-0.5 0 0 2 -1 0 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0 0 0.25 0 0 0
0 -1 0 -1 4 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 -0.25 0 0.25 -0.25 0 0.25 0
0 0 -0.5 0 -1 2 0 0 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 -0.25 0 0 -0.25 0
0 0 0 -0.5 0 0 1 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0 0
0 0 0 0 -1 0 -0.5 2 -0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.25 0 0.25
0 0 0 0 0 -0.5 0 -0.5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.25
0 0 0 0 0 0 0 0 0 1 -0.5 0 -0.5 0 0 0 0 0 0 0.25 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 -0.5 2 -0.5 0 -1 0 0 0 0 0.25 0 0 0.25 0 0 0 0
0 0 0 0 0 0 0 0 0 0 -0.5 1 0 0 -0.5 0 0 0 0 0 0.25 0 0 0 0 0
0 0 0 0 0 0 0 0 0 -0.5 0 0 2 -1 0 -0.5 0 0 0 -0.25 0 0 0 0.25 0 0
0 0 0 0 0 0 0 0 0 0 -1 0 -1 4 -1 0 -1 0 -0.25 0 0 -0.25 0.25 0 0 0.25
0 0 0 0 0 0 0 0 0 0 0 -0.5 0 -1 2 0 0 -0.5 0 0 -0.25 0 0 0 0.25 0
0 0 0 0 0 0 0 0 0 0 0 0 -0.5 0 0 1 -0.5 0 0 0 0 0 0 -0.25 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -0.5 2 -0.5 0 0 0 0 -0.25 0 0 -0.25
0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.5 0 -0.5 1 0 0 0 0 0 0 -0.25 0
0.25 -0.25 0 0 0 0 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0.0001 0 0 0 0 0 0 0
0 0 0 0.25 -0.25 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0 0.0001 0 0 0 0 0 0
0 0.25 -0.25 0 0 0 0 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0.0001 0 0 0 0 0
0 0 0 0 0.25 -0.25 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0 0 0.0001 0 0 0 0
0 0 0 0.25 -0.25 0 0 0 0 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0.0001 0 0 0
0 0 0 0 0 0 0.25 -0.25 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0 0 0.0001 0 0
0 0 0 0 0.25 -0.25 0 0 0 0 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0 0.0001 0
0 0 0 0 0 0 0 0.25 -0.25 0 0 0 0 0.25 0 0 -0.25 0 0 0 0 0 0 0 0 0.0001
which is basically a matrix of the form
A 0 Bx.T
0 A By.T
Bx By eps*I
So my question is where can I find this variable order information of the matrix A or the fespace XhxXhxMh? so I can compare the matrices
Thank you very much for your help and have a good day.