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

High level get_eigenmode_coefficients #248

Merged
merged 7 commits into from
Apr 15, 2018
Merged

High level get_eigenmode_coefficients #248

merged 7 commits into from
Apr 15, 2018

Conversation

ChristopherHogan
Copy link
Contributor

This will require a documentation change, but I think Ardavan is working on that documentation now, so it will need his PR first.
@stevengj @oskooi @HomerReid

@ChristopherHogan
Copy link
Contributor Author

When called from Python, get_eigenmode_coefficients is unable to infer the direction, resulting in

meep: cannot determine normal direction in get_eigenmode_coefficients

Looking at @HomerReid 's wvg-taper.cpp (which has been deleted from the repository, so I had to look at an old commit), he calls the overload of add_dft_flux that takes a direction as the first argument. Then, get_eigenmode_coefficients gets the direction via dft_flux::normal_direction.

However, in Python and Scheme, the overload of add_dft_flux that takes a volume_list as the first parameter is called, which returns a dft_flux with NO_DIRECTION as the direction. This happens in _add_fluxish_stuff.

def _add_fluxish_stuff(self, add_dft_stuff, fcen, df, nfreq, stufflist):
        vol_list = None

        for s in stufflist:
            v = Volume(center=s.center, size=s.size, dims=self.dimensions,
                       is_cylindrical=self.is_cylindrical)
            d0 = s.direction
            d = self.fields.normal_direction(v.swigobj) if d0 < 0 else d0
            c = mp.direction_component(mp.Sx, d)
            v2 = Volume(center=s.center, size=s.size, dims=self.dimensions,
                        is_cylindrical=self.is_cylindrical).swigobj
            vol_list = mp.make_volume_list(v2, c, s.weight, vol_list)

        stuff = add_dft_stuff(vol_list, fcen - df / 2, fcen + df / 2, nfreq)
        vol_list.__swig_destroy__(vol_list)
        return stuff

Note that the direction, d, is available, but stuff.normal_direction is NO_DIRECTION. How can we make this work?

@stevengj stevengj merged commit 2c579c4 into NanoComp:master Apr 15, 2018
@ChristopherHogan ChristopherHogan deleted the chogan/hl_eigenmode_coef branch April 24, 2018 14:09
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
* High level get_eigenmode_coefficients

* Update get_eigenmode_coefficients

* add eigvol to flux

* ../../python/simulation.py

* Attempt at add_eigenmode

* add_eigenmode is alias for add_flux

* No eigvol
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

Successfully merging this pull request may close these issues.

2 participants