Add comprehensive equations documentation#1136
Conversation
Catalog every equation solved by MFC organized by physical model, including governing PDEs, equations of state, viscous stress, bubble dynamics, fluid-structure interaction, phase change, chemistry, surface tension, MHD, IGR, and all numerical methods. Each section references the activating input parameter, source file paths, and paper citations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move docs/equations.md to docs/documentation/equations.md so it is picked up by the GEN_DOCS(documentation) CMake target. Add @page directive for Doxygen and link it from the main documentation hub under the Reference section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert all math delimiters from GitHub markdown dollar signs to Doxygen native (backslash-f) so that LaTeX commands like dot are passed verbatim to MathJax instead of being intercepted by Doxygen command parser (which was interpreting dot as a Graphviz directive and truncating the page). Also replace per-section paper citations with a single link to the papers page and fix bold markers around inline formulas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace manual HTML anchor references and inline text citations across all docs with Doxygen native cite command backed by a central references.bib file. This auto-generates a Bibliography page and provides clickable citation links throughout the documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughWalkthroughAdds centralized BibTeX citation support and documentation content: a new bibliography, Doxygen integration and post-processing, documentation citation conversions and a comprehensive equations reference; tooling and linting updated to validate citation keys and parameter references; a small params dependency tweak. Changes
Sequence Diagram(s)sequenceDiagram
participant CI as CI / Developer
participant CMake as CMake (GEN_DOCS)
participant Doxy as Doxygen
participant HTML as HTML output
participant Post as Postprocess script
participant Lint as lint_docs
CI->>CMake: configure & generate docs (DOXYGEN_CITE_BIB_FILES)
CMake->>Doxy: run Doxygen (produces raw HTML)
Doxy->>HTML: write HTML files with CITEREF_<key> links
CMake->>Post: invoke Python3 docs/postprocess_citations.py on HTML dir
Post->>HTML: rewrite citation links to include author prefixes
CI->>Lint: run toolchain/mfc/lint_docs.py
Lint->>Post: validate that `\cite` keys exist in docs/references.bib
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Nitpicks 🔍
|
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Pull request overview
Adds a comprehensive “Equations” reference page to the MFC Doxygen documentation and switches documentation citations over to a BibTeX-driven workflow (via Doxygen’s \cite + CITE_BIB_FILES), addressing the need for clearer governing-equation/nondimensionalization guidance (Issue #318).
Changes:
- Introduces a new comprehensive equations reference page (
@page equations) covering models, closures, and numerics. - Adds a central BibTeX database and wires it into the Doxygen build (
CITE_BIB_FILES) via CMake configuration. - Updates existing documentation pages to use
\cite ...and simplifies the References page to point to Doxygen’s generated bibliography.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/references.bib | Adds a centralized BibTeX bibliography for Doxygen citations. |
| docs/documentation/equations.md | New comprehensive equations reference page with inline citations and source cross-references. |
| docs/documentation/readme.md | Adds navigation entry to the new Equations page. |
| docs/documentation/references.md | Replaces hardcoded references list with BibTeX/Doxygen bibliography link. |
| docs/documentation/visualization.md | Converts reference links to \cite usage. |
| docs/documentation/case.md | Converts multiple reference links to \cite usage throughout. |
| docs/Doxyfile.in | Enables bibliography input via CITE_BIB_FILES = @DOXYGEN_CITE_BIB_FILES@. |
| CMakeLists.txt | Defines DOXYGEN_CITE_BIB_FILES for Doxygen config generation. |
| .typos.toml | Excludes the new docs/references.bib from typos checking. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/documentation/equations.md`:
- Around line 668-676: There are markdownlint emphasis violations: remove stray
spaces inside emphasis markers and use a consistent emphasis style (or code
formatting) in this section; update the "HLLD (`riemann_solver = 3`, MHD only)"
heading and nearby inline text so code/config (riemann_solver = 3) uses
backticks, citations like Miyoshi05 are not wrapped with * or _, and any
emphasized words use a single consistent marker (prefer asterisks) or plain
text; ensure the surrounding math blocks for S_M, S_L^*, S_R^* remain untouched
and only adjust the surrounding markdown emphasis/citation formatting to
eliminate MD037/MD049 warnings.
- Around line 501-502: Update the HLLD Riemann solver index in the
documentation: change the referenced value for riemann_solver from 3 to 4 in the
sentence describing HLLD, so it matches the implementation where riemann_solver
= 4 corresponds to HLLD (and riemann_solver = 3 is the Exact solver); ensure the
text now reads that HLLD uses riemann_solver = 4 and leave the rest of the
GLM/hyper_cleaning description unchanged.
|
/improve |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1136 +/- ##
=======================================
Coverage 44.03% 44.03%
=======================================
Files 70 70
Lines 20649 20649
Branches 2053 2054 +1
=======================================
Hits 9093 9093
Misses 10368 10368
Partials 1188 1188 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Post-process Doxygen HTML to transform bare [N] citation links into "Author et al. [N]" style, integrated into the CMake doc build. Extend lint_docs.py with cite key validation against references.bib and parameter name validation against the REGISTRY. Fix bib metadata (DOIs, published venues, author lists) and align keys with publication years. Remove stale hyper_cleaning recommendation from mhd dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 7 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="docs/postprocess_citations.py">
<violation number="1" location="docs/postprocess_citations.py:27">
P2: check_bare_citations also looks up citation keys without normalizing case, leading to false ‘missing author prefix’ errors for mixed‑case BibTeX keys.</violation>
<violation number="2" location="docs/postprocess_citations.py:108">
P2: Citation keys are stored lowercase, but process_html looks them up with the original case, so mixed‑case BibTeX keys won’t be found and author prefixes won’t be inserted.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@docs/documentation/equations.md`:
- Around line 640-644: Replace the incorrect parameter name
"interface_compression > 0" with the actual THINC toggle "int_comp" (or
"int_comp == true") and mention the real control parameters "ic_beta" (controls
compression steepness) and "ic_eps" (small threshold used by the scheme) in the
surrounding text; leave the formula unchanged but update the sentence to read
something like: "THINC interface compression (int_comp enabled): applies ...
where ... and ic_beta controls compression steepness (with ic_eps used as the
numerical threshold)", and ensure the doc references the logical flag int_comp
and parameters ic_beta and ic_eps instead of interface_compression.
- Around line 818-834: The low_Mach labels are reversed in this section: update
the text so low_Mach = 1 corresponds to Chen's pressure anti-dissipation
correction (APC, p_d, APC_{p\mathbf{u}}, APC_{pE}, pcorr) and low_Mach = 2
corresponds to Thornber's velocity reconstruction (z and u'_L/u'_R formulas).
Concretely, swap the two section headings, their descriptive sentences, and the
adjacent equation blocks so that the Chen/APC block is labeled low_Mach = 1 and
the Thornber/velocity-reconstruction block is labeled low_Mach = 2 to match the
implementation that checks low_Mach == 1 for pressure correction and low_Mach ==
2 for velocity modification.
In `@docs/postprocess_citations.py`:
- Line 23: The type annotation for the local variable `entries` is incorrect: it
is declared as dict[str, tuple[str, int]] but actually stores 3-element tuples
(surname, count, second_surname) matching the function's declared return type;
update the annotation to dict[str, tuple[str, int, str]] (or a named
tuple/TypedDict if preferred) so `entries`'s type matches the actual stored
tuple shape and the function return annotation.
In `@toolchain/mfc/params/definitions.py`:
- Line 784: Remove the spurious empty dependency entry for the "mhd" parameter
in the DEPENDENCIES mapping: delete the `"mhd": {}` key so
DEPENDENCIES.get("mhd") returns None like other parameters; this change targets
the DEPENDENCIES dict (the entry named "mhd") to avoid triggering truthy checks
in validate.py, json_schema_gen.py, and docs_gen.py.
🧹 Nitpick comments (4)
docs/references.bib (1)
653-661: Inconsistent citation key format:Xu2019uses 4-digit year.All other entries in this file use 2-digit year suffixes (e.g.,
Allaire02,Keller80,Cao24). This key uses 4 digits. Consider renaming toXu19for consistency. Ensure any\cite Xu2019references in docs are updated accordingly.toolchain/mfc/lint_docs.py (1)
87-135:PARAM_REonly matches lowercase-starting identifiers — uppercase MFC params won't be validated.
PARAM_RErequires the first character to be[a-z_], so parameters likeBx0,Re_inv,R0ref,Ca,Web,G,E_wrtreferenced inequations.mdwill never be captured or validated. This is presumably intentional to reduce false positives, but it means a meaningful subset of parameter references won't be checked.docs/documentation/case.md (1)
819-822: Minor: Inconsistent parenthetical style around\cite.Some citations use parentheses, e.g.,
(\cite Preston07)on lines 819 and 866, while others use bare\cite Thornber08. This doesn't affect Doxygen rendering but is a style inconsistency. Consider standardizing to one style across the document.docs/postprocess_citations.py (1)
155-162: Unused variablecount(static analysis).The unpacked
counton line 157 is never used in thehas_prefixlogic. Prefix with_to signal intent.Suggested fix
- surname, count, second_surname = authors[key] + surname, _count, second_surname = authors[key]
Swap low_Mach = 1 (Chen pressure correction) and low_Mach = 2 (Thornber velocity correction) to match source code and case.md. Fix interface_compression → int_comp (actual parameter name). Remove empty mhd dependency dict. Fix type annotations and unused variable in postprocess_citations.py. Extend PARAM_RE to catch comparison operators (>, <) in addition to assignment (=). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
| def replace_cite(match: re.Match) -> str: | ||
| key = match.group(1) | ||
| full_link = match.group(0) | ||
|
|
||
| info = authors.get(key) | ||
| if not info: | ||
| return full_link |
There was a problem hiding this comment.
Suggestion: Normalize the citation key to lowercase before looking it up in the authors dictionary to ensure a case-insensitive match. [possible issue, importance: 8]
| def replace_cite(match: re.Match) -> str: | |
| key = match.group(1) | |
| full_link = match.group(0) | |
| info = authors.get(key) | |
| if not info: | |
| return full_link | |
| def replace_cite(match: re.Match) -> str: | |
| key = match.group(1).lower() | |
| full_link = match.group(0) | |
| info = authors.get(key) | |
| if not info: | |
| return full_link |
| if count == 2: | ||
| second_surname = _extract_surname(authors[1].strip()) | ||
|
|
||
| entries[key.lower()] = (surname, count, second_surname) |
There was a problem hiding this comment.
Suggestion: Store bibliography entries under their original keys instead of lowercasing them, so lookups using citation keys from the HTML (which preserve case) succeed. [custom_rule]
Severity Level: Minor
| entries[key.lower()] = (surname, count, second_surname) | |
| entries[key] = (surname, count, second_surname) |
Why it matters? ⭐
The current implementation lowercases bib keys when building the map but later looks up keys using the exact key captured from the HTML (authors.get(key) / authors[key]). That mismatch can cause lookups to fail and leave citations unprocessed. The proposed change directly fixes this correctness bug (matches storage to lookup) — addressing the repo guideline to prioritize correctness over style. An alternative would be normalizing lookups to key.lower(), but storing the original key is a minimal, correct fix here.
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/postprocess_citations.py
**Line:** 52:52
**Comment:**
*Custom Rule: Store bibliography entries under their original keys instead of lowercasing them, so lookups using citation keys from the HTML (which preserve case) succeed.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.| full_link = match.group(0) | ||
|
|
||
| info = authors.get(key) | ||
| if not info: |
There was a problem hiding this comment.
Suggestion: The BibTeX keys are stored in lowercase in the authors dictionary, but the HTML citation keys come from Doxygen with their original case, so using authors.get(key) and authors[key] makes the lookup case-sensitive and will fail for any key containing uppercase letters, causing citations to be left unprocessed and incorrectly reported as missing; normalize the Doxygen keys to lowercase before lookup to match how they were stored. [logic error]
Severity Level: Critical 🚨
- ❌ Documentation build fails when citations use mixed-case keys.
- ⚠️ Affected citations lack author prefixes in HTML.
- ⚠️ CI docs job may fail due to citation checks.| if not info: | |
| info = authors.get(key.lower()) |
Steps of Reproduction ✅
1. Ensure `docs/references.bib` contains at least one BibTeX entry whose key has uppercase
letters, e.g. `@article{Allaire1992,...}`, which is parsed by `parse_bib_authors()` in
`docs/postprocess_citations.py:15-55` and stored in the `authors` dict under the
lowercased key `"allaire1992"`.
2. Add a corresponding citation `\cite{Allaire1992}` in a documented file such as
`docs/documentation/equations.md`, then run the normal Doxygen documentation build so the
generated HTML (e.g. `docs/html/equations.html`) contains links of the form `<a class="el"
href="citelist.html#CITEREF_Allaire1992">[1]</a>`, matching `CITE_RE` in
`docs/postprocess_citations.py:93-96`.
3. Run `python3 docs/postprocess_citations.py docs/html`, which executes `main()` at
`docs/postprocess_citations.py:168-212`; this calls `parse_bib_authors()` to build
`authors` and then invokes `process_html()` for each HTML file in `docs/html` at lines
`191-199`.
4. Inside `process_html.replace_cite()` (`docs/postprocess_citations.py:108-132`), `key`
is `"Allaire1992"` while `authors` only contains `"allaire1992"`, so `authors.get(key)`
returns `None`, the citation link is returned unchanged (no author prefix added), and
`check_bare_citations()` later treats this as a bare citation, causing incorrect
formatting and potentially a failing docs build despite a valid BibTeX entry.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/postprocess_citations.py
**Line:** 112:112
**Comment:**
*Logic Error: The BibTeX keys are stored in lowercase in the `authors` dictionary, but the HTML citation keys come from Doxygen with their original case, so using `authors.get(key)` and `authors[key]` makes the lookup case-sensitive and will fail for any key containing uppercase letters, causing citations to be left unprocessed and incorrectly reported as missing; normalize the Doxygen keys to lowercase before lookup to match how they were stored.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.| bare.append(f" {html_file.name}: [{m.group(2)}] (CITEREF_{key}) — no bib entry") | ||
| continue | ||
| # Check if an author name precedes the link | ||
| before = text[max(0, m.start() - 60):m.start()].rstrip() | ||
| surname, _count, second_surname = authors[key] | ||
| has_prefix = ( |
There was a problem hiding this comment.
Suggestion: As with process_html, check_bare_citations compares and indexes the authors dictionary using citation keys in their original case even though the dictionary keys were lowercased when parsing the BibTeX file, so entries with uppercase letters are treated as if they have no bib entry and the script will erroneously fail with "no bib entry" or missing author prefix errors; lowercasing the citation key before lookup fixes this. [logic error]
Severity Level: Critical 🚨
- ❌ Script misreports valid citations as missing bibliography entries.
- ⚠️ Causes nonzero exit, breaking automated documentation pipelines.| bare.append(f" {html_file.name}: [{m.group(2)}] (CITEREF_{key}) — no bib entry") | |
| continue | |
| # Check if an author name precedes the link | |
| before = text[max(0, m.start() - 60):m.start()].rstrip() | |
| surname, _count, second_surname = authors[key] | |
| has_prefix = ( | |
| key_lc = key.lower() | |
| if key_lc not in authors: | |
| bare.append(f" {html_file.name}: [{m.group(2)}] (CITEREF_{key}) — no bib entry") | |
| continue | |
| # Check if an author name precedes the link | |
| before = text[max(0, m.start() - 60):m.start()].rstrip() | |
| surname, _count, second_surname = authors[key_lc] |
Steps of Reproduction ✅
1. Use the same setup as in the previous suggestion: have `docs/references.bib` contain a
BibTeX entry with a mixed-case key like `@article{Allaire1992,...}`, and ensure
Doxygen-generated HTML under `docs/html` has links such as `<a class="el"
href="citelist.html#CITEREF_Allaire1992">[1]</a>` that match `CITE_RE` in
`docs/postprocess_citations.py:93-96`.
2. Run `python3 docs/postprocess_citations.py docs/html`, executing `main()` at
`docs/postprocess_citations.py:168-212`, which first builds the `authors` dict with
lowercased keys in `parse_bib_authors()` (lines 15-55) and then, after optional HTML
rewriting, calls `check_bare_citations(html_dir, authors)` at lines `199-205`.
3. Inside `check_bare_citations()` (`docs/postprocess_citations.py:141-165`), for each
citation link the loop sets `key = m.group(1)` to `"Allaire1992"` while `authors` only
contains `"allaire1992"`, so the condition `if key not in authors:` is true and the code
appends a `"no bib entry"` warning even though a matching BibTeX entry exists.
4. After scanning all HTML files, `main()` sees the non-empty `bare` list, prints "Bare
citations found (missing author prefix):" and the spurious `"no bib entry"` lines at
`docs/postprocess_citations.py:202-206`, then calls `sys.exit(1)`, causing the
documentation build or CI docs target to fail incorrectly.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/postprocess_citations.py
**Line:** 153:158
**Comment:**
*Logic Error: As with `process_html`, `check_bare_citations` compares and indexes the `authors` dictionary using citation keys in their original case even though the dictionary keys were lowercased when parsing the BibTeX file, so entries with uppercase letters are treated as if they have no bib entry and the script will erroneously fail with "no bib entry" or missing author prefix errors; lowercasing the citation key before lookup fixes this.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.|
CodeAnt AI Incremental review completed. |
User description
User description
Fixes #318
Type of change
Testing
How did you test your changes?
CI
Checklist
See the developer guide for full coding standards.
PR Type
Documentation
Description
Added comprehensive 847-line equations reference document (
docs/documentation/equations.md) covering all physics models solved by MFC, organized into 18 sections with detailed mathematical formulations and LaTeX equationsCreated new BibTeX bibliography file (
docs/references.bib) with 60+ citations organized by topic to support automated documentation generationStandardized citation format across documentation files (
case.md,visualization.md) from inline HTML anchors to Doxygen\citecommands for consistencyReplaced manually maintained reference list with automated Doxygen-generated bibliography in
docs/documentation/references.mdConfigured Doxygen (
Doxyfile.in) and CMake (CMakeLists.txt) to process BibTeX citations automaticallyUpdated documentation index (
readme.md) to include reference to new equations documentationAdded
docs/references.bibto spell-checker exclusions (.typos.toml)Diagram Walkthrough
File Walkthrough
6 files
equations.md
Comprehensive equations reference documentation for MFCdocs/documentation/equations.md
physics models solved by MFC
state, viscous stress, bubble dynamics, elasticity, phase change,
chemistry, MHD, and numerical methods
cross-references to source files
case.md
Standardize citation format to Doxygen \cite commandsdocs/documentation/case.md
Doxygen
\citecommand format[Author (Year)](@ref references)to\citeAuthorYYformatconsistency
conditions, and bubble models
references.bib
Add comprehensive BibTeX bibliography for documentationdocs/references.bib
documentation
of state, bubble dynamics, elasticity, surface tension, chemistry,
MHD, IGR, acoustic sources, Riemann solvers, WENO/spatial
reconstruction, time integration, boundary conditions, immersed
boundary, low Mach corrections, and MFC papers
year information
\citecommand for automatic bibliography generationreferences.md
Replace manual references with Doxygen-generated bibliographydocs/documentation/references.md
Doxygen bibliography
bibliography via
\ref citelistBibTeX source
visualization.md
Standardize visualization documentation citationsdocs/documentation/visualization.md
\citecommand format
[Author (Year)](@ref references)to\cite AuthorYYforCoralic15 and Meng16
readme.md
Add equations reference to documentation indexdocs/documentation/readme.md
@ref equationspointing to comprehensiveequations documentation
parameters and CLI references
3 files
Doxyfile.in
Configure Doxygen to use BibTeX bibliography filedocs/Doxyfile.in
CITE_BIB_FILESconfiguration variable pointing toreferences.bibautomatically
CMakeLists.txt
Configure CMake to pass bibliography to DoxygenCMakeLists.txt
DOXYGEN_CITE_BIB_FILESpointing todocs/references.bib.typos.toml
Exclude BibTeX file from spell-checking.typos.toml
docs/references.bibto theextend-excludelist in typosconfiguration
Summary by CodeRabbit
CodeAnt-AI Description
Add comprehensive equations reference and integrate BibTeX citations into generated documentation
What Changed
Impact
✅ Clearer equations reference for users selecting physics models✅ Clickable, centralized bibliography in generated docs✅ Fewer broken or missing citations and parameter references detected by CI💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.