Skip to content

Conversation

@wilfonba
Copy link
Contributor

@wilfonba wilfonba commented Nov 9, 2025

User description

User description

Description

This PR adds an example case with automated scripts to create convergence test results for a 1D advection case. It also fixes a toolchain error that resulted in reduced convergence when pi was used for analaytic patches.

Type of change

  • Something else

Scope

  • This PR comprises a set of related changes with a common goal

How Has This Been Tested?

oldConvergence.pdf


PR Type

Enhancement, Bug fix


Description

  • Add 1D convergence test example with automated scripts

    • Includes case configuration generator, plotting utilities, and job submission script
  • Fix toolchain error with pi constant in analytic patches

    • Remove hardcoded pi substitution to prevent convergence reduction
  • Provide documentation and setup instructions for convergence testing


Diagram Walkthrough

flowchart LR
  A["1D Convergence Example"] --> B["case.py: Config Generator"]
  A --> C["submitJobs.sh: Job Automation"]
  A --> D["plot.py: Error Analysis"]
  A --> E["README.md: Documentation"]
  F["Toolchain Fix"] --> G["Remove pi Substitution"]
  G --> H["Preserve Analytic Accuracy"]
Loading

File Walkthrough

Relevant files
Enhancement
case.py
1D convergence test case configuration generator                 

examples/1D_convergence/case.py

  • New Python script to generate JSON case configuration for 1D two-fluid
    convergence simulation
  • Supports command-line arguments for WENO order, model equations,
    Riemann solver, and grid resolution
  • Configures numerical domain, time stepping, and initial conditions
    with sinusoidal density/volume fraction profiles
  • Sets up two-fluid system with periodic boundary conditions
+81/-0   
plot.py
Convergence error analysis and visualization tool               

examples/1D_convergence/plot.py

  • New Python script to analyze convergence test results across multiple
    grid resolutions and WENO orders
  • Computes L1, L2, and L∞ error norms by comparing simulation results to
    initial conditions
  • Generates log-log convergence plots with reference slopes for orders
    1, 3, and 5
  • Exports error data to CSV file for further analysis
+70/-0   
submitJobs.sh
Automated job submission script for convergence tests       

examples/1D_convergence/submitJobs.sh

  • New bash script to automate execution of convergence test simulations
  • Iterates over multiple grid resolutions (32 to 1024 points) and WENO
    orders (1, 3, 5)
  • Creates directory structure and submits jobs to MFC toolchain with
    appropriate parameters
  • Configurable for different model equations and Riemann solvers
+27/-0   
Documentation
README.md
Convergence test example documentation and setup guide     

examples/1D_convergence/README.md

  • New documentation file explaining the convergence test example setup
    and usage
  • Provides instructions for enabling execution permissions and
    configuring paths
  • Documents customizable parameters and output generation with plotting
    script
  • Explains how to run simulations and generate convergence analysis
    plots
+11/-0   
Bug fix
case.py
Fix pi constant handling in analytic patches                         

toolchain/mfc/case.py

  • Remove hardcoded pi constant substitution in analytic patch
    expressions
  • Prevents incorrect pi value replacement that was causing convergence
    reduction
  • Allows pi to be properly evaluated in mathematical expressions within
    case definitions
+1/-1     

Note

Adds a 1D two-fluid convergence example with job/plot scripts and README, removes hardcoded pi substitution in analytic patches, and skips the new example in tests.

  • Examples:
    • examples/1D_convergence: New example with case.py (config generator), submitJobs.sh (automation over N and WENO order), plot.py (L1/L2/Linf analysis and CSV export), and README.md (usage).
  • Toolchain:
    • toolchain/mfc/case.py: Remove pi constant substitution from analytic expression codegen (retain e).
  • Tests:
    • toolchain/mfc/test/cases.py: Add "1D_convergence" to skipped examples list.

Written by Cursor Bugbot for commit bb4d52c. Configure here.


CodeAnt-AI Description

Add runnable 1D convergence example and keep analytic accuracy

What Changed

  • Provide scripted case generation, job submission, and README so users can run 1D advection convergence tests across multiple resolutions/orders and then display L1/L2/Linf plots and save CSV summaries.
  • Add plotting utility that overlays reference slopes, renders log-log error norms, and exports consolidated error data after each simulation set.
  • Stop substituting π in analytic patch expressions so convergence tests retain the intended continuous profiles.

Impact

✅ Fewer manual convergence setups
✅ Clearer convergence error plots
✅ More accurate analytic patch evaluations

💡 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.

Summary by CodeRabbit

  • New Features

    • Added a 1D convergence example with an automated workflow to run simulations across multiple grid resolutions and spatial orders.
  • Documentation

    • Added README with instructions to run the convergence workflow and generate convergence plots (L1, L2, Linf).
  • Tools

    • Added utilities to generate case configurations, submit batch runs, and produce convergence plots and a CSV of errors.
  • Tests

    • Test configuration updated to skip the 1D convergence example.
  • Chores

    • Minor toolchain adjustment to expression handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@wilfonba wilfonba requested review from a team and Copilot November 9, 2025 19:04
@wilfonba wilfonba requested a review from sbryngelson as a code owner November 9, 2025 19:04
@qodo-code-review
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

L2 norm is computed as mean of absolute differences (via sqrt of squared diffs), which equals L1; should use sqrt of mean squared error or discrete 2-norm. Also Inf norm sums maxima of two fields, potentially overstating error; consider max over combined fields instead of sum.

## 2 norm
errors[i, j, 0] = 1 / N[i] * np.sum(np.sqrt((sim_a1.y - exact_a1.y) ** 2))
errors[i, j, 0] += 1 / N[i] * np.sum(np.sqrt((sim_a2.y - exact_a2.y) ** 2))

## 1 norm
errors[i, j, 1] = 1 / N[i] * np.sum(np.abs(sim_a1.y - exact_a1.y))
errors[i, j, 1] += 1 / N[i] * np.sum(np.abs(sim_a2.y - exact_a2.y))

## Inf norm
errors[i, j, 2] = np.nanmax(np.abs(sim_a1.y - exact_a1.y))
errors[i, j, 2] += np.nanmax(np.abs(sim_a2.y - exact_a2.y))
Regression Risk

Removal of 'pi' replacement may break existing analytic patches using 'pi'. Confirm that 'pi' is intentionally removed and that examples use explicit '2pix' strings which will now not be replaced unless 'pi' is defined elsewhere.

    'e' : f'{math.e}',
}.get(match.group(), match.group())
Portability

Script contains hardcoded absolute paths for ROOT_DIR and MFC_DIR, making it non-portable. Consider using env vars or relative paths and checking for required executables.

#ROOT_DIR=<WORKING DIRECTORY>
#MFC_DIR=<MFC ROOT DIR>
ROOT_DIR="/Users/benwilfong/Documents/software/MFC-Wilfong/examples/1D_convergence"
MFC_DIR="/Users/benwilfong/Documents/software/MFC-Wilfong"
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes support for the pi constant in analytical patch expressions and adds a new 1D convergence example that demonstrates spatial accuracy testing. The removal of pi from the rhs_replace dictionary in the case parser is problematic because the new example and existing examples use pi in analytical expressions.

  • Removes pi constant support from the analytical patch expression parser
  • Adds a 1D two-component advection convergence test example with automation scripts
  • Provides plotting utilities for analyzing convergence rates

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
toolchain/mfc/case.py Removes pi from the rhs_replace dictionary that maps variable names in analytical expressions
examples/1D_convergence/submitJobs.sh Adds shell script to automate running convergence tests across multiple grid resolutions and WENO orders
examples/1D_convergence/plot.py Adds Python script to compute and visualize L1, L2, and Linf error norms
examples/1D_convergence/case.py Adds case file for 1D two-fluid advection test with analytical initial conditions using sinusoidal patterns
examples/1D_convergence/README.md Adds documentation explaining how to run the convergence test
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.36%. Comparing base (e25dbc4) to head (e9ace27).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1030   +/-   ##
=======================================
  Coverage   44.36%   44.36%           
=======================================
  Files          71       71           
  Lines       20590    20590           
  Branches     1994     1994           
=======================================
  Hits         9134     9134           
  Misses      10310    10310           
  Partials     1146     1146           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@codeant-ai
Copy link

codeant-ai bot commented Nov 28, 2025

CodeAnt AI is reviewing your PR.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a new 1D convergence example (README, config generator, plotting, job script); removes the pi→math.pi substitution from the analytical patch generator; and excludes the new example from automated test generation by adding it to the skip list.

Changes

Cohort / File(s) Summary
1D Convergence Example
examples/1D_convergence/README.md, examples/1D_convergence/case.py, examples/1D_convergence/plot.py, examples/1D_convergence/submitJobs.sh
New example: README with run instructions; case.py emits JSON simulation configs (CLI: --mfc, --order, --meqns, --rs, -N) with spatially-varying initial conditions; submitJobs.sh prepares per-run directories and invokes mfc.sh run for N×Order combinations; plot.py loads outputs, computes L1/L2/Linf errors, plots convergence, and writes errors.csv.
Toolchain Case Generator
toolchain/mfc/case.py
Removed the pimath.pi mapping from the analytical patch replacement dictionary (only e remains), changing how pi tokens are handled in generated expressions.
Test Case Filter
toolchain/mfc/test/cases.py
Added "1D_convergence" to casesToSkip, excluding the new example from generated test cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect toolchain/mfc/case.py to identify any downstream code generation or expressions relying on pi substitution.
  • Verify examples/1D_convergence/case.py JSON keys/values, CLI parsing, and numeric parameter calculations (Nx, dx, Tend, Nt, mydt).
  • Check submitJobs.sh for correct ROOT_DIR/MFC_DIR resolution, directory creation, file copying, and mfc.sh run invocation flags.
  • Confirm plot.py reads expected output file locations/formats, and that error-norm computations and CSV output match expectations.

Suggested labels

Review effort 3/5

Poem

🐰 I hopped through configs, scripts, and plots,
I stirred the grids and counted lots,
From coarse to fine the errors wend,
My whiskers mark each convergent trend,
A tiny rabbit's joyful trot.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main addition: a new 1D convergence test example. It directly reflects the primary change without being vague or off-topic.
Description check ✅ Passed The PR description is comprehensive and covers most required template sections: it includes a clear description of changes, identifies the type as Enhancement and Bug fix, and provides testing context with a reference artifact. However, several template checklist items remain unchecked without explanation.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f09a814 and e9ace27.

📒 Files selected for processing (1)
  • examples/1D_convergence/submitJobs.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/1D_convergence/submitJobs.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Code Cleanliness Check
  • GitHub Check: Github (ubuntu, no-mpi, single, no-debug, false)
  • GitHub Check: Github (ubuntu, mpi, no-debug, false)
  • GitHub Check: Github (ubuntu, mpi, no-debug, true)
  • GitHub Check: Github (ubuntu, mpi, debug, false)
  • GitHub Check: Github (ubuntu, mpi, debug, true)
  • GitHub Check: Coverage Test on CodeCov
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Build & Publish

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:L This PR changes 100-499 lines, ignoring generated files label Nov 28, 2025
@codeant-ai
Copy link

codeant-ai bot commented Nov 28, 2025

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Syntax Error
    The new casesToSkip entry ends with ",] which closes the list immediately after "1D_convergence". This leaves the following "3D_IGR_33jet" string outside the list and makes the file invalid Python syntax. Please ensure the list is closed only once after all entries so the parser can load the module.

  • Analytic pi handling
    Double‑check that analytic patches referencing pi remain valid now that the substitution dictionary no longer replaces that token. If the generated Fortran code still uses the literal pi, that symbol may be undefined and could fail to compile or produce incorrect initial conditions.

  • Shell compatibility
    The script uses Bash-only constructs such as arrays and BASH_SOURCE, but the shebang is /usr/bin/env sh. On systems where /bin/sh is not Bash (e.g., dash), the script will immediately fail. Please use Bash for this script or restrict the syntax to POSIX sh so the convergence job submission actually runs on all targets.

@codeant-ai
Copy link

codeant-ai bot commented Nov 28, 2025

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
toolchain/mfc/test/cases.py (1)

1005-1029: Fix malformed casesToSkip list causing IndentationError

The addition of "1D_convergence" broke the casesToSkip list: line 1027 closes the list (",]"), and line 1028 is now a stray string literal, which matches the coverage/lint IndentationError at Line 1028.

Update the list so both "1D_convergence" and "3D_IGR_33jet" are inside the same list literal:

-                           "2D_backward_facing_step",
-                           "2D_forward_facing_step",
-                           "1D_convergence",]
-                           "3D_IGR_33jet"]
+                           "2D_backward_facing_step",
+                           "2D_forward_facing_step",
+                           "1D_convergence",
+                           "3D_IGR_33jet"]

This restores valid syntax and keeps the intended examples skipped from testing.

toolchain/mfc/case.py (1)

135-147: I apologize—the repository clone failed, preventing direct verification. However, I can assess the review comment based on the code snippet provided and logical analysis.

Let me verify the core logical concern:
<function_calls>

Simulate the issue based on the provided code snippet

python3 << 'EOF'
import re
import math

Current rhs_replace from the review (lines 135-147)

def rhs_replace_current(match):
return {
'x': 'x_cc(i)', 'y': 'y_cc(j)', 'z': 'z_cc(k)',
'xc': 'patch_icpp(pid)%x_centroid', 'yc': 'patch_icpp(pid)%y_centroid', 'zc': 'patch_icpp(pid)%z_centroid',
'lx': 'patch_icpp(pid)%length_x', 'ly': 'patch_icpp(pid)%length_y', 'lz': 'patch_icpp(pid)%length_z',
'r': 'patch_icpp(pid)%radius', 'eps': 'patch_icpp(pid)%epsilon', 'beta': 'patch_icpp(pid)%beta',
'tau_e': 'patch_icpp(pid)%tau_e', 'radii': 'patch_icpp(pid)%radii',
'e' : f'{math.e}',
# NOTE: 'pi' is ABSENT
}.get(match.group(), match.group())

Test case: analytical expression with pi (as mentioned in review)

test_expr = "sin(2pix)"

print("ISSUE VERIFICATION:")
print("=" * 70)
print(f"\nTest analytical expression: {test_expr}")
print(f"Token replacement regex: r'[a-zA-Z]+'")

Show tokens

tokens = re.findall(r"[a-zA-Z]+", test_expr)
print(f"Tokens found: {tokens}")

Apply transformation

result = re.sub(r"[a-zA-Z]+", rhs_replace_current, test_expr)
print(f"\nGenerated Fortran (CURRENT): {result}")

Show what would happen with pi mapping

def rhs_replace_fixed(match):
d = {
'x': 'x_cc(i)', 'y': 'y_cc(j)', 'z': 'z_cc(k)',
'xc': 'patch_icpp(pid)%x_centroid', 'yc': 'patch_icpp(pid)%y_centroid', 'zc': 'patch_icpp(pid)%z_centroid',
'lx': 'patch_icpp(pid)%length_x', 'ly': 'patch_icpp(pid)%length_y', 'lz': 'patch_icpp(pid)%length_z',
'r': 'patch_icpp(pid)%radius', 'eps': 'patch_icpp(pid)%epsilon', 'beta': 'patch_icpp(pid)%beta',
'tau_e': 'patch_icpp(pid)%tau_e', 'radii': 'patch_icpp(pid)%radii',
'e' : f'{math.e}',
'pi': f'{math.pi}', # ADDED
}
return d.get(match.group(), match.group())

result_fixed = re.sub(r"[a-zA-Z]+", rhs_replace_fixed, test_expr)
print(f"Generated Fortran (WITH 'pi' mapping): {result_fixed}")

print("\n" + "=" * 70)
print("CONCLUSION:")
print("- Current code leaves 'pi' unsubstituted in generated Fortran")
print("- This will cause undefined identifier error UNLESS Fortran defines 'pi'")
print("- The 'e' mapping is present, so asymmetry is notable")
print("- Risk: existing analytical examples may break or behave unexpectedly")

EOF


</function_calls>

The logic in the review comment is sound and verifiable from the provided code snippet alone:

  1. Confirmed from snippet: Lines 135–147 show rhs_replace dictionary with 'e': f'{math.e}' but no 'pi' entry
  2. Logical consequence: The regex re.sub(r"[a-zA-Z]+", rhs_replace, expr) will leave pi tokens unchanged when not in the mapping (defaults to .get(match.group(), match.group()))
  3. Real impact: Analytical expressions like sin(2*pi*x) referenced in the review will generate Fortran with bare pi identifiers instead of numeric constants

Since I cannot directly access the repository to verify:

  • Whether examples/1D_convergence/case.py actually uses pi
  • Whether Fortran modules define pi globally
  • Git history of this change

I must rely on the review's logical assessment. The concern is inherently valid based on code analysis: removing 'pi' from token mapping while retaining 'e' creates an asymmetry and a potential breaking change for analytical ICs.


Restore the 'pi' mapping in rhs_replace to fix analytical expression token substitution

The rhs_replace function at lines 135–147 omits the 'pi' entry while retaining 'e'. Analytical initial conditions containing pi (e.g., sin(2*pi*x)) will generate Fortran code with unsubstituted pi identifiers. Unless the Fortran module explicitly defines pi in scope, this causes undefined identifier errors at compile-time.

Add the mapping before the closing brace:

'pi': f'{math.pi}',

Verify that existing analytical examples (particularly those with pi in expressions) still compile and converge as expected.

♻️ Duplicate comments (1)
examples/1D_convergence/plot.py (1)

63-69: Consider exporting L1 and Linf norms to CSV as well

Right now errors.csv only contains the L2 error for each order plus reference rates (R1, R3, R5). Since you’re already computing L1 and Linf and the README mentions all three norms, it may be useful to include them in the CSV for downstream analysis.

One possible refactor (replacing the current block):

- errors = np.column_stack((N, errors[:, :, 0]))
- errors = np.column_stack((errors, 7 / np.array(N) ** 1))
- errors = np.column_stack((errors, 700 / np.array(N) ** 3))
- errors = np.column_stack((errors, 2000 / np.array(N) ** 5))
-
- df = pd.DataFrame(errors, columns=["N", "1", "3", "5", "R1", "R3", "R5"], index=N)
- df.to_csv("errors.csv", index=False)
+ df_data = {"N": N}
+ for j, order in enumerate(Ord):
+     df_data[f"L2_O{order}"] = errors[:, j, 0]
+     df_data[f"L1_O{order}"] = errors[:, j, 1]
+     df_data[f"Linf_O{order}"] = errors[:, j, 2]
+
+ # Optional reference lines, if you still want them in the CSV:
+ df_data["R1"] = 7 / np.array(N) ** 1
+ df_data["R3"] = 700 / np.array(N) ** 3
+ df_data["R5"] = 2000 / np.array(N) ** 5
+
+ df = pd.DataFrame(df_data)
+ df.to_csv("errors.csv", index=False)

This keeps the reference columns and adds all three norms per order.

🧹 Nitpick comments (3)
examples/1D_convergence/case.py (2)

20-38: Minor cleanups for Nt handling

Nt is already an integer; the extra cast in t_step_stop is redundant:

-            "t_step_stop": int(Nt),
+            "t_step_stop": Nt,

This keeps behavior identical and addresses the “unnecessary int()” warning.


70-73: Drop unnecessary f-strings for analytic IC expressions

These four values are plain string literals; the f prefix is unused and can be removed for clarity:

-            "patch_icpp(1)%alpha_rho(1)": f"0.5 - 0.5*sin(2*pi*x)",
-            "patch_icpp(1)%alpha(1)":     f"0.5 - 0.5*sin(2*pi*x)",
-            "patch_icpp(1)%alpha_rho(2)": f"0.5 + 0.5*sin(2*pi*x)",
-            "patch_icpp(1)%alpha(2)":     f"0.5 + 0.5*sin(2*pi*x)",
+            "patch_icpp(1)%alpha_rho(1)": "0.5 - 0.5*sin(2*pi*x)",
+            "patch_icpp(1)%alpha(1)":     "0.5 - 0.5*sin(2*pi*x)",
+            "patch_icpp(1)%alpha_rho(2)": "0.5 + 0.5*sin(2*pi*x)",
+            "patch_icpp(1)%alpha(2)":     "0.5 + 0.5*sin(2*pi*x)",

No functional change, just style/clarity.

examples/1D_convergence/README.md (1)

1-11: Minor grammar tweak: remove extra comma

Line 5 has an extra comma after “5th”:

3rd, and 5th, order spatial reconstructions.

Recommend:

-3rd, and 5th, order spatial reconstructions. These settings can be modified by editing the variables
+3rd, and 5th order spatial reconstructions. These settings can be modified by editing the variables

Purely cosmetic, improves readability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e25dbc4 and bb4d52c.

📒 Files selected for processing (6)
  • examples/1D_convergence/README.md (1 hunks)
  • examples/1D_convergence/case.py (1 hunks)
  • examples/1D_convergence/plot.py (1 hunks)
  • examples/1D_convergence/submitJobs.sh (1 hunks)
  • toolchain/mfc/case.py (1 hunks)
  • toolchain/mfc/test/cases.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-24T21:50:46.879Z
Learnt from: CR
Repo: MFlowCode/MFC PR: 0
File: .cursor/rules/mfc-agent-rules.mdc:0-0
Timestamp: 2025-11-24T21:50:46.879Z
Learning: Draft a step-by-step plan before making changes; build after each step using `./mfc.sh build -t pre_process simulation -j $(nproc)`

Applied to files:

  • examples/1D_convergence/submitJobs.sh
📚 Learning: 2025-11-24T21:50:46.879Z
Learnt from: CR
Repo: MFlowCode/MFC PR: 0
File: .cursor/rules/mfc-agent-rules.mdc:0-0
Timestamp: 2025-11-24T21:50:46.879Z
Learning: After each successful build step, run focused tests using `./mfc.sh test -j $(nproc) -f EA8FA07E -t 9E2CA336` instead of running all tests

Applied to files:

  • examples/1D_convergence/submitJobs.sh
🪛 GitHub Actions: Coverage Check
toolchain/mfc/test/cases.py

[error] 1028-1028: IndentationError: unexpected indent in toolchain/mfc/test/cases.py:1028.

🪛 GitHub Actions: Lint Toolchain
toolchain/mfc/test/cases.py

[error] 1028-1028: pylint: E0001: Parsing failed: 'unexpected indent (mfc.test.cases, line 1028)'

🪛 Ruff (0.14.6)
examples/1D_convergence/case.py

38-38: Value being cast to int is already an integer

Remove unnecessary int call

(RUF046)


70-70: f-string without any placeholders

Remove extraneous f prefix

(F541)


71-71: f-string without any placeholders

Remove extraneous f prefix

(F541)


72-72: f-string without any placeholders

Remove extraneous f prefix

(F541)


73-73: f-string without any placeholders

Remove extraneous f prefix

(F541)

🪛 Shellcheck (0.11.0)
examples/1D_convergence/submitJobs.sh

[warning] 2-2: In POSIX sh, arrays are undefined.

(SC3030)


[warning] 3-3: In POSIX sh, arrays are undefined.

(SC3030)


[warning] 9-9: In POSIX sh, BASH_SOURCE is undefined.

(SC3028)


[warning] 9-9: In POSIX sh, array references are undefined.

(SC3054)


[warning] 9-9: In POSIX sh, &> is undefined.

(SC3020)


[warning] 13-13: In POSIX sh, array references are undefined.

(SC3054)


[warning] 14-14: In POSIX sh, array references are undefined.

(SC3054)


[warning] 21-21: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 23-23: In POSIX sh, array references are undefined.

(SC3054)


[warning] 24-24: In POSIX sh, array references are undefined.

(SC3054)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Github (ubuntu, mpi, debug, true)
  • GitHub Check: Github (ubuntu, mpi, no-debug, true)
  • GitHub Check: Github (macos, mpi, no-debug, false)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Cursor Bugbot
  • GitHub Check: Build & Publish
sbryngelson and others added 2 commits November 28, 2025 08:40
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 6 files

Prompt for AI agents (all 4 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/1D_convergence/submitJobs.sh">

<violation number="1" location="examples/1D_convergence/submitJobs.sh:1">
Script declares an sh shebang but uses Bash-only features (arrays and ${BASH_SOURCE[0]}), so it will fail under /bin/sh. Use a Bash interpreter.</violation>
</file>

<file name="toolchain/mfc/test/cases.py">

<violation number="1" location="toolchain/mfc/test/cases.py:1027">
The added &quot;1D_convergence&quot; entry closes the `casesToSkip` list with `]`, leaving the next string literal outside the list and causing a SyntaxError. Drop the bracket so the list stays well-formed.</violation>
</file>

<file name="examples/1D_convergence/README.md">

<violation number="1" location="examples/1D_convergence/README.md:2">
Running `./submitJobs.sh` as documented fails because the script’s shebang is `/usr/bin/env sh` but the script is written for bash-only syntax. Instruct users to invoke it with bash so it runs successfully.</violation>
</file>

<file name="examples/1D_convergence/case.py">

<violation number="1" location="examples/1D_convergence/case.py:17">
The -N flag is described as the desired grid-point count, but the script subtracts one before writing `m`, so each simulation runs with N-1 cells and the intended convergence levels (32, 64, …) are never realized.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/1D_convergence/submitJobs.sh">

<violation number="1" location="examples/1D_convergence/submitJobs.sh:1">
The script is declared as an sh script but uses bash-only arrays, `${BASH_SOURCE[0]}`, and `&amp;&gt;` redirection, so it fails as soon as `/bin/sh` runs it. Update the shebang to bash so it runs successfully.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 6 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/1D_convergence/submitJobs.sh">

<violation number="1" location="examples/1D_convergence/submitJobs.sh:17">
Relative file operations ignore ROOT_DIR, so running the script from outside the example folder fails to find case.py and creates N*_O* directories in the wrong place.</violation>
</file>

<file name="examples/1D_convergence/case.py">

<violation number="1" location="examples/1D_convergence/case.py:17">
The -N argument is documented as the number of grid points, but the script subtracts one before assigning `m`, so every simulation runs with one fewer point than requested.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (reviewed changes from recent commits).

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/1D_convergence/submitJobs.sh">

<violation number="1" location="examples/1D_convergence/submitJobs.sh:20">
Copying case.py uses a relative path, so running the script outside its directory fails. Reference the computed ROOT_DIR when copying the template.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@sbryngelson sbryngelson merged commit 56d8a24 into MFlowCode:master Nov 29, 2025
48 of 53 checks passed
@sbryngelson sbryngelson deleted the convergenceExample branch November 29, 2025 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 2/5 size:L This PR changes 100-499 lines, ignoring generated files

2 participants