Created
September 26, 2021 15:49
-
-
Save YannBerthelot/9b3bb13f6fb17e4c9d669c1c185d999f to your computer and use it in GitHub Desktop.
This file contains 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
import numpy as np | |
from numba import njit | |
MACH_CRITIC = 0.78 | |
C_X_MIN = 0.095 | |
@njit(nogil=True, fastmath=True) | |
def compute_cx(alpha, mach): | |
""" | |
Compute the drag coefficient at M = 0 depending on alpha | |
(the higher alpha the higher the drag) | |
""" | |
cx = np.power((np.degrees(alpha) + 5) * 0.03, 2) + C_X_MIN | |
if mach < MACH_CRITIC: | |
return cx / np.sqrt(1 - (mach ** 2)) | |
if mach < 1: | |
return cx * 15 * (mach - MACH_CRITIC) + (cx / np.sqrt(1 - (mach ** 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment