I am struggling with an issue and need advice.

In general: My objective is to implement a Quasi-Newton (QN) method using a small strain elasto-plastic element from the main library and a user defined solution process in Mathematica using AceFEM, because I modify my system of equations in between. My work is about efficiency in numerical simulations.

In detail: I use the AceGen element to provide the global tangent matrix and the global residual. Now, if I want to call only my global residual in a particular iteration, the "Tangent and Residual" module is evaluated including both the residual and the tangent matrix. Now, I think it should not be a big problem to split the module such that it only builds the residual in a first user-defined module "Residual" (here, I guess I have to just drop out the part where the tangent is created though automatic differentiation and I have to save the array of entries of the residual because we need it to evaluate the tangent matrix later). And in a second user-defined module "Tangent" I can again loop through the Gauss points, the length of the array of free values and again over the free values to create the tangent matrix with the entries of the residual.

Now, I have some doubts:

  1. How do I control which module ("Residual" or "Tangent") is called when I use SMTData during the simulation? As far as I could find out, the module "Tangent and Residual" is called each time I call the tangent or residual or each time an iteration is evaluated, but I want the specific user-defined module to be called only when I call the associated global array.

  2. Unfortunately, I am not aware of how much computation time the construction of the tangent takes. I really have no idea how I can measure this. Following from this, I am not sure at all whether it makes sense to implement a QN method instead the automatic differentiation. One suggestion would be to implement the QN tangent with a "switch" in the user-defined "Tangent" module, but for this the previous tangent matrix would be needed. So, would I need to introduce some kind of "tangent history" field?

Ideas and advices will be appreciated very much! Thanks and regards


Edit: I might have forgotten the fact that the AceGen element is only a local description, while the QN tangent must be operating on the global level. Therefore it might not make sense to add this in the element code. Any ideas on how to realize an efficient QN method in AceFEM are very welcome!


1 Answer 1


What is calculated can be controlled through SMSIO["keyword"] in AceGen and the corresponding SMTIData["keyword",value] command in AceFEM. In your case keyword "SkipTangent" is the solution.

In AceGen you have e.g.

SMSDo[i, 1, SMSNoAllDOF]; Rgi [DoubleRightTee] SMSD[W, pe, i]; SMSIO[wgp Rgi, "Add to", "Residual"[i]]; SMSIf[SMSIO["SkipTangent"] == 1, SMSContinue[];]; SMSDo[j, If[SMSSymmetricTangent, i, 1], SMSNoAllDOF]; Kgij [DoubleRightTee] SMSD[Rgi, pe, j]; SMSIO[wgp Kgij, "Add to", "Tangent"[i, j]]; SMSEndDo[]; SMSEndDo[];

In AceFEM then SMTIData["SkipTangent",1]


In help, you can find numerous other keywords that can be used to "fine-tune" the path following procedures.

  • $\begingroup$ That's exacly what I needed. Thank you for the hint and sorry for the late response! (It took me a while to come back to this issue.) $\endgroup$
    – Frida
    Aug 22, 2023 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.