Skip to content

Commit

Permalink
Metal edge region, epr integration, and manual refinement
Browse files Browse the repository at this point in the history
Enable metal edge region to divide substrate, vacuum and TLS
layers into smaller pieces next to metal edge. Dimensions of metal
edge region are set by parameter `metal_edge_region_dimensions`.

Improve TLS layers in simulation class. Now, these can be modelled
as sheet layers, non-model layers, or material layers. TLS layers
work with sheet or thick metal layers and with vertical over
etching, but not with multilayer stack-up feature.

Add in-house energy integration to Ansys export. This is now more
straight-forward compared to pyEPR method. The energy integration
is enabled by setting the export parameter
`'integrate_energies': True` and the post-processing to calculate
participation ratios is enable by setting
`'post_process_script': 'export_epr.py'`.

Add `mesh_size` feature to Ansys simulations to enable manual
refinement on any layer.

Remove parameter `gap_max_element_length`, because `mesh_size` has
the same functionality.

Fix simulation scripts that are affected by the changes. This
includes removal of `gap_max_element_length` and refactoring of
`participation_sheet_distance` and `participation_sheet_thickness`
parameters.

Create simulation script `TLS_waveguide_sim.py` to demonstrate the
new features.

Fix `t1_estimate.py` to work without need to unite the TLS layers.
  • Loading branch information
jukkarabina committed Oct 10, 2023
1 parent 8b62e04 commit 1e3a1fc
Show file tree
Hide file tree
Showing 11 changed files with 413 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ def export_ansys_json(simulation: Simulation, path: Path, ansys_tool='hfss',
frequency_units="GHz", frequency=5, max_delta_s=0.1, percent_error=1, percent_refinement=30,
maximum_passes=12, minimum_passes=1, minimum_converged_passes=1,
sweep_enabled=True, sweep_start=0, sweep_end=10, sweep_count=101, sweep_type='interpolating',
max_delta_f=0.1, n_modes=2, gap_max_element_length=None, substrate_loss_tangent=0,
dielectric_surfaces=None, simulation_flags=None, ansys_project_template=None):
max_delta_f=0.1, n_modes=2, mesh_size=None, substrate_loss_tangent=0,
dielectric_surfaces=None, simulation_flags=None, ansys_project_template=None,
integrate_energies=False):
r"""
Export Ansys simulation into json and gds files.
Expand All @@ -72,8 +73,8 @@ def export_ansys_json(simulation: Simulation, path: Path, ansys_tool='hfss',
sweep_type: choices are "interpolating", "discrete" or "fast"
max_delta_f: Maximum allowed relative difference in eigenfrequency (%). Used when ``ansys_tool`` is *eigenmode*.
n_modes: Number of eigenmodes to solve. Used when ``ansys_tool`` is 'pyepr'.
gap_max_element_length: Largest mesh element length allowed in the gaps given in simulation units
(if None is given, then the mesh element size is not restricted in the gap).
mesh_size(dict): Dictionary to determine manual mesh refinement on layers. Set key as the layer name and
value as the maximal mesh element length inside the layer.
substrate_loss_tangent: Bulk loss tangent (:math:`\tan{\delta}`) material parameter. 0 is off.
dielectric_surfaces: Material parameters for TLS interfaces, used in post-processing field calculations
from the participation sheets. Default is None. Input is of the form::
Expand All @@ -95,6 +96,7 @@ def export_ansys_json(simulation: Simulation, path: Path, ansys_tool='hfss',
},
simulation_flags: Optional export processing, given as list of strings
ansys_project_template: path to the simulation template
integrate_energies: Calculate energy integrals over each layer and save them into a file
Returns:
Path to exported json file.
Expand Down Expand Up @@ -125,10 +127,11 @@ def export_ansys_json(simulation: Simulation, path: Path, ansys_tool='hfss',
'max_delta_f': max_delta_f,
'n_modes': n_modes,
},
'gap_max_element_length': gap_max_element_length,
'mesh_size': {} if mesh_size is None else mesh_size,
'substrate_loss_tangent': substrate_loss_tangent,
'dielectric_surfaces': dielectric_surfaces,
'simulation_flags': simulation_flags
'simulation_flags': simulation_flags,
'integrate_energies': integrate_energies
}

if ansys_project_template is not None:
Expand Down Expand Up @@ -229,12 +232,12 @@ def export_ansys(simulations, path: Path, ansys_tool='hfss', import_script_folde
frequency_units="GHz", frequency=5, max_delta_s=0.1, percent_error=1, percent_refinement=30,
maximum_passes=12, minimum_passes=1, minimum_converged_passes=1,
sweep_enabled=True, sweep_start=0, sweep_end=10, sweep_count=101, sweep_type='interpolating',
max_delta_f=0.1, n_modes=2, gap_max_element_length=None, substrate_loss_tangent=0,
max_delta_f=0.1, n_modes=2, mesh_size=None, substrate_loss_tangent=0,
dielectric_surfaces=None, exit_after_run=False,
ansys_executable=r"%PROGRAMFILES%\AnsysEM\v232\Win64\ansysedt.exe",
import_script='import_and_simulate.py', post_process_script='export_batch_results.py',
intermediate_processing_command=None, use_rel_path=True, simulation_flags=None,
ansys_project_template=None, skip_errors=False):
ansys_project_template=None, integrate_energies=False, skip_errors=False):
r"""
Export Ansys simulations by writing necessary scripts and json, gds, and bat files.
Expand All @@ -259,8 +262,8 @@ def export_ansys(simulations, path: Path, ansys_tool='hfss', import_script_folde
sweep_type: choices are "interpolating", "discrete" or "fast"
max_delta_f: Maximum allowed relative difference in eigenfrequency (%). Used when ``ansys_tool`` is *eigenmode*.
n_modes: Number of eigenmodes to solve. Used when ``ansys_tool`` is 'eigenmode'.
gap_max_element_length: Largest mesh element length allowed in the gaps given in simulation units
(if None is given, then the mesh element size is not restricted in the gap).
mesh_size(dict): Dictionary to determine manual mesh refinement on layers. Set key as the layer name and
value as the maximal mesh element length inside the layer.
substrate_loss_tangent: Bulk loss tangent (:math:`\tan{\delta}`) material parameter. 0 is off.
dielectric_surfaces: Material parameters for TLS interfaces, used in post-processing field calculations
from the participation sheets. Default is None. Input is of the form::
Expand Down Expand Up @@ -294,6 +297,7 @@ def export_ansys(simulations, path: Path, ansys_tool='hfss', import_script_folde
use_rel_path: Determines if to use relative paths.
simulation_flags: Optional export processing, given as list of strings. See Simulation Export in docs.
ansys_project_template: path to the simulation template
integrate_energies: Calculate energy integrals over each layer and save them into a file
skip_errors: Skip simulations that cause errors. Default is False.
.. warning::
Expand All @@ -318,11 +322,12 @@ def export_ansys(simulations, path: Path, ansys_tool='hfss', import_script_folde
sweep_enabled=sweep_enabled, sweep_start=sweep_start,
sweep_end=sweep_end, sweep_count=sweep_count, sweep_type=sweep_type,
max_delta_f=max_delta_f, n_modes=n_modes,
gap_max_element_length=gap_max_element_length,
mesh_size=mesh_size,
substrate_loss_tangent=substrate_loss_tangent,
dielectric_surfaces=dielectric_surfaces,
simulation_flags=simulation_flags,
ansys_project_template=ansys_project_template))
ansys_project_template=ansys_project_template,
integrate_energies=integrate_energies))
except (IndexError, ValueError, Exception) as e: # pylint: disable=broad-except
if skip_errors:
logging.warning(
Expand Down
Loading

0 comments on commit 1e3a1fc

Please sign in to comment.