Closed PetrKryslUCSD closed 4 years ago
many thanks! I definitely want to explore possible uses of AD both for simplifying and for optimizing the solution of continuum mechanics problem, both from the physical modelling and from the implementation point of view.
The reason why I got into this is that I was working on a model for polymers and had to deal with the kinematics of distinct solid phases, which need to be addressed explicitly in the strong form, but are softened in the weak form.
At the moment I seem to be getting similar performance, in terms of speed and memory allocation, between "traditional" implementation of FE and the AD implementation, for the same problem, but I think that there is room for improving the implementation of dual numbers algebra in Julia.
p.s. excuse me if I reply only now, I'm still not very familiar with github, and I must have missed some notification
How did you handle the need for temporaries?
once you define the dual number type, and extend the math operators and function needed over them, you deal with them as if the new type was a float or an int, or any existing type, and Julia does everything in the background for you,
that means that if you need temporary variables to store intermediate results within a function, just assign the result of an operation to some variable and Julia will destroy them when you exit the function
hope this answer your question?
I am closing this, although I will be happy to answer any questions or discuss topics related to this study.
As a side note, similar ideas have been part of https://github.com/PetrKryslUCSD/FinEtoolsDeforNonlinear.jl for some time. For instance: https://github.com/PetrKryslUCSD/FinEtoolsDeforNonlinear.jl/blob/master/src/MatDeforI1RivlinADModule.jl
I found it was important (for instance for explicit dynamics) to try to avoid allocations when using AD. I wonder if you've given it some thought?