electrostatics.height_fields — overhang and height sampling
tempura/electrostatics/height_fields.py holds the small numerical core shared
by device finalization: the conformal overhang model for deposited layers
and the world-coordinate samplers that read a height array at arbitrary points.
The overhang model
When a layer is deposited over a surface with topography (for example a dielectric poured over a patterned gate), it does not fill only the valleys — it drapes over raised features and climbs their sidewalls. Tempura approximates that draping with a morphological dilation of the surface height map.
For a deposition of thickness \(t\) on an in-plane lattice of spacing \(d_x\), the support base is the local maximum of the surface within a disk of radius
so the base height at cell \((i, j)\) is
evaluated with scipy.ndimage.maximum_filter over a circular footprint. The
deposited top is then \(\text{base} + t\). A larger thickness dilates by a larger
disk, which is what makes a thick blanket climb further over a tall gate than a
thin one. Tempura currently restricts devices to \(d_x = d_y\), so a single
spacing defines the disk.
Sampling height arrays
sample_height_array(...) maps world coordinates \((x, y)\) to array cells using
the device extent \(L \times W\) and the array shape \((n_y, n_x)\):
Points outside the footprint return NaN, so callers can treat them as outside
the layer. make_height_fn(...) wraps this as a scalar (x, y) -> height
callable used when building backend shapes.
API
height_fields
Height field utilities for layered device geometry.
make_height_fn(arr, L, W)
Create a function that samples a height map in world coordinates.
Assumes the array matches the device XY size and resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
ndarray
|
Height values indexed as (row=y, col=x). |
required |
L
|
float
|
Device length (x extent). |
required |
W
|
float
|
Device width (y extent). |
required |
Returns:
| Type | Description |
|---|---|
Callable[[float, float], float]
|
Callable that maps (x, y) -> height. |
Source code in tempura/electrostatics/height_fields.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
overhang_base(height_map, *, thickness, dx)
Return the support surface produced by one deposition step.
The overhang model is shared by the generic height-field utility and the
full Device finalization path so both use the same stencil-expansion
behavior. Tempura currently restricts devices to dx == dy, so the
single dx spacing is the common in-plane lattice constant.
Source code in tempura/electrostatics/height_fields.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
sample_height_array(arr, L, W, x, y)
Sample one height array at vectorized world coordinates.
Points outside the device footprint are returned as NaN so callers can
treat them as outside the layer.
Source code in tempura/electrostatics/height_fields.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |