Fix validation logic to only check external boundary nodes#249
Fix validation logic to only check external boundary nodes#249ryancinsight wants to merge 1 commit intomainfrom
Conversation
Updated StokesFlowProblem validation to only enforce boundary conditions on topologically external nodes (cell_count == 1). Internal marked faces are now ignored during validation, preventing false positives where internal nodes were flagged as missing BCs. Implemented get_external_boundary_nodes() helper method and updated solver logic. Also disabled the broken `scheme` dependency in `crates/cfd-1d`. Co-authored-by: ryancinsight <55164720+ryancinsight@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📝 WalkthroughWalkthroughThis PR disables scheme-integration features across Cargo configurations and introduces a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello @ryancinsight, 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 significantly improves the robustness of the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on cc4f248..059fc0d
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (5)
• Cargo.lock
• Cargo.toml
• crates/cfd-1d/Cargo.toml
• crates/cfd-3d/src/fem/problem.rs
• crates/cfd-3d/src/fem/solver.rs
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a validation bug in the Stokes flow problem by correctly identifying external boundary nodes. The introduction of get_external_boundary_nodes and its use in both validation and solver logic is a solid fix. The new test case, test_validate_ignores_internal_marked_faces, is well-constructed and directly verifies that the issue with internal marked faces is resolved. I've added a couple of minor suggestions to improve code style and idiomatic usage. The changes to disable the scheme dependency are also noted and seem appropriate given the description.
| let mut boundary_vertices: HashSet<usize> = HashSet::new(); | ||
| for &face_idx in &external_faces { | ||
| if let Some(face) = self.mesh.face(face_idx) { | ||
| boundary_vertices.extend(&face.vertices); | ||
| } | ||
| } |
There was a problem hiding this comment.
This loop for collecting boundary vertices can be expressed more concisely and idiomatically using Rust's iterator methods. Using filter_map and flat_map can make the intent clearer and reduce boilerplate.
| let mut boundary_vertices: HashSet<usize> = HashSet::new(); | |
| for &face_idx in &external_faces { | |
| if let Some(face) = self.mesh.face(face_idx) { | |
| boundary_vertices.extend(&face.vertices); | |
| } | |
| } | |
| let boundary_vertices: std::collections::HashSet<usize> = external_faces | |
| .iter() | |
| .filter_map(|&face_idx| self.mesh.face(face_idx)) | |
| .flat_map(|face| &face.vertices) | |
| .copied() | |
| .collect(); |
| // Apply BCs only to external nodes (0, 1, 2, 3) | ||
| // Node 4 is strictly internal. | ||
| for i in 0..4 { | ||
| boundary_conditions.insert(i, BoundaryCondition::Dirichlet { value: 0.0, component_values: None }); |
There was a problem hiding this comment.
There is an extra leading space on this line. Please remove it to maintain consistent formatting with the surrounding code.
| boundary_conditions.insert(i, BoundaryCondition::Dirichlet { value: 0.0, component_values: None }); | |
| boundary_conditions.insert(i, BoundaryCondition::Dirichlet { value: 0.0, component_values: None }); |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/cfd-3d/src/fem/solver.rs (1)
457-468: The unconstrained-boundary-node warning is now dead code aftervalidate()succeeds.
validate()(called at line 57) already returnsErrif any external boundary node lacks a BC, sounconstrained_boundary_nodeswill always be empty here. This isn't harmful—it serves as defense-in-depth ifvalidate()is ever bypassed—but worth noting.
Updated StokesFlowProblem validation to only enforce boundary conditions on topologically external nodes (cell_count == 1). Internal marked faces are now ignored during validation, preventing false positives where internal nodes were flagged as missing BCs. Implemented get_external_boundary_nodes() helper method and updated solver logic. Also disabled the broken
schemedependency incrates/cfd-1d.PR created automatically by Jules for task 61686539264122540 started by @ryancinsight
High-level PR Summary
This PR fixes a validation bug in the Stokes flow problem where internal nodes on marked faces were incorrectly flagged as missing boundary conditions. The fix introduces a
get_external_boundary_nodes()method that filters out topologically internal faces (referenced by multiple cells) and only returns nodes on truly external boundaries. The validation and solver logic now use this method instead of the broaderget_boundary_nodes()implementation. Additionally, the brokenschemedependency integration incrates/cfd-1dhas been disabled by commenting out the feature and dependency references.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
crates/cfd-3d/src/fem/problem.rscrates/cfd-3d/src/fem/solver.rscrates/cfd-1d/Cargo.tomlCargo.tomlCargo.lockSummary by CodeRabbit
Bug Fixes
Chores