Ansys Learning Forum Forums Discuss Simulation Photonics Simulation error in port source Reply To: Simulation error in port source

kai.w.ab
Subscriber

 

 

 

Thank you for your response.
Sorry for asking abstract questions without sending details.
The python script we used for the setup is as follows (I inserted 2d photonic crystals structure as holes in the part that imports the gds files)
 
import numpy as np
import lumapi
fdtd = lumapi.FDTD()
 
#—————set constant——————————————-
a=0.46e-6
b=a*1e6
nx=14
ny=100
G=11
 
#—————-set FDTD————————————————-
 
fdtd.addfdtd(dimension=”3D”, x = 0,x_span=4*b*nx*1e-6, y = 0, y_min=-20*b/0.5*1e-6, y_max=ny*b*1e-6 , z = 0.0, z_span=220e-9)
fdtdObj= fdtd.getObjectById(“::model::FDTD”)
fdtdObj.simulation_time=3000e-15
fdtdObj.simulation_temperature=300
fdtdObj.background_material=”
fdtdObj.index=1.0
fdtdObj.x_max_bc=”PML”
fdtdObj.x_min_bc=”PML”
fdtdObj.y_max_bc=”PML”
fdtdObj.y_min_bc=”PML”
fdtdObj.z_max_bc=”PML”
fdtdObj.z_min_bc=”Symmetric”
fdtdObj.same_settings_on_all_boundaries=False
 
#——————set mesh, movie monitor, Frequency-domain field and power monitor, SiSlab(rectangle)—————————
 
fdtd.addmesh(x = 0,x_span=4*b*nx*1e-6,  y_min=-20*b/0.5*1e-6, y_max=ny*b*1e-6 , z = 0.0, z_span=220e-9),
fdtd.addmovie(name=”movie_z0″,monitor_type=3,x = 0,x_span=4*b*nx*1e-6,y_min=-20*b/0.5*1e-6, y_max=ny*b*1e-6 , z = 0.0, lock_aspect_ratio=1, horizontal_resolution=240 ),
fdtd.addpower(name=”monitor_z2″,monitor_type=7,x=0,x_span=2*b*(G-1)*1e-6,
                y=b*(ny-18)*1e-6, y_span=24*b*1e-6, z=1450e-9)
r= fdtd.addrect(name=”SiSlab”, x = 0,x_span=4*b*nx*1e-6, y_min=-20*b/0.5*1e-6, y_max=ny*b*1e-6 , z = 0.0, z_span=220e-9)
r.material = “Si (Silicon) – Palik”
 
#——————–set port——————————————–
 
fdtd.addport(),
port1=fdtd.getObjectById(“::model::FDTD::ports::port 1”)
port1.x=0
port1.x_span=5*a/0.5
port1.y=-8*a/0.5
port1.z=0
port1.z_span=5*a/0.5
port1.direction=”Forward”
port1.amplitude=100
port1.phase=0
port1.mode_selection=”fundamental mode”
port1.number_of_field_profile_samples=1
port1.injection_axis=”y-axis”
 
# ————set global monitor————————
 
fdtd.setglobalmonitor(“use source limits”, False)
fdtd.setglobalmonitor(“minimum wavelength”, 1.25e-6)
fdtd.setglobalmonitor(“maximum wavelength”, 1.45e-6)
fdtd.setglobalmonitor(“frequency points”,41)
fdtd.setglobalmonitor(“use wavelength spacing”,True)
 
# ————–set global source————————-
 
fdtd.setglobalsource(“set wavelength”, True)
fdtd.setglobalsource(“wavelength start”, 1.25e-6)
fdtd.setglobalsource(“wavelength stop”, 1.45e-6)
fdtd.setglobalsource(“eliminate discontinuities”, True)
fdtd.setglobalsource(“optimize for short pulse”, True)
fdtd.setglobalsource(“eliminate dc” , False)
 
 
#——-import layer from gds files———————————–
 
layerlist_1=[0,10,20,30,35]
for layer in layerlist_1:
    fdtd.gdsimport(“gds file 1”, “cell name 1”, layer, “etch”, -110e-9, 110e-9) 
layerlist_p2=[41,42]
for layer in layerlist_2:
    fdtd.gdsimport(“gds file 2”, “cell name 2”, layer, “etch”, -110e-9, 110e-9)
 
 
 
fdtd.run()
 
 
 
 
 
 
The setup works fine, but when I run the simulation, nothing is recorded on the monitor.
Note that when I set up and ran the simulation manually, it worked fine. (a=0.5)  I tried to automate it with a python script to change the variable “a” ,but I am facing this problem.