To implement the Python classes that compute the lift and drag forces acting on a medium. See this confluence page for more details.
Description
You will be implementing the methods in a template class called MediumForceComputation located in boat_simulator/nodes/physics_engine/fluid_forces.py.
The class named MediumForceComputation has the following properties:
Class Attributes:
lift_coefficients is a 2D array functioning as a lookup table for lift coefficients corresponding to various angles of attack.
drag_coefficients is a 2D array functioning as a lookup table for drag coefficients corresponding to various angles of attack.
areas is a 2D array functioning as a lookup table for the fluid-affected areas corresponding to different angles of attack.
fluid_density is the density of the fluid acting on the medium.
Class Methods
MediumForceComputation is a constructor that accepts the lift coefficients, drag coefficients, affected areas, and fluid density as arguments.
compute is a function that accepts two arguments, apparent_velocity, which is the relative velocity between the fluid and the medium calculated by fluid_velocity - medium_velocity, and orientation which is the orientation angle of the medium.
interpolate is a function that accepts one argument, attack_angle, which is the angle of attack formed between orientation angle of the medium and the direction of the apparent velocity.
For reference, consider this diagram of an example medium (a sail) being acted on by an example fluid (wind):
Where
$\vec{V_w}$ is the velocity of the true wind acting on the medium.
$\vec{V_m}$ is the velocity of the medium.
$\vec{V_a}$ is the velocity of the apparent wind acting on the medium.
$\vec{F_L}$ is the lift force acting on the medium.
$\vec{F_D}$ is the drag force acting on the medium.
With the formulas
$F_L = f_L(\alpha) = \dfrac{1}{2}\rho ||v_A||^2 A(\alpha) C_L(\alpha)$, with direction perpendicular to the apparent velocity ($\vec{V_a}$)
$F_D = f_D(\alpha)$, with direction parallel to the apparent velocity ($\vec{V_a}$)
Where
$\rho$ is the fluid density.
$A$ is the area on the medium affected by the fluid, and is a function of $\alpha$.
$v_A$ is the apparent velocity between the fluid and the medium.
$C_L$ is the lift coefficient of the medium, and is a function of $\alpha$.
$\alpha$ is the angle of attack.
Tests
Add your unit tests to tests/unit/nodes/physics_engine/. You will use the pytest API for testing, which is already installed.
Once complete, make a pull request to the main branch.
Purpose
To implement the Python classes that compute the lift and drag forces acting on a medium. See this confluence page for more details.
Description
You will be implementing the methods in a template class called
MediumForceComputation
located inboat_simulator/nodes/physics_engine/fluid_forces.py
.The class named
MediumForceComputation
has the following properties:lift_coefficients
is a 2D array functioning as a lookup table for lift coefficients corresponding to various angles of attack.drag_coefficients
is a 2D array functioning as a lookup table for drag coefficients corresponding to various angles of attack.areas
is a 2D array functioning as a lookup table for the fluid-affected areas corresponding to different angles of attack.fluid_density
is the density of the fluid acting on the medium.MediumForceComputation
is a constructor that accepts the lift coefficients, drag coefficients, affected areas, and fluid density as arguments.compute
is a function that accepts two arguments,apparent_velocity
, which is the relative velocity between the fluid and the medium calculated byfluid_velocity - medium_velocity
, andorientation
which is the orientation angle of the medium.interpolate
is a function that accepts one argument,attack_angle
, which is the angle of attack formed between orientation angle of the medium and the direction of the apparent velocity.For reference, consider this diagram of an example medium (a sail) being acted on by an example fluid (wind):
Where $\vec{V_w}$ is the velocity of the true wind acting on the medium. $\vec{V_m}$ is the velocity of the medium. $\vec{V_a}$ is the velocity of the apparent wind acting on the medium. $\vec{F_L}$ is the lift force acting on the medium. $\vec{F_D}$ is the drag force acting on the medium.
With the formulas $F_L = f_L(\alpha) = \dfrac{1}{2}\rho ||v_A||^2 A(\alpha) C_L(\alpha)$, with direction perpendicular to the apparent velocity ($\vec{V_a}$) $F_D = f_D(\alpha)$, with direction parallel to the apparent velocity ($\vec{V_a}$)
Where $\rho$ is the fluid density. $A$ is the area on the medium affected by the fluid, and is a function of $\alpha$. $v_A$ is the apparent velocity between the fluid and the medium. $C_L$ is the lift coefficient of the medium, and is a function of $\alpha$. $\alpha$ is the angle of attack.
Tests
Add your unit tests to
tests/unit/nodes/physics_engine/
. You will use the pytest API for testing, which is already installed.Once complete, make a pull request to the main branch.
Resources