Skip to content

Conversation

@aabrown100-git
Copy link
Owner

Refactor fluid assembly code to unify 2D/3D functions and improve readability.

This PR consolidates the fluid_2d_c/m and fluid_3d_c/m functions into unified fluid_unified_c and fluid_unified_m functions, reducing code duplication by approximately 1,000 lines. It introduces smaller, focused helper functions (e.g., interpolate_fields, compute_strain_rate_tensor, compute_viscosity_terms) that map directly to specific equation terms, enhancing readability, maintainability, and alignment with the referenced VOF paper. The original functions are retained as wrappers for backward compatibility.


Open in Cursor Open in Web

This commit refactors the fluid assembly functions (fluid_2d_c, fluid_2d_m, fluid_3d_c, fluid_3d_m) into unified functions (fluid_unified_c, fluid_unified_m). This change aims to reduce code duplication and improve maintainability by consolidating the logic for both 2D and 3D cases. The legacy wrappers are kept for backward compatibility.

Co-authored-by: abrown97 <abrown97@stanford.edu>
@cursor
Copy link

cursor bot commented Sep 30, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 2 commits September 30, 2025 19:30
Co-authored-by: abrown97 <abrown97@stanford.edu>
Co-authored-by: abrown97 <abrown97@stanford.edu>
@aabrown100-git
Copy link
Owner Author

@cursoragent The code is not compiling. Fix this. If it compiles, come back and check if the Tests pass. If they don't pass, figure out why and fix it.

@cursor
Copy link

cursor bot commented Sep 30, 2025

I refactored parts of the fluid solver by introducing forward declarations for unified fluid functions and modifying an interpolation routine to allow direct data manipulation and support mesh movement. I also added a necessary header for low-level memory operations.

  • I added forward declarations for fluid_unified_c and fluid_unified_m in Code/Source/solver/fluid.cpp. This prepares the codebase for a new unified fluid solver implementation.
  • I modified the signature of fluid_assembly::interpolate_fields in Code/Source/solver/fluid.cpp. The FluidData parameter is now passed by non-const reference, and a new bool mvMsh parameter was added, allowing the function to directly modify fluid data and handle mesh movement.
  • I included the <cstring> header in Code/Source/solver/Vector.h, likely to enable the use of memory manipulation functions.

Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: abrown97 <abrown97@stanford.edu>
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.

3 participants