-
Notifications
You must be signed in to change notification settings - Fork 29
boundary fix in sweep solver #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sierd
added a commit
that referenced
this pull request
Jan 13, 2026
* Initial plan * Phase 1: Add constants, utility functions, and improve documentation Co-authored-by: Sierd <[email protected]> * Phase 2: Extract helper methods and reduce code duplication Co-authored-by: Sierd <[email protected]> * Phase 3: Add variable label/title constants and improve docstrings Co-authored-by: Sierd <[email protected]> * Final: Add comprehensive refactoring documentation and summary Co-authored-by: Sierd <[email protected]> * Add export functionality: PNG and MP4 animations for all visualizations Co-authored-by: Sierd <[email protected]> * Phase 4: Begin code organization - extract utils module and create gui package structure Co-authored-by: Sierd <[email protected]> * Add comprehensive additional improvements proposal document Co-authored-by: Sierd <[email protected]> * bugfixes related to import and animattion functionality * updated structure for further refactoring * Refactor: Extract DomainVisualizer and rename gui_app_backup.py to application.py Co-authored-by: Sierd <[email protected]> * bugfix * bugfix on loading domain * Refactor: Extract WindVisualizer to modular architecture Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output2DVisualizer for 2D NetCDF visualization Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output1DVisualizer - Complete modular architecture achieved! Co-authored-by: Sierd <[email protected]> * bugfixes loading files * removed netcdf check * bugfixes after refractoring * Carcans files added for Olivier * bugfixes with domain overview * Gui v0.2 added (#264) * add wind plotting functionality * Refactor GUI: Complete modular architecture with all GUI tabs extracted, export functionality, and utilities (#263) * Initial plan * Phase 1: Add constants, utility functions, and improve documentation Co-authored-by: Sierd <[email protected]> * Phase 2: Extract helper methods and reduce code duplication Co-authored-by: Sierd <[email protected]> * Phase 3: Add variable label/title constants and improve docstrings Co-authored-by: Sierd <[email protected]> * Final: Add comprehensive refactoring documentation and summary Co-authored-by: Sierd <[email protected]> * Add export functionality: PNG and MP4 animations for all visualizations Co-authored-by: Sierd <[email protected]> * Phase 4: Begin code organization - extract utils module and create gui package structure Co-authored-by: Sierd <[email protected]> * Add comprehensive additional improvements proposal document Co-authored-by: Sierd <[email protected]> * bugfixes related to import and animattion functionality * updated structure for further refactoring * Refactor: Extract DomainVisualizer and rename gui_app_backup.py to application.py Co-authored-by: Sierd <[email protected]> * bugfix * bugfix on loading domain * Refactor: Extract WindVisualizer to modular architecture Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output2DVisualizer for 2D NetCDF visualization Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output1DVisualizer - Complete modular architecture achieved! Co-authored-by: Sierd <[email protected]> * bugfixes loading files * removed netcdf check * bugfixes after refractoring * bugfixes with domain overview * Speeding up complex drawing * hold on functionality added * Tab to run code added. * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/main.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/output_2d.py Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Rename visualizers folder to gui_tabs and update all imports Co-authored-by: Sierd <[email protected]> * bigfixes related to refactoring * reducing code lenght by omitting some redundancies * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> * testcommit * reverse commit * removed Carcans from Main * Refactor GUI: Complete modular architecture with all GUI tabs extract… (#268) * Refactor GUI: Complete modular architecture with all GUI tabs extracted, export functionality, and utilities (#263) * Initial plan * Phase 1: Add constants, utility functions, and improve documentation Co-authored-by: Sierd <[email protected]> * Phase 2: Extract helper methods and reduce code duplication Co-authored-by: Sierd <[email protected]> * Phase 3: Add variable label/title constants and improve docstrings Co-authored-by: Sierd <[email protected]> * Final: Add comprehensive refactoring documentation and summary Co-authored-by: Sierd <[email protected]> * Add export functionality: PNG and MP4 animations for all visualizations Co-authored-by: Sierd <[email protected]> * Phase 4: Begin code organization - extract utils module and create gui package structure Co-authored-by: Sierd <[email protected]> * Add comprehensive additional improvements proposal document Co-authored-by: Sierd <[email protected]> * bugfixes related to import and animattion functionality * updated structure for further refactoring * Refactor: Extract DomainVisualizer and rename gui_app_backup.py to application.py Co-authored-by: Sierd <[email protected]> * bugfix * bugfix on loading domain * Refactor: Extract WindVisualizer to modular architecture Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output2DVisualizer for 2D NetCDF visualization Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output1DVisualizer - Complete modular architecture achieved! Co-authored-by: Sierd <[email protected]> * bugfixes loading files * removed netcdf check * bugfixes after refractoring * bugfixes with domain overview * Speeding up complex drawing * hold on functionality added * Tab to run code added. * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/main.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/output_2d.py Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Rename visualizers folder to gui_tabs and update all imports Co-authored-by: Sierd <[email protected]> * bigfixes related to refactoring * reducing code lenght by omitting some redundancies * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> * Delete ADDITIONAL_IMPROVEMENTS.md * deleted md files --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> * Update Python version requirement to <3.14 (#270) crash reported when newest python version is used. Numba not compatible yet. * Fix ustarn calculation: initialization and FFT shear formula bugs (#265) * Initial plan * Fix ustars0 and ustarn0 initialization bug in wind.py Fixed bug where ustars0 and ustarn0 were incorrectly set to ustar magnitude instead of their respective directional components ustars and ustarn. Co-authored-by: Sierd <[email protected]> * input files for debugging * Fix missing division in dtauy FFT shear calculation The dtauy_t formula in the FFT shear method was missing the division by sc_kv(0., 2.*sqrt(2.)*sigma), causing incorrect y-direction shear stress perturbations. This resulted in non-zero ustarn values even when the bed had no y-direction variability. The formula now matches the structure of dtaux_t calculation. Co-authored-by: Sierd <[email protected]> * Fix frequency array alignment in FFT shear calculation The kx and ky frequency arrays were misaligned with the FFT output. The code was creating frequency arrays with fftfreq(n+1)[1:] which skips the DC component, but the FFT includes all frequencies. This caused incorrect mapping between frequencies and FFT coefficients, leading to wrong shear perturbations. Fixed by using fftfreq(n) which properly matches the FFT output dimensions and includes the DC component at the correct index. Co-authored-by: Sierd <[email protected]> * Handle division by zero at DC component in FFT shear The previous fix included the DC component (kx=0, ky=0) in the frequency arrays, which caused division by zero errors in the shear calculations. Fixed by: - Using safe division with np.where to replace zeros with 1.0 temporarily - Explicitly setting DC component of perturbations to 0 after calculation - Applying same fix to filter_highfrequencies function The DC component represents the mean value and doesn't contribute to perturbations, so setting it to zero is physically correct. Co-authored-by: Sierd <[email protected]> * Use masked computation to avoid invalid values in FFT shear The previous fix still allowed invalid values when kx=0 (but ky≠0) because sigma depends on kx. When kx=0, sigma=0 which causes issues in Bessel function ratios. New approach: - Create a mask for valid computations: (k > 0) & (abs(kx) > 0) - Initialize perturbation arrays with zeros - Only compute perturbations for valid frequency combinations - All invalid combinations (kx=0 or k=0) automatically get zero perturbation This is physically correct: perturbations at kx=0 (pure y-direction frequencies) should be zero for the x-direction flow formulation. Co-authored-by: Sierd <[email protected]> * Simplify FFT shear edge case handling Simplified the masked computation approach to a cleaner implementation: - Use np.where for safe division (replace zeros with 1.0 temporarily) - Compute formulas normally with safe arrays - Apply invalid_mask at the end to zero out problematic regions This achieves the same result with much simpler, more readable code. Co-authored-by: Sierd <[email protected]> * Update shear.py reverted the suggested division in dtauy_t calculation * deleted wind tests * shear patch --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Sierd <[email protected]> * new work on padding (#278) --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: OlivierBurvingt <[email protected]>
Sierd
added a commit
that referenced
this pull request
Jan 13, 2026
* Initial plan * Phase 1: Add constants, utility functions, and improve documentation Co-authored-by: Sierd <[email protected]> * Phase 2: Extract helper methods and reduce code duplication Co-authored-by: Sierd <[email protected]> * Phase 3: Add variable label/title constants and improve docstrings Co-authored-by: Sierd <[email protected]> * Final: Add comprehensive refactoring documentation and summary Co-authored-by: Sierd <[email protected]> * Add export functionality: PNG and MP4 animations for all visualizations Co-authored-by: Sierd <[email protected]> * Phase 4: Begin code organization - extract utils module and create gui package structure Co-authored-by: Sierd <[email protected]> * Add comprehensive additional improvements proposal document Co-authored-by: Sierd <[email protected]> * bugfixes related to import and animattion functionality * updated structure for further refactoring * Refactor: Extract DomainVisualizer and rename gui_app_backup.py to application.py Co-authored-by: Sierd <[email protected]> * bugfix * bugfix on loading domain * Refactor: Extract WindVisualizer to modular architecture Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output2DVisualizer for 2D NetCDF visualization Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output1DVisualizer - Complete modular architecture achieved! Co-authored-by: Sierd <[email protected]> * bugfixes loading files * removed netcdf check * bugfixes after refractoring * Carcans files added for Olivier * bugfixes with domain overview * Gui v0.2 added (#264) * add wind plotting functionality * Refactor GUI: Complete modular architecture with all GUI tabs extracted, export functionality, and utilities (#263) * Initial plan * Phase 1: Add constants, utility functions, and improve documentation Co-authored-by: Sierd <[email protected]> * Phase 2: Extract helper methods and reduce code duplication Co-authored-by: Sierd <[email protected]> * Phase 3: Add variable label/title constants and improve docstrings Co-authored-by: Sierd <[email protected]> * Final: Add comprehensive refactoring documentation and summary Co-authored-by: Sierd <[email protected]> * Add export functionality: PNG and MP4 animations for all visualizations Co-authored-by: Sierd <[email protected]> * Phase 4: Begin code organization - extract utils module and create gui package structure Co-authored-by: Sierd <[email protected]> * Add comprehensive additional improvements proposal document Co-authored-by: Sierd <[email protected]> * bugfixes related to import and animattion functionality * updated structure for further refactoring * Refactor: Extract DomainVisualizer and rename gui_app_backup.py to application.py Co-authored-by: Sierd <[email protected]> * bugfix * bugfix on loading domain * Refactor: Extract WindVisualizer to modular architecture Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output2DVisualizer for 2D NetCDF visualization Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output1DVisualizer - Complete modular architecture achieved! Co-authored-by: Sierd <[email protected]> * bugfixes loading files * removed netcdf check * bugfixes after refractoring * bugfixes with domain overview * Speeding up complex drawing * hold on functionality added * Tab to run code added. * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/main.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/output_2d.py Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Rename visualizers folder to gui_tabs and update all imports Co-authored-by: Sierd <[email protected]> * bigfixes related to refactoring * reducing code lenght by omitting some redundancies * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> * testcommit * reverse commit * removed Carcans from Main * Refactor GUI: Complete modular architecture with all GUI tabs extract… (#268) * Refactor GUI: Complete modular architecture with all GUI tabs extracted, export functionality, and utilities (#263) * Initial plan * Phase 1: Add constants, utility functions, and improve documentation Co-authored-by: Sierd <[email protected]> * Phase 2: Extract helper methods and reduce code duplication Co-authored-by: Sierd <[email protected]> * Phase 3: Add variable label/title constants and improve docstrings Co-authored-by: Sierd <[email protected]> * Final: Add comprehensive refactoring documentation and summary Co-authored-by: Sierd <[email protected]> * Add export functionality: PNG and MP4 animations for all visualizations Co-authored-by: Sierd <[email protected]> * Phase 4: Begin code organization - extract utils module and create gui package structure Co-authored-by: Sierd <[email protected]> * Add comprehensive additional improvements proposal document Co-authored-by: Sierd <[email protected]> * bugfixes related to import and animattion functionality * updated structure for further refactoring * Refactor: Extract DomainVisualizer and rename gui_app_backup.py to application.py Co-authored-by: Sierd <[email protected]> * bugfix * bugfix on loading domain * Refactor: Extract WindVisualizer to modular architecture Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output2DVisualizer for 2D NetCDF visualization Co-authored-by: Sierd <[email protected]> * Refactor: Extract Output1DVisualizer - Complete modular architecture achieved! Co-authored-by: Sierd <[email protected]> * bugfixes loading files * removed netcdf check * bugfixes after refractoring * bugfixes with domain overview * Speeding up complex drawing * hold on functionality added * Tab to run code added. * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/application.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/domain.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/main.py Co-authored-by: Copilot <[email protected]> * Update aeolis/gui/visualizers/output_2d.py Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Rename visualizers folder to gui_tabs and update all imports Co-authored-by: Sierd <[email protected]> * bigfixes related to refactoring * reducing code lenght by omitting some redundancies * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> * Delete ADDITIONAL_IMPROVEMENTS.md * deleted md files --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> * Update Python version requirement to <3.14 (#270) crash reported when newest python version is used. Numba not compatible yet. * Fix ustarn calculation: initialization and FFT shear formula bugs (#265) * Initial plan * Fix ustars0 and ustarn0 initialization bug in wind.py Fixed bug where ustars0 and ustarn0 were incorrectly set to ustar magnitude instead of their respective directional components ustars and ustarn. Co-authored-by: Sierd <[email protected]> * input files for debugging * Fix missing division in dtauy FFT shear calculation The dtauy_t formula in the FFT shear method was missing the division by sc_kv(0., 2.*sqrt(2.)*sigma), causing incorrect y-direction shear stress perturbations. This resulted in non-zero ustarn values even when the bed had no y-direction variability. The formula now matches the structure of dtaux_t calculation. Co-authored-by: Sierd <[email protected]> * Fix frequency array alignment in FFT shear calculation The kx and ky frequency arrays were misaligned with the FFT output. The code was creating frequency arrays with fftfreq(n+1)[1:] which skips the DC component, but the FFT includes all frequencies. This caused incorrect mapping between frequencies and FFT coefficients, leading to wrong shear perturbations. Fixed by using fftfreq(n) which properly matches the FFT output dimensions and includes the DC component at the correct index. Co-authored-by: Sierd <[email protected]> * Handle division by zero at DC component in FFT shear The previous fix included the DC component (kx=0, ky=0) in the frequency arrays, which caused division by zero errors in the shear calculations. Fixed by: - Using safe division with np.where to replace zeros with 1.0 temporarily - Explicitly setting DC component of perturbations to 0 after calculation - Applying same fix to filter_highfrequencies function The DC component represents the mean value and doesn't contribute to perturbations, so setting it to zero is physically correct. Co-authored-by: Sierd <[email protected]> * Use masked computation to avoid invalid values in FFT shear The previous fix still allowed invalid values when kx=0 (but ky≠0) because sigma depends on kx. When kx=0, sigma=0 which causes issues in Bessel function ratios. New approach: - Create a mask for valid computations: (k > 0) & (abs(kx) > 0) - Initialize perturbation arrays with zeros - Only compute perturbations for valid frequency combinations - All invalid combinations (kx=0 or k=0) automatically get zero perturbation This is physically correct: perturbations at kx=0 (pure y-direction frequencies) should be zero for the x-direction flow formulation. Co-authored-by: Sierd <[email protected]> * Simplify FFT shear edge case handling Simplified the masked computation approach to a cleaner implementation: - Use np.where for safe division (replace zeros with 1.0 temporarily) - Compute formulas normally with safe arrays - Apply invalid_mask at the end to zero out problematic regions This achieves the same result with much simpler, more readable code. Co-authored-by: Sierd <[email protected]> * Update shear.py reverted the suggested division in dtauy_t calculation * deleted wind tests * shear patch --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Sierd <[email protected]> * new work on padding (#278) --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Sierd <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: OlivierBurvingt <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.