[petsc-dev] The question about FD Jacobian

Lulu Liu lulu.liu at kaust.edu.sa
Sat Dec 7 10:37:57 CST 2013


On Sat, Dec 7, 2013 at 5:11 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Lulu Liu <lulu.liu at kaust.edu.sa> writes:
>
> > The Jacobian of the nonlinear system (unknowns are p,s) has the form of
> J=[
> > Jpp,Jps;Jsp,Jss].
> > However, I want to compute each block of Jacobian at different points.
> > Jpp at x=(p1,s1); Jps at x(p2,s2);
> > Is it possible to approximate each block (evaluated at different points)
> > using FD? I have the residual expression for the nonlinear system:
> > f[j][i].p=....
> > f[j][i].S=....
>
> You can use MatFDColoring, but you'll have to write separate functions
> for each part (fp(p;S), fp(S;p), fS(p;S), fS(S;p)).  Those could be
> wrappers around a function that evaluates the whole f(p,S).
>

Sorry, I still feel confused. Is there any example to show how to do this?

If I have separate functions for each part, how to wrapper them into a
function?
For example, how could tell PETSc to use the function fp(S;p) when the
block Jps is computed?

Thanks!

-- 

------------------------------
This message and its contents, including attachments are intended solely 
for the original recipient. If you are not the intended recipient or have 
received this message in error, please notify me immediately and delete 
this message from your computer system. Any unauthorized use or 
distribution is prohibited. Please consider the environment before printing 
this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131207/7eb830be/attachment.html>


More information about the petsc-dev mailing list