<html><body><div style="color:; background-color:; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Got that. Thx, Domenico.</span></div><div> <br> <div>----- Original Message -----<br> From: Barry Smith <bsmith@mcs.anl.gov><br> To: domenico lahaye <domenico_lahaye@yahoo.com>; PETSc users list <petsc-users@mcs.anl.gov><br> Cc: Abdul Hanan Sheikh <hanangul12@yahoo.co.uk><br> Sent: Thursday, July 5, 2012 8:37 PM<br> Subject: Re: [petsc-users] Adapting MatMult and PCMG functions in matrix-free method.<br> <br><br>On Jul 5, 2012, at 11:40 AM, domenico lahaye wrote:<br><br>> Dear PETSc developers, <br>> <br>>   Thank you for your support to Abdul. <br>> <br>>    We are in the process of developing a multilevel <br>> Krylov solver for the Helmholtz equation. Abdul <br>> has implemented Algorithm I for this purpose. <br>> We next would like to implement Algorithm II.
 <br>> Algorithm || amounts to replacing every occurrence <br>> of the system matrix $A$ in Algorithm I by <br>> $M^{-1} A$. This replacement should occur on all <br>> levels. We thought of two ways to realize this <br>> replacement. <br>> <br>> 1) We thought of adopting a matrix-free approach, <br>> and to plug in the operation with  $M^{-1}$ there. <br>> This would require a ksp context inside MatMult.    <br>> We wonder whether this a approach is feasible to <br>> take. <br><br>   If you truly are simply replacing a multiply by A everywhere with a approx. multiply by M^{-1}A then 1 is the easier AND more elegant approach. Simply create a MATSHELL and put in its context a struct continuing the A and the KSP used so approximately solve the M^{-1}A. <br>> <br>> 2) The other approach would by to implement a <br>> customized pcmg preconditioner that we can adapt <br>> to our needs. This could
 be a more elegant approach, <br>> at the cost of doing more work. Is the assumption <br>> that the second approach is more elegant correct <br>> and would you be able to give advice on how to tackle <br>> this approach? <br><br>    <br>> <br>>   Kind wishes, Domenico. <br>> <br>> <br>> <br>> <br>> ----- Forwarded Message -----<br>> From: Matthew Knepley <<a ymailto="mailto:knepley@gmail.com" href="mailto:knepley@gmail.com">knepley@gmail.com</a>><br>> To: Abdul Hanan Sheikh <<a ymailto="mailto:hanangul12@yahoo.co.uk" href="mailto:hanangul12@yahoo.co.uk">hanangul12@yahoo.co.uk</a>>; PETSc users list <<a ymailto="mailto:petsc-users@mcs.anl.gov" href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> <br>> Sent: Thursday, 5 July 2012, 15:45<br>> Subject: Re: [petsc-users] Adapting MatMult and PCMG functions in matrix-free method.<br>> <br>> On Thu, Jul 5, 2012 at
 7:34 AM, Abdul Hanan Sheikh <<a ymailto="mailto:hanangul12@yahoo.co.uk" href="mailto:hanangul12@yahoo.co.uk">hanangul12@yahoo.co.uk</a>> wrote:<br>> Dear developers and users,<br>> Summer greetings.<br>> We have few question listen below: <br>> <br>> 1. <br>> The first question is about adapting " MatMult " function in matrix-free method.<br>> We intend to incorporate a KSP context inside "MatMult" . The immediate question is how to<br>> provide more than one matrices as input. <br>> <br>> You provide extra data through the context for the MATSHELL<br>>  <br>> Is this idea of incorporating a KSP context inside "MatMult" function workable ? Does it make any confrontation <br>> with philosophy of development of Petsc. ? <br>> <br>> I am not sure you want this. Do you think PCKSP can do what you want? There is not enough information here to help us answer.<br>>  <br>> 2. <br>> An other
 advance level feedback is needed. <br>>  Re-implementing PCMG function { mg.c } will lead any violation of philosophy of Petsc-development ??<br>> <br>> Again, there is not enough information. Can you do what you want by just replacing the monitors?<br>> <br>>   Thanks,<br>> <br>>      Matt<br>>  <br>> 3. <br>> Which one of the above both is more elegant and feasible to work on ? <br>> <br>> <br>> Thanking in anticipation, <br>> Abdul <br>> <br>> <br>> <br>> <br>> <br>> -- <br>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>> -- Norbert Wiener<br>> <br>> <br>> <br>> <br><br> </div> </div> </div></body></html>