[petsc-users] To store the RHS vector b of KSPSolve.

Matthew Knepley knepley at gmail.com
Tue Jan 17 15:12:23 CST 2012


On Tue, Jan 17, 2012 at 3:01 PM, Xuefei (Rebecca) Yuan <xyuan at lbl.gov>wrote:

> Hello Matt,
>
> On Jan 17, 2012, at 12:53 PM, Matthew Knepley wrote:
>
> On Tue, Jan 17, 2012 at 2:51 PM, Xuefei (Rebecca) Yuan <xyuan at lbl.gov>wrote:
>
>> Hello all,
>>
>> I have a piece of code that need to store the RHS vector b of the ksp
>> object via vecview.
>>
>> However, the routine is like:
>>
>>
>>        ierr = DMMGSetSNESLocal(dmmg, FormFunctionLocal,
>> FormJacobianLocal,0,0);CHKERRQ(ierr);
>>        ierr = DMMGSolve(dmmg);CHKERRQ(ierr);
>>
>> The rhs evaluation is in FormFunctionLocal(), how could store the rhs
>> vector b?
>>
>
> 1) In your nonlinear problem, what do you mean by b?
>
>
> 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.
>

-ksp_view_binary?

  Matt


> I want to separate the Jacobian matrix and the rhs vector from the very
> beginning for testing some linear solver:
>
> ******* start solving for time = 0.50000 at time step = 1******
>   0 SNES Function norm 1.242539468950e-02
> start saving jacobian
> Linear solve converged due to CONVERGED_ITS iterations 1
>   1 SNES Function norm 3.341795546738e-05
> Linear solve converged due to CONVERGED_ITS iterations 1
>   2 SNES Function norm 1.329755764187e-08
> Linear solve converged due to CONVERGED_ITS iterations 1
>   3 SNES Function norm 3.067585609727e-12
> Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE
>
> 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.
>
> 2) Don't use DMMG, use petsc-dev with regular SNES and SNESSetDM()
>
> I will look into that later.
>
>    Matt
>
>
> Thanks very much!
>
> Best regards,
>
> Rebecca
>
>
>
> Thanks very much!
>>
>> Cheers,
>>
>> Rebecca
>>
>>
>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120117/d208c34f/attachment.htm>


More information about the petsc-users mailing list