Palace is an open-source 3D electromagnetic simulator supporting eigenmode, driven (S-parameter), and electrostatic simulations. This notebook demonstrates using the gsim.palace API to run a driven simulation on a CPW (coplanar waveguide) structure with wave ports.
Requirements:
- IHP PDK:
uv pip install ihp-gdsfactory - GDSFactory+ account for cloud simulation
Define GSG electrode¶
import gdsfactory as gf
from ihp import LAYER, PDK
PDK.activate()
@gf.cell
def gsg_electrode(
length: float = 800,
s_width: float = 20,
g_width: float = 40,
gap_width: float = 15,
layer=LAYER.TopMetal2drawing,
) -> gf.Component:
"""
Create a GSG (Ground-Signal-Ground) electrode.
Args:
length: horizontal length of the electrodes
s_width: width of the signal (center) electrode
g_width: width of the ground electrodes
gap_width: gap between signal and ground electrodes
layer: layer for the metal
"""
c = gf.Component()
r1 = c << gf.c.rectangle((length, g_width), centered=True, layer=layer)
r1.move((0, (g_width + s_width) / 2 + gap_width))
_r2 = c << gf.c.rectangle((length, s_width), centered=True, layer=layer)
r3 = c << gf.c.rectangle((length, g_width), centered=True, layer=layer)
r3.move((0, -(g_width + s_width) / 2 - gap_width))
c.add_port(
name="o1",
center=(-length / 2, 0),
width=s_width,
orientation=180,
port_type="electrical",
layer=layer,
)
c.add_port(
name="o2",
center=(length / 2, 0),
width=s_width,
orientation=0,
port_type="electrical",
layer=layer,
)
return c
c = gsg_electrode()
cc = c.copy()
cc.draw_ports()
cc

Configure simulation¶
from gsim.palace import DrivenSim
sim = DrivenSim()
sim.set_output_dir("./palace-sim-cpw-waveport")
sim.set_geometry(c)
sim.set_stack(substrate_thickness=2.0, air_above=100.0, air_below=100.0)
# Wave ports — max_size fills the full domain boundary
sim.add_wave_port("o1", layer="topmetal2", max_size=True, mode=1, excited=True)
sim.add_wave_port("o2", layer="topmetal2", max_size=True, mode=1, excited=False)
sim.set_driven(fmin=1e9, fmax=100e9, num_points=300)
print(sim.validate_config())
Validation: PASSED
Generate mesh¶
sim.mesh(
preset="default",
refined_mesh_size=2.0,
max_mesh_size=40.0,
fmax=150e9,
margin_x=0,
margin_y=50.0,
)
Mesh Summary
========================================
Dimensions: 800.0 x 230.0 x 218.3 µm
Nodes: 32,940
Elements: 234,684
Tetrahedra: 170,426
Edge length: 0.40 - 76.91 µm
Quality: 0.561 (min: 0.001)
SICN: 0.613 (all valid)
----------------------------------------
Volumes (3):
- SiO2 [1]
- passive [2]
- air [3]
Surfaces (10):
- topmetal2_xy [4]
- topmetal2_z [5]
- P1 [6]
- P2 [7]
- SiO2__None [8]
- SiO2__passive [9]
- SiO2__air [10]
- passive__None [11]
- air__passive [12]
- air__None [13]
----------------------------------------
Mesh: palace-sim-cpw-waveport/palace.msh
sim.plot_mesh(
style="solid",
transparent_groups=["air__None", "SiO2__None", "SiO2__passive", "air__passive"],
interactive=True,
)

Run simulation¶
palace-6424ff6c completed 11m 03s
Extracting results.tar.gz...
Downloaded 8 files to sim-data-palace-6424ff6c
Plot S-parameters¶
Port mapping: Port 1: p1, Port 2: p2
Port mapping: Port 1: p1, Port 2: p2