A collection of PETSc examples for learning parallel scientific computing with time-dependent PDEs.
This repository contains working implementations of:
- 2D heat equation with various boundary conditions
- Gray-Scott reaction-diffusion system (pattern formation)
All examples use PETSc's DMDA for structured grids and TS for time integration.
- PETSc 3.x
- MPI (OpenMPI or MPICH)
- C compiler (gcc, clang)
- pkg-config
- CMake 3.18+ (for CMake build)
brew install petsc open-mpi pkg-config cmakesudo apt-get install petsc-dev libopenmpi-dev pkg-config cmakempicc examples/ex10_heat_2D.c -o heat2d $(pkg-config --cflags --libs petsc)Heat equation (default 7×6 grid)
./heat2d -ts_monitor./heat2d -da_grid_x 25 -da_grid_y 25 -ts_dt 0.001 -ts_adapt_type none./grayscott -ts_max_time 10000 -ts_dt 1.0