<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, May 12, 2018 at 8:08 AM, 我 <span dir="ltr"><<a href="mailto:dayedut123@163.com" target="_blank">dayedut123@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><br><div>Thanks for your reply! I'm confused about how to create a new matrix during the time step advancing.<br>For better understand my problem, simple pseudo code (just contains the main functions) like this:<br></div></div></blockquote><div><br></div><div>It looks like MatDestroy should come before the next Create.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>//////////////////////////////<wbr>///<br>KSP ksp;<br>PC pc;<br>KSPCreate;<br>Mat A;<br>for(int timestep=0; timestep<20; timestep++)<br>{<br>//for example<br>if(timestep==2)<br>{<br>localsize change;<br>}<br>MatCreateMPIAIJWithArrays(<wbr>PETSC_COMM_WORLD, localsize, localsize, m, m, istore, jstore, vstore, &A);<br>KSPSolve;<br><br>MatDestroy(&A);<br>}<br>/////////////////////////////<br>Thanks again!<br>Daye<br></div><br><br><br><div style="zoom:1"></div><div id="m_8134878945576433294divNeteaseMailCard"></div><br>At 2018-05-11 19:07:35, "Matthew Knepley" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br> <blockquote id="m_8134878945576433294isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 11, 2018 at 4:23 AM, 我 <span dir="ltr"><<a href="mailto:dayedut123@163.com" target="_blank">dayedut123@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello all,</div><div>I use the function MatCreateMPIAIJWithArrays to construct my matrix. But the number of local rows m and local columns n may change during the timestep advancing. When the local size changes, the error like "Petsc error: cannot chang local size of Amat after use old sizes 10 10 new sizes 11 11" will appear. Any suggestions about it ?</div><div></div></div></blockquote><div><br></div><div>If the parallel layout changes, you need to create a new matrix.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Thank you very much!</div><div>Daye</div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_8134878945576433294gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br></div></div></div></div></div>
</font></span></div></div>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>