Skip to content

1535 particle bed modificaiton and alternative packing algorithms#1539

Merged
sbryngelson merged 5 commits into
MFlowCode:masterfrom
danieljvickers:1535-particle-bed-modificaiton-and-alternative-packing-algorithms
Jun 5, 2026
Merged

1535 particle bed modificaiton and alternative packing algorithms#1539
sbryngelson merged 5 commits into
MFlowCode:masterfrom
danieljvickers:1535-particle-bed-modificaiton-and-alternative-packing-algorithms

Conversation

@danieljvickers
Copy link
Copy Markdown
Member

Description

As requested by @sbryngelson, the particle "bed" code has been renamed to an appropriate particle "cloud". In addition I separated out the particle cloud generation into two separate subroutines. One iterates through all clouds and sorts them by packing method. The other contains all of the generation for a specific packing method.

This will enhance the ability to build upon the code, as users can now add their specific packing algorithm of choice as a case-file-selectable parameter. This architecture should make it easier for others to edit the code and maintain cleanliness moving forward.

Closes #1535

Type of change (delete unused ones)

  • Refactor

Testing

Ran CPU tests locally (all modifications are CPU-only)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Claude Code Review

Head SHA: 4fbeacd

Files changed:

  • 14
  • docs/documentation/case.md
  • src/common/m_constants.fpp
  • src/common/m_derived_types.fpp
  • src/simulation/m_checker.fpp
  • src/simulation/m_global_parameters.fpp
  • src/simulation/m_mpi_proxy.fpp
  • src/simulation/m_particle_cloud.fpp
  • src/simulation/m_start_up.fpp
  • toolchain/mfc/case_validator.py
  • toolchain/mfc/params/definitions.py

Findings

Missing Python-side validation for packing_method in case_validator.py

definitions.py adds packing_method as a new particle_cloud attribute with a hard constraint (only value 1 is valid). The Fortran-side check is correctly added in m_checker.fpp:

@:PROHIBIT(particle_cloud(i)%packing_method == dflt_int, ...)
@:PROHIBIT(particle_cloud(i)%packing_method /= 1, ...)

However, case_validator.py (which is changed in this PR) has no corresponding check for packing_method. Per the project's parameter system rules (.claude/rules/parameter-system.md): "Add validation rules if the parameter has physics constraints." This means ./mfc.sh validate case.py will silently accept a case with an invalid or omitted packing_method, and the error is only caught at simulation startup. Given that packing_method is currently a required enum field with a single valid value, the Python validator is the right place to surface this early.

@danieljvickers
Copy link
Copy Markdown
Member Author

AI is correct, and comment has been addressed

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 80.40541% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.80%. Comparing base (68dbb6b) to head (865a737).

Files with missing lines Patch % Lines
src/simulation/m_particle_cloud.fpp 82.24% 12 Missing and 7 partials ⚠️
src/simulation/m_start_up.fpp 46.15% 6 Missing and 1 partial ⚠️
src/simulation/m_checker.fpp 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1539   +/-   ##
=======================================
  Coverage   60.80%   60.80%           
=======================================
  Files          73       73           
  Lines       20199    20209   +10     
  Branches     2932     2933    +1     
=======================================
+ Hits        12281    12289    +8     
- Misses       5932     5933    +1     
- Partials     1986     1987    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson sbryngelson merged commit c9dd5c5 into MFlowCode:master Jun 5, 2026
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Particle "Bed" Modificaiton and Alternative Packing Algorithms

2 participants