A 99‐Line FEM Code for Simulating a Moving Point Heat Source Over a Domain

ABSTRACT Simulating transient heat transfer is crucial for computational thermal analysis in manufacturing processes such as arc welding, laser powder bed fusion, and directed energy deposition. These processes feature moving heat sources that generate steep spatial and temporal temperature gradients, which in turn strongly influence microstructure formation, residual stress development, distortion, and final mechanical properties. As a result, accurate and efficient simulation tools are invaluable for both research and industrial applications. This tutorial presents a streamlined, Python‐based finite element (FE) framework for simulating three‐dimensional transient heat conduction with a moving Gaussian heat source over a parallelepiped domain. Distinct from complex commercial or open‐source FE codes, this approach uses the lightweight and transparent scikit‐fem library for spatial discretization. This enables efficient assembly of system matrices and clear correspondence between mathematical formulation and code implementation. Time integration is handled using the generalized ‐method, covering Forward Euler, Backward Euler, and Crank–Nicolson schemes; the Crank–Nicolson option () is chosen for its unconditional stability and second‐order accuracy. Nonlinear boundary conditions due to combined convective and radiative heat losses are included via Newton–Raphson iteration with an analytically derived Jacobian. Each Newton linear system is solved using a conjugate gradient algorithm preconditioned by algebraic multigrid (AMG), ensuring efficiency for moderately fine three‐dimensional meshes. The complete simulation code is concise, at roughly 99 lines, making it well‐suited for teaching, self‐study, or rapid prototyping. The resulting temperature fields are benchmarked against published FEniCS results for the same moving heat source scenario, exhibiting a relative field difference of only 1.5%.

Authors

Institutions

Publication Details

Journal
Computer Applications in Engineering Education
Published
2026-07-01
DOI
https://doi.org/10.1002/cae.70226
Primary Topic
Heat Transfer and Optimization
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

A 99‐Line FEM Code for Simulating a Moving Point Heat Source Over a Domain

Suparno Bhattacharyya
Computer Applications in Engineering Education
Heat Transfer and Optimization
article

A 99‐Line FEM Code for Simulating a Moving Point Heat Source Over a Domain

Suparno Bhattacharyya
article en

Abstract

ABSTRACT Simulating transient heat transfer is crucial for computational thermal analysis in manufacturing processes such as arc welding, laser powder bed fusion, and directed energy deposition. These processes feature moving heat sources that generate steep spatial and temporal temperature gradients, which in turn strongly influence microstructure formation, residual stress development, distortion, and final mechanical properties. As a result, accurate and efficient simulation tools are invaluable for both research and industrial applications. This tutorial presents a streamlined, Python‐based finite element (FE) framework for simulating three‐dimensional transient heat conduction with a moving Gaussian heat source over a parallelepiped domain. Distinct from complex commercial or open‐source FE codes, this approach uses the lightweight and transparent scikit‐fem library for spatial discretization. This enables efficient assembly of system matrices and clear correspondence between mathematical formulation and code implementation. Time integration is handled using the generalized ‐method, covering Forward Euler, Backward Euler, and Crank–Nicolson schemes; the Crank–Nicolson option () is chosen for its unconditional stability and second‐order accuracy. Nonlinear boundary conditions due to combined convective and radiative heat losses are included via Newton–Raphson iteration with an analytically derived Jacobian. Each Newton linear system is solved using a conjugate gradient algorithm preconditioned by algebraic multigrid (AMG), ensuring efficiency for moderately fine three‐dimensional meshes. The complete simulation code is concise, at roughly 99 lines, making it well‐suited for teaching, self‐study, or rapid prototyping. The resulting temperature fields are benchmarked against published FEniCS results for the same moving heat source scenario, exhibiting a relative field difference of only 1.5%.

Computer Applications in Engineering EducationVol. 34(4)
Indian Institute of Technology Dhanbad (IN)
Openalex Percentile: Top 12%
Heat Transfer and Optimization
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

A 99‐Line FEM Code for Simulating a Moving Point Heat Source Over a Domain — Suparno Bhattacharyya · Computer Applications in Engineering Education (2026) | TGRS Research Map | TGRS