idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.72k stars 1.04k forks source link

Allow non-AD residual objects to compute residual and jacobian together #23487

Open hugary1995 opened 1 year ago

hugary1995 commented 1 year ago

Reason

So now we have the capability to compute residual and jacobian together by setting residual_and_jacobian_together = true. However, only a few AD residual objects have provided implementations of computeResidualAndJacobian. The capability will also be useful for non-AD residual objects when the cost of residual computation approaches the cost of jacobian computation. That happens when the material evaluation is extremely expensive -- the idea is to evaluate the expensive material objects once for each residual + jacobian evaluation.

Design

Implement computeResidualAndJacobian for non-AD residual objects.

Impact

This will significantly speed up the simulations with expensive material models, such as crystal plasticity simulations.

Tagging @lindsayad @sapitts

GiudGiud commented 1 year ago

Can we close this now?

hugary1995 commented 1 year ago

There are other residual objects left to be modified. We can keep this issue open or open another one.

GiudGiud commented 1 year ago

ok that works let s keep it open