<div dir="ltr">On Fri, Sep 6, 2013 at 4:25 PM, Lukasz Kaczmarczyk <span dir="ltr"><<a href="mailto:Lukasz.Kaczmarczyk@glasgow.ac.uk" target="_blank">Lukasz.Kaczmarczyk@glasgow.ac.uk</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><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">Hello,<br>
<br>
I solve system of eq. generated by finite element method.<br>
<br>
I apply some projection matrix to stiffness matrix K,<br>
P=I-CT[(CTC)^-1]C<br>
where C is some not square matrix.<br>
<br>
Resulting stiffness matrix K' has form<br>
K' = PT K P,<br>
with that at hand I solve problem K' *x = f'<br>
<br>
I manage to build shell matrix where I use sub ksp solver to get solution for (CTC)*b = C*x, where [ b = (CTC^-1*C*x)] . Using penalised matrix for preconditioner, where K_prec = alpha*CCT + K, where alpha is penalty I can get solution in efficient way.<br>
<br>
Now I like to avoid penalty parameter, in order to do that I will need to apply penalty matrix for each individual finite element matrix before it is assembled into K. No problem with that, using scattering it can be done.<br>
<br>
Problem is with solution (CTC)*b = C*x, C and CTC matrices are parallel, since I have parallelised assembly functions, problem (CTC)*b = C*x need to be solved on each processor independently without communication. It is not problem, but to do that I need to transform C and CTC matrix form MATMPIAIJ to MATAIJ.<br>
</blockquote><div><br></div><div>I think this might be what you want:</div><div><br></div><div> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrices.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrices.html</a></div>
<div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </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">
I know that MatConvert will not do it. I wonder it is any other way that form very beginning to assemble matrix C as a serial matrix.<br>
<br>
Regards,<br>
Lukasz<br>
<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>