Metadata-Version: 2.4
Name: kpex-plugin-palace
Version: 0.3.0
Summary: Palace electrostatic input from KPEX PEX25D scenes: capacitance matrices by FEM
License-Expression: GPL-3.0-or-later
License-File: LICENSE
Keywords: pex,parasitic,extraction,klayout,palace,fem,capacitance
Author: Martin Köhler
Author-email: info@martinjankoehler.com
Requires-Python: >=3.12,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
Requires-Dist: kpex (>=0.12.0,<1)
Requires-Dist: kpex-plugin-gmsh (>=0.3.0,<0.4)
Project-URL: Repository, https://github.com/iic-jku/kpex-plugin-palace
Description-Content-Type: text/markdown

# kpex-plugin-palace

[Palace](https://awslabs.github.io/palace/) electrostatic decks from [KPEX](https://github.com/iic-jku/kpex) PEX25D scenes: the capacitance matrix of every net, floating conductor and the ground plane, by FEM.

## Usage

```bash
pip install kpex-plugin-palace
pex25d export cell.pex25d --to palace --out_dir deck
cd deck && palace -np 4 config.json
```

- **Output of the exporter:**
  - `config.json`
  - `mesh.msh` and `mesh.json`, from [kpex-plugin-gmsh](https://github.com/iic-jku/kpex-plugin-gmsh)
- **Run Palace in the deck directory:** paths in the config are relative.
- **Results:** in `postpro/`
  - `terminal-C.csv`: the Maxwell matrix
  - `terminal-Cm.csv`: mutual capacitances
  - terminal *i* is the group with tag *i* in `mesh.json`
- **In IIC-OSIC-TOOLS:** Palace is in `/foss/tools/bin`. As root, `mpirun` refuses to start, so use `palace -serial config.json`.

## Ground openings and electrical identity

Ground openings, retained ground islands and their coatings follow the selected
`PEX25D` scene. The reference net identifies the terminal independently of the
ground profile name. Floating bodies remain separate even when their names match
connected nets; an optional `body_names.json` records disambiguated solver labels.

These features require a Gmsh backend that explicitly supports both ground cutouts
and electrical identity. An older or incomplete backend is rejected before files
are written.

Scenes requiring capacitance accounting are rejected before output. Ground
openings and electrical ownership alone do not implement exclusion masks, charge
groups or filtered capacitance results.

## Options

The mesh options of kpex-plugin-gmsh, plus:

| Option | Default | Meaning |
| --- | --- | --- |
| `order` | 1 | Polynomial order of the finite elements; 2 is about 1% more accurate with the default mesh, at about 9 times the run time |
| `outer_boundary` | `zero_charge` | Domain box: `zero_charge` (no field crosses it) or `ground` (0 V) |
| `linear_tol` | 1e-8 | Relative residual of the linear solver |
| `linear_max_iterations` | 200 | |

Pass them with `pex25d export --option NAME=VALUE` or `options={...}` in Python.

## Migration

Moving from `klayout-pex-plugin-palace`? Install the renamed plugins in a fresh
environment with `kpex>=0.12.0` to avoid registering the same exporters twice.

## Requirements

- `kpex>=0.12.0,<1` (plugin API `v1` is provisional)
- `kpex-plugin-gmsh>=0.3.0,<0.4`

## Development

```bash
poetry install
poetry run pytest # runs Palace too, if it is on PATH
```

## Acknowledgements

This project is funded by the JKU/SAL [IWS Lab](https://research.jku.at/de/projects/jku-lit-sal-intelligent-wireless-systems-lab-iws-lab/), a collaboration of [Johannes Kepler University](https://jku.at) and [Silicon Austria Labs](https://silicon-austria-labs.com).

This project is further funded by the European project [ODE4EC-AMS](https://ode4ec.eu/projects/ams/), which has received funding from the Chips Joint Undertaking (Chips JU) under Grant Agreement No 101252962.

Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the Chips Joint Undertaking. Neither the European Union nor the granting authority can be held responsible for them.

<p align="center">
  <a href="https://iic.jku.at" target="_blank">
    <img src="https://github.com/iic-jku/kpex-website/raw/main/figures/funding/iic-jku.svg" alt="Johannes Kepler University: Institute for Integrated Circuits and Quantum Computing" width="300"/>
  </a>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <a href="https://silicon-austria-labs.com" target="_blank">
    <img src="https://github.com/iic-jku/kpex-website/raw/main/figures/funding/silicon-austria-labs-logo.svg" alt="Silicon Austria Labs" width="300"/>
  </a>
</p>

<p align="center">
  <a href="https://ode4ec.eu/projects/ams/" target="_blank">
    <img src="https://github.com/iic-jku/kpex-website/raw/main/figures/funding/eu-cofunded.svg" alt="Co-funded by the European Union" width="300"/>
  </a>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <a href="https://www.chips-ju.europa.eu" target="_blank">
    <img src="https://github.com/iic-jku/kpex-website/raw/main/figures/funding/chips-ju.png" alt="Chips Joint Undertaking" width="300"/>
  </a>
</p>

