---
title: Heat Solver
description: A C++ heat equation solver with serial and OpenMP builds, a plain Makefile and a Devbox environment.
date: 2024-09-23T22:00:00.000Z
updateDate: 2026-11-23T23:00:00.000Z
repoURL: "https://public.omerduran.dev/omer/parallelheatequationsolver/"
canonical: "https://omerduran.dev/projects/heat-solver"
---

A compact numerical exercise: the one-dimensional heat equation solved with an explicit finite-difference stencil, once serially and once with OpenMP, from the same code.

> Written for a university assignment; kept public as a small, readable example of parallelising a stencil loop.

## What it does

- Solves the heat equation on a line of `nx` points, starting from a hot spot in the middle.
- Ships `solve_serial` and `solve_parallel` behind the same header and call signature, so the two implementations differ only in how the loops are scheduled.
- The parallel version spreads both the update and the write-back across threads with `#pragma omp parallel for`.
- A plain Makefile builds `bin/heat_solver`; Devbox pins the compiler and OpenMP runtime.

## Build and run

```bash
devbox shell    # optional
make
./bin/heat_solver
```

Without Devbox, any C++ compiler with OpenMP support works.

## Layout

```
include/heat_solver.h   interface
src/heat_solver.cpp     serial and parallel solvers
src/main.cpp            driver
Makefile
devbox.json
```

## Scope

No dependencies beyond the compiler and OpenMP, no input formats and no solver options — the project exists to show the shape of a parallel stencil update, not to be a production PDE solver.
