Hello.<div><br></div><div>When I create vectors using </div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><font class="Apple-style-span" face="'courier new', monospace">VecCreate(PETSC_COMM_WORLD,&u);</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace">VecSetSizes(u,PETSC_DECIDE, VecSize);</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">VecSetFromOptions(u);</font></div>
</div><div><font class="Apple-style-span" face="'courier new', monospace">VecDuplicate(u,&b);</font></div></blockquote><div><div>and matrix using</div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="'courier new', monospace">MatCreate(PETSC_COMM_WORLD,&A);<br>
MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,VecSize,VecSize);</font><div><div><div><font class="Apple-style-span" face="'courier new', monospace">MatSetFromOptions(A);</font></div></div></div></blockquote><font class="Apple-style-span" face="arial, helvetica, sans-serif">PETSc distributes their elements in a proper identical way among processors, so I can use procedures like</font><div>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">MatMult(A,u,b);</font></div></blockquote><font class="Apple-style-span" face="arial, helvetica, sans-serif">and</font><br>
<div><div><div><font class="Apple-style-span" face="'courier new', monospace"> KSPSolve(ksp,b,x); </font> </div><div>Ofcourse after matrix assembling and initialization of KSP and PC</div></div></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div><div><div><font class="Apple-style-span" face="'courier new', monospace">KSPCreate(PETSC_COMM_WORLD,&ksp); </font></div></div></div></div><div><div><div><div><font class="Apple-style-span" face="'courier new', monospace">KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN</font>);</div>
</div></div></div></blockquote>And thats great and works amazingly!<br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><br></div></blockquote><div><div><div><br></div>
<div><br></div><div>But now I've created DA vectors "u" and "b" and assembled them through the natural grid indexing.</div><div><br></div><div>And I need to solve the same SLE Au=b, where A is a Laplacian.</div>
<div><br></div><div>How should I create and assemble the A matrix according to my DA vector to use the same functionality?</div><div><br></div><div>Thank you!</div></div></div><div><br></div><div>Alexey Ryazanov</div><div>
______________________________________</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial, Helvetica, sans-serif; -webkit-border-horizontal-spacing: 5px; -webkit-border-vertical-spacing: 5px; "><a id="ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_DataList1_ctl131_HyperLink2" href="http://www.ibrae.ac.ru/" target="_blank" style="text-decoration: none; color: black !important; text-align: left; padding-left: 0px; "><font class="Apple-style-span" size="1">Nuclear Safety Institute of Russian Academy of Sciences </font></a></span></div>
<div><br></div><div><br></div>