Metadata-Version: 2.4
Name: klayout-pex-plugin-elmer
Version: 0.1.0
Summary: Elmer FEM electrostatic input from KLayout-PEX PEX25D scenes: capacitance matrices by FEM
License-Expression: GPL-3.0-or-later
License-File: LICENSE
Keywords: pex,parasitic,extraction,klayout,elmer,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: klayout-pex (>=0.6.2,<0.7)
Requires-Dist: klayout-pex-plugin-gmsh (>=0.1,<0.2)
Project-URL: Repository, https://github.com/iic-jku/klayout-pex-plugin-elmer
Description-Content-Type: text/markdown

# klayout-pex-plugin-elmer

[Elmer FEM](https://www.elmerfem.org) electrostatics cases from [KLayout-PEX](https://github.com/iic-jku/klayout-pex) PEX25D scenes: the capacitance matrix of every net, floating conductor and the ground plane, by FEM (StatElecSolver).

## Usage

```bash
pip install klayout-pex-plugin-elmer
pex25d export cell.pex25d --to elmer --out_dir case
cd case && ElmerGrid 14 2 mesh.msh -autoclean && ElmerSolver case.sif
```

- **Output of the exporter:**
  - `case.sif`
  - `mesh.msh` and `mesh.json`, from [klayout-pex-plugin-gmsh](https://github.com/iic-jku/klayout-pex-plugin-gmsh)
- **Running it:** ElmerGrid converts the mesh into the directory `mesh/`, which `case.sif` reads.
- **Result:** `cmatrix.dat`
  - mutual capacitances off the diagonal
  - capacitance to ground on the diagonal, which is zero with the default `outer_boundary`
  - body *i* is the group with tag *i* in `mesh.json`
- **IIC-OSIC-TOOLS doesn't include Elmer.**

## Options

The mesh options of klayout-pex-plugin-gmsh, plus:

| Option | Default | Meaning |
| --- | --- | --- |
| `outer_boundary` | `zero_charge` | Domain box: `zero_charge` (Elmer's natural boundary condition) or `ground` (0 V) |
| `linear_tol` | 1e-10 | Relative residual of the linear solver (BiCGStabl, ILU1) |
| `linear_max_iterations` | 1000 | |

Pass them with `pex25d export --option NAME=VALUE` (klayout-pex 0.6.3 or later) or `options={...}` in Python.

Elements are linear. On the same mesh, the matrix matches Palace with `order` 1.

## Development

```bash
poetry install    # uses ../klayout-pex-plugin-gmsh until it is on PyPI
poetry run pytest # runs ElmerGrid and ElmerSolver too, if they are on PATH
```

