Skip to content

Commit

Permalink
Merge pull request #134 from GodotMisogi/develop
Browse files Browse the repository at this point in the history
Version 0.4.7: HyperEllipseFuselage bug fixes
  • Loading branch information
Arjit Seth authored Mar 27, 2023
2 parents 16945c6 + 044829d commit e26c8c1
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AeroFuse"
uuid = "477c59f4-51f5-487f-bf1e-8db39645b227"
authors = ["GodotMisogi <[email protected]>"]
version = "0.4.6"
version = "0.4.7"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If you use AeroFuse in your research, please cite the following until any releva
author = {Arjit Seth, Rhea P. Liem},
title = {AeroFuse},
url = {https://github.com/GodotMisogi/AeroFuse},
version = {0.4.6},
version = {0.4.7},
date = {2023-03-27},
}
```
7 changes: 6 additions & 1 deletion docs/lit/tutorials-stability.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ fuse = HyperEllipseFuselage(
position = [0.,0.,0.] # Set nose at origin, m
)

## Get coordinates of end
## Compute geometric properties
ts = 0:0.1:1 # Distribution of sections for nose, cabin and rear
S_f = wetted_area(fuse, ts) # Surface area, m²
V_f = volume(fuse, ts) # Volume, m³

## Get coordinates of rear end
fuse_end = fuse.affine.translation + [ fuse.length, 0., 0. ]

# Now, let's define the lifting surfaces. We'll download a supercritical airfoil for the wing section; note that this is not the same one as used in the Boeing 777-200LR. We'll also define a two-section wing.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ If you use AeroFuse in your research, please cite the following until any releva
author = {Arjit Seth, Rhea P. Liem},
title = {AeroFuse},
url = {https://github.com/GodotMisogi/AeroFuse},
version = {0.4.6},
version = {0.4.7},
date = {2023-03-27},
}
```
Expand Down
7 changes: 6 additions & 1 deletion docs/src/tutorials-stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ fuse = HyperEllipseFuselage(
position = [0.,0.,0.] # Set nose at origin, m
)
# Get coordinates of end
# Compute geometric properties
ts = 0:0.1:1 # Distribution of sections for nose, cabin and rear
S_f = wetted_area(fuse, ts) # Surface area, m²
V_f = volume(fuse, ts) # Volume, m³
# Get coordinates of rear end
fuse_end = fuse.affine.translation + [ fuse.length, 0., 0. ]
````

Expand Down
32 changes: 24 additions & 8 deletions examples/geometry/fuselage.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
## Fuselage example
using AeroFuse
using Plots

# Fuselage parameters
l_fuselage = 18. # Length (m)
h_fuselage = 1.5 # Height (m)
w_fuselage = 1.8 # Width (m)
S_fuselage = 90 # Surface area (m)²
K_fuselage = 0.487 # Fuselage parameter
l_fuselage = 18. # Length (m)
h_fuselage = 1.5 # Height (m)
w_fuselage = 1.8 # Width (m)

## Hyperelliptic fuselage
fuse = HyperEllipseFuselage(
radius = w_fuselage / 2,
length = l_fuselage,
c_nose = 2,
c_rear = 2,
)

ts = 0:0.1:1 # Distribution of sections
S_f = wetted_area(fuse, ts) # Surface area, m²
V_f = volume(fuse, ts) # Volume, m³

# Chordwise locations and corresponding radii
## Plot
plot(fuse,
aspect_ratio = 1,
zlim = (-0.5, 0.5) .* fuse.length,
label = "Fuselage"
)

## Chordwise locations and corresponding radii
lens = [0.0, 0.005, 0.01, 0.03, 0.1, 0.2, 0.4, 0.6, 0.7, 0.8, 0.98, 1.0]
rads = [0.05, 0.15, 0.25, 0.4, 0.8, 1., 1., 1., 1., 0.85, 0.3, 0.01] * w_fuselage / 2

fuse = Fuselage(l_fuselage, lens, rads, [0., 0., 0.])

## Plotting
using Plots

plot(fuse, aspect_ratio = 1, zlim = (-10,10))
36 changes: 26 additions & 10 deletions src/Geometry/AircraftGeometry/fuselage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ end
"""
HyperEllipseFuselage(;
Define a fuselage based on the following hyperelliptical parameterization.
Define a fuselage based on the following hyperelliptical-cylindrical parameterization.
Nose: Hyperellipse ``z(ξ) = (1 - ξ^a)^{(1/a)}``
Cabin: Cylindrical ``z(ξ) = (1 - ξ^2)^{(1/2)}``
Cabin: Cylindrical ``z(ξ) = 1``
Rear: Hyperellipse ``z(ξ) = (1 - ξ^b)^{(1/b)}``
Expand Down Expand Up @@ -115,8 +115,8 @@ end

function undrooped_curve(fuse :: HyperEllipseFuselage, ts)
# Check parametric curve domain
@assert ts[1] >= 0
@assert ts[end] <= 1
@assert ts[1] == 0
@assert ts[end] == 1

# Properties
x_a = fuse.x_a
Expand Down Expand Up @@ -144,15 +144,20 @@ function undrooped_curve(fuse :: HyperEllipseFuselage, ts)
end

function curve(fuse :: HyperEllipseFuselage, ts)
x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear = undrooped_curve(fuse, ts)
x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear = undrooped_curve(fuse, ts)

# Droop/rise
z_nose += LinRange(fuse.d_nose, 0, length(x_nose))
z_rear += LinRange(0, fuse.d_rear, length(x_rear))
# Droop/rise
z_nose += LinRange(fuse.d_nose, 0, length(x_nose))
z_rear += LinRange(0, fuse.d_rear, length(x_rear))

return x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear
return x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear
end

"""
wetted_area(fuse :: HyperEllipseFuselage, t)
Get the coordinates of a `HyperEllipseFuselage` given the parameter distribution ``t``. Note that the distribution must have endpoints `0` and `1`.
"""
function coordinates(fuse :: HyperEllipseFuselage, ts, n_circ = 20)
x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear = undrooped_curve(fuse, ts)

Expand All @@ -174,7 +179,13 @@ function coordinates(fuse :: HyperEllipseFuselage, ts, n_circ = 20)
return reshape(aff_coo, n_circ, length(ts) * 3, 3)
end

@views function wetted_area(fuse :: HyperEllipseFuselage)

"""
wetted_area(fuse :: HyperEllipseFuselage, t)
Compute the wetted area of a `HyperEllipseFuselage` given the parameter distribution ``t``. Note that the distribution must have endpoints `0` and `1`.
"""
@views function wetted_area(fuse :: HyperEllipseFuselage, ts)
x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear = curve(fuse, ts)

xs = [x_nose; x_cabin; x_rear]
Expand All @@ -183,6 +194,11 @@ end
return sum(x -> truncated_cone_curved_area(x...), zip(zs[1:end-1], zs[2:end], diff(xs)))
end

"""
volume(fuse :: HyperEllipseFuselage, ts)
Compute the volume of a `HyperEllipseFuselage` given the parameter distribution ``t``. Note that the distribution must have endpoints `0` and `1`.
"""
@views function volume(fuse :: HyperEllipseFuselage, ts)
x_nose, x_cabin, x_rear, z_nose, z_cabin, z_rear = curve(fuse, ts)

Expand Down
22 changes: 22 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ end
@test mean_aerodynamic_center(wing) mean_aerodynamic_center(wing_sec) atol = 1e-6 # Mean aerodynamic center
end

@testset "Geometry - Hyperelliptical-Cylindrical Fuselage" begin
# Fuselage parameters
l_fuselage = 18. # Length (m)
h_fuselage = 1.5 # Height (m)
w_fuselage = 1.8 # Width (m)

## Hyperelliptic fuselage
fuse = HyperEllipseFuselage(
radius = w_fuselage / 2,
length = l_fuselage,
c_nose = 2,
c_rear = 2,
)

ts = 0:0.1:1 # Distribution of sections
S_f = wetted_area(fuse, ts) # Surface area, m²
V_f = volume(fuse, ts) # Volume, m³

@test S_f 91.1407334 atol = 1e-6
@test V_f 38.0380653 atol = 1e-6
end

@testset "Geometry - 3D Panel" begin
panel = Panel3D(
[1.0, -1., 0.0],
Expand Down

2 comments on commit e26c8c1

@GodotMisogi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/80401

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.7 -m "<description of version>" e26c8c1116622353708f83343931921ee491ed39
git push origin v0.4.7

Please sign in to comment.