Skip to content

[Solvergraph][Ramses][PIC] Draft PR for PIC solvergraph node with empty kernel on grid#1530

Draft
aserhani wants to merge 8 commits intoShamrock-code:mainfrom
aserhani:pic/solvergraph-node-on-grid-with-empty-kernel
Draft

[Solvergraph][Ramses][PIC] Draft PR for PIC solvergraph node with empty kernel on grid#1530
aserhani wants to merge 8 commits intoShamrock-code:mainfrom
aserhani:pic/solvergraph-node-on-grid-with-empty-kernel

Conversation

@aserhani
Copy link
Collaborator

@aserhani aserhani commented Jan 9, 2026

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Thanks @aserhani for opening this PR!

You can do multiple things directly here:
1 - Comment pre-commit.ci run to run pre-commit checks.
2 - Comment pre-commit.ci autofix to apply fixes.
3 - Add label autofix.ci to fix authorship & pre-commit for every commit made.
4 - Add label light-ci to only trigger a reduced & faster version of the CI (need the full one before merge).
5 - Add label trigger-ci to create an empty commit to trigger the CI.

Once the workflow completes a message will appear displaying informations related to the run.

Also the PR gets automatically reviewed by gemini, you can:
1 - Comment /gemini review to trigger a review
2 - Comment /gemini summary for a summary
3 - Tag it using @gemini-code-assist either in the PR or in review comments on files

@gemini-code-assist
Copy link

Summary of Changes

Hello @aserhani, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational framework for incorporating a Particle-In-Cell (PIC) solver into the RAMSES model. It introduces the necessary data structures, configuration options, and a dedicated solvergraph node to manage PIC-related computations. While the actual kernel implementation is still in progress, this PR provides the essential scaffolding for future development and integration of PIC capabilities, enhancing the model's ability to simulate particle dynamics.

Highlights

  • New Particle-In-Cell (PIC) Module: Introduced a new ParticleInCell module, including its header and source files, and integrated it into the build system.
  • PIC Configuration and Data Fields: Added a PICConfig struct and is_pic_enabled() method to SolverConfig, allowing conditional allocation of mass_particles and rho_pic data fields within the solver and its storage.
  • Solvergraph Integration: Created a NodePIC solvergraph node for Particle-In-Cell calculations and integrated it into the main solver sequence as an OperationSequence.
  • Python Bindings: Updated Python bindings to expose a set_pic() method, enabling the Particle-In-Cell feature from Python.
  • Solvergraph Visualization: Enabled the solvergraph visualization by default, which now outputs a .dot file for easier inspection of the solver's structure.
  • Placeholder PIC Kernel: The core PIC kernel logic in ParticleInCell.cpp is currently a placeholder, indicating ongoing development for the actual particle-in-cell computations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the initial scaffolding for a Particle-In-Cell (PIC) solver node within the Ramses model's solvergraph. The changes include adding a new NodePIC with an empty kernel, associated configuration options, storage fields, and Python bindings. The implementation is a good starting point. My review includes suggestions to improve code quality and maintainability, such as adding const correctness, completing documentation, and removing temporary debugging code before finalization. All original comments have been retained as they do not contradict or align with the provided rules in a way that would require modification or dropping.

Comment on lines +1397 to 1410
if (true) {
// logger::raw_ln(" -- tex:\n" +
// shambase::get_check_ref(storage.solver_sequence).get_tex()); logger::raw_ln(
// " -- dot:\n" + shambase::get_check_ref(storage.solver_sequence).get_dot_graph());

if (shamcomm::world_rank() == 0) {
std::ofstream graph_dot_file;
graph_dot_file.open("./solvergraph.dot");
graph_dot_file << "digraph G {\n";
graph_dot_file << shambase::get_check_ref(storage.solver_sequence).get_dot_graph();
graph_dot_file << "}\n";
graph_dot_file.close();
}
}

Choose a reason for hiding this comment

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

high

This block of code appears to be for debugging, as it unconditionally writes a solvergraph.dot file. This kind of code should not be present in a final merge. Please remove it or guard it with a compile-time debug flag.

// Particle-In-Cell config
//////////////////////////////////////////////////////////////////////////////////////////////
PICConfig pic_config{};
inline bool is_pic_enabled() { return pic_config.enabled; }

Choose a reason for hiding this comment

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

medium

For better code practice and to indicate that this function does not modify the object's state, it's recommended to mark is_pic_enabled as a const method. This allows it to be called on const instances of SolverConfig.

Suggested change
inline bool is_pic_enabled() { return pic_config.enabled; }
inline bool is_pic_enabled() const { return pic_config.enabled; }

* @file ParticleInCell.hpp
* @author Anass Serhani (anass.serhani@cnrs.fr)
* @author Timothée David--Cléris (tim.shamrock@proton.me) --no git blame--
* @brief

Choose a reason for hiding this comment

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

medium

The Doxygen comment for this new file is missing a @brief description. Please add a brief explanation of the file's purpose to improve documentation.

"flux_rhov_dust_face_zp", "flux_rhov_dust_face_zp", ndust);
}

// will be filled by NodePIC

Choose a reason for hiding this comment

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

medium

The comment // will be filled by NodePIC is slightly inaccurate. While rho_pic is an output of NodePIC, refs_mass_particles is an input reference. Consider clarifying the comment to reflect this distinction, for example: // PIC related fields. rho_pic will be filled by NodePIC.

* @file ParticleInCell.cpp
* @author Anass Serhani (anass.serhani@cnrs.fr)
* @author Timothée David--Cléris (tim.shamrock@proton.me) --no git blame--
* @brief

Choose a reason for hiding this comment

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

medium

The Doxygen comment for this new file is missing a @brief description. Please add a brief explanation of what this C++ source file implements to improve documentation.

Comment on lines +81 to +83
std::string tex = R"tex(
// TODO: Add TeX description here
)tex";

Choose a reason for hiding this comment

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

medium

This TODO comment indicates that a TeX description for the solver graph visualization is missing. Please ensure this is addressed before this pull request is finalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants