Dear m., As you have already found out, the code in the Stokes example should do what you need for computing the diagonal. Usually, the approach with FEEvaluation::begin_dof_values() is slightly simpler than the approach with the tensor you mentioned in the first email. We have computed vector-valued problems with matrix-free, including multigrid preconditioners which compute the diagonal in a similar way, so they do work.
One thing I would recommend to do is to compare the diagonal you get with the cell-by-cell approach with computing the global diagonal by applying the operator globally on all unit vectors, i.e., outside the matrix-free loop. This will only work up to a few 10s of thousands of vectors because it is an n^2 operation and obviously the wrong choice for production runs, but it is a useful debugging approach in case you do not know for sure whether the interior things are set up correctly (well, constraints might still possibly mess this up, but that is a different question). Regarding your last question: > is the Multigrid still work well in vector-valued problem? or in > multi-physics couple problem? > I want to use it to solve the couple equations(Allen-Cahn and mechanics > equalibrium equations > This depends a lot on the equation. For coupled problems with non-trivial coupling, the answer is generally "no, multigrid alone will not work out of the box". But that is not specific to the implementation (e.g. whether matrix-free or not) but due to the mathematics of the underlying equations and multigrid convergence theory. In general, you can expect that simple smoothers like Chebyshev will not like multiphysics component coupling, and you need to address smoothing "by hand". What people do is to iterate between the field in an appropriate way and use simple smoothers on each component of the multiphysics problem, as e.g. described in the paper here: https://www.sciencedirect.com/science/article/pii/S0045782516307575 . But I would say that the field is still pretty ad hoc. Then, the next question with Allan-Cahn is whether something like Chebyshev+point-Jacobi still works well in the nonlinear case with the typical contrasts in the terms. Maybe yes, maybe no. The consensus in the field is that for strongly varying coefficients you need to either construct very specific smoothers, or, more commonly, use operator-dependent level transfer operators that are able to react to those case. AMG is supposed to handle some cases better than GMG with naive transfer as we provide in deal.II - but AMG is far from a black box. I have done work with Cahn-Hilliard, which involves a block system of two components, and there you definitely do not want to simply apply multigrid to the 2x2 block system as a whole, but use some algebraic manipulations on the blocks with a basic preconditioner of some related operator instead: https://www.sciencedirect.com/science/article/pii/S0898122112004191 . I hope this helps. Best, Martin -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/04cca9d8-cda3-4f0a-9ffd-7c67cf8063b3%40googlegroups.com.
