kqcircuits.simulations.export.ansys.ansys_export

kqcircuits.simulations.export.ansys.ansys_export.export_ansys_json(simulation: kqcircuits.simulations.simulation.Simulation, path: pathlib.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, mesh_size=None, simulation_flags=None, ansys_project_template=None, integrate_energies=False, hfss_capacitance_export=False)[source]

Export Ansys simulation into json and gds files.

Parameters
  • simulation – The simulation to be exported.

  • path – Location where to write json and gds files.

  • ansys_tool – Determines whether to use HFSS (‘hfss’) or Q3D Extractor (‘q3d’).

  • frequency_units – Units of frequency.

  • frequency – Frequency for mesh refinement. To set up multifrequency analysis in HFSS use list of numbers.

  • max_delta_s – Stopping criterion in HFSS simulation.

  • percent_error – Stopping criterion in Q3D simulation.

  • percent_refinement – Percentage of mesh refinement on each iteration.

  • maximum_passes – Maximum number of iterations in simulation.

  • minimum_passes – Minimum number of iterations in simulation.

  • minimum_converged_passes – Determines how many iterations have to meet the stopping criterion to stop simulation.

  • sweep_enabled – Determines if HFSS frequency sweep is enabled.

  • sweep_start – The lowest frequency in the sweep.

  • sweep_end – The highest frequency in the sweep.

  • sweep_count – Number of frequencies in the sweep.

  • 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’.

  • 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.

  • 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

  • hfss_capacitance_export – If True, the capacitance matrices are exported from HFSS simulations

Returns

Path to exported json file.

kqcircuits.simulations.export.ansys.ansys_export.export_ansys_bat(json_filenames, path: pathlib.Path, file_prefix='simulation', exit_after_run=False, execution_script='scripts/import_and_simulate.py', post_process=None, use_rel_path=True)[source]

Create a batch file for running one or more already exported simulations.

Parameters
  • json_filenames – List of paths to json files to be included into the batch.

  • path – Location where to write the bat file.

  • file_prefix – Name of the batch file to be created.

  • exit_after_run – Defines if the Ansys Electronics Desktop is automatically closed after running the script.

  • execution_script – The script file to be executed.

  • post_process – List of PostProcess objects, a single PostProcess object, or None to be executed after simulations

  • use_rel_path – Determines if to use relative paths.

Returns

Path to exported bat file.

kqcircuits.simulations.export.ansys.ansys_export.export_ansys(simulations, path: pathlib.Path, ansys_tool='hfss', script_folder='scripts', file_prefix='simulation', 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, mesh_size=None, exit_after_run=False, import_script='import_and_simulate.py', post_process=None, use_rel_path=True, simulation_flags=None, ansys_project_template=None, integrate_energies=False, hfss_capacitance_export=False, skip_errors=False)[source]

Export Ansys simulations by writing necessary scripts and json, gds, and bat files.

Parameters
  • simulations – List of simulations to be exported.

  • path – Location where to write export files.

  • ansys_tool – Determines whether to use HFSS (‘hfss’), Q3D Extractor (‘q3d’) or HFSS eigenmode (‘eigenmode’).

  • script_folder – Path to the Ansys-scripts folder.

  • file_prefix – Name of the batch file to be created.

  • frequency_units – Units of frequency.

  • frequency – Frequency for mesh refinement. To set up multifrequency analysis in HFSS use list of numbers.

  • max_delta_s – Stopping criterion in HFSS simulation.

  • percent_error – Stopping criterion in Q3D simulation.

  • percent_refinement – Percentage of mesh refinement on each iteration.

  • maximum_passes – Maximum number of iterations in simulation.

  • minimum_passes – Minimum number of iterations in simulation.

  • minimum_converged_passes – Determines how many iterations have to meet the stopping criterion to stop simulation.

  • sweep_enabled – Determines if HFSS frequency sweep is enabled.

  • sweep_start – The lowest frequency in the sweep.

  • sweep_end – The highest frequency in the sweep.

  • sweep_count – Number of frequencies in the sweep.

  • 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’.

  • 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.

  • exit_after_run – Defines if the Ansys Electronics Desktop is automatically closed after running the script.

  • import_script – Name of import script file.

  • post_process – List of PostProcess objects, a single PostProcess object, or None to be executed after simulations

  • 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

  • hfss_capacitance_export – If True, the capacitance matrices are exported from HFSS simulations

  • skip_errors

    Skip simulations that cause errors. Default is False.

    Warning

    Use this carefully, some of your simulations might not make sense physically and you might end up wasting time on bad simulations.

Returns

Path to exported bat file.

../_images/kqcircuits.simulations.export.ansys.ansys_export.png