This repository contains a finite element solver for
the Shallow Water Equations (SWE) implemented using the deal.II
finite element library.
The software is designed with a dual focus on numerical robustness
and parallel scalability.
This is part of a project-work for Numerical Methods For Partial Differential Equations course @Polimi
Project developed by:
The shallow water equations model fluid flows where the horizontal length scales dominate the vertical depth. They are widely used in oceanography, hydraulics, geophysics, and atmospheric sciences.
.
├── docs/ # Project documentation
├── gifs/ # Showcase gifs
├── mesh/ # Mesh files
├── scripts/ # Scripts for:
│ + Plot data
│ + Generate manufactured solution
│ + Run tests
├── src/ # C++ source code of the solver
├── CMakeLists.txt # Build configuration
└── README.md
The solver is implemented using deal.II's distributed parallel infrastructure:
parallel::distributed::Triangulation- MPI communication
- Trilinos linear algebra backends
- deal.II (compiled with MPI support)
- CMake ≥ 3.16
- MPI (OpenMPI or MPICH)
- C++17 compatible compiler
- Python 3 with
numpyandmatplotlib(optional)
From the project root:
mkdir build
cd build
cmake ..
make -jRun in serial:
./shallow_waters <T> <deltat> <mesh_file_name>Run in parallel:
mpirun -np 4 ./shallow_waters <T> <deltat> <mesh_file_name>The script manufacture.py implements a method of manufactured
solutions (MMS) workflow:
- An analytic solution is defined
- Corresponding forcing terms are computed
Run with:
python manufacture.pyThe repository includes a geometry definition file mesh/mesh_script.geo that can be used to generate computational meshes using GMSH
Below is an example of simulation result.
