NEWTON vs PJFNK

575 views
Skip to first unread message

Harshit Agarwal

unread,
Apr 14, 2016, 12:19:39 PM4/14/16
to moose-users
Hi everyone,
I am solving a transient multiphysics problem with two coupled variables using PJFNK.  I have the diagonal terms of the jacobian defined but not the off diagonal terms.  If I can define my jacobian completely and accurately and use the NEWTON method, will it be faster than PJFNK?  

I don't know if there is a clear answer to this question after reading the documentation, as there are preconditioners involved as well.  But I guess the Jacobian calculation will be much faster, as PJFNK gets jacobian by differencing.        

What preconditioner will be best for NEWTON in case of a serial solve? parallel solve? 

The objective is to speed up my simulations, they are currently taking a long time for large domains.


Regards,
Harshit Agarwal
PhD Student,
Deptt. of Aerospace Engineering,
University of Illinois, Urbana Champaign

SudiptaBiswas

unread,
Apr 14, 2016, 12:34:28 PM4/14/16
to moose-users
In general Newton converges faster if you have the full jacobian computed correctly. I mostly use SMP preconditioner and specify the off-diagonal coupling using off_diag_row & off_diag_column options.

Peterson, JW

unread,
Apr 14, 2016, 12:49:54 PM4/14/16
to moose-users
On Thu, Apr 14, 2016 at 10:19 AM, Harshit Agarwal <harsh...@gmail.com> wrote:
Hi everyone,
I am solving a transient multiphysics problem with two coupled variables using PJFNK.  I have the diagonal terms of the jacobian defined but not the off diagonal terms.  If I can define my jacobian completely and accurately and use the NEWTON method, will it be faster than PJFNK?  

It can be, but it depends on the relative expense of computeQpJacobian() vs. the finite differencing algorithm.  Also the finite differencing involves the selection (by PETSc) of a finite differencing parameter, epsilon, which affects the action of the Jacobian, and which is not present in NEWTON.
 


What preconditioner will be best for NEWTON in case of a serial solve? parallel solve? 

"Best" preconditioner depends entirely on your physics, not on whether you pick PJFNK or Newton.  Some preconditioners are available in serial, but not parallel.

--
John

Derek Gaston

unread,
Apr 14, 2016, 4:11:30 PM4/14/16
to moose-users
All of this is entirely dependent on your physics.  Here are some things it depends on:

1.  Number of coupled equations (and how much coupling is between them).  The Jacobian grows with # of equations _squared_... where the residual only grows linearly with the number of equations.  Depending on the complexity of your Jacobian / Residual statements and how many off-diagonal blocks of the Jacobian you need to fill in there will be a cross-over point where JFNK can be faster.  Based on our experience across a wide range of physics I would put that number of equations somewhere close to 6 or so (i.e. once you are fully-coupling more than about 6 equations JFNK will often be faster... even if you have the ability to perfectly specify the Jacobian)

2.  How amenable your problem is to preconditioning.  JFNK does a lot of work every linear iteration... so linear iterations are its nemesis.  If your physics are very easy to precondition and it's easy to keep the number of linear iterations down then JFNK is often faster.

The opposite is also true: if you can't find a great preconditioner for your problem and no matter what you do it's going to take hundreds (thousands) of linear iterations... then it's going to be worth it to implement the perfect Jacobian and run with Newton because those linear iterations will be MUCH faster.

3.  How much memory you have.  Newton uses way more memory because of the Jacobian storage (and the storage involved with the preconditioner for a full Jacobian).  If you have a large mesh and not much memory then Newton might push you over the edge.

4.  Whether you can find a good preconditioner for JFNK.  Preconditioning JFNK often involves forming approximations to pieces of the true Jacobian.  If you can't find a reduced version of the Jacobian that allows you to solve the problem efficiently and you end up building the full, perfect Jacobian just to precondition JFNK... then you might as well do Newton!

5.  Epsilon scaling (John already mentioned this).

6.  Whether or not you can compute an analytic Jacobian.  It can be REALLY tough to compute the full analytic Jacobian.... especially with many different kinds of physics coupled together.  In those cases it might be more expedient (research wise) to just get answers with JFNK :-)

There are more... but hopefully this shows that the answer is NOT black and white.  There is no "correct" answer here.

What's my recommendation?  Use JFNK until your problem is too slow for you to be able to do your work.  Then investigate more advanced precondition.  Then investigate even more advanced preconditioning.  Then look at implementing all of your Jacobian terms to see if that helps... then maybe switch to Newton :-)

Derek

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/CANj%2BmwC3f%3DW-zM2%2BrkSvAdGSsN2kQ0SwKQGNQ061F0RbxxN5Ng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages