返回资讯中心
外部精选
软件工程
#开发者实时流

I let Claude review the C code I wrote as a math intern in 2013

A finite volume solver for the one-dimensional Saint-Venant (shallow water)

Hacker News 最新MathLab2026/10/23 · 22 天前4 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

A finite volume solver for the one-dimensional Saint-Venant (shallow water) system with topography, built around the kinetic scheme with reflections of B. Perthame and C. Simeoni (Calcolo, 2001).

The scheme treats the bottom (Z) as a potential barrier for fictitious particles: particles cross a step when they have enough kinetic energy and are reflected otherwise. This gives a finite volume method that

A Rusanov scheme with hydrostatic reconstruction (Audusse et al., 2004) is included for comparison.

make ./build/kinetic-solver --case dam-break-wet --cells 400 --snapshot-every 20 python3 scripts/plot.py output --animate make test

Where to go next¶

Page What you will find

Getting started Building, running, options, output files, plots

Theory The equations, the kinetic formulation and the scheme of the paper

Implementation How the code is organised and the numerical choices it makes

Validation Exact solutions, convergence, well-balancing, symmetries

Contributing Tests, adding a scheme, a case or an integrator

References Papers the code is based on

Status¶

The scheme of the paper is implemented and checked against its definitions to round-off (see Validation). The code was first written in 2013; the 2026 revision fixed several bugs (including a truncated value of π that broke the lake-at-rest property), restructured the code and added a test suite. The original guide, Guidebook.pdf in the repository, describes the 2013 version.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →