Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout code
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fig*
*.pkl
*.png
*.tar
*.whl

### Python ###
# Byte-compiled / optimized / DLL files
Expand Down Expand Up @@ -101,7 +102,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
15 changes: 12 additions & 3 deletions MITRotor/Momentum.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def compute_initial_wake_velocities(self, Ct: float, yaw: float) -> ArrayLike:
class HeckMomentum(MomentumModel):
"""
Heck Momentum model based on 2023 paper:
https://doi.org/10.1017/jfm.2023.129
https://doi.org/10.1017/jfm.2023.129

Note that this version takes in CT and has a high thrust correction when calculating induction.
"""
def __init__(
self, averaging: Literal["sector", "annulus", "rotor"] = "rotor", ac: float = 1 / 3, v4_correction: float = 1.0
Expand All @@ -176,10 +178,15 @@ def compute_induction(self, Cx: ArrayLike, yaw: float) -> ArrayLike:
-4 + np.sqrt(-(Cx**2) * np.sin(yaw) ** 2 - 16 * Cx + 16)
)

mask = Cx > Ctc
if np.iterable(Cx):
mask = Cx > Ctc
if np.any(mask):
a[mask] = (Cx[mask] - Ctc) / slope + self.ac
elif isinstance(Cx, (int, float)):
if mask:
a = (Cx - Ctc) / slope + self.ac
else:
raise ValueError(f"Unsupported type of Cx ({Cx}) - not iterable and not a float - so high thrust correction in Heck can't be applied.")

return a

Expand All @@ -194,6 +201,8 @@ class UnifiedMomentum(MomentumModel):
"""
Unified Momentum Model based on 2024 paper:
https://www.nature.com/articles/s41467-024-50756-5

Note that this version takes in CT and thus uses the thrust based unified momentum model.
"""
def __init__(self, averaging: Literal["sector", "annulus", "rotor"] = "rotor", beta=0.1403):
self.beta = beta
Expand All @@ -216,7 +225,7 @@ def compute_induction(self, Cx: ArrayLike, yaw: float) -> ArrayLike:

def compute_initial_wake_velocities(self, Ct: float, yaw: float) -> ArrayLike:
sol = self.model_Ct(Ct, yaw)
return sol.u4[0], sol.v4[0]
return sol.u4, sol.v4


class MadsenMomentum(MomentumModel):
Expand Down
2 changes: 1 addition & 1 deletion examples/MITRotor_quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
Loading