On Wed, 20 Sept 2023 at 12:17, Ce Qin <[email protected]> wrote: > > Dear all, > > I am currently implementing a multigrid solver for Maxwell's equations in 3D. > The AFW smoother has excellent convergence properties for Maxwell's > equations. I > noticed that PCPATCH provides such types of smoothers. However, I am using the > deal.II library to build the patches. PCPATCH seems only to support the PETSc > DMPlex data structure. Is there a way to use PCPATCH with user defined > patches?
When we implemented, we didn't have a better idea about the callback structure. If you can shoe-horn into the API PCPatch provides, then it can work, but I guess deal.II doesn't use DMPlex for its mesh management, so I don't think PCPatch is going to give you that much. > Besides, I found that we can also use PCASM with user defined subdomains. > Is there any performance difference between PCPATCH and PCASM? For PCASM you have to assemble the global matrix and then extract the subdomains, which might be expensive (in theory, pcpatch has a low memory mode where you only assemble and factor one patch at a time, but in most cases where you're using it, it's slower). There are some other small optimisations in pcpatch that could be ported to PCASM for small patches (for example, there's a mode where the patch solver is just the application of an already factored matrix, so you don't go through the KSP/PC/MatSolve callstack), but we didn't do it. But it likely depends a bit on your problem too (with pcpatch you effectively assemble the operator twice if you're using sparse matrices, rather than matrix-free, so that can be a bit more expensive). In summary: give it a go with PCASM. Lawrence
