Skip to content

Commit aefb080

Browse files
tylerflexmomchil-flex
authored andcommitted
fix adjoint if refractive index of 0
1 parent dceb0e0 commit aefb080

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
### Fixed
1616
- `ModeSolver.plot_field` correctly returning the plot axes.
17+
- Avoid error if non-positive refractive index used for integration resolution in adjoint.
1718

1819
## [2.7.0rc2] - 2024-05-14
1920

tidy3d/plugins/adjoint/components/structure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def _get_medium_params(
101101
freq_max = float(max(grad_data_eps.eps_xx.f))
102102
eps_in = self.medium.eps_model(frequency=freq_max)
103103
ref_ind = np.sqrt(np.max(np.real(eps_in)))
104+
ref_ind = max([1.0, abs(ref_ind)])
104105
wvl_free_space = C_0 / freq_max
105106
wvl_mat = wvl_free_space / ref_ind
106107
return dict(wvl_mat=wvl_mat, eps_in=eps_in)

0 commit comments

Comments
 (0)