<div dir="ltr">Without having seen your code, it sounds to me like the best strategy here is to:<div><br></div><div> 1) Produce a mirror of your mesh using DMStag</div><div><br></div><div> 2) Use that DM to construct the linear block problems, which can then be solved by PETSc</div><div><br></div><div> Since the PETSc grid matches your own, you can share the solution vectors between your code and PETSc,</div><div> so it will fit nicely into your existing structure.</div><div><br></div><div>Once that works, if the entire mesh is Cartesian, you could use DMStag to model that and let PETSc handle parallel</div><div>decomposition. At the same stage, you could decide to let PETSc SNES handle the nonlinear problem, rather than</div><div>just the linear parts.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 13, 2019 at 5:25 AM Pierre Gubernatis via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p class="MsoNormal" style="margin:0cm 0cm 8pt;line-height:107%"><font size="4" face="monospace"><a name="m_1900951352345754927__GoBack"></a><span lang="EN-US">Hello all,</span></font></p>
<p class="MsoNormal" style="margin:0cm 0cm 8pt;line-height:107%"><font size="4" face="monospace"><span lang="EN-US">It souds that the best way to introduce
petsc in a code is not to introduce it, but develop the code over the petsc
structure.</span></font></p><p class="MsoNormal" style="margin:0cm 0cm 8pt;line-height:107%"><font face="monospace"><span lang="EN-US" style="font-size:large">It is probably true but my problem is that my existing code </span><span lang="EN-US"><font size="4">already is equipped with a</font></span><font size="4"> domain decomposition based on MPI (</font><span lang="EN-US" style="font-size:large">a typical themal hydraulic with cartesian
staggered mesh)</span></font></p><p class="MsoNormal" style="margin:0cm 0cm 8pt;line-height:107%"><font size="4" face="monospace">The user can slice the domain in
sub-domains and construct a linear problem by block: each sub-domain assembles
its part of the operator and its part of the RHS.</font></p><p class="MsoNormal" style="margin:0cm 0cm 8pt;line-height:107%"><span style="font-size:large"><font face="monospace">I am wondering what is the best way now to introduce petsc (considering that I don’t want to assemble a global
operator on a given proc). Is there an example that would show how to
introduce petsc in this situation ?</font></span></p><div><font face="monospace" size="4">Thank you, </font><span style="font-size:large;font-family:monospace">Pierre </span><span style="font-size:large;font-family:monospace"> </span><span style="font-size:large;font-family:monospace"> </span></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><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.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div>