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

Method __init__

python/simulation.py:222–286  ·  view source on GitHub ↗

+ **`thickness` [ `number` ]** — The spatial thickness of the PML layer which extends from the boundary towards the *inside* of the cell. The thinner it is, the more numerical reflections become a problem. No default value. + **`direction` [ `direction` constant

(
        self,
        thickness: float = None,
        direction: int = mp.ALL,
        side: int = mp.ALL,
        R_asymptotic: float = 1e-15,
        mean_stretch: float = 1.0,
        pml_profile: Callable[[float], float] = DefaultPMLProfile,
    )

Source from the content-addressed store, hash-verified

220 """
221
222 def __init__(
223 self,
224 thickness: float = None,
225 direction: int = mp.ALL,
226 side: int = mp.ALL,
227 R_asymptotic: float = 1e-15,
228 mean_stretch: float = 1.0,
229 pml_profile: Callable[[float], float] = DefaultPMLProfile,
230 ):
231 """
232 + **`thickness` [ `number` ]** — The spatial thickness of the PML layer which
233 extends from the boundary towards the *inside* of the cell. The thinner it is,
234 the more numerical reflections become a problem. No default value.
235
236 + **`direction` [ `direction` constant ]** — Specify the direction of the
237 boundaries to put the PML layers next to. e.g. if `X`, then specifies PML on the
238 $\\pm x$ boundaries (depending on the value of `side`, below). Default is the
239 special value `ALL`, which puts PML layers on the boundaries in all directions.
240
241 + **`side` [ `side` constant ]** — Specify which side, `Low` or `High` of the
242 boundary or boundaries to put PML on. e.g. if side is `Low` and direction is
243 `meep.X`, then a PML layer is added to the $-x$ boundary. Default is the special
244 value `meep.ALL`, which puts PML layers on both sides.
245
246 + **`R_asymptotic` [ `number` ]** — The asymptotic reflection in the limit of
247 infinite resolution or infinite PML thickness, for reflections from air (an
248 upper bound for other media with index > 1). For a finite resolution or
249 thickness, the reflection will be *much larger*, due to the discretization of
250 Maxwell&#x27;s equation. Default value is 10<sup>−15</sup>, which should suffice for
251 most purposes. You want to set this to be small enough so that waves propagating
252 within the PML are attenuated sufficiently, but making `R_asymptotic` too small
253 will increase the numerical reflection due to discretization.
254
255 + **`pml_profile` [ `function` ]** — By default, Meep turns on the PML conductivity
256 quadratically within the PML layer &mdash; one doesn&#x27;t want to turn it on
257 suddenly, because that exacerbates reflections due to the discretization. More
258 generally, with `pml_profile` one can specify an arbitrary PML "profile"
259 function $f(u)$ that determines the shape of the PML absorption profile up to an
260 overall constant factor. *u* goes from 0 to 1 at the start and end of the PML,
261 and the default is $f(u) = u^2$. In some cases where a very thick PML is
262 required, such as in a periodic medium (where there is technically no such thing
263 as a true PML, only a pseudo-PML), it can be advantageous to turn on the PML
264 absorption more smoothly. See [Optics Express, Vol. 16, pp. 11376-92
265 (2008)](http://www.opticsinfobase.org/abstract.cfm?URI=oe-16-15-11376). For
266 example, one can use a cubic profile $f(u) = u^3$ by specifying
267 `pml_profile=lambda u: u*u*u`.
268 """
269 if thickness is None:
270 raise ValueError("PML thickness must be specified.")
271
272 self.thickness = thickness
273 self.direction = direction
274 self.side = side
275 self.R_asymptotic = R_asymptotic
276 self.mean_stretch = mean_stretch
277 self.pml_profile = pml_profile
278
279 if direction == mp.ALL and side == mp.ALL:

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected