I'm running the posted example code for optical forces. I'm comparing my output (errors and all) with that of the posted jupyter notebook at
https://github.com/NanoComp/meep/blob/master/python/examples/parallel-wvgs-force.ipynb
The output that is shown on the example notebook
Working in 3D dimensions.
Computational cell is 7 x 5 x 0.0333333 with resolution 30
I copy and pasted the exact same code into my notebook, and confirmed the same behavior from terminal. In both situations I get the same error:
RuntimeError: meep: Could not determine normal direction for given grid_volume.
I noticed the initial output on my notebook and terminal a major difference:
Working in 2D dimensions.
Computational cell is 7 x 5 x 0 with resolution 30
I'm suspecting this is the reason why I'm getting the RuntimeError. How do I force my simulation to run in 3D rather than defaulting to 2D? I see in the example code the cell is defined as
cell = mp.Vector3(sx+2dpml,sy+2dpml,0)
Would this not force a 2D simulation since the 3rd dimension is 0?
Below is the entire traceback
RuntimeError Traceback (most recent call last)
in
7
8 for k in range(len(s)):
----> 9 fluxes_odd[k], forces_odd[k] = parallel_waveguide(s[k],True)
10 fluxes_even[k], forces_even[k] = parallel_waveguide(s[k],False)
in parallel_waveguide(s, xodd)
82 wvg_force = sim.add_force(f, 0, 1, force_reg1, force_reg2)
83
---> 84 sim.run(until_after_sources=500)
85
86 flux = mp.get_fluxes(wvg_flux)[0]
~/miniconda3/envs/mp/lib/python3.7/site-packages/meep/simulation.py in run(self, *step_funcs, **kwargs)
2283
2284 if self.fields is None:
-> 2285 self.init_sim()
2286
2287 self._evaluate_dft_objects()
~/miniconda3/envs/mp/lib/python3.7/site-packages/meep/simulation.py in init_sim(self)
1335
1336 for s in self.sources:
-> 1337 self.add_source(s)
1338
1339 for hook in self.init_sim_hooks:
~/miniconda3/envs/mp/lib/python3.7/site-packages/meep/simulation.py in add_source(self, src)
1597 if isinstance(src, EigenModeSource):
1598 if src.direction < 0:
-> 1599 direction = self.fields.normal_direction(where)
1600 else:
1601 direction = src.direction
~/miniconda3/envs/mp/lib/python3.7/site-packages/meep/__init__.py in normal_direction(self, where)
4049
4050 def normal_direction(self, where):
-> 4051 return _meep.fields_normal_direction(self, where)
4052
4053 def casimir_stress_dct_integral(self, dforce, dsource, mx, my, mz, ft, where, is_bloch=False):
RuntimeError: meep: Could not determine normal direction for given grid_volume.
I'm running the posted example code for optical forces. I'm comparing my output (errors and all) with that of the posted jupyter notebook at https://github.com/NanoComp/meep/blob/master/python/examples/parallel-wvgs-force.ipynb The output that is shown on the example notebook Working in 3D dimensions. Computational cell is 7 x 5 x 0.0333333 with resolution 30 I copy and pasted the exact same code into my notebook, and confirmed the same behavior from terminal. In both situations I get the same error: RuntimeError: meep: Could not determine normal direction for given grid_volume. I noticed the initial output on my notebook and terminal a major difference: Working in 2D dimensions. Computational cell is 7 x 5 x 0 with resolution 30
I'm suspecting this is the reason why I'm getting the RuntimeError. How do I force my simulation to run in 3D rather than defaulting to 2D? I see in the example code the cell is defined as cell = mp.Vector3(sx+2dpml,sy+2dpml,0) Would this not force a 2D simulation since the 3rd dimension is 0?
Below is the entire traceback
RuntimeError Traceback (most recent call last)