Skip to content

make harris make plots#1027

Merged
PhilipDeegan merged 2 commits intoPHAREHUB:masterfrom
PhilipDeegan:harris
Jun 17, 2025
Merged

make harris make plots#1027
PhilipDeegan merged 2 commits intoPHAREHUB:masterfrom
PhilipDeegan:harris

Conversation

@PhilipDeegan
Copy link
Copy Markdown
Member

@PhilipDeegan PhilipDeegan commented Jun 17, 2025

we have no artifacts for harris
and it only runs with one level, which is not such a great test

sample bz from this after 10 timesteps at t = .05
harris_bz_t0 05

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 17, 2025

📝 Walkthrough

Walkthrough

The Harris 2D current sheet simulation test was refactored for improved modularity, diagnostics, and plotting. The main test script was enhanced with updated physics initialization, diagnostics, and plotting routines, and restructured into a test class. The previous load-balanced test script was removed, consolidating testing and plotting functionality into a single, more maintainable file.

Changes

File(s) Change Summary
tests/functional/harris/harris_2d.py Refactored and enhanced: reorganized imports, updated simulation setup, diagnostics, and plotting; replaced main logic with a test class and new plotting functions.
tests/functional/harris/harris_2d_lb.py Deleted: removed previous load-balanced Harris test and its associated configuration, plotting, and test class.

Sequence Diagram(s)

sequenceDiagram
    participant Tester (HarrisTest)
    participant Simulator
    participant MPI
    participant Plotter

    Tester->>Simulator: Initialize with config
    Tester->>Simulator: Run simulation
    Simulator-->>Tester: Simulation results & diagnostics
    Tester->>MPI: Synchronize ranks
    alt On rank 0
        Tester->>Plotter: Generate plots for diagnostics
        Plotter-->>Tester: Save plots to directory
    end
    Tester->>MPI: Final synchronization
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (6)
tests/functional/harris/harris_2d.py (6)

3-3: Remove unused import

os is imported but never used.

-import os

23-23: Prefer np.linspace for evenly–spaced diagnostics

np.arange(0, final_time + time_step, final_time / 5) relies on floating-point step size and can miss the intended end point on some hardware.

-timestamps = np.arange(0, final_time + time_step, final_time / 5)
+timestamps = np.linspace(0, final_time, 6)  # 0,10,…,50

152-154: Sanitise filenames generated from floats

Plain f"{time}" will produce “0.0”, “10.0”… but also long representations like “0.0500000000001”.

-return f"{plot_dir}/harris_{qty}_t{time}.png"
+return f"{plot_dir}/harris_{qty}_t{time:.3f}.png"

157-184: Load diagnostics only once per time stamp

Run(diag_dir) is inexpensive, but the plotting loop re-parses HDF5 files for each derived quantity. Cache the object per timestamp to cut I/O by ~5×.

E.g.

for time in timestamps:
    ds = run(time)          # hypothetical lazy loader
    ds.divB(...); ds.ranks(...)

187-195: Modernise super() and record simulator handle

Python 3 allows the shorter super().__init__() syntax and storing the simulator avoids double-reset logic later.

-    def __init__(self, *args, **kwargs):
-        super(HarrisTest, self).__init__(*args, **kwargs)
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
         ...

200-205: Use stored simulator to simplify teardown

-        Simulator(config()).run().reset()
+        self.simulator = Simulator(config()).run()
+        self.simulator.reset()

Avoids the “if … is not None” guard in tearDown().

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 32bb8e3 and b54ba98.

📒 Files selected for processing (2)
  • tests/functional/harris/harris_2d.py (4 hunks)
  • tests/functional/harris/harris_2d_lb.py (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/functional/harris/harris_2d_lb.py
🧰 Additional context used
🪛 Ruff (0.11.9)
tests/functional/harris/harris_2d.py

3-3: os imported but unused

Remove unused import: os

(F401)

🪛 Pylint (3.3.7)
tests/functional/harris/harris_2d.py

[refactor] 27-27: Too many local variables (17/15)

(R0914)


[refactor] 188-188: Consider using Python 3 style super() without arguments

(R1725)


[refactor] 194-194: Consider using Python 3 style super() without arguments

(R1725)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest, gcc)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (macos-13)
  • GitHub Check: build (ubuntu-latest, clang)
  • GitHub Check: Analyze (cpp)
  • GitHub Check: Analyze (python)
🔇 Additional comments (1)
tests/functional/harris/harris_2d.py (1)

147-147: Load-balancer tolerance: deliberate?

tol=0.05 triggers rebalancing for 5 % imbalance; this can introduce noisy performance for small runs. Confirm that such an aggressive threshold is intended.

@PhilipDeegan PhilipDeegan merged commit 1b8e7a5 into PHAREHUB:master Jun 17, 2025
9 of 13 checks passed
@PhilipDeegan PhilipDeegan deleted the harris branch June 18, 2025 09:16
UCaromel pushed a commit to UCaromel/PHARE that referenced this pull request Jun 18, 2025
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Jul 1, 2025
This was referenced Jul 8, 2025
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Jul 16, 2025
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants