Re: [deal.II] Re: PETScWrappers::SparseDirectMUMPS for symmetry system matrix and factorization resue

2016-07-27 Thread shanglong zhang
Hi Wolfgang,

Thank you for the explanation. Then everything make sense.

Best,
Shanglong

在 2016年7月27日星期三 UTC-4下午6:13:16,bangerth写道:
>
> On 07/27/2016 01:43 PM, Alexander wrote: 
> > 
> > step-17 claims to solve same problem as step-8. If one produces symmetry 
> > matrix and the other does not or both do not -- this is suspicious. 
>
> The reason why the matrix in step-17 is not symmetric is actually 
> explained in the code: 
>
>  // The last argument to the call to 
>  // MatrixTools::apply_boundary_values() below allows for some 
>  // optimizations. It controls whether we should also delete 
>  // entries (i.e., set them to zero) in the matrix columns 
>  // corresponding to boundary nodes, or to keep them (and passing 
>  // true means: yes, do eliminate the columns). If we 
>  // do eliminate columns, then the resulting matrix will be 
>  // symmetric again if it was before; if we don't, then it 
>  // won't. The solution of the resulting system should be the same, 
>  // though. The only reason why we may want to make the system 
>  // symmetric again is that we would like to use the CG method, 
>  // which only works with symmetric matrices. The reason why we may 
>  // not want to make the matrix symmetric is because this 
>  // would require us to write into column entries that actually 
>  // reside on other processes, i.e., it involves communicating 
>  // data. This is always expensive. 
>  // 
>  // Experience tells us that CG also works (and works almost as 
>  // well) if we don't remove the columns associated with boundary 
>  // nodes, which can be explained by the special structure of this 
>  // particular non-symmetry. To avoid the expense of communication, 
>  // we therefore do not eliminate the entries in the affected 
>  // columns. 
>  std::map boundary_values; 
>  VectorTools::interpolate_boundary_values (dof_handler, 
>0, 
>ZeroFunction(dim), 
>boundary_values); 
>  MatrixTools::apply_boundary_values (boundary_values, 
>  system_matrix, 
>  solution, 
>  system_rhs, 
>  false); 
>
> In other words, it is expected that the matrix is not symmetric, and 
> that consequently when you run a direct solver, you can't use the 
> symmetric setting. 
>
> Best 
>   Wolfgang 
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: PETScWrappers::SparseDirectMUMPS for symmetry system matrix and factorization resue

2016-07-26 Thread shanglong zhang
Hi Alexander,

I switch to :
dealii 8.4.1
petsc 3.6.4
mumps 5.0.1

The result is still not correct.
The modification I did for the code is replacing the following code in 
step-17.cc:

*SolverControl   solver_control (solution.size(),*
*1e-8*system_rhs.l2_norm());*
*PETScWrappers::SolverCG cg (solver_control,*
*mpi_communicator);*
*PETScWrappers::PreconditionBlockJacobi preconditioner(system_matrix);*
*cg.solve (system_matrix, solution, system_rhs,*
*  preconditioner);*
with
*  SolverControl solver_control (**solution.size()**, 1e-12);*
*  PETScWrappers::SparseDirectMUMPS solver(solver_control, 
mpi_communicator);*
*  solver.set_symmetric_mode(true);*
*  solver.solve(system_matrix, solution, system_rhs);*

Thank you very much.
Regards,
Shanglong

在 2016年7月26日星期二 UTC-4上午3:40:09,Alexander写道:
>
>
> deal.II 8.4.0
>> petsc 3.3.0.3
>> MUMPS 4.10.0-p3
>>
>
> This PETSc and MUMPS > 4 years old. Update to the latest versions and try 
> again. If problem persists, provide the relevant snippet of the code.
>  
>
>> Sorry, I am not familiar with the petsc library. You meant if I call 
>> *solver.solve(system_matrix,solution,system_rhs)* twice, internally, it 
>> would use the factorization from the first time for the second solving 
>> process? (of course the system matrix is the same.) Do i understand this 
>> correctly? Thanks.
>>
>
> Yes, correct.
>
> @Denis: I agree, the logic is somewhat deficient. I also think 
> documentation and interface itself (e.g. I have no idea why does method 
> set_solver_type 
> 
>  
> exist and exposed to the public) could be improved. 
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: PETScWrappers::SparseDirectMUMPS for symmetry system matrix and factorization resue

2016-07-25 Thread shanglong zhang
Hi Denis,

Thank you for your information.

Best,
Shanglong

在 2016年7月25日星期一 UTC-4下午12:02:09,Denis Davydov写道:
>
> Hi,
>
> I can't comment on the first part of your question, but as for the second 
> part -- you are right, 
> currently you can't reuse factorization. I you want it, it should be 
> relatively easy to add.
> See Direct solver in TrilinosWrappers which was recently modified to 
> support this: 
>
> https://www.dealii.org/developer/doxygen/deal.II/classTrilinosWrappers_1_1SolverDirect.html#a6c0fecc921bc93f2c005e265cfbdd882
>
> Regards,
> Denis.
>
> On Monday, July 25, 2016 at 5:52:06 PM UTC+2, shanglong zhang wrote:
>>
>> Dear all,
>>
>> I modify the step-17 so that it uses PETScWrappers::SparseDirectMUMPS as 
>> solver. However, when I active the option of set_symmetric_mode, the 
>> solution has discrepancy from CG or MUMPS without the symmetry option. (The 
>> solutions from CG and MUMPS without symmetry option are identical though.) 
>> Any suggestion?
>>
>> And it seems to me that  PETScWrappers::SparseDirectMUMPS doesn't have 
>> the functionality of reusing the factorization of system matrix for 
>> different right-hand side vector. Do I miss anything?
>>
>> Thank you very much.
>>
>> Best,
>> Shanglong
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.