From dfd1f63bc464b6a63bc478a9f2b0550586e22b14 Mon Sep 17 00:00:00 2001 From: Niko Savola Date: Thu, 24 Mar 2022 15:32:35 +0200 Subject: [PATCH] Add dissipative elements as arguments to `ProjectInfo` (#103) --- README.md | 6 ++++-- .../Tutorial 1. Startup example.ipynb | 16 +++++++++++++++- docs/source/examples_quick.rst | 6 ++++-- pyEPR/core_distributed_analysis.py | 2 +- pyEPR/project_info.py | 15 ++++++++++++++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 04200c5..f3c55b0 100644 --- a/README.md +++ b/README.md @@ -104,14 +104,16 @@ pinfo.junctions['jBob'] = {'Lj_variable':'Lj_bob', 'rect':'rect_bob', 'lin pinfo.validate_junction_info() # Check that valid names of variables and objects have been supplied. # 2b. Dissipative elements: specify -pinfo.dissipative['dielectrics_bulk'] = ['si_substrate', 'dielectic_object2'] # supply names of hfss objects +pinfo.dissipative['dielectrics_bulk'] = ['si_substrate', 'dielectric_object2'] # supply names of hfss objects pinfo.dissipative['dielectric_surfaces'] = ['interface1', 'interface2'] +# Alternatively, these could be specified in ProjectInfo with +# pinfo = epr.ProjectInfo(..., dielectrics_bulk = ['si_substrate', 'dielectric_object2']) # 3. Perform microwave analysis on eigenmode solutions eprd = epr.DistributedAnalysis(pinfo) if 1: # automatic reports eprd.quick_plot_frequencies(swp_var) # plot the solved frequencies before the analysis - eprd.hfss_report_full_convergence() # report convergen + eprd.hfss_report_full_convergence() # report convergence eprd.do_EPR_analysis() # 4a. Perform Hamiltonian spectrum post-analysis, building on mw solutions using EPR diff --git a/_tutorial_notebooks/Tutorial 1. Startup example.ipynb b/_tutorial_notebooks/Tutorial 1. Startup example.ipynb index 13d7edb..9eb7129 100644 --- a/_tutorial_notebooks/Tutorial 1. Startup example.ipynb +++ b/_tutorial_notebooks/Tutorial 1. Startup example.ipynb @@ -867,7 +867,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The Q is infinite, since we have not included dissipation yet in this example. The row index is the mode number" + "The Q is infinite, since we have not included dissipation yet in this example. The row index is the mode number. Dissipation can be modelled by selecting the corresponding HFSS objects for solids, sheets, and seams when initialising `ProjectInfo`. For example,\n", + "```python\n", + "pinfo = epr.ProjectInfo(project_path = path_to_project, \n", + " project_name = 'pyEPR_tutorial1',\n", + " design_name = '1. single_transmon',\n", + " dielectrics_bulk = ['si_substrate'],\n", + " dielectric_surfaces = ['interface'],\n", + " resistive_surfaces = None,\n", + " seams = None)\n", + "```\n", + "or after the fact with\n", + "```python\n", + "pinfo.dissipative['dielectrics_bulk'] = ['si_substrate']\n", + "pinfo.dissipative['dielectric_surfaces'] = ['interface']\n", + "```" ] }, { diff --git a/docs/source/examples_quick.rst b/docs/source/examples_quick.rst index 9a8a009..8ed75b5 100644 --- a/docs/source/examples_quick.rst +++ b/docs/source/examples_quick.rst @@ -29,14 +29,16 @@ succinctly plotted. pinfo.validate_junction_info() # Check that valid names of variables and objects have been supplied. # 2b. Dissipative elements: specify - pinfo.dissipative['dielectrics_bulk'] = ['si_substrate', 'dielectic_object2'] # supply names of hfss objects + pinfo.dissipative['dielectrics_bulk'] = ['si_substrate', 'dielectric_object2'] # supply names of hfss objects pinfo.dissipative['dielectric_surfaces'] = ['interface1', 'interface2'] + # Alternatively, these could be specified in ProjectInfo with + # pinfo = epr.ProjectInfo(..., dielectrics_bulk = ['si_substrate', 'dielectric_object2']) # 3. Perform microwave analysis on eigenmode solutions eprd = epr.DistributedAnalysis(pinfo) swp_var = 'Lj_alice' # Sweep variable from optimetric analysis that should be used on the x axis for the frequency plot eprd.quick_plot_frequencies(swp_var) # plot the solved frequencies before the analysis - eprd.hfss_report_full_convergence() # report convergen + eprd.hfss_report_full_convergence() # report convergence eprd.do_EPR_analysis() # 4a. Perform Hamiltonian spectrum post-analysis, building on mw solutions using EPR diff --git a/pyEPR/core_distributed_analysis.py b/pyEPR/core_distributed_analysis.py index a257dec..c6f44d3 100644 --- a/pyEPR/core_distributed_analysis.py +++ b/pyEPR/core_distributed_analysis.py @@ -70,7 +70,7 @@ def __init__(self, *args, **kwargs): Use notes: ------------------- - * If you change the setup or number of eignemodes in HFSS, etc. + * If you change the setup or number of eigenmodes in HFSS, etc. call `update_ansys_info()` diff --git a/pyEPR/project_info.py b/pyEPR/project_info.py index f916ec0..5246914 100644 --- a/pyEPR/project_info.py +++ b/pyEPR/project_info.py @@ -165,6 +165,10 @@ def __init__(self, project_name: str = None, design_name: str = None, setup_name: str = None, + dielectrics_bulk: list[str] = None, + dielectric_surfaces: list[str] = None, + resistive_surfaces: list[str] = None, + seams: list[str] = None, do_connect: bool = True): """ Keyword Arguments: @@ -179,7 +183,14 @@ def __init__(self, Defaults to ``None``, which will get the current active one. setup_name (str) : Name of the setup within the design. Defaults to ``None``, which will get the current active one. - + dielectrics_bulk (list(str)) : List of names of dielectric bulk objects. + Defaults to ``None``. + dielectric_surfaces (list(str)) : List of names of dielectric surfaces. + Defaults to ``None``. + resistive_surfaces (list(str)) : List of names of resistive surfaces. + Defaults to ``None``. + seams (list(str)) : List of names of seams. + Defaults to ``None``. do_connect (bool) [additional]: Do create connection to Ansys or not? Defaults to ``True``. """ @@ -198,6 +209,8 @@ def __init__(self, # Dissipative HFSS volumes and surfaces self.dissipative = self._Dissipative() + for opt in diss_opt: + self.dissipative[opt] = locals()[opt] self.options = config.ansys # Connected to HFSS variable