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

Segmentation fault for 3D simulation using 1D cell #2916

Open
oskooi opened this issue Oct 2, 2024 · 0 comments
Open

Segmentation fault for 3D simulation using 1D cell #2916

oskooi opened this issue Oct 2, 2024 · 0 comments
Labels

Comments

@oskooi
Copy link
Collaborator

oskooi commented Oct 2, 2024

I am running into an unexpected segmentation fault when trying to run a 3D simulation using a 1D cell. This only occurs for certain grid resolutions and Bloch-periodic boundary conditions.

This issue can be reproduced using the script below which involves a point source in vacuum with Bloch-periodic boundaries in $x$ and $y$ (k_point = (-0.2, -0.2, 0)). The simulation is fine when RESOLUTION_UM is 51 but produces the segfault for values of 52 and 53. Changing the k_point also runs fine (no segfault).

The problem therefore seems to be some combination of the grid resolution and the Bloch-periodic boundaries for a 1D cell. I should also mention that I am using Meep compiled using single-precision floating point and OpenMP.

Case 1: RESOLUTION_UM = 51

Initializing structure...
time for choose_chunkdivision = 7.7198e-05 s
Working in 3D dimensions.
Computational cell is 0.0196078 x 0.0196078 x 12 with resolution 51
time for set_epsilon = 0.00449374 s
-----------
Meep: using complex fields.
field decay(t = 50.009803921568626): 0.2511579661675122 / 0.2511579661675122 = 1.0
field decay(t = 100.01960784313725): 0.25115618711643334 / 0.2511579661675122 = 0.9999929166050117
field decay(t = 150.02941176470588): 1.7969355984235213e-10 / 0.2511579661675122 = 7.154603239719811e-10
run 0 finished at t = 150.02941176470588 (15303 timesteps)

Elapsed run time = 2.3554 s

Case 2: RESOLUTION_UM = 52

Using MPI version 3.1, 1 processes
-----------
Initializing structure...
time for choose_chunkdivision = 9.0651e-05 s
Working in 3D dimensions.
Computational cell is 0.0192308 x 0.0192308 x 12 with resolution 52
time for set_epsilon = 0.00381082 s
-----------
Meep: using complex fields.
[devbig095:2604209:0:2604209] Caught signal 11 (Segmentation fault: address not mapped to object at address (nil))
==== backtrace (tid:2604209) ====
 0  /lib64/libucs.so.0(ucs_handle_error+0x2e4) [0x7ff45fc81e44]
 1  /lib64/libucs.so.0(+0x2a4cd) [0x7ff45fc834cd]
 2  /lib64/libucs.so.0(+0x2a6aa) [0x7ff45fc836aa]
 3  /home/oskooi/install/meep/src/.libs/libmeep.so.33(_ZN4meep6fields15step_boundariesENS_10field_typeE+0x4b4) [0x7ff465a314c4]
=================================
[devbig095:2604209] *** Process received signal ***
[devbig095:2604209] Signal: Segmentation fault (11)
import meep as mp
import numpy as np

RESOLUTION_UM = 51
WAVELENGTH_UM = 1.0

frequency = 1 / WAVELENGTH_UM
pml_um = 1.0
air_um = 10.0
size_z_um = pml_um + air_um + pml_um
cell_size = mp.Vector3(0, 0, size_z_um)

pml_layers = [mp.PML(thickness=pml_um)]

src_cmpt = mp.Ex

k_point = mp.Vector3(-0.2, -0.2, 0)

sources = [
    mp.Source(
        src=mp.GaussianSource(frequency, fwidth=0.1 * frequency),
        component=src_cmpt,
        center=mp.Vector3()
    )
]

sim = mp.Simulation(
    resolution=RESOLUTION_UM,
    force_complex_fields=True,
    cell_size=cell_size,
    sources=sources,
    boundary_layers=pml_layers,
    k_point=k_point
)

sim.run(
    until_after_sources=mp.stop_when_fields_decayed(
        50, src_cmpt, mp.Vector3(), 1e-6
    )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant