feat(cph): implement nested outline manifest and batch/combined export

ADR-0029 — nested outline manifest, supersedes ADR-0008's flat [[parts]]:
- cph-model: recursive loader over manifest.toml containers / element.toml
  leaves; Lesson.parts (pure elements, DFS order) + Lesson.outline (elements
  interleaved with section headings at their DFS-open position); rejects
  ambiguous/incomplete folders and root-vs-container table misplacement
- cph-diag: new DiagCode::ManifestMalformed for carrier-document structure
  errors (discharges an existing TODO)
- cph-typst: augmented manifest now serializes the outline (element/section
  entries) instead of a flat parts array
- render/lib.typ: render-lesson renders section headings at their depth
- examples/TH-141 migrated to 5 nested section containers + 3 root segments,
  byte-identical element order; smoke-verified via cph check/build + pdftotext

ADR-0030 — batch & combined export, extends ADR-0009/0011:
- cph build with no --target batches every declared target (repeatable
  --target for an explicit subset); any target failure => non-zero exit,
  per-target ledger, independent per-target execution
- cph-model: bundle.toml loader (directory + [info]/[targets.*]/ordered
  lessons with per-lesson target overrides)
- cph-typst: augmented bundle manifest (path-prefixed member outlines),
  Engine::{compile_check_bundle,build_bundle_pdf}
- render/lib.typ: render-bundle assembles member lessons under per-lesson
  headings, depth-shifts their own section headings, resets example/lemma
  counters at each lesson boundary by default
- cph-cli: `cph bundle <path> --target <name>` subcommand, same batching
  contract as `cph build`
- new bundle fixtures/tests (cph-model unit + cph-typst through-template PDF
  compile), smoke-verified via a real 2-lesson merged PDF

Verification: cargo fmt/clippy/test clean across the workspace (68 tests);
real cph check/build/bundle runs against TH-141 and a bundle fixture, PDF
content inspected via pdftotext.
This commit is contained in:
2026-08-04 20:31:05 +08:00
committed by 洪佳荣
parent e0bd6120ec
commit 9927d38c18
165 changed files with 2638 additions and 691 deletions
+14
View File
@@ -0,0 +1,14 @@
[group]
title = "收束"
[[children]]
kind = "segment"
path = "segments/收束导言"
[[children]]
kind = "segment"
path = "segments/各模型对水的预测对照"
[[children]]
kind = "segment"
path = "segments/算不准背后的真实物理"
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,16 @@
把本章四种模型对常温水液气界面 $sigma_(L G)$ 的预测整理如下:
#figure(
table(
columns: (auto, auto, auto),
align: (left, left, left),
table.header[*模型*][*$sigma$ 预测($"N/m"$*][*相对实测 $0.072$*],
[量纲分析], [$tilde.op 0.1$], [量级正确],
[Stefan ($zeta = 1\/2$)], [$approx 0.38$], [偏大约 5 ],
[缺键模型 ($zeta = 3\/4$FCC (111))], [$approx 0.13$], [偏大约 2 ],
[Eötvös 规则(外推)], [$approx 0.072$], [量级与具体值都接近],
),
caption: [本章各模型对常温水 $sigma_(L G)$ 的预测]
) <模型对照表>
从表上读出的事实有两条:其一,所有模型都能给出对的量级;其二,量纲分析与 Stefan 这类"几乎不假设"的模型反而偏离最大,缺键模型代入具体晶面 $zeta$ 后精度提升一档,而完全唯象的 Eötvös 规则反而最接近实测。最简单的微观模型并不是最准的——粗略的微观模型给出量级,唯象的拟合规则给出具体值。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
= 收束:各模型横向对比
本章沿着"假设由少到多"的方向给出了多种模型:量纲分析、Stefan 极简估算、缺键模型一般式、Eötvös 规则、$sigma(T, p)$ 多项式拟合。模型的输入复杂度不同,对常温水 $sigma_(L G)$ 的预测精度也不同。把几种典型预测并排列出,与实测 $0.072 thin "N/m"$ 对照,可以看到一个略反预期的现象——最简单的微观模型并不是最准的。下面给出对照表并逐一讨论偏差来源。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,11 @@
@模型对照表 中的偏差并非来源不明,每一条都可追溯到一项物理简化。
分子作用力的各向异性。缺键模型把每对分子之间的键能简化为同一个 $epsilon$,但真实的分子间相互作用具有方向性,水的氢键尤甚。各向异性对应的研究方向是液晶与晶体表面物理。
参数 $zeta$ 的有效性。Stefan $zeta = 1\/2$ 只是为得到不依赖晶格的最简表达;FCC (111) 给出 $zeta = 3\/4$ 是基于严格晶格的几何计数。真实液体并没有严格晶格,$zeta$ 应当被视为有效参数。如何从液体的局部结构出发反推 $zeta$ 是液体统计物理的一个分支。
氢键带来的极性贡献。缺键模型把所有相互作用都归为单一键能,忽略了水分子之间的氢键贡献。@GG公式 在水/聚合物体系下与实验偏差较大就是这一简化的具体后果,Fowkes 分解就是针对这一偏差的修正路径。
表面层并非严格二维。我们建模时把表面分子当作一个零厚度的层,但真实液体的表面层有 nm 量级的厚度,密度随深度连续变化。这条偏差对应的研究方向是液气界面的密度剖面与梯度理论。
逐条看下来,每一条偏差都对应一个仍在活跃的研究方向。本章的微观模型给出"理论从分子到宏观浸润如何一步步推出来"的完整链条,但同时也指明了链条上每一段还能被怎么继续精细化。这才是建模在物理学里的常态。