JuliaTopOpt / TopOptGridap.jl

Topology optimization using Gridap!
MIT License
5 stars 1 forks source link

Element-based topology optimization #2

Open mohamed82008 opened 3 years ago

mohamed82008 commented 3 years ago

https://github.com/gridap/Gridap.jl/issues/633

stevengj commented 1 year ago

See this tutorial: https://gridap.github.io/Tutorials/dev/pages/t018_TopOptEMFocus/#Tutorial-18:-Topology-optimization-1

mohamed82008 commented 1 year ago

Thanks Steven. I will take a look at how you worked around the non-differentiability of Gridap. I suppose you have to define one adjoint for each physics. I am hoping that one day Enzyme will be able to diff through the entire code base without needing custom adjoints https://github.com/EnzymeAD/Enzyme.jl/issues/447.

stevengj commented 1 year ago

In my experience any sufficiently complicated problem will require custom adjoints, and the fact that there is currently no good way to do this with Enzyme (EnzymeAD/Enzyme.jl#172) makes it unlikely for me to use Enzyme in any real problem.

(That being said, in this example we probably did more manual differentiation than we needed to. @fverdugo found that he could use ForwardDiff to differentiate the weak form, for example.)

mohamed82008 commented 1 year ago

Fair enough. I need to study your example.