<html>
<head></head>
<body>
<div style="font-family:sans-serif">
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">17 mai 2022 17:53:46 Matthew Knepley <knepley@gmail.com>:</span>
<br>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> On Tue, May 17, 2022 at 4:53 AM Dave May <dave.mayhem23@gmail.com> wrote:</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Dear Loic,</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> I can confirm that PCTELESCOPE works nicely when using KSPSetComputeOperators.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Here is an example</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> petsc-3.17.1/src/ksp/ksp/tutorials $ mpiexec -n 4 ./ex29 -pc_type mg -pc_mg_levels 2 -ksp_view -mg_coarse_pc_type telescope -mg_coarse_pc_telescope_reduction_factor 4 -da_grid_x 65 -da_grid_y 65 -mg_coarse_telescope_pc_type mg -mg_coarse_telescope_pc_mg_levels 2</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> There is no special code in ex29.c to make the above options run.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> I must also apologize for sending you down the garden path with COARSEDM. That really isn't what you want to use - I am sorry for the confusion on my part.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> COARSEDM is intended for the case when YOU (or rather your coarse DM) define the sub-communicator, rather than having PCTELESCOPE define the sub-communicator.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> I believe that PCTELESCOPE should works with DMKSPSetComputeOperators().</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> The function you provide to DMKSPSetComputeOperators() is unusual in my opinion.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Normally the method provided to DMKSPSetComputeOperators() just "assembles" (assembles meaning insert non-zero values for an AIJ or just calls MatAssemblyBegin/End for a matrix-free operator).</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> However your method seems to set sizes, set methods and call SetFromOptions. These are typically things which should done when the matrix is created - not when it is being "assembled".</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Maybe this is part of the reason your code isn't playing nicely with telescope.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> I think the code would be cleaner and if you overloaded your DMCreateMatrix() with a method which would return your matrix-free MATSHELL.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Yes I realize I am not directly helping solve your problem but maybe indirectly I am. Matt?</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> Yes, I agree with Dave. This refactoring, even if it does not solve the problem, should allow us to understand it better.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> Does the change make sense?</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">Yes I think!</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">Thanks,</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">Loïc</span>
<br>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> Thanks,</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> Matt</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> </span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Cheers,</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> Dave</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>> On Tue, 17 May 2022 at 13:18, Loic Gouarin <loic.gouarin@polytechnique.edu> wrote:</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> Le 17/05/2022 à 12:03, Dave May a écrit :</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> On Tue 17. May 2022 at 11:56, Loic Gouarin <loic.gouarin@polytechnique.edu> wrote:</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>> Hi Dave,</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>> could you explain what you mean by state ?</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> Ah - by state Matt and I mean any auxiliary data stored in the user context passed to KSPSetComputeOperators which is required to define your operator and is distributed. For example, a Vec which is used store coefficients of your PDE.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> Yes, I have a context which gives the operators (mult and diagonal) and some other informations to build the matrix free on each multigrid level.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> You can find the idea here: https://github.com/gouarin/cafes/blob/master/cafes/problem/stokes.hpp#L49-L91</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> It's the definition of the operator used inside DMKSPComputeOperators.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>> Loic</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>> Thanks,</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>> Loic</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>> Le 17/05/2022 à 11:50, Dave May a écrit :</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">>>>> …</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> --</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> -- Norbert Wiener</span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">></span>
<br> <span dir="ltr" style="margin-top:0; margin-bottom:0;">> https://www.cse.buffalo.edu/~knepley/[http://www.cse.buffalo.edu/~knepley/]</span>
<br>
<br>
</div>
</body>
</html>