Skip to content
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

Eigenmode source calculated at wrong position in 3D #20

Closed
ghost opened this issue Jun 9, 2015 · 2 comments
Closed

Eigenmode source calculated at wrong position in 3D #20

ghost opened this issue Jun 9, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 9, 2015

Hi everybody,

when I have a 3d geometry of a straight waveguide, parallel to the z-direction and I use the eigenmode-source on one side, I get the correct eigenmode there and thus the correct propagation through the waveguide.
Anyway, when I taper the waveguide for example and again use the eigenmode source at one end of the waveguide, I do not get the correct eigenmode! After testing I found out, that the eigenmode is always calculated in the z-center. Means: Even if I place the eigenmode source at one end of the waveguide, let's say (center 0 0 14) (size sx sy 0), the eigenmode is calculated at (center 0 0 0) (size sx sy 0).
Not even the (eig-lattice-center 0 0 14) (eig-lattice-size sx sy 0) commands can change this.

Can somebody confirm this bug?

Best regards
Marc

@stevengj
Copy link
Collaborator

stevengj commented Jul 2, 2015

Looks like this is a typo in mpb/src/mpb.cpp. Can you tell me whether the following patch fixes the problem?

--- a/src/mpb.cpp
+++ b/src/mpb.cpp
@@ -46,7 +46,7 @@ static void meep_mpb_eps(symmetric_matrix *eps,
   const double *s = eps_data->s;
   const double *o = eps_data->o;
   vec p(eps_data->dim == D3 ?
-       vec(o[0] + r[0] * s[0], o[1] + r[1] * s[1], o[1] + r[1] * s[1]) :
+       vec(o[0] + r[0] * s[0], o[1] + r[1] * s[1], o[2] + r[2] * s[2]) :
        (eps_data->dim == D2 ?
         vec(o[0] + r[0] * s[0], o[1] + r[1] * s[1]) :
         /* D1 */ vec(o[2] + r[2] * s[2])));

@ghost
Copy link
Author

ghost commented Jul 15, 2015

It does fix the problem.
As I can see, you already implemented the patch correctly. As it is actually MEEP/src/mpb.cpp
and

snapshot1

Thanks alot and best regards from Zurich
Marc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant