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

Add kz_2d option #1035

Merged
merged 3 commits into from
Oct 23, 2019
Merged

Add kz_2d option #1035

merged 3 commits into from
Oct 23, 2019

Conversation

ChristopherHogan
Copy link
Contributor

Fixes #1026.

@ChristopherHogan
Copy link
Contributor Author

Using "complex" as the new default (as described in #1026) causes about half of the tests to fail (assuming it's correct to set the default k_point to Vector3(0, 0, 0) when using the "complex" option). Should the failing tests use the "3d" option?


if self.special_kz and self.k_point is False:
self.k_point = Vector3()

Copy link
Collaborator

@oskooi oskooi Oct 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 641-653 should be replaced with:

        self.special_kz = False
        if self.cell_size.z == 0 and self.k_point and self.k_point.z != 0:
            if kz_2d == "complex":
                self.special_kz = True
                self.force_complex_fields = True
            elif kz_2d == "real/imag":
                self.special_kz = True
                self.force_complex_fields = False
            elif kz_2d == "3d":
                self.special_kz = False
            else:
                raise ValueError("Invalid kz_2d option: {} not in [complex, real/imag, 3d]".format(kz_2d))

Setting kpoint=0 when special_kz=True is incorrect since its non-zero z component is what is used in the calculations.

t_real_imag = time() - start

start = time()
Rmeep_3d = self.refl_planar(theta, '3d')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3d simulation can probably be removed (in order to save time) since this particular test is only for the special_kz=True feature.

@stevengj stevengj merged commit 87d523b into NanoComp:master Oct 23, 2019
@ChristopherHogan ChristopherHogan deleted the chogan/special_kz branch November 17, 2019 23:12
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
* Add kz_2d option

* Set default k_point when special_kz is True

* Only use kz_2d when k_point is set
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.

account for implicit "i" factor in special_kz calculations
3 participants