-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug in get_epsilon_point
for points on the cell boundary
#1836
Comments
This function Lines 166 to 182 in f9bd757
should return a nonzero value on exactly one process for each |
I think I have tracked down the cause of the problem: whenever the input Line 181 in f9bd757
There is something about Meep's default metallic boundaries which is causing the problem here because no such error occurs if the cell is defined using periodic boundaries: self.sim = mp.Simulation(resolution=resolution,
cell_size=self.cell_size,
k_point=mp.Vector3()) |
Actually, it turns out that the serial case also fails whenever import unittest
import numpy as np
import meep as mp
class TestGetEpsilonGrid(unittest.TestCase):
def setUp(self):
resolution = 10
self.cell_size = mp.Vector3(1.0,1.0,0)
self.sim = mp.Simulation(resolution=resolution,
cell_size=self.cell_size,
default_material=mp.Medium(epsilon=12.25))
self.sim.init_sim()
def test_get_epsilon_grid(self):
pt = mp.Vector3(-0.5,0.5,0)
eps_grid = self.sim.get_epsilon_grid(np.array([pt.x]),np.array([pt.y]),np.array([pt.z]))
eps_pt = self.sim.get_epsilon_point(pt)
print("eps:, ({},{}), {}, {}".format(pt.x,pt.y,eps_pt,eps_grid))
self.assertAlmostEqual(np.real(eps_grid), np.real(eps_pt), places=6)
self.assertAlmostEqual(np.imag(eps_grid), np.imag(eps_pt), places=6)
if __name__ == '__main__':
unittest.main()
|
get_epsilon_point
for parallel simulationsget_epsilon_point
for for points on the cell boundary
get_epsilon_point
for for points on the cell boundaryget_epsilon_point
for points on the cell boundary
It sounds like a fix would be to change this line: return d == component_direction(c) ? 1.0 : 0; // default to vacuum outside computational cell to something like return d == component_direction(c) && (parallel || am_master()) ? 1.0 : 0; // default to vacuum outside computational cell |
(Right now, the |
There seems to be a bug in
get_epsilon_point
for parallel simulations. This can be demonstrated using the simple test below which compares the output fromget_epsilon_point
andget_epsilon_grid
over a set of grid points in a 2d cell of vacuum. The result everywhere is expected to be 1.0 everywhere.get_epsilon_point
produces the correct result for the serial case but fails in the parallel case.serial simulation
parallel simulation
The text was updated successfully, but these errors were encountered: