PHAREHUB / PHARE

💫 Parallel Hybrid Particle In Cell code with Adaptive mesh REfinement
https://phare.readthedocs.io
GNU General Public License v3.0
71 stars 24 forks source link

absolute tagging #902

Closed nicolasaunai closed 1 month ago

nicolasaunai commented 1 month ago

is on top of #893 the PR only concerns the diff in default hybrid tagging and adds absolute values to the tagging formula. Or alternatively, only the last commit ("tagging better") current master formula (also in the paper) leads to this refinement if increasing the threshold

image

clearly the two current layers being similar in terms of scales and magnetic jump they should be refined the same way. This comes from the absolute value missing in the denominator that makes the positive and negative derivatives of B leading to different values of tagging formula hence difference response to the thresholding.

adding the absolute value and testing it for different tagging thresholds leads to

image

Which behaves better, see the pic above that tested the same configuration as above for different thresholds:

Summary by CodeRabbit

coderabbitai[bot] commented 1 month ago
📝 Walkthrough ## Walkthrough The pull request introduces significant modifications across several files, primarily focusing on enhancing simulation parameters and functionalities. Key updates include the expansion of the `populateDict` function to incorporate new parameters for Ohm's law and load balancing, adjustments to the `Simulation` class to accept a new `hyper_mode` keyword, and the addition of methods to handle particle arrays and grid layouts. Furthermore, error handling improvements and refinements in numerical stability for field calculations are also included. ## Changes | File Path | Change Summary | |-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `pyphare/pyphare/pharein/__init__.py` | Modified `populateDict` to add parameters for Ohm's law and load balancing. Included error handling for unregistered electrons. | | `pyphare/pyphare/pharein/simulation.py` | Added `hyper_mode` keyword argument to the `checker` decorator and updated the `Simulation` class `__init__` method to accept it. | | `src/amr/resources_manager/amr_utils.hpp` | Updated `layoutFromPatch` to include `lvlNbr` parameter in its return statement. | | `src/amr/solvers/solver_ppc.hpp` | Introduced static method `add_to` in `SolverPPC` for managing `ParticleArray` objects in a map. | | `src/amr/tagging/default_hybrid_tagger_strategy.hpp` | Modified `tag` method in `DefaultHybridTaggerStrategy` for improved numerical stability in field difference calculations. | | `src/core/data/grid/gridlayout.hpp` | Enhanced `GridLayout` constructor with `level_number` parameter and added static methods for linear interpolation. Added `levelNumber()` method to return `levelNumber_`. | | `src/core/data/grid/gridlayoutimplyee.hpp` | Added methods in `GridLayoutImplYee` for converting between magnetic and electric field components. | | `src/core/data/tensorfield/tensorfield.hpp` | Improved formatting of lambda expressions in `getCompileTimeResourcesViewList` methods. | | `src/core/data/vecfield/vecfield.hpp` | Added a commented-out function template `norm` for computing the norm of a vector field. | | `src/core/numerics/ohm/ohm.hpp` | Introduced `HyperMode` enum, updated constructor to initialize `hyper_mode`, and modified `hyperresistive_` method to accept additional parameters. Renamed original method and added `spatial_hyperresistive_`. | ## Possibly related PRs - **#879**: The changes in this PR involve modifications to the `Simulation` class and the `as_paths` function, which are related to the handling of simulation parameters, including the addition of new parameters for tagging thresholds. This aligns with the changes in the main PR that also involve modifications to simulation parameters, specifically the addition of new parameters in the `populateDict` function.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `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 generate unit testing code for this file.` - `@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 generate unit testing code.` - `@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.` 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 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.