Re: [deal.II] Re: dealii::SolverControl::NoConvergence with Bicgstab

2021-05-05 Thread blais...@gmail.com
I would second what the other Bruno said. I think the easiest 
preconditioner to try would be an ILU preconditioner. You can play with the 
fill level (start from 1 and move up from there). Make sure you set your 
absolute and relative tolerance to a reasonable level though.


On Thursday, April 15, 2021 at 2:23:13 p.m. UTC-4 bruno.t...@gmail.com 
wrote:

> Le jeu. 15 avr. 2021 à 11:57, bunel...@gmail.com  a 
> écrit :
>
>> Hi,
>>
>> thank you very much for your answer. 
>> I have actually tried to solve using GMRES like this :
>>
>> SolverControl  
>> solver_control(phi_system_rhs.size()*2,1e-10);
>> PreconditionJacobi<>   preconditioner;
>> preconditioner.initialize(phi_system_matrix, 1.0);
>> SolverGMRES> solver(solver_control );
>> solver.solve(phi_system_matrix, phi_update, phi_system_rhs, 
>> preconditioner); 
>>
>> and with this, I still get an error because the solver reached the max 
>> number of iteration and did not converge... :
>>
>> "Iterative method reported convergence failure in step 164354. The 
>> residual in the last step was 0.348567."
>>
>  
> Let me rephrase what I said. Non-restarted GMRES is guaranteed to 
> converge. deal.II uses restarted gmres. You can increase the number of 
> iterations before a restart (see 
> https://dealii.org/developer/doxygen/deal.II/structSolverGMRES_1_1AdditionalData.html#ac385db0e8c853c02d828469d5a5bdcca
> )
>
>>
>> Unfortunately, I did not find any literature on preconditioner for my 
>> specific system so I guess I am down to trying them all and seeing if one 
>> of them works...
>>
>
> If you have no idea which preconditioner to use, you can try a black-box 
> preconditioner, such as incomplete LU (ILU), algebraic multigrid (AMG), and 
> geometric multigrid (GMG). ILU and AMG require Trilinos or PETSc. For GMG, 
> there are a couple of tutorials you can look at.
>
> Best,
>
> Bruno
>  
>
>>
>> Le jeudi 15 avril 2021 à 17:41:10 UTC+2, bruno.t...@gmail.com a écrit :
>>
>>> Hi,
>>>
>>> Bicgstab is not guaranteed to converge especially when using a bad 
>>> preconditioner. You are using Jacobi as preconditioner which is a simple 
>>> but not very good preconditioner. As you can see from the error message, 
>>> you performed 1959 bicgstab iterations. That's a lot and it probably 
>>> indicates that there was a breakdown. The easy fix to your problem is to 
>>> use gmres instead of bicgstab. Gmres is guaranteed to converge. The real 
>>> fix is to use a better preconditioner. With a bad preconditioner, gmres 
>>> will converge slowly. You should look in the literature what kind of 
>>> preconditioner you should use.
>>>
>>> Best,
>>>
>>> Bruno
>>>
>>> On Thursday, April 15, 2021 at 4:21:21 AM UTC-4 bunel...@gmail.com 
>>> wrote:
>>>

 Hi, 
 I'm having a problem for some values of parameters in my code.
 I get an error "dealii::SolverControl::NoConvergence", almost instantly 
 after the start of the solving process. The status at the end is this :

 "Iterative method reported convergence failure in step 1959. The 
 residual in the last step was nan."

 Here is some details about my problem. 

 I'm solving this equation in phi :
 [image: Screenshot from 2021-04-15 10-03-35.png]
 with u and v, speeds that are calculated in another part of the code.

 Since it is a non linear problem in phi, i'm using a Newton method to 
 solve it.
 I have developped my Newton Method and calculated the part that I'm 
 assembling.
 [image: Screenshot from 2021-04-15 10-05-29.png]
 As you can see, it is a non symmetric problem because of the advection 
 term and as such, i'm using the Bicgstab solver like this :

 SolverControl  
 solver_control(phi_system_rhs.size()*2,1e-10);
 SolverBicgstab> solver(solver_control);
 PreconditionJacobi<>   preconditioner;

 preconditioner.initialize(phi_system_matrix, 1.0);
 solver.solve(phi_system_matrix, phi_update, phi_system_rhs, 
 preconditioner); 
 phi_constraints.distribute(phi_update);

 Note that if I use a direct solver like this : 

 SparseDirectUMFPACK A_direct;
 A_direct.initialize(phi_system_matrix);
 A_direct.vmult(phi_update, phi_system_rhs); 

 phi_constraints.distribute(phi_update);

 I don't get an error but it is of course much slower (and the newton 
 method painfully converge but I knew this was gonna be difficult).


 "The other situation where this error may occur is when your matrix is 
 not invertible (e.g., your matrix has a null-space), or if you try to 
 apply 
 the wrong solver to a matrix (e.g., using CG for a matrix that is not 
 symmetric or not positive definite). In these cases, the residual in the 
 last iteration is likely going to be large."

Re: [deal.II] Re: dealii::SolverControl::NoConvergence with Bicgstab

2021-04-15 Thread Bruno Turcksin
Le jeu. 15 avr. 2021 à 11:57, bunel...@gmail.com  a
écrit :

> Hi,
>
> thank you very much for your answer.
> I have actually tried to solve using GMRES like this :
>
> SolverControl
> solver_control(phi_system_rhs.size()*2,1e-10);
> PreconditionJacobi<>   preconditioner;
> preconditioner.initialize(phi_system_matrix, 1.0);
> SolverGMRES> solver(solver_control );
> solver.solve(phi_system_matrix, phi_update, phi_system_rhs,
> preconditioner);
>
> and with this, I still get an error because the solver reached the max
> number of iteration and did not converge... :
>
> "Iterative method reported convergence failure in step 164354. The
> residual in the last step was 0.348567."
>

Let me rephrase what I said. Non-restarted GMRES is guaranteed to converge.
deal.II uses restarted gmres. You can increase the number of iterations
before a restart (see
https://dealii.org/developer/doxygen/deal.II/structSolverGMRES_1_1AdditionalData.html#ac385db0e8c853c02d828469d5a5bdcca
)

>
> Unfortunately, I did not find any literature on preconditioner for my
> specific system so I guess I am down to trying them all and seeing if one
> of them works...
>

If you have no idea which preconditioner to use, you can try a black-box
preconditioner, such as incomplete LU (ILU), algebraic multigrid (AMG), and
geometric multigrid (GMG). ILU and AMG require Trilinos or PETSc. For GMG,
there are a couple of tutorials you can look at.

Best,

Bruno


>
> Le jeudi 15 avril 2021 à 17:41:10 UTC+2, bruno.t...@gmail.com a écrit :
>
>> Hi,
>>
>> Bicgstab is not guaranteed to converge especially when using a bad
>> preconditioner. You are using Jacobi as preconditioner which is a simple
>> but not very good preconditioner. As you can see from the error message,
>> you performed 1959 bicgstab iterations. That's a lot and it probably
>> indicates that there was a breakdown. The easy fix to your problem is to
>> use gmres instead of bicgstab. Gmres is guaranteed to converge. The real
>> fix is to use a better preconditioner. With a bad preconditioner, gmres
>> will converge slowly. You should look in the literature what kind of
>> preconditioner you should use.
>>
>> Best,
>>
>> Bruno
>>
>> On Thursday, April 15, 2021 at 4:21:21 AM UTC-4 bunel...@gmail.com wrote:
>>
>>>
>>> Hi,
>>> I'm having a problem for some values of parameters in my code.
>>> I get an error "dealii::SolverControl::NoConvergence", almost instantly
>>> after the start of the solving process. The status at the end is this :
>>>
>>> "Iterative method reported convergence failure in step 1959. The
>>> residual in the last step was nan."
>>>
>>> Here is some details about my problem.
>>>
>>> I'm solving this equation in phi :
>>> [image: Screenshot from 2021-04-15 10-03-35.png]
>>> with u and v, speeds that are calculated in another part of the code.
>>>
>>> Since it is a non linear problem in phi, i'm using a Newton method to
>>> solve it.
>>> I have developped my Newton Method and calculated the part that I'm
>>> assembling.
>>> [image: Screenshot from 2021-04-15 10-05-29.png]
>>> As you can see, it is a non symmetric problem because of the advection
>>> term and as such, i'm using the Bicgstab solver like this :
>>>
>>> SolverControl
>>> solver_control(phi_system_rhs.size()*2,1e-10);
>>> SolverBicgstab> solver(solver_control);
>>> PreconditionJacobi<>   preconditioner;
>>>
>>> preconditioner.initialize(phi_system_matrix, 1.0);
>>> solver.solve(phi_system_matrix, phi_update, phi_system_rhs,
>>> preconditioner);
>>> phi_constraints.distribute(phi_update);
>>>
>>> Note that if I use a direct solver like this :
>>>
>>> SparseDirectUMFPACK A_direct;
>>> A_direct.initialize(phi_system_matrix);
>>> A_direct.vmult(phi_update, phi_system_rhs);
>>>
>>> phi_constraints.distribute(phi_update);
>>>
>>> I don't get an error but it is of course much slower (and the newton
>>> method painfully converge but I knew this was gonna be difficult).
>>>
>>>
>>> "The other situation where this error may occur is when your matrix is
>>> not invertible (e.g., your matrix has a null-space), or if you try to apply
>>> the wrong solver to a matrix (e.g., using CG for a matrix that is not
>>> symmetric or not positive definite). In these cases, the residual in the
>>> last iteration is likely going to be large."
>>>
>>> This message at the end of the error made me wonder if I was choosing a
>>> bad solver for this task and tried to find the Bicgstab recquirements.
>>> Unfortunately, I was not able to find the recquirements for the Bicgstab in
>>> the documentation.
>>>
>>> I found this page
>>> that
>>> tells me to go to the solver base for requirements but I could not find the
>>> solverBase page with this information.
>>>
>>> So could someone point me in the right direction and/or tell me if they
>>> have an idea of why 

[deal.II] Re: dealii::SolverControl::NoConvergence with Bicgstab

2021-04-15 Thread bunel...@gmail.com
Hi,

thank you very much for your answer. 
I have actually tried to solve using GMRES like this :

SolverControl  
solver_control(phi_system_rhs.size()*2,1e-10);
PreconditionJacobi<>   preconditioner;
preconditioner.initialize(phi_system_matrix, 1.0);
SolverGMRES> solver(solver_control );
solver.solve(phi_system_matrix, phi_update, phi_system_rhs, 
preconditioner); 

and with this, I still get an error because the solver reached the max 
number of iteration and did not converge... :

"Iterative method reported convergence failure in step 164354. The residual 
in the last step was 0.348567."

Unfortunately, I did not find any literature on preconditioner for my 
specific system so I guess I am down to trying them all and seeing if one 
of them works...

Le jeudi 15 avril 2021 à 17:41:10 UTC+2, bruno.t...@gmail.com a écrit :

> Hi,
>
> Bicgstab is not guaranteed to converge especially when using a bad 
> preconditioner. You are using Jacobi as preconditioner which is a simple 
> but not very good preconditioner. As you can see from the error message, 
> you performed 1959 bicgstab iterations. That's a lot and it probably 
> indicates that there was a breakdown. The easy fix to your problem is to 
> use gmres instead of bicgstab. Gmres is guaranteed to converge. The real 
> fix is to use a better preconditioner. With a bad preconditioner, gmres 
> will converge slowly. You should look in the literature what kind of 
> preconditioner you should use.
>
> Best,
>
> Bruno
>
> On Thursday, April 15, 2021 at 4:21:21 AM UTC-4 bunel...@gmail.com wrote:
>
>>
>> Hi, 
>> I'm having a problem for some values of parameters in my code.
>> I get an error "dealii::SolverControl::NoConvergence", almost instantly 
>> after the start of the solving process. The status at the end is this :
>>
>> "Iterative method reported convergence failure in step 1959. The residual 
>> in the last step was nan."
>>
>> Here is some details about my problem. 
>>
>> I'm solving this equation in phi :
>> [image: Screenshot from 2021-04-15 10-03-35.png]
>> with u and v, speeds that are calculated in another part of the code.
>>
>> Since it is a non linear problem in phi, i'm using a Newton method to 
>> solve it.
>> I have developped my Newton Method and calculated the part that I'm 
>> assembling.
>> [image: Screenshot from 2021-04-15 10-05-29.png]
>> As you can see, it is a non symmetric problem because of the advection 
>> term and as such, i'm using the Bicgstab solver like this :
>>
>> SolverControl  
>> solver_control(phi_system_rhs.size()*2,1e-10);
>> SolverBicgstab> solver(solver_control);
>> PreconditionJacobi<>   preconditioner;
>>
>> preconditioner.initialize(phi_system_matrix, 1.0);
>> solver.solve(phi_system_matrix, phi_update, phi_system_rhs, 
>> preconditioner); 
>> phi_constraints.distribute(phi_update);
>>
>> Note that if I use a direct solver like this : 
>>
>> SparseDirectUMFPACK A_direct;
>> A_direct.initialize(phi_system_matrix);
>> A_direct.vmult(phi_update, phi_system_rhs); 
>>
>> phi_constraints.distribute(phi_update);
>>
>> I don't get an error but it is of course much slower (and the newton 
>> method painfully converge but I knew this was gonna be difficult).
>>
>>
>> "The other situation where this error may occur is when your matrix is 
>> not invertible (e.g., your matrix has a null-space), or if you try to apply 
>> the wrong solver to a matrix (e.g., using CG for a matrix that is not 
>> symmetric or not positive definite). In these cases, the residual in the 
>> last iteration is likely going to be large."
>>
>> This message at the end of the error made me wonder if I was choosing a 
>> bad solver for this task and tried to find the Bicgstab recquirements. 
>> Unfortunately, I was not able to find the recquirements for the Bicgstab in 
>> the documentation. 
>>
>> I found this page 
>> that
>>  
>> tells me to go to the solver base for requirements but I could not find the 
>> solverBase page with this information. 
>>
>> So could someone point me in the right direction and/or tell me if they 
>> have an idea of why this solver is not converging in my case ?
>>
>> Thanks again for developing dealii that is very useful to my research.
>>
>>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/2570a596-bc4c-401a-81e1-03ee929ef46fn%40googlegroups.com.


[deal.II] Re: dealii::SolverControl::NoConvergence with Bicgstab

2021-04-15 Thread Bruno Turcksin
Hi,

Bicgstab is not guaranteed to converge especially when using a bad 
preconditioner. You are using Jacobi as preconditioner which is a simple 
but not very good preconditioner. As you can see from the error message, 
you performed 1959 bicgstab iterations. That's a lot and it probably 
indicates that there was a breakdown. The easy fix to your problem is to 
use gmres instead of bicgstab. Gmres is guaranteed to converge. The real 
fix is to use a better preconditioner. With a bad preconditioner, gmres 
will converge slowly. You should look in the literature what kind of 
preconditioner you should use.

Best,

Bruno

On Thursday, April 15, 2021 at 4:21:21 AM UTC-4 bunel...@gmail.com wrote:

>
> Hi, 
> I'm having a problem for some values of parameters in my code.
> I get an error "dealii::SolverControl::NoConvergence", almost instantly 
> after the start of the solving process. The status at the end is this :
>
> "Iterative method reported convergence failure in step 1959. The residual 
> in the last step was nan."
>
> Here is some details about my problem. 
>
> I'm solving this equation in phi :
> [image: Screenshot from 2021-04-15 10-03-35.png]
> with u and v, speeds that are calculated in another part of the code.
>
> Since it is a non linear problem in phi, i'm using a Newton method to 
> solve it.
> I have developped my Newton Method and calculated the part that I'm 
> assembling.
> [image: Screenshot from 2021-04-15 10-05-29.png]
> As you can see, it is a non symmetric problem because of the advection 
> term and as such, i'm using the Bicgstab solver like this :
>
> SolverControl  
> solver_control(phi_system_rhs.size()*2,1e-10);
> SolverBicgstab> solver(solver_control);
> PreconditionJacobi<>   preconditioner;
>
> preconditioner.initialize(phi_system_matrix, 1.0);
> solver.solve(phi_system_matrix, phi_update, phi_system_rhs, 
> preconditioner); 
> phi_constraints.distribute(phi_update);
>
> Note that if I use a direct solver like this : 
>
> SparseDirectUMFPACK A_direct;
> A_direct.initialize(phi_system_matrix);
> A_direct.vmult(phi_update, phi_system_rhs); 
>
> phi_constraints.distribute(phi_update);
>
> I don't get an error but it is of course much slower (and the newton 
> method painfully converge but I knew this was gonna be difficult).
>
>
> "The other situation where this error may occur is when your matrix is not 
> invertible (e.g., your matrix has a null-space), or if you try to apply the 
> wrong solver to a matrix (e.g., using CG for a matrix that is not symmetric 
> or not positive definite). In these cases, the residual in the last 
> iteration is likely going to be large."
>
> This message at the end of the error made me wonder if I was choosing a 
> bad solver for this task and tried to find the Bicgstab recquirements. 
> Unfortunately, I was not able to find the recquirements for the Bicgstab in 
> the documentation. 
>
> I found this page 
> that 
> tells me to go to the solver base for requirements but I could not find the 
> solverBase page with this information. 
>
> So could someone point me in the right direction and/or tell me if they 
> have an idea of why this solver is not converging in my case ?
>
> Thanks again for developing dealii that is very useful to my research.
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/6550d9a8-ccbe-4d28-b24d-479b1488afa8n%40googlegroups.com.