frispy
Submodules
Package Contents
Classes
Flying spinning disc object. The disc object contains only physical |
|
The environment in which the disc is flying in. This object contains |
|
|
|
Coefficient model for a disc. Holds all of the aerodynamic |
Attributes
- class frispy.Disc(model: frispy.model.Model = Model(), eom: Optional[frispy.equations_of_motion.EOM] = None, **kwargs)[source]
Flying spinning disc object. The disc object contains only physical parameters of the disc and environment that it exists (e.g. gravitational acceleration and air density). Note that the default area, mass, and inertial moments are for Discraft Ultrastars (175 grams or 0.175 kg).
All masses are kg, lengths are meters (m) and times are seconds (s). That is, these files all use mks units. Angular units use radians (rad), and angular velocities are in rad/s.
- Parameters
- _default_initial_conditions
- _default_physical_attributes
- compute_trajectory(self, flight_time: float = 3.0, n_times: int = 100, return_scipy_results: bool = False, **kwargs)[source]
Call the differential equation solver to compute the trajectory. The kinematic variables and timesteps are saved as the current_trajectory attribute, which is a dictionary, which is also returned by this function.
See the scipy docs for more information on the solver.
Warning
You cannot pass a flight_time if t_span is a key in solver_args.
- Parameters
flight_time (float, optional) – time in seconds that the simulation will run over. Default is 3 seconds.
n_times (int, optional) – default 100. Number of samples in time you would like the trajectory. Samples are spaced evenly in time from
(0, flight_time).return_scipy_results (bool, optional) – Default is False. Flag to indicate whether to return the full results object of the solver. See the scipy docs for more information.
kwargs – extra keyword arguments to pass to the
scipy.integrate.solver_ivp()
- reset_initial_conditions(self) None[source]
Set the initial_conditions of the disc to the default and clear the trajectory.
- property environment(self) frispy.environment.Environment
- property coordinate_names(self) List[str]
Names of the kinematic variables
- class frispy.Environment[source]
The environment in which the disc is flying in. This object contains information on the magnitude and direction of gravity, properties of the wind, and also intrinsic properties of the disc such as its area and mass.
- Parameters
air_density (float) – default is 1.225 kg/m^3
g (float) – default is 9.81 m/s^2; gravitational acceleration on Earth
- air_density :float = 1.225
- g :float = 9.81
- property grav_unit_vector(self) numpy.ndarray
Gravitational direction.
- class frispy.EOM(area: numbers.Number, I_xx: numbers.Number, I_zz: numbers.Number, mass: numbers.Number, environment: frispy.environment.Environment = Environment(), model: frispy.model.Model = Model())[source]
EOMis short for “equations of motion” is used to run the ODE solver from scipy. It takes in a model for the disc, the trajectory object, the environment, and implements the functions for calculating forces and torques.- static rotation_matrix(sp: float, cp: float, st: float, ct) numpy.ndarray[source]
Compute the (partial) rotation matrix that transforms from the lab frame to the disc frame. Note that because of azimuthal symmetry, the azimuthal angle (gamma) is not used.
This matrix (R) can be used to transform a vector from the lab frame (L) into the disk frame (D), i.e.: r_D = R dot r_L.
The
z_hatunit vector in the disk frame (D) will always be pointing perpendicular up from the top face of the disk.
- classmethod compute_angle_of_attack(cls, phi: float, theta: float, velocity: numpy.ndarray, return_all_variables: bool = False)[source]
- geometric_quantities(self, phi: float, theta: float, velocity: numpy.ndarray, angular_velocity: numpy.ndarray) Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]][source]
Compute intermediate quantities on the way to computing the time derivatives of the kinematic variables.
- compute_forces(self, phi: float, theta: float, velocity: numpy.ndarray, ang_velocity: numpy.ndarray) Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]][source]
Compute the lift, drag, and gravitational forces on the disc.
- compute_torques(self, velocity: numpy.ndarray, res: Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]]) Dict[str, Union[float, numpy.ndarray, Dict[str, numpy.ndarray]]][source]
Compute the torque around each principle axis.
- compute_derivatives(self, time: float, coordinates: numpy.ndarray) numpy.ndarray[source]
Right hand side of the ordinary differential equations. This is supplied to
scipy.integrate.solve_ivp(). See this page for more information about its fun argument.- Parameters
time (float) – instantanious time of the system
coordinates (np.ndarray) – kinematic variables of the disc
- Returns
derivatives of all coordinates
- class frispy.Model[source]
Coefficient model for a disc. Holds all of the aerodynamic parameters coupling the kinematic variables (spins and angles) to the force magnitudes.
- PL0 :float = 0.33
- PLa :float = 1.9
- PD0 :float = 0.18
- PDa :float = 0.69
- PTxwx :float
- PTxwz :float
- PTy0 :float
- PTya :float = 0.43
- PTywy :float
- PTzwz :float
- alpha_0 :float
- C_lift(self, alpha: float) float[source]
Lift force scale factor. Linear in the angle of attack (alpha).
- Parameters
alpha (float) – angle of attack in radians
- Returns
(float) lift force scale factor
- C_drag(self, alpha: float) float[source]
Drag force scale factor. Quadratic in the angle of attack (alpha).
- Parameters
alpha (float) – angle of attack in radians
- Returns
(float) drag force scale factor
- C_x(self, wx: float, wz: float) float[source]
‘x’-torque scale factor. Linearly additive in the ‘z’ angular velocity (w_z) and the ‘x’ angular velocity (w_x).
- Parameters
wx (float) – ‘x’ angular velocity in radians per second
wz (float) – ‘z’ angular velocity in radians per second
- Returns
(float) ‘x’-torque scale factor
- C_y(self, alpha: float, wy: float) float[source]
‘y’-torque scale factor. Linearly additive in the ‘y’ angular velocity (w_y) and the angle of attack (alpha).
- Parameters
alpha (float) – angle of attack in radians
wy (float) – ‘y’ angular velocity in radians per second
- Returns
(float) ‘y’-torque scale factor
- frispy.__author__ = Tom McClintock thmsmcclintock@gmail.com
- frispy.__version__ = 1.1.0
- frispy.__docs__ = Simulates flying spinning discs.