Hello. Thanks for one more great library. I'm trying to solve a system of linear equations originating from convection equation (cell-centered finite volume method). I get the right solution for a simple test case:
Fig. 1. Test case 1. Parameters of matrix K (K C = L): dimensions 3148x3148, nonsymmetric, cond.number=152, rank=3148, det=0 (MATLAB command det(A) gives such a result)
But I get the wrong solution for a little more complex test case:
Fig. 2. Test case 2. Parameters of matrix K (K C = L): dimensions 10901x10901, nonsymmetric, cond.number=5.92E3, rank=10901, det=0
I've also tried without preconditioner and with different number of maximum iterations but without success. What should I try to understand why ViennaCL doesn't solve the linear system of test case 2?
Thanks,
Cyril
Last edit: cyril 2017-09-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Cyril,
in viennacl::linalg::gmres_tag my_gmres_tag(1e-6, 100, 20); you set a maximum iteration number of 100. This is likely to be insufficient for the larger problem. Try viennacl::linalg::gmres_tag my_gmres_tag(1e-8); for the default values on iterations and a tighter error bound.
Best regards,
Karli
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've tried your solver parameters and got the same wrong solution. I didn't mention in the first massage that I've already "played" with different parameters of the solver but without success. I've also tried to solve with transposed stiffness matrix and without preconditioner.
Why GMRES solves test case 1 though MATLAB tells me that my matrix has zero determinant?
Thanks,
Cyril
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ah, good catch, the determinant of zero tells us that the system matrix is singular. That is, there is a nontrivial kernel vector v for which Av = 0. For any solution x of Ax=b, the vectors x + a * v for any scalar a are also a solution of the system. Matlab might solve for the minimum norm solution, i.e. min_a ||x + av||, whereas GMRES in general does not compute the minimum-norm solution.
A possible cause of the singularity are incorrect boundary conditions (or no boundary conditions at all). For finite volume schemes I expect to see a nonzero determinant.
Best regards,
Karli
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello. Thanks for one more great library. I'm trying to solve a system of linear equations originating from convection equation (cell-centered finite volume method). I get the right solution for a simple test case:
Fig. 1. Test case 1. Parameters of matrix K (K C = L): dimensions 3148x3148, nonsymmetric, cond.number=152, rank=3148, det=0 (MATLAB command det(A) gives such a result)
But I get the wrong solution for a little more complex test case:
Fig. 2. Test case 2. Parameters of matrix K (K C = L): dimensions 10901x10901, nonsymmetric, cond.number=5.92E3, rank=10901, det=0
Fig. 3. Test case 2. MATLAB solution
I call ViennaCL as
I've also tried without preconditioner and with different number of maximum iterations but without success. What should I try to understand why ViennaCL doesn't solve the linear system of test case 2?
Thanks,
Cyril
Last edit: cyril 2017-09-05
Hi Cyril,
in
viennacl::linalg::gmres_tag my_gmres_tag(1e-6, 100, 20);
you set a maximum iteration number of 100. This is likely to be insufficient for the larger problem. Tryviennacl::linalg::gmres_tag my_gmres_tag(1e-8);
for the default values on iterations and a tighter error bound.Best regards,
Karli
Hello Karli,
I've tried your solver parameters and got the same wrong solution. I didn't mention in the first massage that I've already "played" with different parameters of the solver but without success. I've also tried to solve with transposed stiffness matrix and without preconditioner.
Why GMRES solves test case 1 though MATLAB tells me that my matrix has zero determinant?
Thanks,
Cyril
Hi Cyril,
ah, good catch, the determinant of zero tells us that the system matrix is singular. That is, there is a nontrivial kernel vector
v
for whichAv = 0
. For any solutionx
ofAx=b
, the vectorsx + a * v
for any scalara
are also a solution of the system. Matlab might solve for the minimum norm solution, i.e.min_a ||x + av||
, whereas GMRES in general does not compute the minimum-norm solution.A possible cause of the singularity are incorrect boundary conditions (or no boundary conditions at all). For finite volume schemes I expect to see a nonzero determinant.
Best regards,
Karli
Thanks for the answer. I have to think over it.
GMRES of ViennaCL works great. The stupid error was connected with results plotting.