kqcircuits.simulations.export.ansys.ansys_export¶
- kqcircuits.simulations.export.ansys.ansys_export.copy_ansys_scripts_to_directory(path: pathlib.Path, import_script_folder='scripts')[source]¶
Copies Ansys scripts into directory path.
- Parameters
path – Location where to copy scripts folder.
import_script_folder – Name of the folder in its new location.
- 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, gap_max_element_length=None, substrate_loss_tangent=0, dielectric_surfaces=None, simulation_flags=None, ansys_project_template=None)[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’.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).
substrate_loss_tangent – Bulk loss tangent (\(\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:
'layerMA': { # metal–vacuum 'tan_delta_surf': 0.001, # loss tangent 'th': 4e-9, # thickness 'eps_r': 10 # relative permittivity }, 'layerMS': { # metal–substrate 'tan_delta_surf': 0.001, 'th': 2e-9, 'eps_r': 10 }, 'layerSA': { # substrate–vacuum 'tan_delta_surf': 0.001, 'th': 2e-9, 'eps_r': 10 },
simulation_flags – Optional export processing, given as list of strings
ansys_project_template – path to the simulation template
- 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, ansys_executable='%PROGRAMFILES%\\AnsysEM\\v232\\Win64\\ansysedt.exe', import_script_folder='scripts', import_script='import_and_simulate.py', post_process_script='export_batch_results.py', intermediate_processing_command=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.
ansys_executable – Path to the Ansys Electronics Desktop executable.
import_script_folder – Path to the Ansys-scripts folder.
import_script – Name of import script file.
post_process_script – Name of post processing script file.
intermediate_processing_command –
Command for intermediate steps between simulations. Default is None, which doesn’t enable any processing. An example argument is
python scripts/script.py
, which runs in the .bat as:python scripts/script.py json_filename.json
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', import_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, gap_max_element_length=None, substrate_loss_tangent=0, dielectric_surfaces=None, exit_after_run=False, ansys_executable='%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)[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’).
import_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’.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).
substrate_loss_tangent – Bulk loss tangent (\(\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:
'layerMA': { # metal–vacuum 'tan_delta_surf': 0.001, # loss tangent 'th': 4e-9, # thickness 'eps_r': 10 # relative permittivity }, 'layerMS': { # metal–substrate 'tan_delta_surf': 0.001, 'th': 2e-9, 'eps_r': 10 }, 'layerSA': { # substrate–vacuum 'tan_delta_surf': 0.001, 'th': 2e-9, 'eps_r': 10 },
exit_after_run – Defines if the Ansys Electronics Desktop is automatically closed after running the script.
ansys_executable – Path to the Ansys Electronics Desktop executable.
import_script – Name of import script file.
post_process_script – Name of post processing script file.
intermediate_processing_command –
Command for intermediate steps between simulations. Default is None, which doesn’t enable any processing. An example argument is
python scripts/script.py
, which runs in the .bat as:python scripts/script.py json_filename.json
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
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.
