<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Many thanks all for help. I started to implement function for DM. </div>
<div class=""><br class="">
</div>
<div class="">I understand that minimal implementation is that for the DM i need to have, is to have DMCoarsen and in each level for all DMs, set operators</div>
<div class="">DMKSPSetComputeOperators and DMCreateInterpolation. Matrix matrix free P from DMCreateInterpolation have to have operators for mult and mult_traspose. Is that is all? </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Kind regards,</div>
<div class="">Lukasz</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 7 Mar 2016, at 15:55, Mark Adams <<a href="mailto:mfadams@lbl.gov" class="">mfadams@lbl.gov</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">You can just set the coarse grid matrix/operator instead of using Galerkin. If you have a shell (matrix free) P then you will need to create and set this yourself. Our Galerkin requires a matrix P.</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Mon, Mar 7, 2016 at 9:32 AM, Lukasz Kaczmarczyk <span dir="ltr" class="">
<<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" target="_blank" class="">Lukasz.Kaczmarczyk@glasgow.ac.uk</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb">
<div class="h5"><br class="">
> On 7 Mar 2016, at 14:21, Lawrence Mitchell <<a href="mailto:lawrence.mitchell@imperial.ac.uk" class="">lawrence.mitchell@imperial.ac.uk</a>> wrote:<br class="">
><br class="">
> On 07/03/16 14:16, Lukasz Kaczmarczyk wrote:<br class="">
>><br class="">
>>> On 7 Mar 2016, at 13:50, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a><br class="">
>>> <mailto:<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>>> wrote:<br class="">
>>><br class="">
>>> On Mon, Mar 7, 2016 at 6:58 AM, Lukasz Kaczmarczyk<br class="">
>>> <<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" class="">Lukasz.Kaczmarczyk@glasgow.ac.uk</a><br class="">
>>> <mailto:<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" class="">Lukasz.Kaczmarczyk@glasgow.ac.uk</a>>> wrote:<br class="">
>>><br class="">
>>> Hello,<br class="">
>>><br class="">
>>> I run multi-grid solver, with adaptivity, works well, however It<br class="">
>>> is some space for improving efficiency. I using hierarchical<br class="">
>>> approximation basis, for which<br class="">
>>> construction of interpolation operators is simple, it is simple<br class="">
>>> injection.<br class="">
>>><br class="">
>>> After each refinement level (increase of order of approximation<br class="">
>>> on some element) I rebuild multigrid pre-conditioner with<br class="">
>>> additional level. It is a way to add dynamically new levels<br class="">
>>> without need of rebuilding whole MG pre-conditioner.<br class="">
>>><br class="">
>>><br class="">
>>> That does not currently exist, however it would not be hard to add,<br class="">
>>> since the MG structure jsut consists of<br class="">
>>> arrays of pointers.<br class="">
>>><br class="">
>>><br class="">
>>> Looking at execution profile I noticed that 50%-60% of time is<br class="">
>>> spent on MatPtAP function during PCSetUP stage.<br class="">
>>><br class="">
>>><br class="">
>>> Which means you are using a Galerkin projection to define the coarse<br class="">
>>> operator. Do you have a direct way of defining<br class="">
>>> this operator (rediscretization)?<br class="">
>><br class="">
>> Matt,<br class="">
>><br class="">
>><br class="">
>> Thanks for swift response. You are right, I using Galerkin projection.<br class="">
>><br class="">
>> Yes, I have a way to get directly coarse operator, it is some sub<br class="">
>> matrix of whole matrix. I taking advantage here form hierarchical<br class="">
>> approximation.<br class="">
>><br class="">
>> I could reimplement PCSetUp_MG to set the MG structure directly, but<br class="">
>> this probably not good approach, since my implementation which will<br class="">
>> work with current petsc version could be incompatible which future<br class="">
>> changes in native MG data structures. The alternative option is to<br class="">
>> hack MatPtAP itself, and until petsc MG will use this, whatever<br class="">
>> changes you will make in MG in the future my code will work.<br class="">
><br class="">
> Why not provide a shell DM to the KSP that knows how to compute the<br class="">
> operators (and how to refine/coarsen and therefore<br class="">
> restrict/interpolate). Then there's no need to use Galerkin coarse<br class="">
> grid operators, and the KSP will just call back to your code to create<br class="">
> the appropriate matrices.<br class="">
<br class="">
</div>
</div>
Hello Lawrence,<br class="">
<br class="">
Thanks, it is good advice.<br class="">
I have already my DM shell, however I have not looked yet how make it in the context of MG. Now is probably time to do that.<br class="">
<br class="">
DM shell<br class="">
<a href="http://userweb.eng.gla.ac.uk/lukasz.kaczmarczyk/MoFem/html/group__dm.html" rel="noreferrer" target="_blank" class="">http://userweb.eng.gla.ac.uk/lukasz.kaczmarczyk/MoFem/html/group__dm.html</a><br class="">
<br class="">
<br class="">
Regards,<br class="">
Lukasz</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>