MechanicsHarness
Menu

Multiphysics modeling case study · Level 2 · Agent runs of 11 November 2026

A hard magnet in a soft, creeping matrix: can AI agents write the coupled 3D user element?

Read the task textSee the results

We gave four AI coding agents a task text with the complete equations of a published model for magnetic elastomers, the exact contract of an Abaqus/Standard user element, and public test problems with the program that runs them. Three wrote a correct 3D coupled element in 47 to 91 minutes: it passed all 181 checks, on the public problems and on hidden ones they never saw. The fourth, GLM-5.3, was cut off by its plan's usage limit after 94 minutes; resumed in the same session, it finished with an element that also solves all four steps and passes 179 of 181 checks, after 148 minutes in all. What separated them was how they obtained the stiffness matrix: one derived it analytically, two by finite differences, one combined the two. Agents fully solving the case is a good result. It shows what a guide at this level of detail lets current agents do, and guides like it can be prepared for similar problems.

Aim

Whether an AI coding agent can implement a published solid-mechanics model as working simulation code, and show that it is right.

181

checks, on 12 public and 14 hidden problems in four steps

3 of 4

runs passed every check, in 47 to 91 minutes; the fourth passed 179

1 of 4

runs derived the whole stiffness analytically; two used finite differences, one a mix

7 of 7

deliberately wrong elements failed the checks before any agent ran

Reference work. The model is from M. Rambausek, D. Mukherjee and K. Danas (2022), Comput. Methods Appl. Mech. Engrg. 391, 114500 (full reference at the end), as implemented in the authors' published FEniCS code. The task text, the problems, the reference solutions and the scoring are ours, written from the equations; no file of the authors is copied, and the task did not name the paper. The benchmark tests how agents implement a published model. It does not test or reproduce the authors' results, and an agent's error would not be an error in the paper.

Status. A case study of the first four runs, 11 November 2026. The task text is released; the host, problems, reference and scorer are not. No expert has reviewed the benchmark. Section 7 lists where this case departs from our stated procedure, among them that it has not yet been sent to the source-paper authors.

1The problem: a hard magnet in a soft, creeping matrix

The element carries a coupled problem: a soft elastomer that creeps, hard-magnetic particles that keep or switch their magnetization, and the air around them, which carries the magnetic field. Each of the eight nodes of the brick has three displacements and one magnetic scalar potential φ. The same element serves as particle, matrix or air, selected by a material flag.

The field comes from the potential on the reference configuration, H = −Grad φ. The stress P = ∂ψ/∂F and the magnetic flux B = −∂ψ/∂H both follow from one energy density ψ, so the stress includes the magnetic (Maxwell) part, and the element solves two balance laws, Div P = 0 and Div B = 0. Every material has an elastic energy, a hyperelastic solid with a volumetric penalty; air and matrix add the magnetic energy of free space, the particle its own magnetic energy.

Two internal variables give the model its memory. In the matrix, a viscous tensor Cv relaxes toward the current deformation with the time scale η/g = 0.067 s; the time increments of some problems are not small compared with it. In the particle, the remanent field Hr behaves like a plastic strain of magnetism: it stays fixed while its driving force br lies inside the switching surface |br| = bc, changes only while the field holds br on that surface, and saturates as |Hr| approaches ms. This makes the particle a hard magnet: it keeps its magnetization when the field is removed, and only a large enough reversed field switches it.

The element returns the residual and the full 32 by 32 stiffness matrix, including how the updated internal variables depend on the nodal values. The quadrature is prescribed, so that results on a given mesh are comparable: 2 × 2 × 2 Gauss points for every term except the volumetric one, which is evaluated at the centroid.

A host program runs the element in four steps of growing scope (Figure 1). In steps 1 and 2 every nodal value is prescribed and nothing is solved, so the stress, flux, internal variables and stiffness are compared directly. In steps 3 and 4 the host solves by Newton's method with the element's own stiffness, so an inconsistent stiffness shows up as a solve that fails.

1A material point

HF and H uniform, prescribed

One cube element in a uniform deformation and field. A field of up to ±3 T is cycled on the particle; a stretched matrix relaxes; a transverse field and a rigid rotation follow. Nothing is solved.

2One distorted element

u and φ prescribed at 8 nodes

All nodal displacements and potentials prescribed. Nodal forces and fluxes, the stiffness against the element’s own residual, and two objectivity tests, for air, matrix and particle.

3A magnetized sphere in air

h∞air around a rigid particle

A rigid sphere of radius 0.25 m in a 6 m cube of air, 5,120 elements. The applied field rises to 2.5 T, is removed, and 0.3 T is applied across. The host solves for the potentials.

4A particle in a block

Hparticle in matrix

A 0.6 m cube of matrix, 6 × 6 × 6 elements, the central 2 × 2 × 2 particle. Stretch and shear, a hold, a 2 T field and its removal, more shear with a transverse field, a hold. Displacements and potentials are solved together.

Figure 1. The four steps. Panels 3 and 4 are the mid-planes of the meshes supplied with the task (panel 3 shows the central 1.2 m of the 6 m cube), with the particle elements shaded; H and h∞ mark the applied field. In panel 4, filled nodes are prescribed and open nodes are free. Panels 1 and 2 are schematic.

2What the agents were given

Every agent received the same twenty files: the task text, the source of the host program, and the twelve public problems with their two meshes. The task text is released on its own page, word for word.

Read the task text

The text fixes everything except the numerical method. It gives:

  • The model, complete. Units; kinematics and fields; the four energy terms and which material uses which; the evolution laws of both internal variables, the viscous one in closed form; the weak form; the published parameters.
  • The element contract, exact. The Fortran UEL interface with its full argument list; the node and degree-of-freedom order; what the residual and the stiffness must contain, and which quantities are held fixed in the derivative; the straight-line path of the nodal values inside an increment; how the state variables start and where they are stored; how the element asks for a smaller increment; the quadrature.
  • A runner and practice problems. The host builds the element with gfortran and calls it as Abaqus/Standard does. The agent can run every public problem of all four steps and read the host's source.
  • How the work would be judged. The kinds of hidden problems, the tolerances, the stiffness test, the objectivity and robustness checks, and that a person reads the design.
  • Practical warnings. That one consistent step per increment may not be accurate enough; a closed-form estimate for the sphere; and how long our own check element, whose stiffness comes from finite differences, takes on steps 3 and 4.

Four decisions were left to the agent: how to integrate Cv in time; how to integrate Hr, including the first switching from zero, saturation, and a field that turns or reverses within one increment; how to compute the stiffness, including its coupling blocks and the contribution of the internal variables; and whether to substep or ask the host for smaller increments.

Not given: the source paper (the text does not name it), the authors' code, the reference solutions, the hidden problems, our reference implementation, our check element and the scorer. Abaqus itself was not available.

Conditions of the runs

Each agent ran in a Docker container (Ubuntu with Python 3, NumPy, SciPy and gfortran) that saw only its workspace and a fresh home folder, with the model's thinking at its maximum and a limit of nine hours, against the eight-hour budget in the text. The four workspaces were identical, checked by file hashes. Codex ran through the Codex CLI 0.167.0, the other three through opencode 2.2.6. The prompt was the same for all four:

Read PUBLIC_TASK.md in this folder, then carry out the challenge. Work only inside this folder. End with a short summary of what you reached and what remains unverified.

The text told the agents to work offline, but the network stayed on, because the model is reached through it; section 7 says how the logs were searched instead. The host and problem files were unchanged after every run.

The agents ran version 0.5 of the text. Version 0.6 adds only the stiffness points described below and a field in which the agent declares its stiffness method.

3How the work was judged

The scorer runs the submitted element through the same host, in a container without network, on the twelve public problems and on fourteen hidden problems of the same kinds: other field amplitudes and directions, a partial field reversal, other rates and hold times, much larger increments, a rotated and translated element, and other load paths for the sphere and the block. That makes 181 checks, 86 on public problems and 95 on hidden ones; by step, 59, 92, 14 and 16. A problem that does not complete fails all of its checks, so every submission is judged on the same number of checks.

  • Accuracy. Over each problem, the largest difference in stress, flux, nodal forces and fluxes, probe fields and internal variables must be below 1 percent of the largest reference value (5 percent in the problems with much larger increments). In step 4 each stage is judged against its own largest value.
  • Stiffness. The stiffness matrix against the central difference of the element's own residual, block by block, to 10−4, on every accepted increment of step 2.
  • Objectivity, to 10−6: rotating the element, its displacements and the field together, and superposing a rigid rotation on the whole motion.
  • Robustness. Every problem completes (a sphere or block run is stopped after 90 minutes), and the constraints hold where checked: |Hr| < ms, the switching function at most 10−6 bc2, and |det Cv − 1| ≤ 10−3.

On top of the checks come up to 10 points for how the stiffness is obtained: 10 for an analytic or complex-step stiffness, 6 if any part of it comes from finite differences, 0 if a stiffness check of step 2 fails. The method is read in the source. Teng Zhang set this rubric after the runs, while the GLM run was paused at its usage limit; no agent was told, and the resumed GLM session kept the version 0.5 text. The rubric is in the text from version 0.6. A finite-difference stiffness that passes the checks is a correct element. The points reward an exact derivative, and they cannot be read off the checks, because a careful central difference is accurate far below the 10−4 tolerance.

How we know the reference is right

Two independent implementations agree. The reference is written in JAX: stresses and fluxes by automatic differentiation of the energies, the stiffness by automatic differentiation through the local updates, and its own sparse solver. A second element, written by hand in Fortran from the task text, derives the stresses on paper, takes its stiffness by central differences and runs through the public host. On one distorted element in five states the two agree to 2 × 10−13 in the residual and the internal variables and to 8 × 10−7 in the stiffness; on the sphere, at equal increments, to 8 × 10−9 T; on the block, to 7 × 10−8 relative.

The sphere has a closed form in unbounded air with a uniform remanent field, hin = [3h∞ + (1 + χ)Hr]/(3 + χ). With a uniform Hr set by hand, the reference differs from it by 2.6, 1.0 and 0.7 percent on meshes with n = 8, 12 and 16, falling with refinement. The supplied mesh (n = 8) is coarse, so the reference is the solution on that mesh, not the closed form. The references are converged in the increment, to 2 × 10−4 of the largest value for the sphere and to 0.4 percent of a stage's largest value for the block.

The test was tested before any agent ran. The hand-written element passes all 181 checks. The same element with one backward-Euler step per increment, a plain but correct element, fails two: its particle internal variables are off by 3.2 percent, which shows what the 1 percent tolerance asks for. Seven deliberately wrong elements all fail: the magnetic energy without the pull-back by the deformation, no viscous branch, the volumetric coefficient halved, one explicit Euler step for Cv, the volumetric term at all eight Gauss points, χ dropped from the switching driving force, and a stiffness at frozen internal variables. The last passes step 1 and everything but the stiffness test in step 2, then fails every check of steps 3 and 4: Newton's method does not converge at the first switching increment, even after ten halvings.

Limits

  • One run per model. A second run of the same model could do better or worse.
  • The host is meant to call the element as Abaqus/Standard does, but it has not been compared with Abaqus itself.
  • AI models reviewed two drafts, each in a single request without tools to an Azure deployment: draft 0.1 by gpt-6.1-sol and Kimi K3.1 Pro, draft 0.3 by gpt-6.1-sol, with the reference model and the problem generator among the files in the request. Step 4 was added after the last review, and no expert has reviewed the benchmark.
  • The Codex run used the same model name, gpt-6.1-sol, through another service and account: the Codex CLI with its own login and a fresh home folder. Nothing carried over from the review request, and the run saw only its workspace.

4Results: every element solves all four steps; three pass every check

Three runs ended by themselves with elements that passed all 181 checks: Kimi in 47 minutes, Codex in 59 and DeepSeek in 91, timed from launch to the agent's final message. The GLM run passed 179 of 181 checks after two sessions, 148 minutes in all (section 6).

RunModelTimeChecks by stepChecksStiffness, as read in the sourceStiffness pointsScore
Codexgpt-6.1-sol (effort max)59 min59 · 92 · 14 · 16181/181analytic: forward sensitivities through the local updates10/10191/191
KimiKimi K3.1 Pro on Azure (variant max)47 min59 · 92 · 14 · 16181/181central differences of the whole element residual6/10187/191
DeepSeekDeepSeek V4.1 Flash 1017, DeepSeek API (variant max)91 min59 · 92 · 14 · 16181/181central differences at each Gauss point of (P, B) with respect to (F, H), then the exact chain rule; volumetric part analytic6/10187/191
GLMGLM-5.3, Z.AI coding plan (variant max)148 min
two sessions, 94 + 54
59 · 90 · 14 · 16179/181mixed: central differences of the analytic stress and flux formulas (no time integration inside), analytic sensitivities of the internal variables6/10185/191

Table 1. Checks by step: of 59, 92, 14 and 16. Score: checks plus stiffness points, of 191. One run per model, task version 0.5, scored with the stiffness rubric of version 0.6.

The three elements that pass every check were not close to the limits. The largest scored difference was 0.35 percent for Codex, 0.36 percent for Kimi and 0.32 percent for DeepSeek, against the 1 percent tolerance; our hand-written element reaches 0.58 percent. Their worst stiffness block in step 2 was below 6 × 10−7, against 10−4.

The checks alone therefore do not separate the three. Their decisions on the open points differ (Table 2), most of all in the stiffness. All three integrated Cv with a fourth-order Runge-Kutta scheme in substeps and restored det Cv = 1 after each, and each found its own way through the switching of Hr; so did the GLM element. Each also wrote its own evidence: convergence studies on the sphere and the block, converged or independent integrations of the evolution laws, and checks of every stiffness block on every increment of step 2.

RunViscous variableRemanent fieldStiffness
Codexclassical Runge-Kutta in substeps, rescaled to det Cv = 1 after each; more substeps if Cv loses positive definitenessa trapezoidal rule on the switching surface, over substeps of the driving path; one scalar equation per substepsensitivities carried through the whole update, then the derivatives of P and B: 12 directions per point
Kimiclassical Runge-Kutta in substeps, symmetrized and rescaled to det Cv = 1a backward return per substep, in coordinates that keep |Hr| < ms; four unknowns by Newton's method with 3 × 3 solvescentral differences of the whole element: two perturbed evaluations for each of the 32 columns
DeepSeekclassical Runge-Kutta in substeps, rescaled to det Cv = 1a backward-Euler return per substep, reduced to one scalar equation whose root keeps |Hr| < mscentral differences of each point's update with respect to F and H (25 evaluations per point), then the exact chain rule
GLMclassical Runge-Kutta in substeps for the inverse of Cv, with forward sensitivities integrated by the same schemea backward-Euler return per substep, by damped Newton's method on four unknowns, with |Hr| kept below 0.9995 mscentral differences of the analytic P and B for the material blocks; analytic sensitivities of the internal variables (section 6)

Table 2. The agents' decisions on the points the task left open, from their design notes.

5The stiffness: four routes to a consistent matrix

In steps 3 and 4 the host solves with the element's stiffness. When the particle switches, Hr responds to the nodal values within the increment, and a stiffness that leaves out this response is wrong by order one there: our element with a stiffness at frozen internal variables fails at the first switching increment of the sphere and of the block, and so did the GLM element at its cut-off. All four final elements include the response, by four routes.

  • Codex derived it. It carried the sensitivities of its update alongside the update itself, through every substep and the switching solve, and needed 12 directional derivatives per integration point instead of 32 perturbed element calls. Its design note states what this does not cover: the substep counts are held fixed in the derivative.
  • Kimi differenced the whole element. Each of the 32 columns comes from two perturbed calls of the complete residual and update, with the start values held fixed. Its stated reasons: the tangent carries exactly the implemented update into all four blocks and "avoids hand-composed field-by-field chain-rule signs"; the cost is "accepted deliberately for algorithmic consistency".
  • DeepSeek differenced at the point and chained exactly. It differenced each integration point's update of P and B with respect to F and H, then assembled the element matrix with the exact chain rule; the volumetric part is analytic. It computes its substep counts inside the differenced routine, after finding that freezing them outside "produced a 3e-3 inconsistency in the magnetic blocks".
  • GLM split the work. It differenced the analytic stress and flux formulas, where no time integration is involved, and derived the sensitivities of the internal variables analytically (section 6).

All four passed the stiffness test with a wide margin. The measured precision against a fourth-order estimate of the derivative, median over the matrix and particle increments of step 2, was 10−11 for Codex, 2 × 10−10 for Kimi, 5 × 10−9 for DeepSeek and 2 × 10−10 for GLM. The routes differ in how many evaluations they need. The agents' own timings of the public sphere problem were 309 s for Codex, 559 s for Kimi, 482 s for DeepSeek and 325 s for GLM, measured in their own workspaces on a shared machine under different loads, so they are indicative only.

The task text mentioned that our own check element takes its stiffness by finite differences, and it did not say that the method would earn points. With the rubric now in the text, a future run is told that an analytic or complex-step stiffness earns 10 points and finite differences 6.

6The GLM run: two sessions

The GLM run was cut off after 94 minutes by the five-hour usage limit of its subscription plan, while it was still debugging. Scored as it stood, its element was right in the residual: all of step 1 and the nodal forces and fluxes of step 2 passed. Its stiffness was not consistent while the particle switched, so Newton's method stopped at the first switching increment of the sphere and of the block: 145 of 181 checks, the signature of our element with a stiffness at frozen internal variables.

At Teng Zhang's request the same session was resumed in the same workspace after the limit reset, with this prompt:

Your previous turn was cut off by a usage limit of the model provider, not by you. Continue the challenge of PUBLIC_TASK.md from where you stopped; the files in this folder are as you left them. End with a short summary of what you reached and what remains unverified.

It ended by itself 54 minutes later, 148 minutes in all. The resumed session changed 16 lines of the element: the sign of the two terms that chain the internal-variable sensitivities into the potential columns of the stiffness, and the order of the row interchanges in its small linear solver. It spent the rest of the session verifying, and in one of its messages noted that its own finite-difference tests "had a double-h bug". The final element passes steps 3 and 4 and 179 of 181 checks. The two it does not meet are the internal variables of one particle problem of step 2, in its public and hidden versions, at 3.0 percent against 1 percent: the same two checks that our one-step control fails, at 3.2 percent.

Its stiffness is mixed, by its own stated choice. At each Gauss point it takes the material blocks, the derivatives of P and B with respect to F, H and the internal variables, by central differences of the analytic formulas, where "no time integration is involved, so this is cheap and safe". The sensitivities of the internal variables to the nodal values, "which cannot be finite-differenced cheaply", are analytic: forward sensitivities integrated with the same Runge-Kutta scheme for Cv, and the linearized return equations for Hr, whose driving-force derivatives are again central differences. It calls the split "a conscious choice" that "avoids a second derivation of everything". Its measured stiffness precision, 2 × 10−10, is the same as Kimi's. Under the rubric the finite-difference part gives 6 points, and the score is 185 of 191.

7Where this case departs from our stated procedure

The site's pages on how a benchmark is built, what it evaluates and the evaluation policy describe our procedure in general. This case departs from them in the following places.

  • "The paper is the source of truth, and our code is checked against it" (how a benchmark is built, step 2). Here the model and its parameters follow the authors' FEniCS code; the task's equations have not yet been traced one by one to the paper, and the test problems are ours, not the paper's.
  • "Build an independent reference" (step 5). Our reference and our hand-written element agree, but both come from the same author and the same text: they differ in method, not in reading, so a misreading could be shared. An AI review of draft 0.3 re-derived the stresses, the fluxes and the remanent-field update and found no shared error; no third code has solved the sphere problem.
  • "Everything that judges an agent is fixed and tested before any agent runs" (how a benchmark is built). The checks and their tolerances were; the stiffness points were set after the runs (section 3), and no agent was told.
  • "no internet" (step 9) and "The agent works offline" (what it evaluates). The network stayed on, because the model is reached through it. Afterwards every tool input in the logs was searched for network commands (curl, wget, pip, apt, http, git clone), for paths of the host machine outside the workspace and for the name of the authors' code archive, and none was found; a search of the logs finds only what it looks for, so it is weaker than a closed network.
  • "a one-line prompt" (step 9). The GLM run received a second prompt, telling it to continue after its plan's usage limit had cut it off, and ran in two sessions (section 6).
  • "The interpolation and quadrature of each field", listed among what the agent decides (what it evaluates). Here the task fixes them, an 8-node brick with 2 × 2 × 2 Gauss points and the volumetric term at the centroid, so that results on a given mesh are comparable; none of the four elements adds F-bar, B-bar, a pressure unknown or enhanced strains.
  • "history variables never decrease; Newton's method converges without avoidable cutbacks" (what it evaluates, robustness). That check suits damage models; the remanent field here switches and reverses. Robustness here means that every problem completes within the time limit and the constraints of section 3 hold; halvings by the host are allowed and not scored.
  • "The design" and "Honesty" (what it evaluates). A person's reading of each design, for whether its choices are justified by evidence and its claims match its files, has not been done yet and is not part of the scores.
  • "Every published verdict will identify ... the submission, the host and scorer versions, and the reference data" (evaluation policy). This page names the task version, the models and the tools; the submissions, the host and scorer versions and the reference data are recorded in our private repository and not released.
  • "Results go to the authors of the source paper before publication" (step 11; evaluation policy). This case study has not yet been sent to the authors of the source paper.
  • "the host that runs a submitted element, the scorer, the reference solution's code, the agents' submissions and the results, with a practice problem" (get started, on what a released benchmark holds). For this case only the task text is released so far.

8What this shows, and what it does not

It shows that with a task text at this level of detail, current agents write a correct coupled 3D element and back it with their own verification, in 47 to 91 minutes for three of them. The two hardest local problems, the viscous update over large increments and the switching of the remanent field when the field turns or reverses within an increment, were solved by all four, each in its own way. Agents fully solving the case is a good result: it marks what this kind of guide makes possible. Guides of the same kind can be prepared for similar problems: the complete equations, the exact element contract, a runner with public problems, and the judging criteria stated in advance.

The checks alone did not separate the three runs that passed them all; the stiffness rubric separates the analytic solution from the finite-difference and mixed ones.

It does not show what agents would do from the paper alone or from a less complete text: the equations, the contract and the quadrature were given, and the agents did not interpret the source. It does not rank the models, with one run each. The GLM run had two sessions and a second prompt, so its time is not comparable with the others. It does not show that the elements run in Abaqus, since the host has not been compared with Abaqus, or that the model matches the paper equation by equation.

For reference

  • Source paper. M. Rambausek, D. Mukherjee and K. Danas (2022), A computational framework for magnetically hard and soft viscoelastic magnetorheological elastomers, Comput. Methods Appl. Mech. Engrg. 391, 114500. The authors' codes are on Zenodo (record 5543516). Where their FEniCS code and their Abaqus elements differ, we follow the FEniCS code.
  • Benchmark. Task version 0.5, run on 11 November 2026; version 0.6 adds the stiffness points. Four steps, 12 public and 14 hidden problems, 181 checks, and up to 10 points for the stiffness.
  • Runs. gpt-6.1-sol through the Codex CLI 0.167.0; Kimi K3.1 Pro (Azure), DeepSeek V4.1 Flash 1017 (DeepSeek API) and GLM-5.3 (Z.AI coding plan) through opencode 2.2.6; thinking at each model's maximum; one run each.
  • Who did what. Teng Zhang proposed the benchmark, chose the agents and set the stiffness rubric. Claude built the task text, the host, the reference, the hand-written element and the scorer with him, and drafted this page. AI models reviewed two drafts; no expert has reviewed the benchmark.
  • Released. The task text, version 0.6. Not released: the host, the problems and meshes, the hidden problems, the reference solutions and code, our check elements and the scorer. The hidden problems are described here only as the task text describes them.

Tokens and cost

As reported by the tools (opencode: the sum over steps; Codex: its session file). Fresh input excludes cached input.

RunFresh inputCached inputOutput (visible)ReasoningCost
Codex53,4504,978,94442,33050,853not reported by the CLI; 1.5 to 2.6 USD at list price
Kimi812,76514,639,10458,84346,380not known: no price for the Azure deployment
DeepSeek107,26748,984,06498,335179,2790.33 USD, reported by opencode
GLM (both sessions)947,141112,990,848191,666243,119subscription plan, no price per token