Tutorials¶
The tutorials teach samurai by example. Each one builds a program step by step and explains what it does to the mesh and the fields. To carry out a precise task, see the how-to guides. To look up how a feature behaves, see the reference or the API reference.
Start here¶
Getting started: a first adaptive simulation: install samurai, then write, build and run a program that transports a disc on an adaptive mesh.
Hands-on samurai course: the guided path through samurai. The course starts with a mesh and a field and ends with a 2D solver for the Euler equations on an adaptive mesh, one part at a time.
Data structure¶
These tutorials explain how samurai stores a mesh and its fields, and how a program walks through them. Each one builds on the previous one.
Interval and Cartesian grid representation: how a Cartesian mesh is stored as intervals of integers, level by level.
Field storage and access: how the values of a field are stored on these intervals, and how to write them cell by cell or interval by interval.
Choosing between cell loops and interval loops: when to visit a mesh one cell at a time and when one interval at a time.
Apply a subset operator on a set expression: how to select a part of the mesh with the set algebra and compute on it only.
Graduation of a mesh: how to keep neighboring cells within one level of each other, written with the set algebra.
Solvers¶
These tutorials write a complete solver on an adaptive mesh.
A finite volume solver for the 1D Burgers equation: an explicit upwind scheme that runs from a hat function until after a shock forms, with a refinement criterion that keeps small cells where the solution varies.
Level-set transport on an adaptive mesh: the transport of a level-set function in 2D, with the mesh adapted around the contour at each time step.
Reaction-diffusion equation: implicit time schemes for a reaction-diffusion equation, solved with PETSc.
Complete programs¶
After the tutorials, start from a complete program close to your problem.
Demos: the programs of the
demos/folder, with the CMake target and a run command for each one.samurai gallery: complete simulations with videos of the solution and the mesh, each one a self-contained project.