Metadata-Version: 2.4
Name: gds2palace
Version: 0.9.4
Summary: Create AWS Palace model from RFIC GDSII layout file
Author-email: Volker Muehlhaus <volker@muehlhaus.com>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2
Project-URL: Repository, https://github.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2
Project-URL: Changelog, https://github.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2/blob/main/doc/CHANGES.md
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gdspy>1.6.0
Requires-Dist: gmsh
Requires-Dist: numpy
Requires-Dist: shapely>=2.0
Dynamic: license-file

# Create AWS Palace FEM Models from GDSII layout files

![Intro](https://raw.githubusercontent.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2/main/doc/png/gds2palace_banner.png)

The files provided here enable RFIC FEM simulation using AWS Palace from GDSII layouts created in [IHP SG13G2](https://github.com/IHP-GmbH/IHP-Open-PDK) RFIC technology. 

Palace, is an open-source, parallel finite element code for full-wave 3D electromagnetic simulations. It can be scaled from single computer to large high performance simulation clusters and cloud-based computing.  
https://awslabs.github.io/palace/stable/  

In addition to AWS Palace, gds2palace can also generate models for [Elmer FEM](https://www.elmerfem.org/), as an additional workflow option for EM (S-parameter) simulation as well as steady-state thermal simulation. See [CHANGES.md](https://raw.githubusercontent.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2/main/doc/CHANGES.md) for this and other recent additions.

The gds2palace workflow in this repository is pre-configured for GDSII layout files in the [IHP SG13G2 Open PDK.](https://github.com/IHP-GmbH/IHP-Open-PDK)
Special thanks to IHP and the public funded German project FMD-QNC (16ME0831) https://www.elektronikforschung.de/projekte/fmd-qnc for financial support, which has contributed to this work.

## Install

    pip install gds2palace

**Full documentation, installation guide, and usage walkthrough:**
https://github.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2

## Recent changes

## 5 November-2026
gds2palace 0.9.4

**New features**  
`util_thermal_map`: powers from a circuit simulation onto the heat sources of a thermal export. The thermal export of the KLayout EM Export plug-in puts each transistor and resistor on a heat source layer of its own and writes `<name>_thermalmap.json` (layer, layout device and, from LVS, the schematic instance name per heat source). `read_powers()` reads a file with one line per device (instance name and power in W; comma, semicolon, tab or spaces; SPICE suffixes), `apply_powers()` returns the power per heat source layer and a report of heat sources without a power and names that match no heat source or several. Nothing is set silently. Command line: `python -m gds2palace.util_thermal_map <name>_thermalmap.json powers.csv <name>.tsimcfg` writes the powers into a setupThermal file. setupThermal's **Load powers...** uses it.

Elmer thermal: `refined_cellsize_override` now works for thermal models too. A heat source in the list (`source_<GDS layer>`, e.g. `['source_205', 0.25]`) gets its own mesh size instead of `refined_cellsize`, e.g. a fine mesh only at the emitter fingers of an npn. A metal layer in the list gets edge refinement at its value, growing to `meshsize_max` like the mesh around a heat source (below); thermal models refine no metal edges otherwise.

Elmer thermal: the mesh around a heat source now grows at a fixed rate, 0.3 µm per µm of distance, to the maximum size away from the sources. Before, it reached the maximum size within 30 times the source's mesh size, which is very fast for a small mesh size: for an npn13G2 with 0.25 µm at the emitter fingers, the temperature rise came out about 20 % too low. Models whose maximum size is more than 10 times the mesh size at the sources get more elements; at 10 times (e.g. 2 µm / 20 µm) the mesh is the same as before. The thermal example (5 µm / 100 µm) has 98k instead of 74k elements, with the same peak temperature within 0.1 K. Without the setting, thermal meshes are unchanged. Names that are neither a heat source nor a metal layer of the model are reported.

**Fix**  
Elmer thermal: a temperature-dependent thermal conductivity (`ThermalConductivityTable`, e.g. silicon) was taken at 0 K. The model had a single heat solver iteration and no initial temperature, so Elmer read the table once at 0 K, far below its range, and extrapolated it linearly: about 270 W/m·K for IHP's silicon table instead of 82 W/m·K at 300 K, and about 380 W/m·K for the literature table of the thermal example. Temperatures came out too low. A model with a table now starts at the lowest constant temperature of the model and iterates until converged (at most 50 iterations). The thermal example now gives a temperature rise of 48.0 K instead of 39.7 K. Models with constant thermal conductivities are unchanged.

Stackups (`XML_stackup/latest/IHP`): Activ's thermal conductivity is now the silicon table `Si_vs_T_IHP` instead of a constant 50 W/m·K that had no source. The heat sources of a thermal export sit in Activ, so this value decides much of a transistor's temperature rise. Thermal models of devices now come out cooler; EM models are unchanged.

Elmer thermal: a heat source inside a conductor of its target layer (an npn emitter's heat area in `Activ`) stopped the model with "Polygon on conductor layer source_... touches another conductor layer". The heat source takes the target layer's material, so the face it shares with that conductor is an interior face; it now stays with the conductor's surface group (thermal surface groups are only for viewing, boundary conditions come from the constant-temperature groups). Heat sources outside conductors (resistors over field oxide) are unchanged.

Mesh check: after meshing, elements of zero (or negative) volume are reported with their volume and position. A coarse mesh around small conductors (e.g. 0.7 µm metal fingers with a cell size of several µm) can leave flat tetrahedra in the dielectric between them, which gmsh's optimization keeps; Elmer then stops with "Degenerate 3D element" and a NaN solution. For Elmer models (thermal and EM) this is an error before the mesh is written, with the hint to use a finer mesh (`refined_cellsize`, `meshsize_max`); for Palace a warning.

ElmerGrid check: the conversion of the gmsh mesh to an Elmer mesh (and the split for MPI) now stops with an error when ElmerGrid fails. A crashed ElmerGrid (a segmentation fault on a large thermal mesh, on Windows and Linux) went unnoticed until ElmerSolver reported a missing mesh folder. When the ElmerGrid location is unknown (Windows: `ELMER_HOME` set but empty), the message no longer fails on an undefined variable.

## 31 October-2026
gds2palace 0.9.4

**Fix**  
`read_gds()` reads each GDS layer number once. A stackup can use one GDS layer for several stackup layers (one drawn shape makes all of them, e.g. a MIM top plate and the dielectric below it); `read_gds()` read such a layer once per stackup layer, so its polygons were in the model several times. The current IHP stackups have no shared layers, so their models do not change. `read_gds()` also no longer adds `gds_boundary_layers` to the caller's layer list.

## 31 October-2026
gds2palace 0.9.3

**New features**  
Multielement ports: several shapes on one port layer now become one port with one element per shape, the elements in parallel (a Palace `LumpedPort` with `Elements`; the port impedance stays the given Z0). Use it for a terminal that is spread over several strips, e.g. the source fingers of a multi-finger transistor. Before, only the last shape read became the port, and the others stayed in the model as surfaces without a port. `port_information.json` has one entry per element, with its `element` number. `combine_extend_snp.py` takes one Z0 per port for the Touchstone option line and treats the port inductances of the elements as parallel for de-embedding. Elmer models stop with an error for a multielement port.

**Documentation**  
User's guide, FAQ and AGENTS.md: the IHP SG13G2 PDK resistors as sheets in the EM model. The sheets have the drawn size and the nominal sheet resistance, without the PDK's width offset and contact end resistance; in Palace, rhigh and rppd come out about 10 % below their PDK value, rsil within about 2 %. See "Accuracy of IHP SG13G2 PDK resistors as sheets" in the user's guide.

Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2/blob/main/doc/CHANGES.md)

---

**Note:** the `gds2palace` PyPI package itself only requires:

- gdspy>1.6.0
- gmsh
- numpy
- shapely>=2.0

(Other Python modules mentioned above are only needed to run the example/model scripts in this repository, not to use the installed package.)
