Metadata-Version: 2.4
Name: gds2palace
Version: 0.9.2
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

## 22 October-2026
gds2palace 0.9.2

**New features**  
The result tools `combine_extend_snp.py` (Palace results to Touchstone) and `palace_summary.py` (run summary: unknowns, run time, peak RAM, AMR error) are now installed with the pip package, as `gds2palace.scripts`: `python -m gds2palace.scripts.palace_summary <path>` and `python -m gds2palace.scripts.combine_extend_snp`. They need scikit-rf (`pip install scikit-rf`), which gds2palace does not install. `utilities.get_scripts_dir()` returns their folder. The files in `scripts/` are unchanged, so the Linux install script still downloads them from there.

**Documentation**  
User's guide and AGENTS.md: a via port drawn as a box with an area becomes a sheet along the box's left edge (xmin, if it is taller than wide) or bottom edge (ymin), as the code has always done; the documentation said "along its center line". Draw via ports as lines.

## 18-20 October-2026
gds2palace 0.9.1

**New features**  
A pre-built Apptainer image for Palace 0.18.1 is now available: `apptainer pull palace_0181.sif oras://ghcr.io/volkermuehlhaus/palace_0181:latest`. It is compiled for a common processor level (`x86_64_v3`, AVX2), so it runs on all Intel processors since 2013 and all AMD processors since 2017. The Linux and Windows install scripts now download this image by default; `--palace-version 016` still gives the 0.16 image. The generated `run_palace` script now calls `apptainer -q`, which hides Apptainer's info messages.

The latest IHP stackup files (`SG13G2_FEM_200um.xml`, `SG13G2_FEM_200um_passi3D.xml`, `SG13CMOS5L_200um.xml`) are now installed with the pip package, so a model no longer needs a copy of the repository. `utilities.get_stackup_path('SG13G2_FEM_200um.xml')` returns the full path of one; `utilities.get_stackup_path()` without an argument prints the stackup folder and the available files. Legacy stackups are not included.

**Fixes**  
For very long polygon edges, mesh refinement along the conductor edges is more robust now.

`scripts/combine_extend_snp.py`: with different port impedances, the Touchstone option line now has one Z0 per port, in port order (ports with the same Z0 as port 1 were left out before).  

**Documentation**  
[`building-palace-apptainer.md`](building-palace-apptainer.md) and [`building-palace-spack.md`](building-palace-spack.md) are rewritten for end users: simple steps for Palace 0.18.1, an explanation of each tool, and a table of problems and solutions. Both end with technical notes for AI agents. The Apptainer guide explains how to build an image that runs on other computers: without a fix for libCEED, which always compiles for the build computer's processor, a self-built image can stop with `Illegal instruction` on other computers.

New study [`amr_conformal`](../more_examples/mesh_convergence/mesh_convergence_D-band_balun/amr_conformal/README.md) on the D-band balun: conformal vs. nonconformal AMR, `UpdateFraction`, and AMR at a single frequency followed by one full sweep on the saved mesh.

## 15-17 October-2026
gds2palace 0.9.0

**New features**  
`settings['conductor_model']` chooses the conductor model in one setting: 
- `'surface'` (default, unchanged behavior), 
- `'solve_inside'` (conductors as volumes, the former `filled_metals = True`) or  
- `'solve_inside_skin'` (volumes with skin layers, new).  

This replaces `settings['filled_metals']`, see "API changes".  

`'solve_inside_skin'` splits each conductor into thin layers along all its faces plus a core, so that the mesh has thin cells next to the conductor surface (where the skin effect puts the current) while the cell size along the surface stays at `refined_cellsize`. See "Accuracy at high frequency" in the user's guide, chapter "Conductor loss modelling".

New study [`more_examples/conductor_models`](../more_examples/conductor_models/README.md): accuracy and cost of the three conductor models on six SG13G2 structures and straight lines, against the most accurate earlier results and, for L6n2, the measurement.

Each study in `more_examples/mesh_convergence` was extended, to cover the conductor model also. This compares the three models on five SG13G2 structures: at a 2 µm mesh, the peak Q of coils on TopMetal1/TopMetal2 (2-8 µm traces) is 18-30 % too high with `'surface'`, 4-8 % too low with `'solve_inside'` and 2-3 % too low with `'solve_inside_skin'`, relative to `'solve_inside_skin'` at 1 µm.


**Documentation**  
Chapter "Conductor loss modelling" of the user's guide: the `z_thickness_factor` section is removed (with the L2n0 and microstrip tests and the Palace code walk-through), and so is the section "Transmission line compared with openEMS and measurement", which compared it with the full side wall thickness; the setup of that line and its measurement is now described in chapter "Dielectric loss modelling", `conductor_model` is the recommended choice. New section "Choosing the conductor model" with the errors and run times of the three models, and a table of what the errors mean for typical designs (VCO phase noise, insertion loss of LNA input matches and baluns, MIM capacitor Q, line loss). The same tables are in the FAQ. The code examples no longer set `z_thickness_factor`.

New section "Accuracy at high frequency" in chapter "Conductor loss modelling" of the user's guide. It also describes a limitation of the surface impedance model that was not documented: thin conductors that carry current on one face only, e.g. a Metal1-Metal5 ground plane under a line, get up to twice their real loss (line resistance of `palace_line_viaport.py` 21-41 % too high).

Run times of the conductor models in the user's guide ("Choosing the conductor model") and the FAQ now come from the conductor model study, which ran all models on one machine, one run at a time: relative to `'surface'`, `'solve_inside'` takes 1.25-1.7x and `'solve_inside_skin'` 1.5-3.5x the run time on coils and baluns at a 2 µm mesh. The earlier values (0.7-2.7x and 1.5-4.7x) came from machines shared with other runs.


**API changes**  
`settings['filled_metals']` is replaced by `settings['conductor_model']`. Existing scripts keep working: `filled_metals = True` is the same as `conductor_model = 'solve_inside'`, `False` the same as `'surface'`, with the same results, and the model script prints a note. Giving both settings with different meanings stops with an error. setupEM writes `conductor_model` from its next version on.

`settings['z_thickness_factor']` (thickness factor for the side walls of surface impedance conductors) is removed. It also changed the side wall impedance well into the skin effect regime, and the full thickness was closer to openEMS and measured data. A script that sets it to a value other than 1 gets a warning, and the full thickness is used, so its results change. The examples `palace_balun_mesh5.py` (gds2palace) and `palace_rfcmim.py`, `palace_demo_line.py`, `palace_balun_mesh2.py` (setupEM) used 0.33. For accurate conductor loss, use `conductor_model`.

All faces of a surface impedance conductor (top, bottom and side walls) are now one physical group, e.g. `TopMetal2_1`, instead of a horizontal and a vertical group (`TopMetal2_1_xy`, `TopMetal2_1_z`): without `z_thickness_factor`, both groups got the same conductivity and thickness. The mesh and the results are unchanged; only the group names in the mesh file, the Palace config and the Elmer input change, which matters for scripts or Paraview states that refer to the old names. The same applies to the lateral faces of vias in Elmer thermal models (`TopVia2_1` instead of `TopVia2_1_z`).

**Bugfixes**  
Conductor faces of surface impedance models were sorted into horizontal (`_xy`) and vertical (`_z`) groups by a normal computed from their boundary vertices, which gave a wrong or zero normal when a face was split, e.g. by a port: in a single-turn inductor, 68 % of the side wall area ended up in the horizontal group. Now the normal of the planar CAD face is used. This only mattered for `z_thickness_factor` other than 1, which is removed in this version (see above): before, only part of the side walls got the reduced thickness.

Reading a GDSII file printed "WARNING: could not auto-repair 2 invalid polygon(s)" for via ports drawn as a zero-width line (e.g. layers 201/202 in `workflow/line_simple_viaport.gds`), although the port works and nothing was changed. The check for self-intersecting polygons now only looks at layers that are meshed as solids (stackup metals and vias, dielectric boundary layers, derived layers), not at port and marker layers. Polygons that need repair are repaired as before.

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.)
