Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjoint Master Plan #1548

Open
39 of 95 tasks
tylerflex opened this issue Mar 15, 2024 · 8 comments
Open
39 of 95 tasks

Adjoint Master Plan #1548

tylerflex opened this issue Mar 15, 2024 · 8 comments
Assignees

Comments

@tylerflex
Copy link
Collaborator

tylerflex commented Mar 15, 2024

October 2024 >

  • short term

    • look into gradients again
    • publish notebooks (field projection + photonic crystal)
    • Update Readme including how to use jax / pytorch, not saying it's an "experimental feature"
    • yannick merge open PRs? (field projection, local cache, faqs, etc)
  • features

    • slab bounds (polyslab.slab_bounds, cylinder.length)
    • triangular mesh -> implement other shapes (eg sphere) using a mesh conversion
    • server side field projection
    • polyslab dilation / sidewall angle
    • field time monitor
    • autograd for resonance finder
    • numerical dA/dp
    • multi-frequency fitting.
    • anisotropic medium (custom and regular)
  • multi-physics

    • nonlinear adjoint
    • adjoint mode solver
    • adjoint heat solver
    • adjoint component modeler
    • adjoint photon forge
  • performance

    • make data arrays faster and easier to use
    • speedup geometry group with many structures / vjp generalize
    • 1 forward N adjoint
    • simultaneous fwd and adjoint
    • lossy compression for adjoint field monitors
    • unstructured point monitors
  • examples

    • Industry relevant adjoint examples
    • invdes implementations of existing notebooks
    • convert adjoint notebooks to autograd
    • standardize variable names in notebooks
    • pytorch example
    • optimization with constraints example
  • invdes improvements

    • Invdes python web API hookup
    • Invdes redesign / API
    • start with given permittivity
    • parameter scheduling
    • shape design region
    • unify with design plugin? or add gradient based methods to design plugin

Older

Roughly ordered by priority within each section

Tyler

Yannick

  • Notebook demo for autograd utilities
  • differentiable DataArray interp
  • Invdes improvements
    • Schema-based post processing
    • GUI support (with Emerson)
    • Web API support
    • More optimizers. (Ya)
    • More design regions. (Ya)
  • Wrappers for other auto diff (Ya)
    • Jax
    • Pytorch
    • Tensorflow
@nkvij
Copy link

nkvij commented Aug 16, 2024

Hello, I am a Tidy3D user and am interested in doing inverse design on photonic crystal cavities for which I would require Adjoint support for Cylinder geometry, FieldTimeMonitor and FieldMonitor. Is it possible for you guys to bump up these things in priority? It would also be great if you could give me an approximate timeline for these features.
Also, apologies if this is the wrong place for this comment.
Thank you,
Neelesh

@tylerflex
Copy link
Collaborator Author

Hi @nkvij thanks for your feedback.

  • FieldMonitor is supported as of the latest release (2.7.2) and you can differentiate through various operations on the field monitor output, such as flux, poynting and intensity.
  • Cylinder is in production, there's actually a PR open for it 🗻 autograd Cylinder #1791 but it will need some more work. I'd anticipate it will be out within the next 2-3 weeks.
  • FieldTimeMonitor is a bit trickier. In principle it shouldn't be too hard, but we need more bandwidth to work on it. So I'll bump the priority (you're the first person who asked) but I wouldn't expect that one for the next 2-3 months.

Thanks for your patience. We're going through a bit of a clean-up period to make the feature more stable and tested after the very fast feature implementation over the past couple months, but once we finish that up, we'll definitely start on cylinder and field time!

@momchil-flex
Copy link
Collaborator

Hi @nkvij , do you also need our ResonanceFinder to be differentiable and not just the FieldTimeMonitor? Because that's another thing that's not even on the map yet.

By the way maybe you should consider legume :)

@nkvij
Copy link

nkvij commented Sep 13, 2024

Hey @momchil-flex, just saw your comment. Yes, I would need Resonancefinder to be differentiable too. I forgot that it was separate from FieldTimeMonitor.

Haha that's a great pitch for Legume. However, it would be nice to be able to inverse design 1D photonic crystals too :)

@nkvij
Copy link

nkvij commented Oct 10, 2024

Hello, as we are reaching the 2-month mark, I wanted to check in if there are any updates regarding this.
Thank you so much!

Hi @nkvij thanks for your feedback.

  • FieldMonitor is supported as of the latest release (2.7.2) and you can differentiate through various operations on the field monitor output, such as flux, poynting and intensity.
  • Cylinder is in production, there's actually a PR open for it 🗻 autograd Cylinder #1791 but it will need some more work. I'd anticipate it will be out within the next 2-3 weeks.
  • FieldTimeMonitor is a bit trickier. In principle it shouldn't be too hard, but we need more bandwidth to work on it. So I'll bump the priority (you're the first person who asked) but I wouldn't expect that one for the next 2-3 months.

Thanks for your patience. We're going through a bit of a clean-up period to make the feature more stable and tested after the very fast feature implementation over the past couple months, but once we finish that up, we'll definitely start on cylinder and field time!

@tylerflex
Copy link
Collaborator Author

Hi @nkvij ,

Cylinder is working, but we have not started work on FieldTimeMonitor or ResonanceFinder. I looked into the field time monitor support and I think it will require substantial changes. Since we have a number of things on our roadmap which are higher urgency (such as some performance improvements), I don't anticipate being able to work on this for at least a few more months.

In the meantime, it might be worth seeing if you can find a workaround solution. For example, perhaps you can run your simulations with FieldTimeMonitor and ResonanceFinder, find the resonance frequency, and then run a differentiable simulation using a FieldMonitor at that frequency?

Given your concern, I'll bump the priority of this feature and will keep you updated once we start work on it.

@nkvij
Copy link

nkvij commented Oct 11, 2024

How do I use the cylinder geometry?

I will try and figure out a workaround using only the FieldMonitor. Thank you for the update!

@tylerflex
Copy link
Collaborator Author

The cylinder just works when your objective function arguments ultimately give rise to either the center or the radius of a td.Cylinder. For example, an objective function like

def f(x):
    radius = x + 2
    cyl = td.Cylinder(radius=radius, ...)
    # make a sim containing this cylinder
    # figure of merit, etc.

see cell [9] of this unpublished notebook for an example for photonic crystals

https://github.com/flexcompute/tidy3d-notebooks/blob/e6501bf89419fbefcd3566b1eee1dc062dbc5876/Autograd18PhotonicCrystal.ipynb

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

No branches or pull requests

5 participants