Links

GitHub: https://github.com/yashpatel5400/router-agent

Shipables: https://shipables.dev/skills/yashpatel5400%2Fpde-design-optimizer

Inspiration

Thermal design is one of engineering's most tedious loops: sketch a heat sink layout, run a simulation, check if temperatures are in spec, tweak, repeat. A single chip cooling design can take hours of manual iteration. We wondered -- what if an AI agent could close that loop autonomously? Give it a plain-English problem description and let it solve PDEs, evaluate constraints, and refine the design on its own until the thermal targets are met.

What it does

PDE Thermal Design Optimizer is an AI agent that takes a natural-language thermal design problem (e.g., "cool 6 power devices below 0.5 peak temperature with a copper heat spreader") and autonomously iterates toward a solution. On each iteration it:

  • Selects and tunes solver parameters (grid resolution, SOR relaxation factor, convergence tolerance)
  • Runs a real 2D Poisson equation solver using Successive Over-Relaxation (SOR)
  • Evaluates the result against user-specified thermal constraints
  • Proposes design modifications: adjusting heat source placement, adding high-conductivity regions, or refining the mesh

The entire process streams in real time: an interactive web-native heatmap with hover-to-inspect shows the temperature field evolving, a convergence sparkline tracks peak temperature across iterations, and a parameter panel reveals the agent's solver tuning decisions.

How we built it

  • Backend: Next.js API route using Vercel AI SDK with OpenAI GPT-4o, orchestrating multi-step tool calls (solve, evaluate, visualize) that invoke Python CLI tools for PDE solving
  • Solver: Custom Python implementation of the Successive Over-Relaxation (SOR) method for the 2D Poisson/heat equation with Dirichlet boundary conditions
  • Frontend: assistant-ui for the chat interface, HTML Canvas for web-native heatmap rendering with an inferno colormap, SVG for the convergence sparkline
  • Sponsor integrations: Unkey for API rate limiting, assistant-ui for composable chat primitives, DigitalOcean App Platform for containerized deployment, Shipables for publishing the agent skill
  • Infrastructure: Dockerized with CPU-only PyTorch, deployed via DigitalOcean with autodeploy on push

Challenges we ran into

  • Making the agent actually iterate: Early versions solved most problems in one shot. We had to tighten constraints, increase heat source intensities, and carefully engineer the system prompt to enforce a progressive refinement workflow.
  • Web-native visualization: Replacing static Matplotlib PNGs with interactive Canvas heatmaps required building a custom renderer with responsive sizing

Accomplishments that we're proud of

  • A fully autonomous agent that iterates on thermal designs: not just a one-shot solver, but a system that reasons about why a design failed and what to change
  • The convergence sparkline that tells the optimization story at a glance: you can watch the peak temperature line drop toward the target across iterations

What we learned

  • Prompt engineering for scientific agents is fundamentally different from chat: you need to teach the agent a workflow, not just give it knowledge
  • The AI SDK's multi-step tool calling with stopWhen is powerful for building agents that need autonomy within bounds

What's next for PDE Thermal Design Optimizer

  • ML surrogate solvers: Train a Fourier Neural Operator (FNO) on the SOR solver's outputs for 100x faster approximate solves during early design exploration, falling back to the classical solver for final validation
  • Multi-physics: Couple thermal simulation with structural stress analysis for holistic design optimization
  • Design export: Generate CAD-ready specifications and thermal reports from optimized designs

Built With

Share this project:

Updates