Bodies
Methods
Whirl.Bodies.Ellipse
— Type.Ellipse(a,b,n)
Construct an elliptical body with semi-major axis a
and semi-minor axis b
, with n
points distributed on the body perimeter.
The constructor Ellipse(a,n)
creates a circle of radius a
.
Whirl.Bodies.Plate
— Type.Plate(length,thick,n,[λ=1.0])
Construct a flat plate with length length
and thickness thick
, with n
points distributed on the body perimeter.
The optional parameter λ
distributes the points differently. Values between 0.0
and 1.0
are accepted.
The constructor Plate(length,n,[λ=1.0])
creates a plate of zero thickness.
Whirl.Bodies.RigidTransform
— Type.RigidTransform(x::Tuple{Float64,Float64},α::Float64)
Construct a rigid-body transform operator, with rotation by angle α
and translation specified by x
. The translation coordinates are specified in the target coordinate system.
The resulting transform can be used as an operator on pairs of coordinate vectors, x
and y
, or on bodies. For transformation of bodies, it only overwrites the x
and y
fields of the body, but leaves the x̃
and ỹ
(body coordinates) intact.
The translation can be provided as either a tuple (x,y)
or as a complex number.
Example
julia> body = Bodies.Ellipse(0.5,0.1,100)
Elliptical body with 100 points and semi-axes (0.5,0.1)
Current position: (0.0,0.0)
Current angle (rad): 0.0
julia> T = RigidTransform((1.0,1.0),π/4)
Rigid-body transform
Translation: (1.0,1.0)
Rotation angle (rad): 0.7853981633974483
julia> T(body)
Elliptical body with 100 points and semi-axes (0.5,0.1)
Current position: (1.0,1.0)
Current angle (rad): 0.7853981633974483
Whirl.Bodies.NACA4
— Type.NACA4(cam,pos,thick[;np=20][,Zc=0.0+0.0im][,len=1.0]) -> Vector{Complex128}
Generates the vertices of a NACA 4-digit airfoil of chord length 1. The relative camber is specified by cam
, the position of maximum camber (as fraction of chord) by pos
, and the relative thickness by thick
.
The optional parameter np
specifies the number of points on the upper or lower surface. The optional parameter Zc
specifies the mean position of the vertices (which is set to the origin by default). The optional parameter len
specifies the chord length.
Example
Base.LinAlg.diff
— Method.diff(body::Body) -> Tuple{Vector{Float64},Vector{Float64}}
Compute the x and y differences of the faces on the perimeter of body body
, whose centers are at the current x
and y
coordinates (in inertial space) of the body.
Base.length
— Method.length(body::Body)
Return the number of points on the body perimeter
Whirl.Bodies.dlength
— Method.dlength(body::Body) -> Vector{Float64}
Compute the lengths of the faces on the perimeter of body body
, whose centers are at the current x
and y
coordinates (in inertial space) of the body.
Whirl.Bodies.normal
— Method.normal(body::Body) -> Tuple{Vector{Float64},Vector{Float64}}
Compute the current normals (in inertial components) of the faces on the perimeter of body body
, whose centers are at the current x
and y
coordinates (in inertial space) of the body.