<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="">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 7 Mar 2016, at 16:42, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<div class="gmail_extra">
<div class="gmail_quote">On Mon, Mar 7, 2016 at 10:28 AM, Lukasz Kaczmarczyk<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" target="_blank" class="">Lukasz.Kaczmarczyk@glasgow.ac.uk</a>></span><span class="Apple-converted-space"> </span>wrote:<br class="">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">
<div style="word-wrap: break-word;" 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>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Yes, that should be it. It would be nice to have some example that does this if you would</div>
<div class="">be willing to contribute some version of your code.</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>No problem, I will do that will pleasure. </div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<div class="gmail_extra">
<div class="gmail_quote">
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">
<div style="word-wrap: break-word;" class="">
<div class="">Kind regards,</div>
<div class="">Lukasz</div>
<div class="">
<div class="h5">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 7 Mar 2016, at 15:55, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank" class="">mfadams@lbl.gov</a>> wrote:</div>
<br class="">
<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 class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" target="_blank" class="">Lukasz.Kaczmarczyk@glasgow.ac.uk</a>></span><span class="Apple-converted-space"> </span>wrote:<br class="">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">
<div class="">
<div class=""><br class="">
> On 7 Mar 2016, at 14:21, Lawrence Mitchell <<a href="mailto:lawrence.mitchell@imperial.ac.uk" target="_blank" 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" target="_blank" class="">knepley@gmail.com</a><br class="">
>>> <mailto:<a href="mailto:knepley@gmail.com" target="_blank" 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" target="_blank" class="">Lukasz.Kaczmarczyk@glasgow.ac.uk</a><br class="">
>>> <mailto:<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" target="_blank" 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="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
<br clear="all" class="">
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>