-
Notifications
You must be signed in to change notification settings - Fork 29
New Separation bubble #271
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
base: main
Are you sure you want to change the base?
Changes from all commits
8d0a7a3
caae299
b3fb74d
39934d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,258 @@ | ||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||
| Streamline-based separation bubble model for AeoLiS | ||||||||||||||||||||||||||||||||||
| This module provides a unified 1D/2D separation bubble computation based on | ||||||||||||||||||||||||||||||||||
| a streamline curvature model. The physics is contained in a single numba- | ||||||||||||||||||||||||||||||||||
| compiled 1D core. For 2D grids (FFT shear mode), the 1D streamline model | ||||||||||||||||||||||||||||||||||
| is applied to each wind-aligned row. | ||||||||||||||||||||||||||||||||||
| Public Entry Point: | ||||||||||||||||||||||||||||||||||
| compute_separation(z_bed, dx, wind_sign, p) | ||||||||||||||||||||||||||||||||||
| Internal: | ||||||||||||||||||||||||||||||||||
| _compute_separation_1d(...) | ||||||||||||||||||||||||||||||||||
| _compute_separation_2d(...) | ||||||||||||||||||||||||||||||||||
| _streamline_core_1d(...) # numba auto-compiled | ||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import numpy as np | ||||||||||||||||||||||||||||||||||
| from numba import njit | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Wrapper for 1D vs 2D | ||||||||||||||||||||||||||||||||||
| def compute_separation(p, z_bed, dx, udir=0): | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Get all parameters | ||||||||||||||||||||||||||||||||||
| look_dist = p['sep_look_dist'] | ||||||||||||||||||||||||||||||||||
| k_press_up = p['sep_k_press_up'] | ||||||||||||||||||||||||||||||||||
| k_crit_down = p['sep_k_crit_down'] | ||||||||||||||||||||||||||||||||||
| s_crit = p['sep_s_crit'] | ||||||||||||||||||||||||||||||||||
| s_leeside = p['sep_s_leeside'] | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Determine size | ||||||||||||||||||||||||||||||||||
| ny_, nx = z_bed.shape | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Flip the bed for negative wind directions (only in 1D) | ||||||||||||||||||||||||||||||||||
| if udir < 0 and ny_ == 0: | ||||||||||||||||||||||||||||||||||
| z = z[::-1] | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+37
|
||||||||||||||||||||||||||||||||||
| z = z[::-1] |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Condition uses ny_ == 0 but should check ny_ == 1 for the 1D case. A 1D array with shape (1, nx) has ny_ = 1, not ny_ = 0.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'Curviture' should be 'Curvature'.
| k_press_up, k_crit_down, # Curviture | |
| k_press_up, k_crit_down, # Curvature |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Condition uses ny_ == 0 but should check ny_ == 1 for the 1D case. A 1D array with shape (1, nx) has ny_ = 1, not ny_ = 0.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'curviture' should be 'curvature'.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'curviture' should be 'curvature'.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'Curviture' should be 'Curvature'.
| # Required curviture (k) to close slope difference for height (k_req_height) and slope (k_req_slope) | |
| # Required curvature (k) to close slope difference for height (k_req_height) and slope (k_req_slope) |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'curviture' should be 'curvature'.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The loop starts at i_curv (line 183) but the calculation references i instead of i_curv when computing zj and zj_prev (lines 184-185). This appears to be intentional based on the comment at line 177 about "addition to the detachment length", but the variable i_curv is computed and used as the loop starting point. If the intent is to start the downward projection from position i (not i_curv), then either the loop should start at i or the formulas should reference i_curv.
| zj = z[i] - s_L * (j - i_curv) * dx | |
| zj_prev = z[i] - s_L * (j - i_curv - 1) * dx | |
| zj = z[i_curv] - s_L * (j - i_curv) * dx | |
| zj_prev = z[i_curv] - s_L * (j - i_curv - 1) * dx |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'leeslide' should be 'leeside'.
| # Double crossing could be caused due to a small hill on the leeslide | |
| # Double crossing could be caused due to a small hill on the leeside |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code should be removed. Lines 245, 250-251, 253, and 255-256 contain commented code that clutters the module. If these parameters are not needed, remove them entirely; if they may be needed later, document why they're kept as comments.
| # gamma_down = 0.4 # [-] Ratio of k_down to k_up | |
| # --- Upward curvature limit (perturbation theory) --- | |
| p['sep_k_press_up'] = (1 - f_min) * (2*np.pi / (np.sqrt(p['L']) * 40)) | |
| # # --- Downward curvature limit (softer than upward) --- | |
| # p['sep_k_press_down'] = gamma_down * p['sep_k_press_up'] | |
| # print(p['sep_k_press_down']) | |
| # # --- Curvature threshold for detachment trigger --- | |
| # p['sep_curv_limit_down'] = np.maximum(p['sep_s_crit'] / 0.5, 1.5 * p['sep_k_press_down']) | |
| # --- Upward curvature limit (perturbation theory) --- | |
| p['sep_k_press_up'] = (1 - f_min) * (2*np.pi / (np.sqrt(p['L']) * 40)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation: The unit notation
[1/m]forsep_k_crit_downappears inconsistent with the unit-less[-]notation used forsep_k_press_upon line 251, even though both represent curvature parameters. Clarify whether these parameters have different units or if the notation should be consistent.