Tidy3D Workspace: Blender Plugin #2
Labels
No Milestone
No Assignees
1 Participants
Notifications
Total Time Spent: 2 days 21 hours
Due Date
so-rose
2 days 21 hours
Dependencies
No dependencies set.
Reference: dtu-courses/bsc_thesis#2
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Requirements
The goal of this project is to use computational techniques to identify methods of detecting and sorting chiral molecules. The process of this goal inevitably involves performing "numerical experiments", where a suitable 3D Maxwell solver is prepared, run, and analyzed, in order to guide the convergence of theoretical intuitions.
This process is not simply empirical: The effects that are being searched for are nuanced, and will most likely require intuitive reasoning about simulation outputs before effective empirical techniques can find very much success.
Therefore, it is critical that a suitable 3D workspace be chosen. The following are the ideal requirements placed on such a tool:
Existing Tools
For input visualization, no tools really fit the bill.
Tidy3D ships with several functions for certain kinds of output visualization.
xarray
is used to represent data output from monitors.matplotlib
. Though convenience functions are provided, manual analysis with other plotting libraries is more desirable.Usually, favorite plotting libraries like
plotly
,jupyter-k3d
, etc. do the trick - however, they chronically suffer from:These libraries remain appropriate for 2D plotting, even animated (ideally through ex. the
holoviews
interface); however, for realtime configurable visualization of 3D voxel structures, they are insufficient.Proposed Tool
Blender (https://www.blender.org/) is a tool traditionally used for non-scientific 3D work. However, out of the box, it actually manages to come extremely close:
Therefore, the proposed approach is to tailor Blender to meet our requirements for a tool.
Proposed Workflow
The goal is to provide the smallest possible well-designed glue software that provides for the following proposed workflow:
Blender (w/Plugin) should be run on a sufficiently capable workstation, which is network-accessible to a computer on which the user is working. The user computer does the scientific work in a ex. Notebook, which does not require a capable workstation. These can be the same computer, but don't have to be.
Component: Blender Addon
The addon fundamentally has three functions:
This is to keep the Blender-specialized code to a minimum, as well as allowing the use of a more powerful networked workstation for the heavier visualizations required.
To define simulations, the following conventions are used.
Simulation Domain: The parent of the entire simulation.
tidy3d.Simulation
https://docs.flexcompute.com/projects/tidy3d/en/latest/_autosummary/tidy3d.Simulation.html.tidy3d.BoundarySpec
(https://docs.flexcompute.com/projects/tidy3d/en/latest/_autosummary/tidy3d.BoundarySpec.html#tidy3d.BoundarySpec), which should be represented in Blender. Ideally, the grid that will be used should be shown as a wireframe.Source: Create eletromagnetic excitations.
tidy3d.components.source
; seetidy3d.Simulation
documentation.PointDipole
orPlaneWave
.Structure: Any structures interacting with the simulation.
tidy3d.Structure
(https://docs.flexcompute.com/projects/tidy3d/en/latest/_autosummary/tidy3d.Structure.html#tidy3d.Structure)TriMesh
. In the case of Triangle Mesh, the object should be left alone; else, it should be represented with the specified shape.Monitor: Provide an opportunity for visualizable output.
tidy3d.components.monitors
; seetidy3d.Simulation
documentation.TriMesh
. In the case of Triangle Mesh, the object should be left alone; else, it should be represented with the specified shape.The plugin should listen for queries for this internal data, and respond appropriately.
To visualize, the plugin should:
Volume
datablock pointing to this sequence.Image
(sequence) pointing to this sequence.Standard Blender tools can be used to, for example:
Python Library
A minimalist companion library, which allows the following:
- Querying the Blender plugin for simulation info, which can be customized/loaded into Tidy3D.
- Syncing simulation setup in the notebook and in Blender.
- Converting Tidy3D
xarray
data into OpenVDB/jpg for use by Blender.Procedure
New checklist:
Fixes:
At this point, we are ready to incrementally add features to the plugin/library as we need them.
Successful test of:
Notes:
json
?). We should then try to run a simulation defined like this, and get the plugin to automatically visualize the output fields appropriately.Plugin has been defined, and I've determined that a custom node tree is the appropriate abstraction.
The base issue's "Procedure" has been edited with a new (working) checklist.
Overnight time tracking accounts for untracked Saturday work.
Another rearchitecting later and the data model is being more friendly. Node / socket implementations are going well.
Design decisions that are learned:
sympy
flexibility. The cost is a few pain points in extracting the dimensions, but we've addressed this (and thesympy
model of unit systems is actually quite helpful in its restrictions).gpu
viewport drawing code.bpy
on PyPi is surprisingly light.rye
(https://rye-up.com/guide/basics/), which in turn can utilizebpy
to do things like lint, test, etc. .jax
plugin fortidy3d
, which allowstidy3d
objects that are registered.I'd consider the plugin to be pseudo-MVP now - there's still a bunch of paper cuts, but it's more appropriate to attach more specialized tracking issues at this point.
Closing.