Haoming Luo · LabAgentFEM ↗

AGENTFEM / GETTING STARTED

Your first finite element analysis with AI

Six short exercises with prompts to copy. Obtain a result, then change one condition.

Before you start

Check that your AI assistant can run AgentFEM. For example, Codex can use a local command line or MCP tools with your permission. A chat-only assistant without access to computation tools cannot run these simulations.

Open a project folder for your exercises and send this to your AI assistant:

Send to your AI assistant

Check whether you can run AgentFEM. Tell me its version and where projects will be saved. Ask for my approval before installing or configuring anything. For now, check the environment only; do not start a simulation.

Once the environment is ready, send the instructions below. Wait for the reply, then choose an exercise and send its prompt.

Send to your AI assistant

I will send an exercise next. Once you receive it, create a new AgentFEM project, check and run it, and save the model and results. Show only one result figure, key values with units, and a two- or three-sentence explanation. Avoid lengthy analysis. Tell me if essential information is missing or you cannot run it. For now, reply only: ‘Ready. Please send the exercise.’ Do not start calculating or guess the exercise.

Not installed? Ask your AI assistant

Send this prompt to an AI assistant with access to your computer, and approve the requested steps.

Send to your AI assistant

Install AgentFEM for me: https://github.com/haoming-luo/agentfem . Follow INSTALL.md, read AGENT_GUIDE.md, and run agentfem doctor. When finished, briefly report the version and check result.

After installation, continue with the environment check above.

01

Start with a deformed shape

How far will this beam deflect?

Clamp the left end of a steel beam and apply a downward load at the right end. Look at the bent shape, then read the tip deflection.

Send to your AI assistant

Use AgentFEM to analyse a steel cantilever beam: length 200 mm, height 20 mm, thickness 10 mm, Young’s modulus 210 GPa and Poisson’s ratio 0.3. Fix the left end and distribute a total downward force of 200 N uniformly over the right end face. Use a 2D plane-stress, small-displacement linear-elastic model and neglect gravity. Show the deformed shape and the downward displacement at the midpoint of the right end (mm). State the deformation scale factor on the figure.

Cantilever displacement field, fixed at the left and loaded downwards at the right. Deformation magnified 15 times.
Reference results computed with AgentFEM

What to look for

A deformed-shape plot and the downward displacement at the midpoint of the right end. The left end stays fixed; displacement increases towards the tip.

Reference tip deflection: 0.383 mm

Locate the midpoint of the right end, then check the value and its units. Deformation is magnified 15 times in this figure; the actual deflection is about 0.38 mm. Beam theory gives approximately 0.381 mm, a useful magnitude check.

Modelling notes

Include the 10 mm thickness when converting total force to traction in the 2D model: the uniform end traction is 1 MPa. The reference uses quadratic elements on an 80 × 8 mesh. Stress peaks at the clamped corners are not a basis for a strength assessment.

02

A different loading problem

How much does internal pressure expand a cylinder?

Apply uniform internal pressure to a thick-walled cylinder. Measure the outward movement of the inner wall and compare it with the outer wall.

Send to your AI assistant

Use AgentFEM to analyse a thick-walled cylinder: inner radius 25 mm, outer radius 50 mm, length 100 mm, Young’s modulus 210 GPa and Poisson’s ratio 0.3. Apply 10 MPa internal pressure, leave the outer wall radially free and apply no end-cap load. Use a linear-elastic axisymmetric model with zero axial displacement throughout. Report how far the inner wall expands outward (μm), plot radial displacement from the inner to the outer wall, and compare with Lamé’s analytical solution.

Pressurised cylinder cross-section and radial displacement profile, comparing finite elements with Lamé’s analytical solution.
Reference results computed with AgentFEM

What to look for

The inner-wall radial displacement and a displacement profile from the inner to the outer wall. Radial displacement is the distance moved outwards along the radius.

Reference inner-wall expansion: 2.270 μm

The annulus shows the cylinder’s cross-section. The curve plots radial displacement against radius, showing how far each point moves outward. The finite element results should agree closely with Lamé’s analytical solution.

Modelling notes

This idealised long cylinder has zero axial strain. It is not a freely extending or end-capped pressure-vessel model. The reference uses quadratic elements on a mesh with 40 radial and 4 axial divisions; inner-wall displacement agrees with Lamé’s solution.

03

From mechanics to heat transfer

How hot is the centre of the plate?

Keep the left side of a metal plate hot and the right side cold. Once temperatures stop changing, what is the temperature at the centre?

Send to your AI assistant

Use AgentFEM for 2D steady-state heat conduction in a metal plate: length 100 mm, height 40 mm and uniform thermal conductivity 45 W/(m·K). Hold the left boundary at 100 °C and the right at 20 °C. Insulate all other boundaries and use no internal heat source. Show the temperature field, centre temperature (°C), temperature profile along the horizontal centreline and rightward heat flux density (W/m²).

Temperature field in a rectangular metal plate: 100 °C on the left, 20 °C on the right and 60 °C at the centre.
Reference results computed with AgentFEM

What to look for

A temperature field that cools from left to right, and the centre temperature. Steady state means temperature no longer changes with time.

Reference centre temperature: 60.0 °C

The centre lies halfway between the two ends. With uniform material, no internal heat source and insulated top and bottom boundaries, temperature varies linearly along the length. The centre is therefore at 60 °C.

Modelling notes

This is solid heat conduction only, without airflow or thermal stress. The reference mesh is 80 × 16. Temperatures are computed in K and displayed in °C.

04

Now follow the evolution

How does the plate warm up?

Use the same plate, initially at 20 °C throughout. This time, follow the heating process rather than looking only at the final state.

Send to your AI assistant

Use AgentFEM to simulate transient heating of a 2D metal plate: length 100 mm, height 40 mm and initial temperature 20 °C. Keep thermal conductivity 45 W/(m·K), density 7800 kg/m³ and specific heat capacity 500 J/(kg·K) constant. From the start of heating, hold the left boundary at 100 °C and the right at 20 °C. Insulate all other boundaries and use no internal heat source. Run to 600 s using backward Euler with a 2 s time step. Provide the centre-temperature curve and data table (°C). Save the temperature field every 10 s as a time series playable in ParaView.

Centre temperature rising from 20 °C towards 60 °C over time. The dashed line marks the 60 °C steady state.
Reference results computed with AgentFEM

What to look for

A rising centre-temperature curve and a temperature-field time series that you can play as an animation.

Centre temperature at 600 s: 59.94 °C

The centre does not reach 60 °C instantly: heat must travel from the left. Notice when the temperature begins to rise appreciably and when the curve flattens. Compare it with the previous steady-state result.

Modelling notes

The reference uses backward Euler with 300 increments. Equilibrium is not imposed at 600 s; 59.94 °C is the computed temperature at that time. Keep the XDMF file with its accompanying H5 file. Open the XDMF file in ParaView, select Temperature and play the time series.

05

From deformation to instability

How much compression can a slender column carry?

As compression increases, does sideways displacement remain proportional to the load? Plot the response and see what happens near Euler’s critical load.

How much compression can a slender column carry?
Send to your AI assistant

Use AgentFEM to compress a slender column gradually: length 200 mm, section 10×10 mm, E=210 GPa, Poisson’s ratio 0.3. Clamp the left end and apply uniform compression along the original axis at the right end; leave other boundaries free. Use a linear elastic material with geometric nonlinearity. Add the first buckling shape as an initial bow of amplitude 0.1 mm. Increase total force from 0 to 10.7 kN. Plot force against lateral tip displacement and compare with Euler’s critical load. Show several deformed shapes, explain in two or three sentences.

Computed column load–lateral displacement curve with the ideal Euler critical load marked.6 / 9 / 10.7 kN · ×1
Reference results computed with AgentFEM

What to look for

A load–lateral displacement curve and deformed shapes at several loads.

Euler critical load: 10.795 kN

Lateral displacement grows much faster near this load. An initially curved column bends smoothly; it does not jump from perfectly straight to bent at one point.

Modelling notes

Requires an AgentFEM version supporting geometric nonlinearity and plane-stress StVK elasticity. Use quadratic elements and incremental loading. The bow is stress-free geometry, not an imposed displacement. Do not prescribe uniform axial displacement over the right face: that prevents rotation and changes the critical load. This is an ideal elastic stability exercise, without steel yielding. Reference run: N, mm, MPa; 80×4 quadratic mesh, quadrature degree 4, Newton absolute residual tolerance 1e-7; maximum precritical load 10.7 kN.

06

Geometry changes the response

Why does it get wider when stretched?

A solid plate usually narrows when stretched. A re-entrant honeycomb made of the same material can widen. Download and unzip the mesh pack, then give the folder to your AI assistant.

Why does it get wider when stretched?

Download mesh

Send to your AI assistant

Use AgentFEM to import the attached honeycomb.msh without redrawing the geometry. Coordinates are in metres; width 51.9615 mm, height 60 mm. Boundary tags 11/12/13/14 mean left/right/bottom/top. Use small-strain linear elasticity in 2D plane stress, E=1 GPa and Poisson’s ratio 0.3; neglect gravity. Fix horizontal displacement on the left and impose a horizontal extension of 0.1% of the width on the right. Leave vertical motion free except at the lowest node on the left boundary (honeycomb: x=0, y=5 mm; solid plate: bottom-left corner). Use mean displacements on all four boundaries to calculate axial and transverse strains and apparent Poisson’s ratio. Compare with a solid plate of the same size, material and constraints. Show both deformed shapes side by side with their original outlines; magnify displacement 100 times and label the factor.

At equal horizontal strain, the solid plate contracts vertically and the re-entrant honeycomb expands; displacement magnified 100 times, with original outlines.
Reference results computed with AgentFEM

What to look for

Deformed honeycomb and solid plate, their axial and transverse strains, and apparent Poisson’s ratios.

Honeycomb about −1.30; solid plate 0.30

Both extend horizontally; the honeycomb expands vertically while the plate contracts. The negative ratio comes from geometry: the constituent material still has Poisson’s ratio 0.3.

Modelling notes

The pack contains baseline and refined meshes, boundary definitions and a geometry generator. Inclined ligament 10 mm, vertical ligament 15 mm, wall width 1.2 mm, angle −30°, 3×3 rectangular periods; disconnected boundary fragments are removed. Use quadratic displacement elements. Apparent Poisson’s ratio is minus transverse strain divided by axial strain, not the effective ratio of an infinite periodic material.

Use the same approach for your next problem

Be more specific than “run a simulation”: what structure, what loads or heating, and what results? These are the essentials of a useful prompt. You do not need to write it like a program.

You do not have to supply every detail on the first try. State what you know and ask the assistant to clarify missing conditions. Once you have a result, ask: “What happens if I change only this condition?”

If you only get code, or the results differ

Ask: “Run the calculation and open the result figure. Tell me where the project and output files are saved. If it fails, explain why; do not present an expected result as a computed one.” For small numerical differences, check units, loads, constraints, elements and mesh, then the time step. Matching colours alone are not a useful check.

Exercises 1–4 were computed on 2026-10-07; exercises 5–6 use AgentFEM updated on 2026-10-10, with DOLFINx 0.11.0.Values and version record;Results for exercises 5–6. These introductory models are not engineering safety assessments.