Dear meep community, I encounter a problem when using eigenmode-source:
The 3D simulation structure contains a waveguide along z direction which stops at z=0 and extends to z=-infinity (pml is used at all the boundaries.) The eigenmode source is a plane placed in the simulation region at some z < 0. However, the Mpb does not give an eigenmode source and gives the following error: meep: Newton solver not converging -- need a better starting kpoint However, when I simulate the same waveguide which extends from z=-infinity to z=+infinity and place the planar source plane, Mpb gives the correct eigenmode source. The initial k-points are same in thees two cases which are very close to the k-point of the guided mode. I am wondering about the reason of this problem. Is it related to how eigenmode-source is built? I would also appreciate if anyone could point out the error in my code. Here are the ctl files for the semi-infinite waveguide and the infinite waveguide. ctl file for the semi-infite waveguide simulation: (reset-meep) (set-param! resolution 50) ;resolution is a pre-defined parameter representing the resolution of simulation (define-param dpml 0.4) (define-param resol 50) (define-param acone 0.2) (define-param bcone 0.6) (define-param eps_cone 12) (define-param length-x 3) (define-param length-y 3) (define-param length-wg 1) (define-param length-air 1) (define-param length-z (+ length-wg length-air)) (define-param length-err (/ 1 resol)) (define-param lattice-x (+ length-x (* 2 dpml))) (define-param lattice-y (+ length-y (* 2 dpml))) (define-param lattice-z (+ length-z (* 2 dpml))) (set! geometry-lattice (make lattice (size lattice-x lattice-y lattice-z))) (set! pml-layers (list (make pml (thickness dpml)))) ; parameters related to source (define-param wvlen 2) (define-param fcen (/ 1 wvlen)) ; wavelength 2um (define-param df 0.05) ;delta_f of the gaussian beam, half width (define-param src-cmpt Ey) (define-param src-parity ODD-Y) ;TM (define-param nfreq 11) ; number of frequencies to compute farfield (define-param neff 1.9) ;effective refractive index of waveguide mode (define-param wvg-kz (* neff (/ 1 wvlen))) ;define the k-point of the guided mode in unit of 2*pi/a (set! k-point (vector3 0 0 wvg-kz)) (define-param Hwg (+ length-wg dpml)) ;Height of waveguide including the part in pml (define list1 (list (make block (center 0 0 (/ (- Hwg lattice-z) 2)) ; center of block 1/2*(Hwg - lattice-z) (size acone bcone Hwg) (material (make dielectric (epsilon eps_cone)))))) (set! geometry list1) ; define the source (set! sources (list (make eigenmode-source (src (make gaussian-src (frequency fcen) (fwidth df))) ;(component src-cmpt) is comment, as the mode source contains J and M in all directions (center 0 0 (/ (- Hwg lattice-z) 2)) (size wvlen wvlen 0) (component ALL-COMPONENTS) (eig-kpoint k-point) (eig-band 1) (eig-match-freq? true) (eig-parity src-parity) (eig-lattice-size lattice-x lattice-y 0) (eig-lattice-center 0 0 (/ (- Hwg lattice-z) 2)) ) )) (if (= src-cmpt Ex) (set! symmetries (list (make mirror-sym (direction X) (phase -1)) ))) (if (= src-cmpt Ey) (set! symmetries (list (make mirror-sym (direction X) (phase 1)) ))) ; We also want to add a flux near the source (define transmission (add-flux fcen df nfreq (make flux-region (center 0 0 (- (* 4 length-err) (/ length-z 2))) (size length-x length-y 0) ))) ;; run the simulation (define-param t0 (/ 5 df)) (run-sources+ (stop-when-fields-decayed 50 src-cmpt (vector3 0 0) 1e-8) (at-beginning output-epsilon) (if (= src-cmpt Ey) (at-time t0 output-efield-y) (at-time t0 output-efield-x)) ) ; output the field at the time of the peak of gaussian pulse (display-fluxes transmission) ; After simulation, use grep farfield: *.out > *.txt to extract farfield data into file *.txt ------------------------------------------------------- ctl file for the infinite waveguide simulation: (reset-meep) (set-param! resolution 50) ;resolution is a pre-defined parameter representing the resolution of simulation (define-param dpml 0.4) (define-param resol 50) (define-param acone 0.2) (define-param bcone 0.6) (define-param eps_cone 12) (define-param length-err (/ 1 resol)) (define-param length-x 3) (define-param length-y 3) (define-param length-z (* 6 length-err)) (define-param lattice-x (+ length-x (* 2 dpml))) (define-param lattice-z (+ length-z (* 2 dpml))) (define-param lattice-y (+ length-y (* 2 dpml))) (set! geometry-lattice (make lattice (size lattice-x lattice-y lattice-z))) (set! pml-layers (list (make pml (thickness dpml)))) ; parameters related to source (define-param wvlen 2) (define-param fcen (/ 1 wvlen)) ; wavelength 2um (define-param df 0.05) ;delta_f of the gaussian beam, half width (define-param src-cmpt Ey) ;source component, We still need it anyway! (define-param src-parity ODD-Y) ;TM (define-param nfreq 11) ; number of frequencies to compute farfield (define-param neff 1.9) ;effective refractive index of waveguide mode (define-param wvg-ky (* neff (/ 1 wvlen))) ;define the k-point of the guided mode in unit of 2*pi/a (set! k-point (vector3 0 0 wvg-ky)) (define list1 (list (make block (center 0 0 0) ; center of block (size acone bcone lattice-z) (material (make dielectric (epsilon eps_cone)))))) (set! geometry list1) (set! force-complex-fields? false) ; define the source (set! sources (list (make eigenmode-source (src (make gaussian-src (frequency fcen) (fwidth df))) ;(component src-cmpt) is comment, as the mode source contains J and M in all directions (center 0 0 (- 0 length-err)) (size wvlen wvlen 0) (component ALL-COMPONENTS) (eig-kpoint k-point) (eig-match-freq? true) (eig-parity src-parity) (eig-lattice-size lattice-x lattice-y 0) (eig-lattice-center 0 0 (- 0 length-err)) ) )) (if (= src-cmpt Ex) (set! symmetries (list (make mirror-sym (direction X) (phase -1)) ))) (if (= src-cmpt Ey) (set! symmetries (list (make mirror-sym (direction X) (phase 1)) ))) ; We also want to add a flux near the source (define transmission (add-flux fcen df nfreq (make flux-region (center 0 0 length-err) (size length-x length-y 0) ))) ;; run the simulation (define-param t0 (/ 5 df)) (run-sources+ (stop-when-fields-decayed 50 src-cmpt (vector3 0 0) 1e-8) (at-beginning output-epsilon) (if (= src-cmpt Ey) (at-time t0 output-efield-y) (at-time t0 output-efield-x)) (if (= src-cmpt Ey) (at-time (+ t0 0.5) output-efield-y) (at-time (+ t0 0.5) output-efield-x)) ) ; output the field at the time of the peak of gaussian pulse (display-fluxes transmission) ; After simulation, use grep flux1: *.out > *.txt to extract flux data into file *.txt --------------------------------------------------- Here are some of the outputs of MEEP: Output of the semi-infinite waveguide simulation: Using MPI version 3.0, 12 processes ----------- Initializing structure... Working in 3D dimensions. Computational cell is 3.8 x 3.8 x 2.8 with resolution 50 block, center = (0,0,-0.7) size (0.2,0.6,1.4) axes (1,0,0), (0,1,0), (0,0,1) dielectric constant epsilon diagonal = (12,12,12) Halving computational cell along direction x time for set_epsilon = 0.516129 s ----------- Meep: using complex fields. KPOINT: 0, 0, 0.95 near maximum in trace linmin: converged after 7 iterations. iteration 1: trace = 5.115624310137203 (198.778% change) linmin: converged after 9 iterations. iteration 2: trace = 1.301462483253573 (118.875% change) linmin: converged after 6 iterations. iteration 3: trace = 1.251212625843106 (3.93704% change) linmin: converged after 9 iterations. iteration 4: trace = 1.228494236027998 (1.83234% change) linmin: converged after 6 iterations. iteration 5: trace = 1.216128224414988 (1.01169% change) linmin: converged after 6 iterations. iteration 6: trace = 1.215825449143953 (0.0248998% change) linmin: converged after 6 iterations. iteration 7: trace = 1.215617748892674 (0.0170845% change) linmin: converged after 12 iterations. iteration 8: trace = 1.213850491414006 (0.145485% change) linmin: converged after 6 iterations. iteration 9: trace = 1.213796991469279 (0.00440755% change) linmin: converged after 6 iterations. iteration 10: trace = 1.213735308386204 (0.00508196% change) linmin: converged after 6 iterations. iteration 11: trace = 1.213661191327328 (0.00610671% change) linmin: converged after 6 iterations. iteration 12: trace = 1.213565335735766 (0.00789836% change) linmin: converged after 6 iterations. iteration 13: trace = 1.213419219406641 (0.012041% change) linmin: converged after 10 iterations. iteration 14: trace = 1.212962113896583 (0.037678% change) linmin: converged after 6 iterations. iteration 15: trace = 1.212690343386805 (0.022408% change) linmin: converged after 7 iterations. iteration 16: trace = 1.212341368325867 (0.0287811% change) linmin: converged after 6 iterations. iteration 17: trace = 1.212088318617335 (0.020875% change) linmin: converged after 3 iterations. iteration 18: trace = 1.212085791843462 (0.000208465% change) linmin: converged after 3 iterations. iteration 19: trace = 1.212085741540342 (4.15013e-06% change) meep: Newton solver not converging -- need a better starting kpoint -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 3 in communicator MPI_COMM_WORLD with errorcode 1. ———————————————— Output of the infinite waveguide simulation: Using MPI version 3.0, 4 processes ----------- Initializing structure... Working in 3D dimensions. Computational cell is 3.8 x 3.8 x 0.92 with resolution 50 block, center = (0,0,0) size (0.2,0.6,0.92) axes (1,0,0), (0,1,0), (0,0,1) dielectric constant epsilon diagonal = (12,12,12) Halving computational cell along direction x time for set_epsilon = 0.649085 s ----------- Meep: using complex fields. KPOINT: 0, 0, 0.95 near maximum in trace linmin: converged after 7 iterations. iteration 1: trace = 3.874134575398054 (199.073% change) linmin: converged after 9 iterations. iteration 2: trace = 0.3371600882791002 (167.976% change) linmin: converged after 4 iterations. iteration 3: trace = 0.2725431147299467 (21.1962% change) linmin: converged after 4 iterations. iteration 4: trace = 0.260946907469141 (4.3473% change) linmin: converged after 3 iterations. iteration 5: trace = 0.2598623400796542 (0.416493% change) linmin: converged after 3 iterations. iteration 6: trace = 0.2596493636959499 (0.081991% change) linmin: converged after 2 iterations. iteration 7: trace = 0.2596191376889248 (0.0116418% change) linmin: converged after 3 iterations. iteration 8: trace = 0.2596124392241173 (0.00258015% change) linmin: converged after 3 iterations. iteration 9: trace = 0.2596112791941831 (0.000446832% change) linmin: converged after 2 iterations. iteration 10: trace = 0.2596111905348572 (3.41508e-05% change) linmin: converged after 2 iterations. iteration 11: trace = 0.2596111700800143 (7.87903e-06% change) MPB solved for omega_1(0,0,0.95) = 0.509521 after 11 iters Newton step: group velocity v=0.225609, kscale=0.95558 linmin: converged after 3 iterations. iteration 1: trace = 0.250141844008388 (0.139838% change) linmin: converged after 2 iterations. iteration 2: trace = 0.2500453459669771 (0.0385848% change) linmin: converged after 2 iterations. iteration 3: trace = 0.2500400248923117 (0.00212807% change) linmin: converged after 2 iterations. iteration 4: trace = 0.250039253977889 (0.000308317% change) linmin: converged after 2 iterations. iteration 5: trace = 0.2500391834832076 (2.81934e-05% change) linmin: converged after 2 iterations. iteration 6: trace = 0.2500391738551966 (3.8506e-06% change) MPB solved for omega_1(0,0,0.907801) = 0.500039 after 6 iters Newton step: group velocity v=0.223761, kscale=0.955395 linmin: converged after 2 iterations. iteration 1: trace = 0.2500000009975931 (3.11255e-06% change) MPB solved for omega_1(0,0,0.907626) = 0.5 after 1 iters Newton step: group velocity v=0.223728, kscale=0.955395 creating output file "./wg_3D_modesrc_meep_Si_Ey_kz-eps-000000.00.h5"... on time step 17 (time=0.17), 0.236012 s/step … Thank you so much. Best wishes, Zhexin _______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss