Ansys Learning Forum › Forums › Discuss Simulation › Photonics › How to input material instead of permittivity in polygon python script › Reply To: How to input material instead of permittivity in polygon python script
October 26, 2021 at 11:43 pm
Taylor Robertson
Ansys Employee
Hello
I believe that if you refer to the y-branch example, it shows how to define a new material based on existing one through Python. See the setup script varFDTD_y_branch.py line 39-43.
##MATERIAL
opt_material=mode.addmaterial('Dielectric');
mode.setmaterial(opt_material,'name','Si:non-dispersive');
n_opt=mode.getindex('Si(Silicon)-Palik',c/lam_c);
mode.setmaterial('Si:non-dispersive','RefractiveIndex',n_opt);
In the optimization script you define the device and cladding material in the Polygon class.
#Setdeviceandcladdingmaterials,aswellasasdevicelayerthickness
eps_in=Material(name='Si:non-dispersive',mesh_order=2)
eps_out=Material(name='SiO2:non-dispersive',mesh_order=3)
depth=220.0e-9
#InitializeFunctionDefinedPolygonclass
polygon=FunctionDefinedPolygon(func=splitter,
initial_params=prev_results bounds=bounds z=0.0 depth=depth eps_out=eps_out,eps_in=eps_in edge_precision=5 dx=1.0e-9)
You could pass the name of a material already defined in the base FDTD file just make sure this string is exactly the same as the name in fdtd, and that it is an instance of Material. If you just want to pass the permittivity that should be fine as well.
eps_in = 3.4 **2
eps_out = 1.4 **2
I hope this helps.
I believe that if you refer to the y-branch example, it shows how to define a new material based on existing one through Python. See the setup script varFDTD_y_branch.py line 39-43.
##MATERIAL
opt_material=mode.addmaterial('Dielectric');
mode.setmaterial(opt_material,'name','Si:non-dispersive');
n_opt=mode.getindex('Si(Silicon)-Palik',c/lam_c);
mode.setmaterial('Si:non-dispersive','RefractiveIndex',n_opt);
In the optimization script you define the device and cladding material in the Polygon class.
#Setdeviceandcladdingmaterials,aswellasasdevicelayerthickness
eps_in=Material(name='Si:non-dispersive',mesh_order=2)
eps_out=Material(name='SiO2:non-dispersive',mesh_order=3)
depth=220.0e-9
#InitializeFunctionDefinedPolygonclass
polygon=FunctionDefinedPolygon(func=splitter,
initial_params=prev_results bounds=bounds z=0.0 depth=depth eps_out=eps_out,eps_in=eps_in edge_precision=5 dx=1.0e-9)
You could pass the name of a material already defined in the base FDTD file just make sure this string is exactly the same as the name in fdtd, and that it is an instance of Material. If you just want to pass the permittivity that should be fine as well.
eps_in = 3.4 **2
eps_out = 1.4 **2
I hope this helps.