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

Method test_geometry_center

python/tests/test_simulation.py:652–689  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

650 self.assertTrue(size.close(mp.Vector3(2, 2, 2)))
651
652 def test_geometry_center(self):
653 resolution = 20
654 cell_size = mp.Vector3(10, 10)
655 pml = [mp.PML(1)]
656 center = mp.Vector3(2, -1)
657 result = []
658 fcen = 0.15
659 df = 0.1
660
661 sources = [
662 mp.Source(
663 src=mp.GaussianSource(fcen, fwidth=df),
664 component=mp.Ez,
665 center=mp.Vector3(),
666 )
667 ]
668 geometry = [
669 mp.Block(
670 center=mp.Vector3(),
671 size=mp.Vector3(mp.inf, 3, mp.inf),
672 material=mp.Medium(epsilon=12),
673 )
674 ]
675
676 def print_field(sim):
677 result.append(sim.get_field_point(mp.Ez, mp.Vector3(2, -1)))
678
679 sim = mp.Simulation(
680 resolution=resolution,
681 cell_size=cell_size,
682 boundary_layers=pml,
683 sources=sources,
684 geometry=geometry,
685 geometry_center=center,
686 )
687 sim.run(mp.at_end(print_field), until=50)
688
689 self.assertAlmostEqual(result[0], -0.0599602798684155)
690
691 def test_timing_data(self):
692 resolution = 20

Callers

nothing calls this directly

Calls 1

runMethod · 0.95

Tested by

no test coverage detected