Skip to content

shoujilywork/SOD

Repository files navigation

Sod Shock Tube Solver in C++

This project implements a numerical solver for the Sod shock tube problem, a standard benchmark in computational fluid dynamics (CFD), using C++ with support from the Eigen library and OpenMP for parallelism.

📌 Overview

The Sod problem models a 1D in space and 4D in physical properties Riemann problem with a discontinuity in pressure and density, producing shock waves, rarefaction waves, and contact discontinuities. This solver numerically integrates the 1D Euler equations using a finite difference scheme.

X direction is splitted into X-positive and X-negative. Physical dimensions are rho, p, E, and u.

6 cores are used to calculate derivatives.

The code is designed to be:

  • Lightweight (header-only Eigen dependency)
  • Parallelized using OpenMP for computing spatial derivatives
  • Configurable for grid size, time step, and domain

🚀 Features

  • Solves the 1D Euler equations (conservation of mass, momentum, and energy)
  • Initial conditions based on Sod's classical setup
  • OpenMP-powered parallel derivative computations across 6 cores
  • Adjustable parameters: spatial resolution, CFL condition, total time

🔧 Build Instructions

Requirements

  • C++17 or newer
  • Eigen (header-only linear algebra library)
  • g++ with OpenMP support

Compile (on Ubuntu/Linux)

g++ -std=c++17 -fopenmp -O2 main_omp.cpp -o sod_solver

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published