Repository: NanoComp/meep

Issue #881: weird yee shift for component in get_array_metadata
Created: 2019-05-15T20:57:21Z
This may be related to #838.
When trying to grab the coordinates of a single point in 3D coordinates (like a source), I sometimes get the error:
weird yee shift for component.
import meep as mp

cell = mp.Vector3(16,8,4)

geometry = [mp.Block(mp.Vector3(mp.inf,1,1),
                     center=mp.Vector3(),
                     material=mp.Medium(epsilon=12))]

sources = [mp.Source(mp.ContinuousSource(frequency=0.15),
                     component=mp.Ez,
                     center=mp.Vector3(-7,0,0))]

pml_layers = [mp.PML(1.0)]

resolution = 10

sim = mp.Simulation(cell_size=cell,
                    boundary_layers=pml_layers,
                    geometry=geometry,
                    sources=sources,
                    resolution=resolution)

sim.init_sim()
temp = sim.get_source(mp.Ez,center=sources[0].center,size=sources[0].size)
print(temp)

(x,y,z,w)=sim.get_array_metadata(center=sources[0].center,size=sources[0].size)
print(x)
print(y)
print(z)
Output:
Using MPI version 3.1, 1 processes
-----------
Initializing structure...
Working in 3D dimensions.
Computational cell is 16 x 8 x 4 with resolution 10
     block, center = (0,0,0)
          size (1e+20,1,1)
          axes (1,0,0), (0,1,0), (0,0,1)
          dielectric constant epsilon diagonal = (12,12,12)
time for set_epsilon = 1.75841 s
-----------
0j
meep: weird yee shift for component none
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

The 2D results occasionally segfault. When the routine succeeds, it outputs:
Using MPI version 3.1, 1 processes
-----------
Initializing structure...
Working in 2D dimensions.
Computational cell is 16 x 8 x 0 with resolution 10
     block, center = (0,0,0)
          size (1e+20,1,1)
          axes (1,0,0), (0,1,0), (0,0,1)
          dielectric constant epsilon diagonal = (12,12,12)
time for set_epsilon = 0.031008 s
-----------
0j
(-7.050000000000001, -6.950000000000001)
(-0.05, 0.05)
(0.0,)

Elapsed run time = 0.0366 s

Field time usage:
        outputting fields: 0.000228 s
          everything else: 0.001851 s```

Duplicate issue #943: get_array_metadata crashes for 3D simulation
Created: 2019-07-02T09:54:00Z
On meep 1.10.0-14-g5b2f4b9e, get_array_metadata crashes for 3d simulations, but not for 2d simulations:
import meep as mp
from meep import Vector3

print(mp.__version__)

mpSim = mp.Simulation(
	cell_size=Vector3(1, 1, 1),
	resolution=10,
)
mpSim.init_sim()
mpSim.get_array_metadata()

prints:
Using MPI version 3.1, 1 processes
1.10.0-14-g5b2f4b9e
-----------
Initializing structure...
Working in 3D dimensions.
Computational cell is 4 x 4 x 1 with resolution 20
time for set_epsilon = 0.48629 s
-----------
meep: weird yee shift for component none
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=1
:
system msg for write_line failure : Bad file descriptor

Process finished with exit code 1

If I change cell_size to Vector3(1,1,0), meep uses a 2D simulation and the crash does not occur. From what I can tell, get_array_metadata works for all 2D scenes and fails for all 3D scenes.

Closing comment (2020-02-11T19:19:21Z): Duplicate of #881