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

Method test_chunks

python/tests/test_chunks.py:15–107  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

13 mp.delete_directory(cls.temp_dir)
14
15 def test_chunks(self):
16 sxy = 10
17 cell = mp.Vector3(sxy, sxy, 0)
18
19 fcen = 1.0 # pulse center frequency
20 df = 0.1 # pulse width (in frequency)
21
22 sources = [mp.Source(mp.GaussianSource(fcen, fwidth=df), mp.Ez, mp.Vector3())]
23
24 dpml = 1.0
25 pml_layers = [mp.PML(dpml)]
26 resolution = 10
27
28 sim = mp.Simulation(
29 cell_size=cell,
30 boundary_layers=pml_layers,
31 sources=sources,
32 resolution=resolution,
33 split_chunks_evenly=False,
34 )
35
36 sim.use_output_directory(self.temp_dir)
37
38 top = mp.FluxRegion(
39 center=mp.Vector3(0, +0.5 * sxy - dpml),
40 size=mp.Vector3(sxy - 2 * dpml, 0),
41 weight=+1.0,
42 )
43 bot = mp.FluxRegion(
44 center=mp.Vector3(0, -0.5 * sxy + dpml),
45 size=mp.Vector3(sxy - 2 * dpml, 0),
46 weight=-1.0,
47 )
48 rgt = mp.FluxRegion(
49 center=mp.Vector3(+0.5 * sxy - dpml, 0),
50 size=mp.Vector3(0, sxy - 2 * dpml),
51 weight=+1.0,
52 )
53 lft = mp.FluxRegion(
54 center=mp.Vector3(-0.5 * sxy + dpml, 0),
55 size=mp.Vector3(0, sxy - 2 * dpml),
56 weight=-1.0,
57 )
58
59 tot_flux = sim.add_flux(fcen, 0, 1, top, bot, rgt, lft, decimation_factor=1)
60
61 sim.run(
62 until_after_sources=mp.stop_when_fields_decayed(
63 50, mp.Ez, mp.Vector3(), 1e-5
64 )
65 )
66
67 sim.save_flux("tot_flux", tot_flux)
68 sim1 = sim
69
70 geometry = [
71 mp.Block(
72 center=mp.Vector3(),

Callers

nothing calls this directly

Calls 5

use_output_directoryMethod · 0.95
add_fluxMethod · 0.95
runMethod · 0.95
save_fluxMethod · 0.95
load_minus_fluxMethod · 0.95

Tested by

no test coverage detected