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 option to use fallback integration for user material functions #771

Merged
merged 2 commits into from
Mar 21, 2019
Merged

Add option to use fallback integration for user material functions #771

merged 2 commits into from
Mar 21, 2019

Conversation

ChristopherHogan
Copy link
Contributor

@ChristopherHogan ChristopherHogan commented Mar 15, 2019

Fixes #764.

Allows setting a do_averaging property on a user material function to True (defaults to False) to use fallback_chi1inv_row.

def my_func(p):
  return mp.Medium()

my_func.do_averaging = True
sim = mp.Simulation(default_material=my_func, ...)

This was a little more complicated than the fix described in #764. get_front_object always returns false for a material function, so the if (material_type_equal(mat, mat_behind)) line is never reached.

### TODO
Running the script in issue #764 performs subpixel-averaging when setting do_averaging to True, but fails in the harminv step with

On entry to ZGEBAL parameter number 3 had an illegal value

I traced this back to chi1inv_row getting filled in with nans in geom_epsilon::fallback_chi1inv_row due to a divide by zero here. How should we handle this?

@ChristopherHogan ChristopherHogan changed the title WIP: Add option to use fallback integration for user material functions Add option to use fallback integration for user material functions Mar 21, 2019
@stevengj stevengj merged commit 072a763 into NanoComp:master Mar 21, 2019
@ChristopherHogan ChristopherHogan deleted the chogan/mat_func_fallback branch March 25, 2019 14:11
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
…anoComp#771)

* Add option to use fallback integration for user material functions

* Handle divide by zero
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.

subpixel averaging using adaptive cubature
2 participants