HFSSSimulationConfig#

class pyedb.workflows.job_manager.backend.job_submission.HFSSSimulationConfig(**data)#

Bases: pydantic.BaseModel

Complete, validated simulation configuration.

The class is a frozen dataclass (after __post_init__) and can be serialised to/from JSON via to_dict() / from_dict(). e Parameters ———- ansys_edt_path : str

Path to ansysedt executable.

solverstr, optional

Solver name. Defaults to "Hfss3DLayout".

jobidstr, optional

Unique identifier. Auto-generated with timestamp if omitted.

distributedbool, optional

Enable MPI distribution. Defaults to True.

machine_nodeslist[MachineNode], optional

Compute nodes. Defaults to [MachineNode()].

autobool, optional

Non-interactive mode. Defaults to True.

non_graphicalbool, optional

Hide GUI. Defaults to True.

monitorbool, optional

Stream solver log. Defaults to True.

layout_optionsHFSS3DLayoutBatchOptions, optional

Solver flags. Defaults to a new instance.

project_pathstr, optional

.aedt or .aedb file. Defaults to platform temp.

design_namestr, optional

Design inside project. Defaults to "" (use active).

design_modestr, optional

Variation name. Defaults to "".

setup_namestr, optional

Setup to solve. Defaults to "".

scheduler_typeSchedulerType, optional

External scheduler. Defaults to SchedulerType.NONE.

scheduler_optionsSchedulerOptions, optional

Scheduler directives. Defaults to a new instance.

Raises:
ValueError

On validation failure.

FileNotFoundError

If project_path does not exist.

Overview#

from_dict

Deserialize a dictionary produced by to_dict().

validate_fields

Validate all options and raise ValueError on violation.

generate_machinelist_string

Return HFSS -machinelist argument.

generate_batch_options_string

Generate HFSS batch options string from layout options.

generate_design_string

Generate design specification string for HFSS command.

generate_slurm_script

Returns a proper SLURM batch script with shebang.

generate_lsf_script

Return LSF batch script that matches the reference command.

generate_scheduler_script

Delegate to the correct generator based on

generate_command_string

Platform-escaped command line.

submit_to_scheduler

Write the batch script (if script_path given) and submit to the

run_simulation

Main entry point — run the simulation either

generate_command_list

List form for subprocess.run(shell=False).

to_dict

Serialize the complete configuration to a JSON-safe dictionary.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ansys_edt_path

solver

jobid

user

distributed

machine_nodes

auto

non_graphical

monitor

layout_options

project_path

design_name

design_mode

setup_name

scheduler_type

scheduler_options

__str__

String representation of the complete HFSS command.

Import detail#

from pyedb.workflows.job_manager.backend.job_submission import HFSSSimulationConfig

Attribute detail#

HFSSSimulationConfig.model_config#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

HFSSSimulationConfig.ansys_edt_path: str = None#
HFSSSimulationConfig.solver: str = 'Hfss3DLayout'#
HFSSSimulationConfig.jobid: str = None#
HFSSSimulationConfig.user: str = 'unknown'#
HFSSSimulationConfig.distributed: bool = True#
HFSSSimulationConfig.machine_nodes: List[MachineNode] = None#
HFSSSimulationConfig.auto: bool = True#
HFSSSimulationConfig.non_graphical: bool = True#
HFSSSimulationConfig.monitor: bool = True#
HFSSSimulationConfig.layout_options: HFSS3DLayoutBatchOptions = None#
HFSSSimulationConfig.project_path: str = None#
HFSSSimulationConfig.design_name: str = ''#
HFSSSimulationConfig.design_mode: str = ''#
HFSSSimulationConfig.setup_name: str = ''#
HFSSSimulationConfig.scheduler_type: SchedulerType#
HFSSSimulationConfig.scheduler_options: SchedulerOptions = None#

Method detail#

HFSSSimulationConfig.validate_fields() None#

Validate all options and raise ValueError on violation. Checks ranges, formats, and scheduler-specific rules.

HFSSSimulationConfig.generate_machinelist_string() str#

Return HFSS -machinelist argument.

Returns:
str

Machine list string.

HFSSSimulationConfig.generate_batch_options_string() str#

Generate HFSS batch options string from layout options. Converts HFSS3DLayoutOptions to command-line batch options format. Format matches Ansys reference: “key1=value1 key2=value2”

Returns:
str

Batch options string with space-separated key=value pairs.

HFSSSimulationConfig.generate_design_string() str#

Generate design specification string for HFSS command.

Returns:
str

Design string.

HFSSSimulationConfig.generate_slurm_script() str#

Returns a proper SLURM batch script with shebang. This script can be written to a file and submitted via sbatch.

HFSSSimulationConfig.generate_lsf_script() str#

Return LSF batch script that matches the reference command.

HFSSSimulationConfig.generate_scheduler_script() str#

Delegate to the correct generator based on scheduler_type.

Returns:
str

Batch script or PowerShell code.

Raises:
ValueError

If scheduler_type is unsupported.

HFSSSimulationConfig.generate_command_string() str#

Platform-escaped command line. Local → list=… Scheduler → distributed numcores=… + -auto

HFSSSimulationConfig.submit_to_scheduler(script_path: str | None = None) subprocess.CompletedProcess#

Write the batch script (if script_path given) and submit to the configured scheduler.

Parameters:
script_pathstr, optional

Destination file name. Auto-generated if omitted.

Returns:
subprocess.CompletedProcess

Result of sbatch / bsub / qsub / PowerShell.

Raises:
ValueError

If scheduler_type is SchedulerType.NONE. subprocess.TimeoutExpired If submission takes longer than 30 s.

HFSSSimulationConfig.run_simulation(**subprocess_kwargs) subprocess.CompletedProcess | str#

Main entry point — run the simulation either

  • locally (subprocess), or

  • by submitting to an external scheduler.

Parameters:
**subprocess_kwargs

Forwarded to subprocess.run for local execution.

Returns:
subprocess.CompletedProcess

For local runs (contains stdout, stderr, returncode).

str

For scheduler runs — external job ID such as "slurm_job_12345".

Raises:
Exception

On any failure (solver not found, submission error, timeout, …).

HFSSSimulationConfig.generate_command_list() List[str]#

List form for subprocess.run(shell=False). Local → list=… Scheduler → distributed numcores=… + -auto

HFSSSimulationConfig.to_dict() Dict[str, Any]#

Serialize the complete configuration to a JSON-safe dictionary.

Returns:
dict

Contains all fields including nested BaseModels and enums.

classmethod HFSSSimulationConfig.from_dict(data: Dict[str, Any]) HFSSSimulationConfig#

Deserialize a dictionary produced by to_dict().

Parameters:
datadict

Dictionary obtained via json.load or equivalent.

Returns:
HFSSSimulationConfig

New validated instance.

HFSSSimulationConfig.__str__() str#

String representation of the complete HFSS command.

Returns:
str

Complete HFSS command string.