quantcore_circuits.sim_tools.palace

Palace adapter: KQC Elmer export + KQC gmsh mesher → Palace config.

export_palace writes a normal KQC Elmer job (geometry, layer stack, ports, mesh sizes and KQC’s scripts/gmsh_helpers.py) and adds:

  • palace_job.json — what to generate (Electrostatic or Eigenmode) and solver settings,

  • run_palace.sh — python -m quantcore_circuits.sim_tools.palace prepare . then mpirun palace palace.json.

prepare (run where gmsh is available, usually the Linux server) meshes with KQC’s produce_mesh in MSH 2.2 (required by MFEM/Palace), reads the physical groups and writes palace.json:

  • volumes → Domains.Materials (permittivity / loss tangent from the KQC material_dict; vacuum ε=1),

  • Electrostatic: Ground = excitation_0_boundary, Terminal k = excitation_k_boundary (same order as Q3D Net<k> / Elmer capacitance bodies, so C-matrix labels from job.json apply unchanged),

  • Eigenmode: PEC = all metal boundaries + outer box; junction ports → LumpedPort with L = Lj, C = Cj; other internal ports → 50 Ω LumpedPort (gives κ in port-Q.csv).

Lengths stay in µm (Model.L0 = 1e-6).

Attributes

Functions

export_palace(setup, job_dir, **cfg) → pathlib.Path

palace_config(sim_json, physical, spec, mesh_file) → dict

Palace configuration dict from a KQC simulation JSON and mesh physical groups.

prepare(job_dir) → pathlib.Path

Mesh (KQC produce_mesh, MSH 2.2) and write palace.json in job_dir.

read_physical_names(msh_path) → dict[str, tuple[int, int]]

$PhysicalNames of an ASCII .msh → {name: (dim, tag)}.

Module Contents

quantcore_circuits.sim_tools.palace.export_palace(setup, job_dir: pathlib.Path, **cfg) → pathlib.Path
quantcore_circuits.sim_tools.palace.palace_config(sim_json: dict, physical: dict[str, tuple[int, int]], spec: dict, mesh_file: str) → dict

Palace configuration dict from a KQC simulation JSON and mesh physical groups.

quantcore_circuits.sim_tools.palace.prepare(job_dir: str | pathlib.Path) → pathlib.Path

Mesh (KQC produce_mesh, MSH 2.2) and write palace.json in job_dir.

quantcore_circuits.sim_tools.palace.read_physical_names(msh_path: pathlib.Path) → dict[str, tuple[int, int]]

$PhysicalNames of an ASCII .msh → {name: (dim, tag)}.

quantcore_circuits.sim_tools.palace.PALACE_JOB = 'palace_job.json'