A Monte Carlo thermal simulator for solving heat PDEs using the Walk-on-Stars (WoS) algorithm via the zombie library. The project explores WoS as a mesh-free alternative to classical solvers (FEM) for steady-state and transient heat problems, with applications in additive manufacturing (3D printing).
Each example is verified against either an analytical solution or a deterministic FEM reference.
- Python 3.12
- The zombie Walk-on-Stars library (included as a git submodule)
# Clone the repo with submodules
git clone --recurse-submodules https://github.com/MohammadrezaMoeini/MontoThermoPOC.git
cd MontoThermoPOC
# Create and activate a virtual environment
python3 -m venv ~/.MontoThermoPOC312
source ~/.MontoThermoPOC312/bin/activate
# Install dependencies
pip install -r requirements.txtpython experimentDev/example01/example01.pySolves the Laplace equation on the unit square
PDE & boundary conditions:
| Edge | Condition |
|---|---|
| Top ( |
|
| All others |
Output:
- Example 1: WoS solution vs analytical — 2D temperature field on
$[0,1]^2$
Extends Example 01 to a 3D unit cube
PDE & boundary conditions:
| Face | Condition |
|---|---|
| Top ( |
|
| All others |
Output:
- Example 2: Analytical vs Zombie WoS solution and absolute error at three
$z$ -slices
- Example 2: 3D view of the solution at horizontal slices coloured by temperature
- Example 2: 1D cross-section along
$y=0.5$ ,$z=0.5$ — Analytical vs Zombie WoS
Solves the transient heat equation on
PDE & boundary conditions:
| Edge | Condition |
|---|---|
| Top ( |
|
| All others |
Initial condition:
Time discretisation:
Backward Euler converts the PDE into a screened-Poisson (Yukawa) equation at each step:
Zombie solves this directly with
Key constraint —
The Dirichlet boundary influence on interior points decays as
-
Increasing N_walks 10× (2 000 → 20 000) with
$\sigma = 50$ : error unchanged — not a variance issue -
Reducing
$\sigma$ from 50 to 2 ($\Delta t$ : 0.02 → 0.5): mean error dropped 9× — confirmed root cause
| Parameter | Value |
|---|---|
| dt | 0.5 s |
| sigma | 2 |
| N_steps | 6 (t_final = 3.0 s) |
| N_walks | 2 000 |
| Mean error | 0.017 |
Output:
- Example 3: WoS (top) vs analytical (bottom) temperature field at six time snapshots
- Example 3: 1D profile at
$x=0.5$ — analytical (line) vs WoS (dots) at each saved time
Solves the same problem as Example 03 deterministically using the Finite Element Method (P1 linear triangles) as a benchmark for the WoS results.
Time discretisation:
Backward Euler with the FEM system matrix
where
Output:
- Example 4: FEM (top) vs analytical (bottom) temperature field at six time snapshots
- Example 4: 1D profile at
$x=0.5$ — analytical (line) vs FEM (dots) at each saved time
- Example 4: WoS (example03) vs FEM vs Analytical — 1D profile at
$x=0.5$ , backward Euler$\Delta t=0.5$ ,$\sigma=2$
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE for details.
For commercial use, please contact the author.








