Firedrake Notes#
Firedrake 是一个用于求解偏微分方程的有限元框架, 类似于 FEniCS, 且主要由 Python 编写, 方便根据算法需求进行修改.
在使用 Firedrake 的过程中, 我记录了一些学习笔记, 以便后续参考. 当前笔记内容较为简略, 但第一二章较为详细, 可供初学者参考. 本笔记以中文为主, 正在逐步补充英文内容: 点击页面右上角的 EN 按钮可切换到英文模式.
Firedrake is a finite element framework for solving partial differential equations, similar to FEniCS. It is written mainly in Python, which makes it easy to adapt to the needs of your own algorithms.
These are notes I took while learning and using Firedrake, kept here for future reference. Most of the notes are brief, but the first two chapters are fairly detailed and should be helpful for beginners. The notes are written mostly in Chinese and English content is being added gradually: untranslated parts are shown in Chinese. Click the 中文 button at the top of the page to switch back to Chinese.
阅读指南 How to read#
正文分为两个部分: 入门 (Tutorials) 介绍求解各类方程的基本流程; 进阶专题 (Advanced Topics) 涵盖并行计算, 调试, 性能分析, 网格生成, 以及 PETSc, DMPlex, 内核生成等 Firedrake 实现细节. 初学者建议从 Poisson 方程 I 和 Poisson 方程 II 开始. 每章开头附有英文概要 (Overview), 并注明运行前提.
附加信息部分收录了 Python, Linux 和编辑器等相关工具的笔记, 供不熟悉这些工具的读者参考.
常用术语的中英文对照见术语对照表.
The main text has two parts: Tutorials on the basic workflow of solving PDEs, and Advanced Topics covering parallel computing, debugging, profiling, meshing, and Firedrake implementation details such as PETSc, DMPlex, and kernel generation. Beginners are encouraged to start with the two chapters on the Poisson equation. Each chapter starts with a short English overview stating its scope and prerequisites.
See the Installation part for how to install Firedrake. Beginners may find Docker or Colab the easiest way to get started, as no local build is needed.
The Additional Information part collects notes on related tools such as Python, Linux and editors, for readers who are not yet familiar with them.
See the Glossary for Chinese–English terminology used throughout the notes.
本地构建 Build locally#
本书使用 Jupyter Book 构建:
The book is built with Jupyter Book:
python3 -m pip install -r requirements.txt
jupyter-book build ./
CI 使用最新的 firedrakeproject/firedrake-vanilla-default 镜像构建.
推送前可运行 make docker-html, 在与 CI 相同的镜像中做一次验证构建
(先用 make docker-pull 更新镜像), 以提前发现 Firedrake 新版本的接口变化.
The CI builds with the latest firedrakeproject/firedrake-vanilla-default
image. Before pushing, you can run make docker-html to verify the build
inside the same image (update it first with make docker-pull), catching
API changes of new Firedrake releases early.
Document |
Modified |
Method |
Run Time (s) |
Status |
|---|---|---|---|---|
2026-08-01 13:28 |
cache |
4.04 |
✅ |
|
2026-08-01 13:29 |
cache |
26.13 |
✅ |
|
2026-08-01 13:29 |
cache |
21.34 |
✅ |
|
2026-08-01 13:30 |
cache |
14.61 |
✅ |
|
2026-08-01 13:30 |
cache |
5.16 |
✅ |
|
2026-08-01 13:30 |
cache |
21.66 |
✅ |
|
2026-08-01 13:30 |
cache |
12.24 |
✅ |
|
2026-08-01 13:31 |
cache |
30.37 |
✅ |
|
2026-08-01 13:31 |
cache |
14.54 |
✅ |
|
2026-08-01 13:31 |
cache |
24.49 |
✅ |
|
2026-08-01 13:32 |
cache |
40.53 |
✅ |
|
2026-08-01 13:32 |
cache |
0.8 |
✅ |
|
2026-08-01 13:32 |
cache |
21.41 |
✅ |