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 > // <code>true</code> 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 > // <i>not</i> 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<types::global_dof_index,double> boundary_values; > VectorTools::interpolate_boundary_values (dof_handler, > 0, > ZeroFunction<dim>(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.