-
-
July 8, 2021 at 10:04 amzhenjiehanSubscriber
Hi,
Does this code only set X boundary condition to PML, while not modifying original y boundary condition?
lumapi.evalScript(_globals.FDTD, " set('name','%s'); set('direction', '%s'); set('number of field profile samples', %s); updateportmodes(%s); select('FDTD'); set('%s','PML'); ?'Added pin: %s, set %s to PML'; " % (p.pin_name, p.direction, FDTD_settings['frequency_points_expansion'], mode_selection_index, port_dict[p.rotation], p.pin_name, port_dict[p.rotation] ) )
I am confused with it. Who know this?
Thank you in advance!
July 14, 2021 at 5:32 pmTaylor RobertsonAnsys EmployeeHello Zhenjiehan
This seems to be a python issue and not a Lumerical issue. The evalScript will simply evaluate the string as lsf code. You are passing this string %s repeatedly? Since you have not define s here I cannot say exactly what this doing. The question seems to be what is the command?
select('FDTD'); set('%s','PML');
To update all the BC you should call set for set each boundary x, y, z.
select('FDTD'); set('x min bc','PML');set('x max bc','PML');set('y min bc','PML');set('y max bc','PML'); ...
A more efficient way of doing this may be to do this may be to pass a struct (LSF) or dictionary (python). When using the API I think it is best practice to use the python methods rather then evaluating long strings as LSF code. There should be a 1-1 correspondence between lumapi methods and lsf commands. The following is how I would set all BC to PML in FDTD.
PML = 'PML'
bc_dict = {"x min bc" : PML, "x max bc" : PML, "y min bc" : PML , "y max bc" : PML, "z min bc" : PML, "z max bc", PML}
fdtd.setnamed("FDTD",bc_dict)
I hope this helps. I think reading up on string formatting, and dictionary datatypes would also be valuable.
BestJuly 16, 2021 at 6:12 amzhenjiehanSubscriberHi,@troberts Thank you very much. There are sentences before this script.
Their architecture is showed as followed:
lumapi.evalScript(_globals.FDTD, " \
newproject; closeall; \
addfdtd; set('x min',%s); set('x max',%s); set('y min',%s); set('y max',%s); set('z span',%s);\
set('force symmetric z mesh', 1); set('mesh accuracy',1); \
set('x min bc','Metal'); set('x max bc','Metal'); \
set('y min bc','Metal'); set('y max bc','Metal'); \
set('z min bc','%s'); set('z max bc','%s'); \
setglobalsource('wavelength start',%s); setglobalsource('wavelength stop', %s); \
setglobalmonitor('frequency points',%s); set('simulation time', %s/c+1500e-15); \
addmesh; set('override x mesh',0); set('override y mesh',0); set('override z mesh',1); set('z span', 0); set('dz', %s); set('z', %s); \
?'FDTD solver with mesh override added'; " % ( FDTDxmin,FDTDxmax,FDTDymin,FDTDymax,FDTDzspan, \
Z_symmetry, FDTD_settings['Initial_Z-Boundary-Conditions'], \
wavelength_start,wavelength_stop, \
FDTD_settings['frequency_points_monitor'], sim_time, \
FDTD_settings['thickness_Si']/4, FDTD_settings['thickness_Si']/2) )
........
lumapi.evalScript(_globals.FDTD, " \
set('name','%s'); set('direction', '%s'); set('number of field profile samples', %s); updateportmodes(%s); \
select('FDTD'); set('%s','PML'); \
?'Added pin: %s, set %s to PML'; " % (p.pin_name, p.direction, FDTD_settings['frequency_points_expansion'], mode_selection_index, \
port_dict[p.rotation], p.pin_name, port_dict[p.rotation] ) )
Finally, y boundary condition is Metal, so I have the question in title.
So´╝îdoes this mean I am passing this string%srepeatedly?
Beside, thank you for the methods you mentioned, I will use the method when I need it.
July 21, 2021 at 4:37 pmTaylor RobertsonAnsys EmployeeHello It seems to me that the string s is being passed repeatedly. I would look into what this variable is defined as to understand what is going on here.
Best RegardsJuly 30, 2021 at 6:37 amAugust 9, 2021 at 6:41 pmTaylor RobertsonAnsys Employee
You haven't defined s here, so I cannot comment on this case. Additionally we cannot necessarily debug your python code, but we are happy to answer questions on Lumerical solvers. I would suggest using the API calls instead of eval method, which will be easier to determine where the error may be.
Viewing 5 reply threads- The topic ‘Does this only set x boudary condition to PML?’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Difference between answers in version 2024 and 2017 lumerical mode solution
- Errors Running Ring Modulator Example on Cluster
- INTERCONNECT – No results unless rerun simulation until it gives any
- Import material .txt file with script
- Help for qINTERCONNECT
- Trapezoidal ring
- Issues with getting result from interconnent analysis script
- Topology Optimization Error
- Edge Coupler EME Example Issue
- How to measure transmission coefficients on a given plane .
Top Contributors-
1241
-
543
-
523
-
225
-
209
Top Rated Tags© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-