How to model a melt pool.
A laser moves across metal. It leaves a small, very hot pool. The pool leaves a tail of heat behind it. This is the physics of welding and 3D-printed metal. It is a moving, transient heat-transfer problem. We solve it on the field engine of physicsbase. We check it against the textbook.
Point a laser at a metal plate and move it. At the beam, the metal melts. One millimetre behind, it becomes solid again. A few millimetres away, it is barely warm. This moving hot spot is the melt pool. It controls the weld or the 3D-printed part: its strength, its residual stress, and whether it cracks. To predict its temperature field is a common problem in thermal engineering. It is hard, because the heat source moves. Nothing is in steady state in the lab frame. This is the moving-heat-source problem (Rosenthal 1946, and a common topic in the additive-manufacturing FEM literature). It maps well onto the transient field engine of physicsbase.
The problem
One equation governs it: \[ \rho c\,\frac{\partial T}{\partial t} \;=\; \nabla\!\cdot\!(k\,\nabla T) \;+\; Q(x, y, t) \] The heat capacity stores energy. Conduction spreads it. A source \(Q\) adds it. Here \(Q\) is a Gaussian shape that moves. Its centre slides across the plate at the scan speed. The important behaviour comes from the race between the speed of the source and the speed of diffusion. If the source moves slowly, the field is nearly circular. If it moves fast, it becomes a long tail.
Using physicsbase: two operators and a time march
The finite-element method needs two element matrices. physicsbase gives both from the same FieldQuad4 element that solves ordinary heat conduction. The conductivity operator is the spatial (diffusion) term. The capacitance operator is the transient (storage) term:
from femengine.field.elements import FieldQuad4 Ke = FieldQuad4.conductivity(cell, k, {}) # (4,4) ∫∇N·k∇N — conduction Ce = FieldQuad4.capacitance(cell, rho_c, {}) # (4,4) ∫N·ρc·N — heat storage Fc = FieldQuad4.source(cell, 1.0, {}) # (4,) ∫N — source template
Assemble those into the global matrices K and C one time. Then the transient problem becomes a march in time. We use backward Euler. It is unconditionally stable. This is important, because the steep gradient at the source would make an explicit scheme unstable. The system matrix does not change. Thus we factorise it one time. We reuse the factorisation for all 3000 steps.
# backward Euler: (C/dt + K) T_new = (C/dt) T_old + F(t) lu = splu((C/dt + K).tocsc()) # factorise ONCE — the matrix is constant for step in range(nsteps): x_src = x0 + v*step*dt # move the source this step Q_e = Q0 * exp(-r2(x_src) / (2*r0**2)) # Gaussian at each element F = assemble_source(Fc, Q_e) # re-deposit the heat at its new spot T = lu.solve(C/dt @ T + F) # ← the only thing that changes each step
What came out
We moved a 180 kW/m line source across a 10 × 5 mm steel plate at 6 mm/s. The field is clear. There is a peak of 1927 °C under the source. There is a small melt pool (the region above the ~1450 °C melting point of steel). There is heat behind the source as it moves away.
Checking it against Rosenthal
In 1946 Rosenthal wrote the exact temperature field for a moving point or line source in an infinite body. It is still the reference for every moving-source code. We take a slice along the scan line. We plot it in the moving frame of the source. physicsbase reproduces the Rosenthal shape well:
The two agree where it is important. They differ where they should. physicsbase is smoother at the peak, because our source has a finite radius and the mesh has a finite size. The Rosenthal source is a mathematical singularity. Our far tail is a little warmer, because our plate is finite and insulated. It keeps heat that the infinite Rosenthal body carries away. Neither result is an error. Both come from the boundary conditions.
Honest footnotes
This is the linear, single-phase version of the problem. It reproduces the Rosenthal analytical benchmark under those assumptions. It leaves out the parts that special additive-manufacturing codes add: latent heat, temperature-dependent conductivity and specific heat, convection in the liquid pool, and the third dimension. Those omissions change the numbers. The result is numerical benchmark evidence, not validation of a physical melt-pool process.
References
- D. Rosenthal, "The theory of moving sources of heat and its application to metal treatments," Transactions of the ASME 68 (1946), 849–866.
- "Numerical simulation of transient heat conduction with a moving heat source using Physics-Informed Neural Networks" (2025). arXiv:2506.17726
- "Modeling melt pool geometry in metal additive manufacturing" (2024). arXiv:2404.08834
examples/moving_heat.py — backward-Euler time marching on physicsbase's FieldQuad4 conductivity and capacitance operators. Read the multiphysics docs →