-
Notifications
You must be signed in to change notification settings - Fork 40
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
Fully anisotropic materials #846
Conversation
ea73ee4
to
1f168da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good, thanks Daniil for this long awaited and critical feature.
A few general things to discuss:
- Add item in changelog
- compatibility with old
AnisotropicMedium
: the naming conflict is a pain. But it does seem that these two have different functionality (eg can fully anisotropic handle dispersive?) so they should be separate. However, I do wish that we could have called this oneAnisotropicMedium
and the diagonal oneDiagonallyAnisotropicMedium
or something. in the future, are we planning to keep both separate or merge them? If merge, when we get closer to that, we can add a deprecation warning to encourage people to switch to the more general syntax given what we decide. - Can
RotationAroundAxis
be used in some of the geometry handling? We currently have some rotation code there, but I think it would be nice to unify things.
tidy3d/components/simulation.py
Outdated
@@ -2579,7 +2595,10 @@ def make_eps_data(coords: Coords): | |||
return xr.DataArray(eps_array, coords=coords, dims=("x", "y", "z")) | |||
|
|||
# combine all data into dictionary | |||
coords = grid[coord_key] | |||
if coord_key[0] != "E": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a bit simpler to do
if coord_key[0] == "E":
coord_key = coord_key[0:2]
coords = grid[coord_key]
return make_eps_data(coords)
although I',m not exactly sure what this bit is doing exactly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this part a little bit to try to make it more clear.
Here I'm trying to generalize epsilon_on_grid(..., coord_key: str, ...)
to be able to return off-diagonal components too. The way I did this is that in addition to coord_key = "Ex", "Ey", "Ez"
we can also call coord_key = "Exy", "Exz", "Eyx", ...
which would return a corresponding off-diagonal component but still at an Yee location (e.g., eps_xy
at Ex
). So, for those keys I just remove the last letter.
What I'm a bit hesitant about is that:
- things like
Ezy
are not proper physical concepts - from efficiency point of view, maybe it would make more sense to add a separate flag
include_off_diag
, and thencoord_key="Ex", include_off_diag=True
would return three arrayseps_xx, eps_xy, eps_xz
def _source_homogeneous(cls, val, values): | ||
"""Error if a plane wave or gaussian beam source is not in a homogeneous region.""" | ||
def _source_homogeneous_isotropic(cls, val, values): | ||
"""Error if a plane wave or gaussian beam source is not in a homogeneous and isotropic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFSF should also error if the box crosses any anisotropic region?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, added
You must be talking about this https://github.com/flexcompute/tidy3d/blob/daniil/fully-anisotropic/tidy3d/components/geometry.py#L635? You're right, it's actually a specific case of
One way how |
A gyrotropic medium with external magnetic field will have a tensorial conductivity in every axis orientation, no? |
Yeah, I forgot to mention that we would also need a field to specify gyrotropic part of permittivity, which could be defined as gyration vector So, eventually we have something like
where we would need to decide whether gyration vector is given in coordinates before or after rotation (probably before) |
5faede6
to
4ea819b
Compare
I think I've addressed all the comments so far, in case you want to give these corrections a look |
79aed74
to
9bc4f05
Compare
4c2ad59
to
7cce69a
Compare
7cce69a
to
47a8c55
Compare
47a8c55
to
f567f8e
Compare
Frontend interface for fully anisotropic materials:
AnisotropicMedium
was already taken, fully anisotropic materials are calledFullyAnisotropicMedium
RotationAroundAxis(AbstractRotation)
is implemented for convenient rotation of tensors in space. In future we can add more methods likeRotationEulerAngles(AbstractRotation)
, etc.FullyAnisotropicMedium
returns main componentsModeSolver
so that it is feeded with the full permittivity tensoreps_comp
is introduced in material classes to retrieve a specified component of a permittivity tensorReview todo's:
ArrayLike
AnisotropicMedium
andFullyAnisotropicMedium
AnisotropicMedium
andFullyAnisotropicMedium