Open shanto268 opened 3 hours ago
I was following the running eigenmodal sim documentation that y'all have using the following toy code - A CPW resonator connected to a port.
import numpy as np
from collections import OrderedDict
from qiskit_metal import designs, draw
from qiskit_metal import MetalGUI, Dict, Headings
from qiskit_metal.qlibrary.tlines.meandered import RouteMeander
from qiskit_metal.qlibrary.tlines.straight_path import RouteStraight
from qiskit_metal.qlibrary.terminations.launchpad_wb import LaunchpadWirebond
from qiskit_metal.qlibrary.terminations.launchpad_wb_coupled import LaunchpadWirebondCoupled
from qiskit_metal.qlibrary.terminations.short_to_ground import ShortToGround
from qiskit_metal.qlibrary.terminations.open_to_ground import OpenToGround
short_to_ground = False
print(design.variables['cpw_width'])
print(design.variables['cpw_gap'])
design._chips['main']['size']['size_x'] = '8mm'
design._chips['main']['size']['size_y'] = '5mm'
# we also set metal thickness to 0
print(design.ls.ls_df)
design.ls.ls_df.loc[0, 'thickness'] = '0 um' # top PEC layer has no thickess (2D sim)
print(design.ls.ls_df)
# instantiate wirebond pad
wb_fd_1 = LaunchpadWirebond(design, 'wb_fd_1', options = dict(pos_x='-2mm', pos_y='0mm', orientation='0', layer=1, chip="main"))
# instantiate OTGs instead, a little smaller
otg_2 = OpenToGround(design, 'otg-2', options = dict(pos_x = '2mm', orientation='0'))
# instantiate meander resonator
meander_opts = dict(
pin_inputs = dict(
start_pin = dict(component = "wb_fd_1", pin = "tie"),
# end_pin = dict(component = "wb_fd_2", pin = "tie")
#start_pin = dict(component = "otg-1", pin = "open"),
end_pin = dict(component = "otg-2", pin = "open")
),
lead = dict(
start_straight = "500um",
),
total_length = '30mm',
fillet = "99.99um",
asymmetry = "100um",
chip="main",
layer=1
)
resonator = RouteMeander(design, 'res_1', meander_opts)
# check to see the build
gui.rebuild()
gui.autoscale()
# connect to SQDMetal
from SQDMetal.PALACE.Eigenmode_Simulation import PALACE_Eigenmode_Simulation
from SQDMetal.PALACE.SQDGmshRenderer import Palace_Gmsh_Renderer
#Eigenmode Simulation Options
user_defined_options = {
"mesh_refinement": 0, #refines mesh in PALACE - essetially divides every mesh element in half
"dielectric_material": "silicon", #choose dielectric material - 'silicon' or 'sapphire'
"starting_freq": 7.5, #starting frequency in GHz
"number_of_freqs": 4, #number of eigenmodes to find
"solns_to_save": 4, #number of electromagnetic field visualizations to save
"solver_order": 2, #increasing solver order increases accuracy of simulation, but significantly increases sim time
"solver_tol": 1.0e-8, #error residual tolerance foriterative solver
"solver_maxits": 100, #number of solver iterations
"comsol_meshing": "Extremely fine", #level of COMSOL meshing: 'Extremely fine', 'Extra fine', 'Finer', 'Fine', 'Normal'
"mesh_max": 120e-3, #maxiumum element size for the mesh in mm
"mesh_min": 10e-3, #minimum element size for the mesh in mm
"mesh_sampling": 130, #number of points to mesh along a geometry
"sim_memory": '300G', #amount of memory for each HPC node i.e. 4 nodes x 300 GB = 1.2 TB
"sim_time": '20:00:00', #allocated time for simulation
"HPC_nodes": '4', #number of Bunya nodes. By default 20 cpus per node are selected, then total cores = 20 x HPC_nodes
"fillet_resolution":12 #Number of vertices per quarter turn on a filleted path
}
#Creat the Palace Eigenmode simulation
eigen_sim = PALACE_Eigenmode_Simulation(name ='single_resonator_example_eigen', #name of simulation
metal_design = design, #feed in qiskit metal design
sim_parent_directory = "test", #choose directory where mesh file, config file and HPC batch file will be saved
mode = 'simPC', #choose simulation mode 'HPC' or 'simPC'
meshing = 'GMSH', #choose meshing 'GMSH' or 'COMSOL'
user_options = user_defined_options, #provide options chosen above
view_design_gmsh_gui = False, #view design in GMSH gui
create_files = True)
eigen_sim.add_metallic(1)
eigen_sim.add_ground_plane()
eigen_sim.create_port_CPW_on_Launcher('wb_fd_1', 20e-3)
eigen_sim.fine_mesh_along_path(100e-6, 'res_1', mesh_sampling=130, mesh_min=5e-3, mesh_max=120e-3)
eigen_sim.prepare_simulation()
I get the following error at the eigen_sim.prepare_simulation()
command.
{
"name": "NameError",
"message": "name 'options' is not defined",
"stack": "---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[17], line 1
----> 1 eigen_sim.prepare_simulation()
File ~/LFL/SQDMetal/SQDMetal/PALACE/Model.py:36, in PALACE_Model.prepare_simulation(self)
35 def prepare_simulation(self):
---> 36 self._prepare_simulation(self._metallic_layers, self._ground_plane)
File ~/LFL/SQDMetal/SQDMetal/PALACE/Model.py:249, in PALACE_Model_RF_Base._prepare_simulation(self, metallic_layers, ground_plane)
246 lePorts += [(cur_port['port_name'] + 'b', cur_port['portBcoords'])]
248 #prepare design by converting shapely geometries to Gmsh geometries
--> 249 gmsh_render_attrs = pgr._prepare_design(metallic_layers, ground_plane, lePorts, options['fillet_resolution'], 'eigenmode_simulation')
251 if self.create_files == True:
252 #create directory to store simulation files
253 self._create_directory(self.name)
NameError: name 'options' is not defined"
}
I am not sure what is causing this and how I can fix this.... I do have a working executable of palace
and I am sure I have to let SQDMetal
know about this but I am not sure where to pass on that information....
Hi all,
First off, great work on the project! I was wondering if you could upload an example file that demonstrates how to use SQDMetal to design and run simulations in Palace on a local PC?
Specifically, Iām looking for examples like running an eigenmodal simulation of a half-wave resonator or calculating the capacitance matrix of a floating transmon qubit using Palace. Or really just any complete design to simulation flow....
Some more complete tutorial/example files would be really appreciated! šš½
Thanks for all your hard work.
Best, Shanto