MCPcopy Create free account
hub / github.com/NanoComp/meep / get_eigenmode

Method get_eigenmode

python/simulation.py:4256–4324  ·  view source on GitHub ↗

The parameters of this routine are the same as that of `get_eigenmode_coefficients` or `EigenModeSource`, but this function returns an object that can be used to inspect the computed mode. In particular, it returns an `EigenmodeData` instance with the following fiel

(
        self,
        frequency,
        direction,
        where,
        band_num,
        kpoint,
        eig_vol=None,
        match_frequency=True,
        parity=mp.NO_PARITY,
        resolution=0,
        eigensolver_tol=1e-12,
    )

Source from the content-addressed store, hash-verified

4254 )
4255
4256 def get_eigenmode(
4257 self,
4258 frequency,
4259 direction,
4260 where,
4261 band_num,
4262 kpoint,
4263 eig_vol=None,
4264 match_frequency=True,
4265 parity=mp.NO_PARITY,
4266 resolution=0,
4267 eigensolver_tol=1e-12,
4268 ):
4269 """
4270 The parameters of this routine are the same as that of
4271 `get_eigenmode_coefficients` or `EigenModeSource`, but this function returns an
4272 object that can be used to inspect the computed mode. In particular, it returns
4273 an `EigenmodeData` instance with the following fields:
4274
4275 + `band_num`: same as a single element of the `bands` parameter
4276 + `freq`: the computed frequency, same as the `frequency` input parameter if
4277 `match_frequency=True`
4278 + `group_velocity`: the group velocity of the mode in `direction`
4279 + `k`: the Bloch wavevector of the mode in `direction`
4280 + `kdom`: the dominant planewave of mode `band_num`
4281 + `amplitude(point, component)`: the (complex) value of the given $\\mathbf{E}$ or $\\mathbf{H}$ field
4282 `component` (`Ex`, `Hy`, etcetera) at a particular `point` (a `Vector3`) in
4283 space (interpreted with Bloch-periodic boundary conditions if you give a point
4284 outside the original `eig_vol`).
4285
4286 If `match_frequency=False` or `kpoint` is not zero in the given `direction`, the
4287 `frequency` input parameter is ignored.
4288 """
4289
4290 if self.fields is None:
4291 raise ValueError("Fields must be initialized before calling get_eigenmode")
4292
4293 where = self._volume_from_kwargs(vol=where)
4294 if eig_vol is None:
4295 eig_vol = where
4296 else:
4297 eig_vol = self._volume_from_kwargs(vol=eig_vol)
4298
4299 swig_kpoint = mp.vec(kpoint.x, kpoint.y, kpoint.z)
4300 kdom = np.zeros(3)
4301 emdata = mp._get_eigenmode(
4302 self.fields,
4303 frequency,
4304 direction,
4305 where,
4306 eig_vol,
4307 band_num,
4308 swig_kpoint,
4309 match_frequency,
4310 parity,
4311 resolution,
4312 eigensolver_tol,
4313 kdom,

Callers 3

run_kdomMethod · 0.95
parallel_waveguideFunction · 0.95
test_modesMethod · 0.45

Calls 3

_volume_from_kwargsMethod · 0.95
EigenmodeDataClass · 0.85
vecMethod · 0.80

Tested by 2

run_kdomMethod · 0.76
test_modesMethod · 0.36