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

Class Source

python/source.py:18–161  ·  view source on GitHub ↗

The `Source` class is used to specify the current sources via the `Simulation.sources` attribute. Note that all sources in Meep are separable in time and space, i.e. of the form $\\mathbf{J}(\\mathbf{x},t) = \\mathbf{A}(\\mathbf{x}) \\cdot f(t)$ for some functions $\\mathbf{A}$ and

Source from the content-addressed store, hash-verified

16
17
18class Source:
19 """
20 The `Source` class is used to specify the current sources via the `Simulation.sources`
21 attribute. Note that all sources in Meep are separable in time and space, i.e. of the
22 form $\\mathbf{J}(\\mathbf{x},t) = \\mathbf{A}(\\mathbf{x}) \\cdot f(t)$ for some functions
23 $\\mathbf{A}$ and $f$. Non-separable sources can be simulated, however, by modifying
24 the sources after each time step. When real fields are being used (which is the
25 default in many cases; see `Simulation.force_complex_fields`), only the real part of
26 the current source is used.
27
28 **Important note**: These are *current* sources (**J** terms in Maxwell's equations),
29 even though they are labelled by electric/magnetic field components. They do *not*
30 specify a particular electric/magnetic field which would be what is called a "hard"
31 source in the FDTD literature. There is no fixed relationship between the current
32 source and the resulting field amplitudes; it depends on the surrounding geometry, as
33 described in the
34 [FAQ](FAQ.md#how-does-the-current-amplitude-relate-to-the-resulting-field-amplitude)
35 and in Section 4.4 ("Currents and Fields: The Local Density of States") in [Chapter
36 4](http://arxiv.org/abs/arXiv:1301.5366) ("Electromagnetic Wave Source Conditions") of
37 the book [Advances in FDTD Computational Electrodynamics: Photonics and
38 Nanotechnology](https://www.amazon.com/Advances-FDTD-Computational-Electrodynamics-Nanotechnology/dp/1608071707).
39 """
40
41 def __init__(
42 self,
43 src,
44 component,
45 center=None,
46 volume=None,
47 size=Vector3(),
48 amplitude=1.0,
49 amp_func=None,
50 amp_func_file="",
51 amp_data=None,
52 ):
53 """
54 Construct a `Source`.
55
56 + **`src` [`SourceTime` class ]** — Specify the time-dependence of the source (see
57 below). No default.
58
59 + **`component` [`component` constant ]** — Specify the direction and type of the
60 current component: e.g. `mp.Ex`, `mp.Ey`, etcetera for an electric-charge
61 current, and `mp.Hx`, `mp.Hy`, etcetera for a magnetic-charge current. Note that
62 currents pointing in an arbitrary direction are specified simply as multiple
63 current sources with the appropriate amplitudes for each component. No default.
64
65 + **`center` [`Vector3`]** — The location of the center of the current source in
66 the cell. No default.
67
68 + **`size` [`Vector3`]** — The size of the current distribution along each
69 direction of the cell. Default is `(0,0,0)`: a point-dipole source.
70
71 + **`volume` [`Volume`]** — A `meep.Volume` can be used to specify the source
72 region instead of a `center` and a `size`.
73
74 + **`amplitude` [`complex`]** — An overall complex amplitude multiplying the
75 current source. Default is 1.0. Note that specifying a complex `amplitude`

Callers 1

Calls

no outgoing calls

Tested by 1