Skip to content

Expose erosion rate control - #41

Merged
sergioald merged 1 commit into
mainfrom
expose-erosion-rate-control
Jul 24, 2026
Merged

sergioald merged 1 commit into
mainfrom
expose-erosion-rate-control

Conversation

@sergioald

Copy link
Copy Markdown
Owner

Summary

Exposes the existing bank-erodibility / erosion-rate coefficient as a validated user control while preserving the historical default of 1.0e-8.

Changed

  • ldsfl/main.py

    • validates that the selected erosion rate is finite and strictly positive;
    • records the resolved value in the run summary;
    • continues to pass the value through the existing ER solver argument.
  • run_ldsfl.py

    • adds --erosion-rate;
    • validates the CLI value before launching the solver;
    • forwards the selected value to run_project(...).
  • ldsfl/gui_utils.py

    • adds erosion_rate to RunControls;
    • includes it in configuration round-tripping and converted-input previews;
    • validates finite, positive values.
  • gui_ldsfl.py

    • adds an advanced “Bank erodibility / erosion rate” field;
    • preserves the value in saved GUI configurations;
    • restores it when configurations are loaded;
    • forwards it to the solver and therefore into run manifests.
  • tests/test_erosion_rate_control.py

    • checks backward-compatible defaults;
    • checks config round-tripping, preview output, CLI forwarding and GUI forwarding;
    • checks invalid-value rejection;
    • checks run-summary reporting;
    • documents the adaptive-timestep relationship: doubling the erosion rate approximately halves dt while preserving displacement per solver step.

Why

run_case(...) already had the coefficient as the internal ER argument, with a fixed default of 1.0e-8, but neither the CLI nor GUI exposed it.

Making it configurable is useful for physical-time scaling, sensitivity studies and calibrated applications. The interface deliberately describes it as a bank-erodibility / migration-rate coefficient rather than a direct displacement-per-step control.

The current adaptive timestep is inversely proportional to migration speed. Consequently, changing the erosion rate normally changes cumulative simulated time much more than it changes geometry versus iteration number. That behaviour is preserved and explicitly tested.

Validation

python -m py_compile ldsfl/main.py ldsfl/gui_utils.py run_ldsfl.py gui_ldsfl.py tests/test_erosion_rate_control.py
python -m pytest tests/test_erosion_rate_control.py
python -m pytest
python -m run_ldsfl --base-dir . --cases 1 --max-steps 100 --no-plots --erosion-rate 1e-8
python -m run_ldsfl --base-dir . --cases 1 --max-steps 1 --no-plots --erosion-rate 2e-8
python -m ruff check ldsfl/main.py ldsfl/gui_utils.py run_ldsfl.py gui_ldsfl.py tests/test_erosion_rate_control.py

Compatibility

  • The default remains 1.0e-8.
  • Existing Python callers that use ER=... continue to work.
  • Existing GUI configuration files that do not contain erosion_rate load with the historical default.
  • Input/Parameter.csv, output directory names and per-step CSV schemas are unchanged.

Notes

This PR exposes and validates an existing coefficient. It does not change the flow solution, sediment-resistance closures, adaptive-timestep formula, geometry update, cutoff logic, resonance diagnostics or output naming.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fc17ed1e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gui_ldsfl.py
@sergioald
sergioald merged commit 83666cf into main Jul 24, 2026
3 checks passed
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.

1 participant