diff --git a/_faqs/how-do-i-use-anisotropic-medium.md b/_faqs/how-do-i-use-anisotropic-medium.md new file mode 100644 index 0000000..a988ab0 --- /dev/null +++ b/_faqs/how-do-i-use-anisotropic-medium.md @@ -0,0 +1,38 @@ +--- +title: How Do I Use Anisotropic Medium? +date: 2025-09-24 11:50:54 +enabled: true +category: "Inverse Design" +--- +Currently, classes of [AnisotropicMedium](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.AnisotropicMedium.html){: .color-primary-hover} are not supported with the `autograd` plugin. +However, it is possible to work with diagonally anisotropic materials by defining a [CustomMedium](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.CustomMedium.html#tidy3d.CustomMedium){: .color-primary-hover} that uses a diagonally anisotropic [PermittivityDataset](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.PermittivityDataset.html){: .color-primary-hover}. + +The following example shows how to create an anisotropic LN medium with the extraordinary axis aligned along the z-axis: + + +
+{% highlight python %} +# Define the coordinates for the medium +X = [-1e12, 1e12] +f = [td.C_0] +coords = dict(x=X, y=X, z=X, f=f) + +# Define the datasets +n_e = 2.17 +n_o = 2.23 + +eps_xx = td.ScalarFieldDataArray(np.ones((2, 2, 2, 1)) * n_e**2, coords=coords) +eps_yy = eps_xx +eps_zz = td.ScalarFieldDataArray(np.ones((2, 2, 2, 1)) * n_o**2, coords=coords) + +# Define anisotropic permittivity dataset +permittivity = td.PermittivityDataset( + eps_xx=eps_xx, + eps_yy=eps_yy, + eps_zz=eps_zz +) + +# Define anisotropic custom medium +medium = td.CustomMedium(eps_dataset=permittivity) +{% endhighlight %} +{% include copy-button.html %}
diff --git a/docs/faq/how-do-i-use-anisotropic-medium.md b/docs/faq/how-do-i-use-anisotropic-medium.md new file mode 100644 index 0000000..945fd3a --- /dev/null +++ b/docs/faq/how-do-i-use-anisotropic-medium.md @@ -0,0 +1,41 @@ +# How Do I Use Anisotropic Medium? + +| Date | Category | +|------------|-------------| +| 2025-09-24 11:50:54 | Inverse Design | + + +Currently, classes of [AnisotropicMedium](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.AnisotropicMedium.html) are not supported with the `autograd` plugin. +However, it is possible to work with diagonally anisotropic materials by defining a [CustomMedium](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.CustomMedium.html#tidy3d.CustomMedium) that uses a diagonally anisotropic [PermittivityDataset](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.PermittivityDataset.html). + +The following example shows how to create an anisotropic LN medium with the extraordinary axis aligned along the z-axis: + + + + +```python +# Define the coordinates for the medium +X = [-1e12, 1e12] +f = [td.C_0] +coords = dict(x=X, y=X, z=X, f=f) + +# Define the datasets +n_e = 2.17 +n_o = 2.23 + +eps_xx = td.ScalarFieldDataArray(np.ones((2, 2, 2, 1)) * n_e**2, coords=coords) +eps_yy = eps_xx +eps_zz = td.ScalarFieldDataArray(np.ones((2, 2, 2, 1)) * n_o**2, coords=coords) + +# Define anisotropic permittivity dataset +permittivity = td.PermittivityDataset( + eps_xx=eps_xx, + eps_yy=eps_yy, + eps_zz=eps_zz +) + +# Define anisotropic custom medium +medium = td.CustomMedium(eps_dataset=permittivity) +``` + + diff --git a/docs/inverse-design.rst b/docs/inverse-design.rst index b5024cc..4605c66 100644 --- a/docs/inverse-design.rst +++ b/docs/inverse-design.rst @@ -16,3 +16,4 @@ Inverse Design faq/how-do-i-include-fabrication-constraints-in-adjoint-topology-optimization.md faq/how-do-i-include-fabrication-constraints-in-adjoint-level-set-optimization.md faq/how-do-i-export-the-final-inverse-design-structure-to-gds.md + faq/how-do-i-use-anisotropic-medium.md diff --git a/faq_categories.json b/faq_categories.json index a44d70c..a863f9c 100644 --- a/faq_categories.json +++ b/faq_categories.json @@ -300,7 +300,8 @@ "_faqs/how-do-i-include-fabrication-constraints-in-adjoint-shape-optimization.md", "_faqs/how-do-i-include-fabrication-constraints-in-adjoint-topology-optimization.md", "_faqs/how-do-i-include-fabrication-constraints-in-adjoint-level-set-optimization.md", - "_faqs/how-do-i-export-the-final-inverse-design-structure-to-gds.md" + "_faqs/how-do-i-export-the-final-inverse-design-structure-to-gds.md", + "_faqs/how-do-i-use-anisotropic-medium.md" ] }, {