<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 28, 2015 at 12:34 AM, Harshad Sahasrabudhe <span dir="ltr"><<a href="mailto:hsahasra@purdue.edu" target="_blank">hsahasra@purdue.edu</a>></span> wrote:<br><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"><div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>I'm trying to copy the solution and functions vecs from a Newton SNES to a Shell SNES. I'm doing it like this:<br><br></div>  SNES newton_snes, shell_snes;<br></div>  Vec newton_function, newton_solution;<br></div>  Vec shell_function, shell_solution;<br>  .<br>  .<br></div>  Newton SNES initialized and solved here. Shell SNES initialized.<br><div><div>  .<br>  .<br><div><div><div>  SNESGetFunction(newton_snes, &newton_function, 0, 0);<br>  SNESGetFunction(shell_snes, &shell_function, 0, 0);<br>  VecDestroy(&shell_function);<br>  VecDuplicate(newton_function, &shell_function);<br></div></div></div></div></div></div></blockquote><div><br></div><div>If you want to use the same vector</div><div><br></div><div>  SNESGetFunction(newton, &f)</div><div>  SNESSetFunction(shell, f)</div><div><br></div><div>otherwise for a copy</div><div><br></div><div><div>  SNESGetFunction(newton, &f)</div><div>  VecDuplicate(f, &sf)</div><div>  SNESSetFunction(shell, sf)</div></div><div>  VecDestroy(&sf)</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div><br></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"><div dir="ltr"><div><div><div><div><div>  SNESGetSolution(newton_snes, &newton_solution);<br>  SNESGetSolution(shell_snes, &shell_solution);<br>  VecDestroy(&shell_solution);<br>  VecDuplicate(newton_solution, &shell_solution);<br><br></div><div>But I get this error on first VecDuplicate line:<br><br>[0]PETSC ERROR: VecDuplicate() line 511 in /home/hsahasra/NEMO5/libs/petsc/build-real/src/vec/vec/interface/vector.c Null Object: Parameter # 1<br><br></div><div>Is there any other better way to do this?<br><br></div><div>Thanks,<br></div><div>Harshad<br></div></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>