Skip to main content
Glama

solve_heat_1d

Solve the 1D heat equation u_t = alpha*u_xx using explicit FTCS with Dirichlet, Neumann, or Robin boundary conditions and configurable grid and time steps.

Instructions

Solve u_t = alpha*u_xx with explicit FTCS and configurable ends.

``nx`` is the number of spatial intervals (nx+1 grid points) and ``nt`` the
number of time steps. The scheme requires r = alpha*dt/dx^2 <= 0.5; larger
values are rejected as unstable. Each of ``left``/``right`` is either a
float (Dirichlet value) or a dict:
``{"type": "dirichlet", "value": v}``,
``{"type": "neumann", "flux": q}`` or
``{"type": "robin", "h": h, "ambient": a}``.

Sign conventions: ``flux`` is the x-derivative du/dx at the boundary, not
the outward-normal derivative. At the left end the outward normal is -x,
so the outward-normal derivative there is -flux; at the right end it is
+flux. The Robin condition uses the same x-derivative convention at both
ends: ``h*(u - ambient) + du/dx = 0`` (unit conductivity k), i.e.
``h*(u - ambient) - du/dn = 0`` on the left and
``h*(u - ambient) + du/dn = 0`` on the right. Neumann/Robin ends use ghost
nodes; Robin is applied at the new time level so that large h remains
stable. The full grid is saved as .npz, while the returned arrays are
downsampled to at most 100 spatial and 50 time points.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ntYes
nxYes
leftNo
alphaYes
rightNo
t_endYes
lengthYes
initialYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does so richly: the failed-input behavior (unstable r rejected), the ghost-node treatment, the stability-motivated choice to apply Robin at the new time level, the full-grid .npz save, and the downsampling of returned arrays to <=100 spatial / <=50 time points. The explicit sign conventions for flux vs outward-normal derivative are exactly the kind of behavioral detail an agent cannot infer elsewhere.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the PDE and scheme, then grid, stability, boundary types, sign conventions, implementation notes, and output behavior. It is dense and long, but nearly every clause carries load for a genuinely complex numerical tool; the extended Robin sign discussion is verbose yet defensible because it is error-prone.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter, annotation-free tool with no output schema, the description covers the scheme, boundary handling, stability, and even return-value behavior (downsampled arrays + full .npz). The main residual gaps are the undocumented semantics of alpha/length/t_end and, critically, the expected format of `initial`.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% across 8 params, so the description must compensate. It explains nx ('nx+1 grid points'), nt, and gives full structure for left/right (float vs {dirichlet|neumann|robin} dicts). However alpha, length, t_end, and especially `initial` (a string whose expected format is never stated) are left undocumented, so half the parameters still lack semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb + resource and the exact mathematical problem: 'Solve u_t = alpha*u_xx with explicit FTCS and configurable ends.' By pinning the constant-coefficient 1D heat PDE and the FTCS scheme, it clearly separates this from siblings like solve_heat_1d_variable, solve_heat_3d, and solve_burgers_1d without the agent needing to open any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied through the mathematical spec and the stability constraint ('r = alpha*dt/dx^2 <= 0.5; larger values are rejected as unstable'), which tells the agent about valid inputs but not when to choose this tool over alternatives. No alternatives (e.g. the variable-coefficient or implicit solvers) are named and there are no explicit inclusions/exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.