Skip to content

UCSB-CASL/pets-p4est-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PETSc Tutorial Examples

A collection of PETSc examples for learning parallel scientific computing with time-dependent PDEs.

Overview

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.

Requirements

  • PETSc 3.x
  • MPI (OpenMPI or MPICH)
  • C compiler (gcc, clang)
  • pkg-config
  • CMake 3.18+ (for CMake build)

Installation on macOS

brew install petsc open-mpi pkg-config cmake

Installation on Linux (Ubuntu/Debian)

sudo apt-get install petsc-dev libopenmpi-dev pkg-config cmake

Building

Option 1: Direct Compilation

mpicc examples/ex10_heat_2D.c -o heat2d $(pkg-config --cflags --libs petsc)

Option 2: Using CMake

Running Examples

Basic Runs

Heat equation (default 7×6 grid)

./heat2d -ts_monitor

Heat equation with specific grid

./heat2d -da_grid_x 25 -da_grid_y 25 -ts_dt 0.001 -ts_adapt_type none

Gray-Scott (forms patterns over time)

./grayscott -ts_max_time 10000 -ts_dt 1.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages