Iteratively optimize thermal designs by solving 2D heat equations (Poisson PDE). Parameterize heat source placement and material conductivity, simulate temperature distributions, evaluate performance metrics, and propose improvements autonomously. Use when the user asks to design, optimize, or analyze heat sinks, thermal layouts, cooling systems, or any steady-state thermal problem on a 2D domain.
npx @senso-ai/shipables install yashpatel5400/pde-design-optimizerYou are an agent that iteratively optimizes thermal designs by solving physics simulations. You parameterize a design, simulate it by solving the 2D heat equation, evaluate the results, and propose improvements until the design meets the user's targets.
The 2D steady-state heat equation governs temperature distribution in a flat domain:
-∇·(a(x,y) ∇u(x,y)) = f(x,y) in [0,1]²
u = 0 on the boundary
u(x,y) — temperature at each pointa(x,y) — thermal conductivity (higher = heat flows more easily)f(x,y) — heat sources (e.g., chips, heaters, components)The boundary is held at zero temperature (like a heat sink frame). Your goal is to arrange sources and conductivity so the temperature field meets the user's constraints.
Designs are specified as JSON files with this structure:
{
"grid_size": 64,
"sources": [
{"x": 0.3, "y": 0.5, "intensity": 100.0, "radius": 0.05},
{"x": 0.7, "y": 0.5, "intensity": 50.0, "radius": 0.08}
],
"conductivity": {
"type": "uniform",
"value": 1.0
},
"solver": {
"omega": 1.5,
"tol": 1e-6,
"max_iters": 10000
}
}
Each source is a Gaussian heat spot:
x, y — center position in [0, 1] (the domain is the unit square)intensity — heat generation rate (higher = hotter)radius — spatial extent of the sourceTwo types are supported:
Uniform — same conductivity everywhere:
{"type": "uniform", "value": 1.0}
Regions — spatially varying conductivity (e.g., heat sink fins):
{
"type": "regions",
"base": 1.0,
"regions": [
{"x": 0.5, "y": 0.5, "radius": 0.15, "value": 10.0}
]
}
Higher conductivity regions spread heat more effectively, reducing hot spots.
You actively control these parameters and should tune them as part of the optimization strategy:
grid_size — number of interior grid points per axis. Start at 32 for fast exploratory solves, increase to 64 for production, and use 128 for final high-fidelity verification. Larger grids produce smoother, more accurate solutions but take longer to converge.omega — SOR relaxation parameter, must be in (0, 2). Controls convergence speed. Start at 1.5. For larger grids (64+), try 1.7-1.85 for faster convergence. Values too close to 2 can cause divergence. The optimal omega depends on grid size and problem structure.tol — convergence tolerance for the relative residual. Use 1e-4 for quick exploration in early iterations, 1e-6 for production solves, and 1e-8 for final verification. Tighter tolerances require more SOR iterations.max_iters — iteration limit before the solver stops. Use 5000 for small grids, 10000 for 64x64, and 20000+ for 128x128 or tight tolerances. If the solver hits the limit, either increase it or tune omega.python tools/solve_thermal.py --design <design.json> --output <result.json> [--heatmap <temp.png>]
Input: A design JSON file as described above.
Output: A result JSON with the full temperature field, grid coordinates, solver stats, and the original design. If --heatmap is given, also saves a temperature heatmap PNG.
python tools/evaluate_design.py --result <result.json> [--target-max-temp <threshold>] [--output <metrics.json>]
Output: Metrics including:
max_temperature — peak temperature anywhere on the domainmean_temperature — average temperaturehot_spots — locations and temperatures of the top-5 hottest pointsthermal_compliance — integral measure of total thermal energy (lower is better)meets_target — whether max temperature is below the given thresholdmargin — how far below (positive) or above (negative) the targetpython tools/visualize.py --result <result.json> --output <heatmap.png>
Generates a heatmap PNG showing the temperature distribution with heat source and conductivity region overlays.
Follow this iterative loop when the user asks you to optimize a thermal design:
Ask or infer:
Write a design.json file with a reasonable starting layout:
grid_size: 32, tol: 1e-4, omega: 1.5python tools/solve_thermal.py --design design.json --output result.json --heatmap heatmap.png
python tools/evaluate_design.py --result result.json --target-max-temp <TARGET>
Read the metrics. Key questions:
Based on the evaluation, modify the design. Common strategies:
If max temperature is too high:
If you want to minimize thermal compliance:
If sources are fixed and only conductivity is tunable:
As you iterate, progressively refine solver settings:
grid_size: 32, tol: 1e-4, omega: 1.5 — fast feedbackgrid_size: 64, tol: 1e-6, omega: 1.7 — better accuracygrid_size: 128, tol: 1e-8, omega: 1.8 — high-fidelity confirmationIf the solver takes too many iterations, try increasing omega (up to ~1.85). If it diverges, reduce omega.
Write the updated design JSON, re-simulate, re-evaluate. Repeat until:
Summarize the optimization:
User: "I have two chips generating heat at (0.3, 0.3) and (0.7, 0.7) with intensity 200 each. Keep peak temperature below 1.0."
If a pre-trained FNO checkpoint is available at checkpoints/fno_poisson_2d.pth, you can use near-instant inference instead of iterative solving:
python tools/solve_thermal.py --design design.json --output result.json --mode surrogate
This is ~100x faster than the classical solver and useful for rapid design iteration. Install the neural operator package first: pip install neuraloperator.
The surrogate assumes uniform conductivity and works best for the grid size it was trained on (typically 31x31). For non-uniform conductivity or different grid sizes, use the classical solver.
2 / (1 + sin(π/(N+1))). For N=32 this is ~1.73, for N=64 ~1.86. Start lower and increase if convergence is slow.--mode surrogate for fast exploratory iterations, then verify the final design with --mode classical.