Skip to content

Topology optimization example - #81

Draft
jorgensd wants to merge 7 commits into
mainfrom
dokken/topology-optimization
Draft

Topology optimization example#81
jorgensd wants to merge 7 commits into
mainfrom
dokken/topology-optimization

Conversation

@jorgensd

@jorgensd jorgensd commented Sep 1, 2026

Copy link
Copy Markdown
Member

Implementation of the structural problem from Pasteur Labs (mosaic) using DOLFINx adjoint.
Heads up @dionhaefner :)

Instead of using ADAM I've opted for using an optimization solver that can use reduced hessian vector products as well.

Bug-fixes along the way

  • Compute_adjoint split blocked elements when calling extract_blocks. This was not intentional and therefore we now ensure that blocks are not extracted for the un-blocked case. Test added to verify that this was an issue on main.
    - Nonlinear test locally exposed an issue with snes converging early if tolerance is too low.: This has been fixed properly on main with Mypy fixes #82

Summary of outputs:

[corner_load] one tape recompute (Jhat(rho)): 4.7843e-02 s
[corner_load] one adjoint solve (Jhat.derivative()): 6.0980e-02 s

[full_face_load] one tape recompute (Jhat(rho)): 5.1036e-02 s
[full_face_load] one adjoint solve (Jhat.derivative()): 6.2825e-02 s

topopt_compliance_convergence topopt_full_face_load_final topopt_full_face_load topopt_corner_load_final topopt_corner_load

@jorgensd jorgensd mentioned this pull request Sep 2, 2026
@dionhaefner

Copy link
Copy Markdown

Cool stuff @jorgensd! (and CC @andrinr)

Please backport to Mosaic if you can, or tell us what + how to do it 🙏

@jorgensd

jorgensd commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Cool stuff @jorgensd! (and CC @andrinr)

Please backport to Mosaic if you can, or tell us what + how to do it 🙏

I'll clean up the demo a bit first, so it's clearer how things differ from legacy dolfin adjoint.
A general question is why did you choose the ADAM optimizer rather than another first order method like BFGS?

Comment thread tests/test_blocked_problem.py Outdated
Comment thread tests/test_blocked_problem.py Outdated
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
@dionhaefner

dionhaefner commented Sep 2, 2026

Copy link
Copy Markdown

We do use L-BFGS for most cases (example), and it's the optimizer we use to compare solvers in the paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants