Conversation
📝 WalkthroughWalkthroughThe 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
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
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (6)
tests/functional/harris/harris_2d.py (6)
3-3: Remove unused import
osis imported but never used.-import os
23-23: Prefernp.linspacefor 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 floatsPlain
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: Modernisesuper()and record simulator handlePython 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
📒 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.05triggers rebalancing for 5 % imbalance; this can introduce noisy performance for small runs. Confirm that such an aggressive threshold is intended.
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
