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

Meep integration: cell size not correctly calculated #505

Closed
HelgeGehring opened this issue Jun 30, 2022 · 10 comments
Closed

Meep integration: cell size not correctly calculated #505

HelgeGehring opened this issue Jun 30, 2022 · 10 comments

Comments

@HelgeGehring
Copy link
Collaborator

The size of the Mode monitor is not correctly taken into account for bends:

from gdsfactory.components import bend_euler
from gdsfactory.simulation.gmeep import write_sparameters_meep
from gdsfactory.simulation.effective_permittivity import calculate_effective_permittivity

bend = bend_euler(radius=5)
material_name_to_meep = {
    'si': float(calculate_effective_permittivity(3.477 ** 2, 1.444 ** 2, 1.444 ** 2, .22, 1.55, 'te')[0] ** .5)}
write_sparameters_meep(bend, resolution=20, is_3d=False, animate=True, material_name_to_meep=material_name_to_meep)

image

@simbilod
Copy link
Collaborator

simbilod commented Jun 30, 2022

The band-aid solution to this is to manually pad the component before simulating it:

    bend = bend_euler(radius=5)
    p = 3
    bend = gf.add_padding_container(bend, default=0, right=p)
    material_name_to_meep = {
        'si': float(calculate_effective_permittivity(3.477 ** 2, 1.444 ** 2, 1.444 ** 2, .22, 1.55, 'te')[0] ** .5)}
    write_sparameters_meep(bend, resolution=20, is_3d=False, animate=True, material_name_to_meep=material_name_to_meep)

image

We could automate this padding in gmeep.get_simulation conditionned on component size, port location, and port sizes if that is a persistent issue. EDIT: working on it now

@joamatab
Copy link
Contributor

yes, we could pass some padding, or you can use the bend90 function that we have in the docs

https://gdsfactory.github.io/gdsfactory/notebooks/plugins/meep/001_meep_sparameters.html#Port-symmetries

df = gm.write_sparameters_meep_1x1_bend90(c, run=False)

@simbilod
Copy link
Collaborator

See PR #512

@joamatab
Copy link
Contributor

joamatab commented Jun 30, 2022

Hi Simon

i'd rather set the simulation manually, as we do now

the current solution:

  • minimizes extra space
  • lets you control the margin manually
write_sparameters_meep_mpi_1x1_bend90 = gf.partial(
    write_sparameters_meep_mpi,
    ymargin_bot=3,
    ymargin=0,
    xmargin_right=3,
    port_symmetries=port_symmetries.port_symmetries_1x1,
)

what do you think?

@simbilod
Copy link
Collaborator

Agreed

@joamatab
Copy link
Contributor

joamatab commented Jun 30, 2022

another way to automatically fix these issues is to add port_markers

image

@joamatab
Copy link
Contributor

we could do this as a FdtdSimulator class that can have all the FDTD as backends

  • meep
  • lumerical
  • tidy3d

we could also add 3D rendering capabilities

what do you think?

@HelgeGehring
@flaport

@HelgeGehring
Copy link
Collaborator Author

another way to automatically fix these issues is to add port_markers

image

seems like the best approach!

@simbilod
Copy link
Collaborator

This is a good opportunity to allow these port markers to hold height and mode information to allow multilayer and multimode simulations #502

@joamatab
Copy link
Contributor

see function to add port markers in the docs

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

3 participants