idaholab / moose

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

AD return mapping #20407

Open hugary1995 opened 2 years ago

hugary1995 commented 2 years ago

Reason

Hand coding the derivative of the yield function can be tedious, and defeat the purpose of using AD to a large extent.

Design

Use forward mode AD to retrieve the derivative of the yield function w.r.t. the effective plastic strain.

Impact

New API, correct jacobian, cleaner code, better maintainability.

dschwen commented 2 years ago

Gary, in practice users could implement a templated computeResidualInternal function that would take care of both the regular AD and the ADAD compute.

hugary1995 commented 2 years ago

You are right. You make me feel so stupid.

hugary1995 commented 2 years ago

@recuero If you are interested in multi-variate return mapping, what you want to do is to instantiate a type like:

typedef DualNumber<Real, array<Real>> ChainedReal;
typedef DualNumber<ADReal, array<ADReal>> ChainedADReal;

for an array of internal variables, and you need to somehow track the "dof" of the internal variable, i.e. the i-th value in the array corresponds to the derivative of the j-th internal variable. I can't tell which ADT is best for this array without further testing though.

I am also interested in this multi-variate return mapping capability. So if you need any help just let me know.

recuero commented 2 years ago

Thanks, @hugary1995. This feature will come in handy for sure.