<div dir="ltr">Hong:<div><br></div><div style><span class="GRcorrect">thank</span> you for your answer.</div><div style>I can replace <span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">DIFFERENT_NONZERO_PATTERN by </span><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">SAME_NONZERO_PATTERN, however this will give me the wrong answer as the zero pattern changes from a time step to another (e.g. <span class="GRcorrect">the</span> matrix A at time step 1 has more zeros than at time step 2) . What I can precompute is the maximal non-zero pattern. Do you mean I should compute the <span class=""><span class="GRcorrect">facorization</span></span> for the maximal zero pattern before time iterations and then use </span><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">SAME_NONZERO_PATTERN during the iterations ?</span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 14, 2013 at 3:29 PM, Hong Zhang <span dir="ltr"><<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Tibo:<br>
<br>
Replace<br>
<div class="im">call KSPSetOperators(KSP_A, A, A, DIFFERENT_NONZERO_PATTERN, ierr)<br>
</div>with<br>
call KSPSetOperators(KSP_A, A, A, SAME_NONZERO_PATTERN, ierr)<br>
<br>
Run your code with option '-log_summary' to see the number of calling<br>
MatLUSymbolic() and MatLUNumeric().<br>
<span class="HOEnZb"><font color="#888888"><br>
Hong<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> I am using the cray-petsc implementation on the NERSC system. Specifically,<br>
> I have implemented a runge kutta solver, and I need to solve a linear system<br>
> Ax = b several times per time step. I am using PETSC to interface with the<br>
> MUMPS solver for direct factorization.<br>
><br>
> The matrix A is constant over a whole time step, but changes at each time<br>
> step. What I do now is that at the beginning of each time step, I compute<br>
> the matrix A, use the MUMPS solver to compute a LU factorization of A, and<br>
> then use KSPSolve to solve each linear system during the same time step.<br>
> Here is an example of the succession of calls (inspired from example<br>
> ex52.c):<br>
><br>
> Once per time step:<br>
> call KSPSetOperators(KSP_A, A, A, DIFFERENT_NONZERO_PATTERN, ierr)<br>
> call KSPSetType(KSP_A, KSPPREONLY, ierr);<br>
> call KSPGetPC(KSP_A, PC_A, ierr)<br>
> call KSPSetTolerances(KSP_A, 1.d-20, PETSC_DEFAULT_DOUBLE_PRECISION,<br>
> PETSC_DEFAULT_DOUBLE_PRECISION, PETSC_DEFAULT_INTEGER, ierr)<br>
> call PCSetType(PC_A, PCLU, ierr)<br>
> call PCFactorSetMatSolverPackage(PC_A, MATSOLVERMUMPS, ierr)<br>
> call PCFactorSetUpMatSolverPackage(PC_A, ierr)<br>
> call PCFactorGetMatrix(PC_A, PC_A, ierr)<br>
> call MatMumpsSetIcntl(PC_A, 7, 5, ierr)<br>
> call PCSetup(PC_A, ierr)<br>
> call KSPSetUp(KSP_A, ierr)<br>
><br>
> Then several times per time step:<br>
> call KSPSolve( KSP_A, b, x, ierr)<br>
><br>
> This works fine.<br>
> However, I am able to precompute the maximal sparsity pattern of A before<br>
> the time iterations. Therefore, I would like to use this information by<br>
> precomputing the symbolic factorization before the time iterations start,<br>
> and only compute the numerical factorization at each time step. Is there a<br>
> way to use MUMPS in PETSC to do this ? I would appreciate any help/reference<br>
> on this topic.<br>
><br>
> Thank you,<br>
><br>
> Tibo<br>
</div></div></blockquote></div><br></div>