<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Matt,<div><br></div><div><div><div>On Jan 17, 2012, at 12:53 PM, Matthew Knepley wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Tue, Jan 17, 2012 at 2:51 PM, Xuefei (Rebecca) Yuan <span dir="ltr"><<a href="mailto:xyuan@lbl.gov">xyuan@lbl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
Hello all,<br>
<br>
I have a piece of code that need to store the RHS vector b of the ksp object via vecview.<br>
<br>
However, the routine is like:<br>
<br>
<br>
ierr = DMMGSetSNESLocal(dmmg, FormFunctionLocal, FormJacobianLocal,0,0);CHKERRQ(ierr);<br>
ierr = DMMGSolve(dmmg);CHKERRQ(ierr);<br>
<br>
The rhs evaluation is in FormFunctionLocal(), how could store the rhs vector b?<br></blockquote><div><br></div><div>1) In your nonlinear problem, what do you mean by b?</div><div><br></div></div></blockquote><div><br></div><div>This b is refer to the linear problem's rhs, i.e., for the nonlinear problem F(u)=0 is the residual evaluation in FormFunctionLocal, and for the linear solver, Ax=b, this rhs vector b is -F(u^{k]), k is the iteration number for the nonlinear solver.</div><div><br></div><div>I want to separate the Jacobian matrix and the rhs vector from the very beginning for testing some linear solver:</div><div><br></div><div><div>******* start solving for time = 0.50000 at time step = 1******</div><div> 0 SNES Function norm 1.242539468950e-02</div><div>start saving jacobian</div><div>Linear solve converged due to CONVERGED_ITS iterations 1</div><div> 1 SNES Function norm 3.341795546738e-05</div><div>Linear solve converged due to CONVERGED_ITS iterations 1</div><div> 2 SNES Function norm 1.329755764187e-08</div><div>Linear solve converged due to CONVERGED_ITS iterations 1</div><div> 3 SNES Function norm 3.067585609727e-12</div><div>Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE</div><div><br></div></div><div>The jacobian matrix was saved before calling the linear solver provided by PETSc, and I need to get the corresponding rhs vector b with this jacobian matrix.</div><div><br></div><blockquote type="cite"><div class="gmail_quote"><div>2) Don't use DMMG, use petsc-dev with regular SNES and SNESSetDM()</div>
<div><br></div></div></blockquote><div>I will look into that later.</div><br><blockquote type="cite"><div class="gmail_quote"><div> Matt</div><div> </div></div></blockquote><div>Thanks very much!</div><div><br></div><div>Best regards,</div><div><br></div><div>Rebecca</div><div><br></div><div><br></div><br><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks very much!<br>
<br>
Cheers,<br>
<br>
Rebecca<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>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<br>
</blockquote></div><br></div></body></html>