Skip to main content

Lab 4 — Simulate a melt pool with open-source codes

📍 Where we are: Part VI · Starting Your Own Research — Chapter 16 of 19. Parts I–V described what goes wrong in the melt and why simulation is hard; this lab runs the simplest physics-based models yourself and checks them against a public measurement. Lab 5 then works with measured data instead.

The simple version

Imagine predicting how wide a puddle of melted butter a hot knife drags across a cold pan. A back-of-the-envelope formula gives an answer in a second. A full computer model of the heat, the swirling liquid and the freezing gives a better answer but takes minutes and needs many settings you have to guess. The honest test is to measure a real puddle and see which prediction lands closer, and to notice that the settings were tuned, so a good match proves less than it seems.

What this chapter covers​

You will run, on a laptop, (1) a Python implementation of Rosenthal's moving-point-source solution, (2) ORNL's open-source AdditiveFOAM, a heat-and-mass-transfer solver built on OpenFOAM, on its AMB2018-02-B tutorial, and (3) ExaCA, a cellular-automaton grain-growth code fed with AdditiveFOAM's temperature history. The results are compared with the NIST AM Bench 2018 single-track measurements on nickel alloy IN625. All code is in examples/lab-process-simulation/. Every number below is from our own run on 2026-11-15 unless a citation says otherwise.

Problem​

The melt pool is where defects start, but it is a hundred micrometres wide and cannot be sampled everywhere. Simulation is the only way to explore parameters without printing. A beginner in process-physics research needs a first working pipeline and, more importantly, a sense of which of its outputs are trustworthy. The public benchmark used here is AMB2018-02: ten single laser tracks on bare IN625 plates, with cross-section width and depth measured by microscopy and melt-pool length by thermography [1]; the organisers' overview of the 2018 benchmark outcomes is [2].

State of the art: three models, in order of cost​

ModelWhat it solvesNeedsRun time here
Rosenthal 1946 [3]Conduction from a moving point source, constant propertiesPython + NumPyabout 1 min for 6 cases
AdditiveFOAM 2.0.0 [4]3-D heat transfer with latent heat, temperature-dependent properties, Marangoni flowDocker7.5 s at 20 µm cells
ExaCA 2.1.0 [5]Nucleation and grain growth on the thermal historyDocker24 s

Three simulators on the AMB2018-02 case B track: Rosenthal, AdditiveFOAM and ExaCA, with a bar chart of simulated and measured melt-pool width and depth. Pipeline of the lab and the case B melt-pool width and depth predicted by each model next to the NIST measurement. Original diagram by the authors, created with AI assistance.

Step 1. Rosenthal in Python​

Rosenthal's solution for a point source moving at speed v over a thick plate is a closed form: the temperature rise is q divided by 2πkR, times an exponential in v(R plus ξ) over twice the thermal diffusivity, with R the distance to the source and ξ the coordinate along the track [3]. It assumes constant properties, no latent heat, no convection and no surface losses. A modern comparison of this equation with finite-element results for laser powder bed fusion of Inconel 718 found both reasonable for melt-pool shape, but the Rosenthal answer much more sensitive to the assumed absorptivity, and too wide at keyholing conditions [6].

cd examples/lab-process-simulation
python3 -m venv .venv && .venv/bin/pip install -r python/requirements.txt
make test # four self-checks, 0.2 s
make rosenthal # ~1 min

The code uses IN625 properties from AdditiveFOAM's own material file (density 7569.92 kg/m3, specific heat 579.28 J/kg/K, conductivity 8.275 plus 0.01472 T W/m/K, solidus 1410 K, liquidus 1620 K) and evaluates the constant conductivity at the mean of 300 K and the solidus, 20.9 W/m/K. That choice is ours; it is one of the knobs. A point source has infinite temperature at its centre, so the script also integrates the same kernel over a Gaussian disc (D4σ 170 µm, the AMMT laser) as a second variant. Output from our run (Python 3.14.6, NumPy 2.5.4; an independent re-run with NumPy 2.5.5 gave identical numbers; absorptivity 0.33, solidus isotherm, micrometres):

case source k[W/mK] length width depth
A point 20.9 340.0 140.0 70.0
A gaussian 20.9 342.0 176.0 57.0
B point 20.9 424.0 116.0 58.0
B gaussian 20.9 396.0 162.0 45.0
C point 20.9 418.0 96.0 48.0
C gaussian 20.9 358.0 148.0 34.0

Cases A, B and C are the benchmark's three power and speed pairs (the true laser powers, 137.9, 179.2 and 179.2 W, at 400, 800 and 1200 mm/s [1]). The test file checks the closed form on the track axis, that the Gaussian variant collapses onto the point source when it is made narrow, and that the quadrature is converged.

Step 2. Build the AdditiveFOAM image​

AdditiveFOAM 2.0.0 requires the OpenFOAM Foundation's OpenFOAM-14 [4] [7]. No ready-made OpenFOAM-14 Docker image exists (the Foundation's Docker Hub images stop at version 11 as far as we found), but the Foundation publishes an Ubuntu 24.04 package for arm64 as well as amd64, so the image installs that package and compiles AdditiveFOAM at the 2.0.0 tag.

make images

On our arm64 host this took about 7.7 minutes for the first build (mostly downloading and installing the OpenFOAM package and its dependencies), about 1.5 minutes more to rebuild once we fixed an error described under When it breaks, and about 1 minute of that is the AdditiveFOAM compile. ExaCA 2.1.0 on Kokkos 4.5.01 (OpenMP backend) added 28 seconds. An independent clean rebuild on 2026-11-15 (--no-cache, same host) took 3 min 56 s for the first image and 24 s for ExaCA, so treat the times above as machine- and network-dependent. We did not try spack, the other install route; the Foundation's package was enough.

Step 3. Run the tutorial​

make run # docker/run-amb2018.sh dx20

The script copies the tutorial AMB2018-02-B, switches on its three post-processing function objects (meltPoolDimensions, solidificationData, ExaCA, shipped disabled) and runs ./Allrun: blockMesh, decomposePar into 8 ranks, additiveFoam, then reconstruction. The case is a 2 mm track at 0.8 m/s with the true 179.2 W, absorptivity 0.33 and a super-Gaussian source with 85 µm second-moment radius, on IN625 with a flat top boundary carrying a Marangoni condition and convective-radiative cooling. The base mesh is 150 by 25 by 15 cells (20 µm, 56,250 cells). Our run: 7.5 s wall time, 4 ms simulated (4.9 s in an independent re-run on 2026-11-15, with identical melt-pool CSVs).

meltPoolDimensions writes one CSV per isotherm, 1410.csv (solidus) and 1620.csv (liquidus), each with the length, width and depth of the bounding box of that isotherm. Averaging the steady part of the track (1.0 to 1.5 ms):

.venv/bin/python python/summarize_pool.py work/dx20
solidus length 391.3 +- 1.6 width 137.3 +- 0.1 depth 43.7 +- 0.0 (um, mean +- sd over window)
liquidus length 250.6 +- 1.2 width 118.5 +- 0.1 depth 36.8 +- 0.1 (um, mean +- sd over window)

Step 4. Check mesh convergence​

A 20 µm cell is coarse for a pool 44 µm deep. Refine and repeat:

docker/run-amb2018.sh dx10 300 50 30 0.0016 # 450,000 cells, 50 s
docker/run-amb2018.sh dx5 600 100 60 0.001 # 3,600,000 cells, 14 min 52 s
CellsSolidus widthSolidus depthLiquidus widthLiquidus depthWall time
20 µm137.343.7118.536.87.5 s (4 ms simulated)
10 µm140.943.4123.636.150 s (1.6 ms simulated)
5 µm140.943.6123.836.214 min 52 s (1 ms simulated)

The width and depth changed by under 3 percent from 20 to 5 µm cells, and not at all between 10 and 5 µm. The coarse tutorial mesh is adequate for these two outputs; we did not test length convergence beyond its agreement within about 1 percent (solidus length 391, 390, 390 µm).

Step 5. Grain growth with ExaCA​

ExaCA is a cellular-automaton code for nucleation and grain growth under additive-manufacturing conditions [8].

make exaca # docker/run-exaca.sh dx20

The function object wrote ExaCA/time-temperature.csv (413,815 solidification events) and an input file. ExaCA ran 8 MPI ranks in 23.6 s total (15.6 s of cellular-automaton time), then ExaCA-GrainAnalysis summarised the result (an independent re-run took 12.0 s for the ExaCA step and printed the same grain statistics; the 10 µm mesh took 30 s instead of 50 s and gave the same table row):

-- There are 8591 grains in this volume , and the mean grain volume is 1041.169556 cubic microns
-- The mean grain aspect ratio (Z direction to transverse) is 1.135104
-- The volume fraction of the region consisting of nucleated grains is 0.004082

The 2.5 µm cell domain spans 812 by 47 by 15 cells, about 2.0 mm by 115 µm by 35 µm. The nucleation parameters (density, mean undercooling) and the grain-orientation files come from the tutorial and ExaCA defaults. We did not compare these grains with the NIST EBSD data for case B, so the grain statistics are a demonstration that the coupling runs, not a validation.

Why it is hard: compare with the measurement, and with yourself​

NIST's reference values for case B on the AMMT machine are width 123.5 µm and depth 36 µm from cross-sections, and a melt-pool length of 359 µm from thermography [1] [9] [10]. The paper reports standard uncertainties of the mean of 1.9 µm (width), 0.6 µm (depth) and 3.7 µm (length), and NIST notes that class averages indicate stochastic variability of the process [9] [10]. The scale of that uncertainty matters below.

Model (case B)Width µmDepth µmLength µm
NIST AMMT measurement123.536.0359
AdditiveFOAM, solidus, 5 µm cells140.9 (+14 %)43.6 (+21 %)389.6 (+9 %)
AdditiveFOAM, liquidus, 5 µm cells123.8 (+0.2 %)36.2 (+0.6 %)258.8
Rosenthal, point source116 (-6 %)58 (+61 %)424 (+18 %)
Rosenthal, Gaussian source162 (+31 %)45 (+25 %)396 (+10 %)

Read this table carefully, because it is easy to over-read.

  • The liquidus match is not independent validation. The tutorial README states that its absorption and heat-source dimensions were calibrated to the AMB2018-02 single-track data [4] [11]. A near-perfect liquidus width and depth is therefore partly built in. Which isotherm the etched fusion line represents is an interpretation choice: the solidus gives 14 and 21 percent over, the liquidus 0.2 and 0.6 percent. The measured length used the solidus (NIST assumed 1290 °C), so the liquidus length is not comparable; the solidus length is 9 percent long.
  • Rosenthal's width looks good by luck. The point source has the correct width but a depth 61 percent too large, because the absorbed power sits at one point. Spreading it over the real beam fixes the depth partly and spoils the width. Its inputs are also soft: the sweep below shows the answer moves far more than the measurement does.
  • Disagreement is larger than measurement error. All simulated values differ from the measurement by many times the 0.6 to 3.7 µm uncertainty of the mean, so differences are real model differences, not noise. Rosenthal-type models cannot be tuned out of this by a single factor because width and depth respond differently to it.

How much do the uncalibrated inputs matter?​

make rosenthal also runs sweep_uncertainty.py: case B, Gaussian source, absorptivity 0.25 to 0.45, conductivity 16 to 30 W/m/K:

eta k[W/mK] width depth
0.25 16.0 148.0 36.0
0.33 22.4 160.0 44.0
0.45 30.0 172.0 54.0

(three of the nine rows; the full table is in expected/rosenthal_sweep.txt). Across the grid, width spans 136 to 180 µm and depth 32 to 58 µm, a spread of roughly 40 µm in width and 26 µm in depth from two numbers nobody measured for this plate. Absorptivity is not even a constant: in-situ calorimetry showed that effective absorptivity rises once recoil pressure starts to depress the surface [12]. For AdditiveFOAM the same applies to its constant 0.33, and to the thermophysical properties above the solidus, which are extrapolated. Our own mesh test shows that numerical error is not the dominant uncertainty here; calibration is.

What the model cannot claim​

  • Keyholes and porosity. Case B is a conduction-mode track. The tutorial's top boundary is a fixed flat wall with a Marangoni condition (0/U, system/blockMeshDict), so the free surface cannot deform and no vapour depression forms. Above the keyhole threshold, which ultrahigh-speed X-ray imaging located and characterised [13], these models fail first, and Rosenthal over-predicts width there [6]. Keyhole-pore formation requires a resolved vapour cavity.
  • Spatter and denudation. These come from vapour-driven flow and recoil pressure, which mesoscale simulations with a free surface have reproduced [14]; neither this heat-transfer-and-Marangoni setup nor Rosenthal contains them.
  • Powder. AMB2018-02 is a bare plate on purpose, to remove powder from the problem [1]. Real powder-bed tracks add absorption and conductivity changes the tutorial does not test.
  • Cooling rate. The solidification data give a median cooling rate near 2.1 million K/s in our dx20 run, the same order as the roughly 1 million °C/s NIST measured for case B, but NIST itself flags its cooling rates as exemplar rather than reference data because of motion blur and calibration-range limits [9], and the temperature intervals differ. We draw no conclusion from the match.
  • Grain structure. See Step 5: unvalidated here.

When it breaks​

  1. apt refuses the OpenFOAM package. Our first image build failed after about seven minutes with "Redirection from https to 'http://downloads.sourceforge.net/…' is forbidden": the Foundation's apt repository redirects package downloads to HTTP on SourceForge. Fix: download the .deb with curl -L and apt-get install the local file, which is what the Dockerfile now does.
  2. additiveFoam: command not found for the unprivileged user. Building as root installs the binaries under /root/OpenFOAM. The Dockerfile now builds as the user sim.
  3. Wrong CPU architecture. The .deb URL is for arm64. On an amd64 machine change binary-arm64 and _arm64 to the amd64 names (the Foundation lists both architectures; we only ran arm64).
  4. Python version. AdditiveFOAM's own Python tools require Python 3.10 to 3.12; the image uses Ubuntu's 3.12. Our host Python 3.14 was used only for the Rosenthal scripts.
  5. ExaCA run from the wrong directory. Run it from the case directory, since input.json uses relative paths.
  6. No space left on device in a container. On our host the Docker VM disk was full: additiveFoam died at mpirun with orte_session_dir failed (log.additiveFoam says mkdir ... No space left on device), and a fresh apt-get update failed with "repository ... is not signed". Free space (docker builder prune -af, docker image prune) and rerun; both errors vanished.
  7. Quadrature singularity. Our first Gaussian-source version returned a width of 206 µm for every case, because a field point sat exactly on a source point. A small softening length (0.28 of the cell size) fixed it; the test file guards the converged result.

What to try next​

  1. Switch the refinement model in constant/heatSourceDict from none to targetCellLoad (documented in the tutorial README) and compare cost with uniform 5 µm cells.
  2. Run cases A and C: edit constant/scanPath (power 137.9 W, speed 0.4 m/s; or 1.2 m/s) and compare with the measured 147.9/42.5 µm and 106/29.6 µm [10].
  3. Use the project's heat-source calibration tutorial (tutorials/heatSourceCalibration) to calibrate against case A and test on B and C: a held-out check the tutorial does not give you.
  4. Replace the constant absorptivity by a power-dependent curve and see whether Rosenthal's width and depth can match at the same time.
  5. Download the NIST bright-field cross-section images, measure width and depth yourself, and see how much your answer varies by operator.

Why it matters​

Process simulation is how the field proposes to reduce trial-and-error printing, but a model with two or three tuned parameters can match one track exactly and still say little about the next. Doing this lab shows the three honest questions to ask any melt-pool result: was it calibrated on the same data, how sensitive is it to inputs nobody measured, and which physics is missing?

In the real world​

AdditiveFOAM is released by Oak Ridge National Laboratory under GPL-3.0 or later and has a peer-reviewed software paper [15]; ExaCA is an MIT-licensed code from the Exascale Computing Project [5]. The two codes are designed to be coupled, as in Step 5. Our timing is a laptop result on a 20 µm mesh; production simulations of multi-layer parts are far larger, and the cost grows steeply with finer cells (here from 7.5 s for 4 ms of simulated time at 20 µm to 14 min 52 s for 1 ms at 5 µm).

Key terms​

  • Rosenthal solution — closed-form temperature field of a point heat source moving over a thick solid with constant properties.
  • Absorptivity — fraction of laser power that becomes heat in the metal; a calibration parameter in simulations.
  • D4σ diameter — beam diameter defined from the second moment of the intensity, used to specify laser spot size.
  • Solidus and liquidus — temperatures at which melting begins and ends; here 1410 K and 1620 K in the model's IN625 file.
  • Isotherm — surface of constant temperature; the melt-pool boundary in a model is one of these.
  • Marangoni flow — liquid motion driven by surface-tension differences caused by temperature differences.
  • Conduction mode — melting without a vapour cavity, giving a shallow rounded pool.
  • Keyhole mode — melting with a deep vapour cavity, a source of pores and a failure regime for simple models.
  • Cellular automaton (CA) — a model that updates cells by local rules; ExaCA uses it for nucleation and grain growth.
  • Calibration — tuning uncertain model inputs so that outputs match a measurement.
  • Mesh convergence — checking that results stop changing as cells are made smaller.

Where this leads​

Lab 5 works with measured melt-pool data from the NIST AM Bench 2022 benchmark and shows how a split that ignores the experiment design inflates a machine-learning score.