Skip to content

Commit

Permalink
Merge pull request #129 from GodotMisogi/develop
Browse files Browse the repository at this point in the history
Version 0.4.3: Primarily updated docs + minor fixes
  • Loading branch information
Arjit Seth authored Mar 14, 2023
2 parents 7b0ffdb + 9a57b90 commit 9d24004
Show file tree
Hide file tree
Showing 22 changed files with 11,132 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CompatHelper
on:
schedule:
- cron: 0 0 * * *
- cron: 0 0 * * 1
workflow_dispatch:
jobs:
CompatHelper:
Expand Down
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.2"
version = "0.4.3"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,44 @@
<img width="60%", src="https://raw.githubusercontent.com/GodotMisogi/AeroFuse.jl/main/docs/src/assets/logo.svg">
</p>

AeroFuse is meant to be a toolbox for aircraft design analyses. It currently provides convenient methods for developing studies in aerodynamics and structures, with implementations in other relevant fields such as flight dynamics and propulsion in progress.
AeroFuse is meant to be a toolbox for aircraft design analyses. It currently provides convenient methods for developing studies in aircraft geometry, aerodynamics and structures, with implementations in other relevant fields such as flight dynamics and propulsion in progress.

**Authors**: Arjit Seth, Stephane Redonnet, and Rhea P. Liem
**Authors**: Arjit Seth and Rhea P. Liem

## Objectives

The current focus is to enable tutorials in computation for undergraduates in an aerospace educational curriculum, particularly at The Hong Kong University of Science and Technology. For this purpose, the code is written in a functional style replicating the mathematics presented in textbooks as much as possible.
The current focus is to enable tutorials in computation in an aerospace educational curriculum, particularly at The Hong Kong University of Science and Technology. An additional aim is to write code compatible with automatic differentiation libraries written in Julia for enabling multidisciplinary studies.

An additional aim is to write code compatible with automatic differentiation libraries written in Julia.
>**Disclaimer**: The implementations are work-in-progress, and hence the results may not be entirely accurate. Please exercise caution when interpreting the results until validation cases are added.
## Features

**Disclaimer**: The implementations are work-in-progress, and hence the results may not be entirely accurate. Please exercise caution when interpreting the results until validation cases are added.

**Functioning:**

- Basic geometric tools for airfoil processing and wing design.
- Basic geometric tools for airfoil processing, wing (and tail), and fuselage design.
- Steady, inviscid, incompressible, isentropic 2D and 3D aerodynamic analyses.
- 2D - Doublet-source panel method
- 3D - Vortex lattice method with derivatives
- 3D - Vortex lattice method
- Semi-/empirical profile drag prediction methods for wings.
- Finite-element beam model based on Euler-Bernoulli theory for structural analysis.
- Automatic differentiation support primarily via [`ForwardDiff.jl`](https://github.com/JuliaDiff/ForwardDiff.jl).
- Optimization capabilities with these features.

![](plots/VortexLattice.svg)
![](plots/LinearVortex.svg)
<!-- ![](plots/LinearVortex.svg) -->
![](plots/SciMLWingOptimization.svg)

**In progress:**

- Aeroelastic analyses coupling vortex lattice and beam element models.
- 2D integral boundary layer solver for viscous-inviscid analyses.
- Generic, flexible and efficient flight dynamics integrator in 2 and 3 dimensions.
- Fuselage geometry parametrization and aerodynamic implementation.
- Aeroelastic analyses coupling vortex lattice and beam element models. This is functioning, but a good interface is yet to be implemented.
- Adjoints for aerodynamic, structural and aerostructural design via [`ChainRulesCore.jl`](https://github.com/JuliaDiff/ChainRulesCore.jl).

![](plots/AerostructWingTail.svg)

## Installation

Please install the current stable release of [Julia](https://julialang.org/downloads/) for your operating system and execute the following commands in the REPL.

```julia
julia> using Pkg; Pkg.add("AeroFuse")
julia> Pkg.test("AeroFuse")
Expand All @@ -57,15 +58,10 @@ If you use AeroFuse in your research, please cite the following until any releva

```bibtex
@software{AeroFuse,
author = {Arjit Seth, Stephane Redonnet, Rhea P. Liem},
author = {Arjit Seth, Rhea P. Liem},
title = {AeroFuse},
url = {https://github.com/GodotMisogi/AeroFuse},
version = {0.4.2},
date = {2023-02-23},
version = {0.4.3},
date = {2023-03-14},
}
```

## References

1. Mark Drela. _Flight Vehicle Aerodynamics_. MIT Press, 2014.
2. Joseph Katz and Allen Plotkin. _Low-Speed Aerodynamics, Second Edition_. Cambridge University Press, 2001.
```
5,492 changes: 5,492 additions & 0 deletions docs/src/assets/SciMLWingOptimization.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 17 additions & 16 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
# AeroFuse -- Aircraft Design Platform

AeroFuse is meant to be a toolbox for aircraft design analyses. It currently provides convenient methods for developing studies in aerodynamics and structures, with implementations in other relevant fields such as flight dynamics and propulsion in progress.
AeroFuse is meant to be a toolbox for aircraft design analyses. It currently provides convenient methods for developing studies in aircraft geometry, aerodynamics and structures, with implementations in other relevant fields such as flight dynamics and propulsion in progress.

**Authors**: Arjit Seth, Stephane Redonnet, and Rhea P. Liem
**Authors**: Arjit Seth and Rhea P. Liem

## Objectives

The current focus is to enable tutorials in computation for undergraduates in an aerospace educational curriculum, particularly at The Hong Kong University of Science and Technology. For this purpose, the code is written in a functional style replicating the mathematics presented in textbooks as much as possible.
The current focus is to enable tutorials in computation in an aerospace educational curriculum, particularly at The Hong Kong University of Science and Technology. An additional aim is to write code compatible with automatic differentiation libraries written in Julia for enabling multidisciplinary studies.

An additional aim is to write code compatible with automatic differentiation libraries written in Julia.
>**Disclaimer**: The implementations are work-in-progress, and hence the results may not be entirely accurate. Please exercise caution when interpreting the results until validation cases are added.
## Features

**Disclaimer**: The implementations are work-in-progress, and hence the results may not be entirely accurate. Please exercise caution when interpreting the results until validation cases are added.

**Functioning:**

- Basic geometric tools for airfoil processing and wing design.
- Basic geometric tools for airfoil processing, wing (and tail), and fuselage design.
- Steady, inviscid, incompressible, isentropic 2D and 3D aerodynamic analyses.
- 2D - Doublet-source panel method
- 3D - Vortex lattice method with derivatives
- Empirical viscous drag prediction methods for wings.
- 3D - Vortex lattice method
- Semi-/empirical profile drag prediction methods for wings.
- Finite-element beam model based on Euler-Bernoulli theory for structural analysis.
- Automatic differentiation support primarily via [`ForwardDiff.jl`](https://github.com/JuliaDiff/ForwardDiff.jl).
- Optimization capabilities with these features.

![](assets/VortexLattice.svg)
![](assets/LinearVortex.svg)
![](assets/SciMLWingOptimization.svg)

**In progress:**

- Aeroelastic analyses coupling vortex lattice and beam element models.
- 2D integral boundary layer solver for viscous-inviscid analyses.
- Generic, flexible and efficient flight dynamics integrator in 2 and 3 dimensions.
- Fuselage geometry parametrization and aerodynamic implementation.
- Aeroelastic analyses coupling vortex lattice and beam element models. This is functioning, but a good interface is yet to be implemented.
- Adjoints for aerodynamic, structural and aerostructural design via [`ChainRulesCore.jl`](https://github.com/JuliaDiff/ChainRulesCore.jl).

![](assets/AerostructWingTail.svg)

## Installation

Please install the current stable release of [Julia](https://julialang.org/downloads/) for your operating system and execute the following commands in the REPL.

```julia
julia> using Pkg; Pkg.add("AeroFuse")
julia> Pkg.test("AeroFuse")
Expand All @@ -49,11 +50,11 @@ If you use AeroFuse in your research, please cite the following until any releva

```bibtex
@software{AeroFuse,
author = {Arjit Seth, Rhea P. Liem, Stephane Redonnet},
author = {Arjit Seth, Rhea P. Liem},
title = {AeroFuse},
url = {https://github.com/GodotMisogi/AeroFuse},
version = {0.4.2},
date = {2023-02-23},
version = {0.4.3},
date = {2023-03-14},
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ ref = References(
##
@time system = solve_case(
aircraft, fs, ref;
# print = true, # Prints the results for only the aircraft
# print_components = true, # Prints the results for all components
print = true, # Prints the results for only the aircraft
print_components = true, # Prints the results for all components
);

## Compute dynamics
Expand Down
1 change: 1 addition & 0 deletions examples/geometry/foil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cst_foil = kulfan_CST(alpha_u, alpha_l, (0., 0.), (0., 0.))

## Plot
plot(cst_foil)
plot!(naca_foil)

## Control surface
cst_foil_flap = control_surface(cst_foil,
Expand Down
2 changes: 1 addition & 1 deletion examples/geometry/wing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ lambda_w_c4 = sweeps(wing, 0.25) # Quarter-chord sweep angles
lambda_w_c2 = sweeps(wing, 0.5) # Half-chord sweep angles

ct = camber_thickness(wing, 60) # Camber-thickness distribution
coords = wing_bounds(wing) # Leading and trailing edge coordinates
coords = coordinates(wing) # Leading and trailing edge coordinates

## Plotting
using plots
Expand Down
31 changes: 12 additions & 19 deletions examples/optimization/sciml_wing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ using Ipopt
include("wing_definition.jl")

## Initial guess
n_vars = 30 # Number of spanwise stations
n_vars = 32 # Number of spanwise stations
c = 0.125 # Fixed chord
c_w = LinRange(c, c, n_vars) # Constant distribution
CL_tgt = 1.5 # Target lift coefficient
CL_tgt = 1. # Target lift coefficient
nc = length(c_w)

wing_init = make_wing(c_w)
Expand All @@ -33,7 +33,7 @@ end
## Initial run
sys = make_case(α0, wing_init, refs)
init = get_forces(sys, wing_init)
# print_coefficients(sys)
print_coefficients(sys)

# Common
function get_res(x, w_sweep = 0.25, ref= refs)
Expand All @@ -51,17 +51,10 @@ end
function opt_drag(x, p)
sys, mesh = get_res(x)

# Evaluate aerodynamic coefficients
CDi, _, _, _, _, _ = nearfield(sys)

# Calculate local-dissipation/local-friction drag
CVs = norm.(surface_velocities(sys)).wing
CDv = profile_drag_coefficient(mesh, 0.98, CVs, sys.reference)

# @info "Variables:" x
# @info "Objective:" CDi
# Get forces
res = get_forces(sys, mesh)

CDi # + CDv
res.CD
end

# Constraints
Expand Down Expand Up @@ -122,7 +115,7 @@ xopt = sol.u
wing_opt = make_wing(xopt[2:end])
sys_opt = make_case(xopt[1], wing_opt, refs)
opt = get_forces(sys_opt, wing_opt)
# print_coefficients(sys_opt)
print_coefficients(sys_opt)

# Exact solution
y_exact = LinRange(0., 1., n_vars)
Expand All @@ -131,7 +124,7 @@ x_exact = @. √(1. - y_exact^2) * 4 / π * c
wing_exact = make_wing(x_exact)
sys_exact = make_case(xopt[1], wing_exact, refs)
exact = get_forces(sys_exact, wing_exact)
# print_coefficients(sys_exact)
print_coefficients(sys_exact)

## Plotting
#==========================================================================================#
Expand All @@ -158,7 +151,7 @@ plt_opt = plot(
legend = :bottom,
xlabel = L"x,~m",
guidefontrotation = 90.0,
title = LaTeXString("Planform, \$ S = $(round(Sw; digits = 4)),~C_L = $(round(CL_tgt; digits = 4)) \$"),
title = LaTeXString("Planform, \$ S = $(round(Sw; digits = 4)),~C_{L_{req}} = $(round(CL_tgt; digits = 4)) \$"),
grid = false,
# aspect_ratio = 1,
# zlim = (-0.5, 0.5) .* span(wing_init)
Expand Down Expand Up @@ -215,19 +208,19 @@ plot!(
[ -cumsum(wing_init.surface.spans)[end:-1:1]; 0; cumsum(wing_init.surface.spans) ],
[ wing_init.surface.chords[end:-1:2]; wing_init.surface.chords ],
lc = :black,
label = LaTeXString("Initial Wing: \$ (C_{D_i}, C_{D_v}, C_D) = $(round.([init.CDi;init.CDv;init.CD]; digits = 4)) \$"),
label = LaTeXString("Initial Wing: \$ (C_{D_i}, C_{D_v}, C_D, C_L) = $(round.([init.CDi;init.CDv;init.CD;init.CL]; digits = 4)) \$"),
)
plot!(
[ -cumsum(wing_opt.surface.spans)[end:-1:1]; 0; cumsum(wing_opt.surface.spans) ],
[ wing_opt.surface.chords[end:-1:2]; wing_opt.surface.chords ],
lc = :cornflowerblue,
label = LaTeXString("Optimized Wing: \$ (C_{D_i}, C_{D_v}, C_D) = $(round.([opt.CDi;opt.CDv;init.CD]; digits = 4)) \$"),
label = LaTeXString("Optimized Wing: \$ (C_{D_i}, C_{D_v}, C_D, C_L) = $(round.([opt.CDi;opt.CDv;opt.CD;opt.CL]; digits = 4)) \$"),
)
plot!(
[ -cumsum(wing_exact.surface.spans)[end:-1:1]; 0; cumsum(wing_exact.surface.spans) ],
[ wing_exact.surface.chords[end:-1:2]; wing_exact.surface.chords ],
lc = :green,
label =LaTeXString("Inviscid Optimum: \$ (C_{D_i}, C_{D_v}, C_D) = $(round.([exact.CDi;exact.CDv;exact.CD]; digits = 6)) \$"),
label = LaTeXString("Inviscid Optimum: \$ (C_{D_i}, C_{D_v}, C_D, C_L) = $(round.([exact.CDi;exact.CDv;exact.CD;exact.CL]; digits = 6)) \$"),
)

plt_CL = plot(
Expand Down
16 changes: 8 additions & 8 deletions examples/optimization/snow_wing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ using Ipopt # The optimizer
includet("wing_definition.jl")

## Initial guess
n_vars = 30 # Number of spanwise stations
n_vars = 64 # Number of spanwise stations
c = 0.125 # Fixed chord
c_w = LinRange(c, c, n_vars) # Constant distribution
CL_tgt = 1.5 # Target lift coefficient
CL_tgt = 1 # Target lift coefficient
nc = length(c_w)

wing_init = make_wing(c_w)
Expand Down Expand Up @@ -51,7 +51,7 @@ function optimize_drag!(g, x, w = 0.25, ref = refs)
res = get_forces(system, wing_mesh)

# Objective
f = res.CDi
f = res.CD

# Constraints
g[1] = res.CL # Lift coefficient
Expand Down Expand Up @@ -88,7 +88,7 @@ opts = Options(
)

## Run optimization
@time xopt, fopt, info = minimize(optimize_drag!, x0, ng, lx, ux, lg, ug, opts)
@time xopt, fopt, info = minimize(optimize_drag!, x0, ng, lx, ux, lg, ug, opts);

## Substitute
wing_opt = make_wing(xopt[2:end])
Expand Down Expand Up @@ -131,7 +131,7 @@ plt_opt = plot(
legend = :bottom,
xlabel = L"x,~m",
guidefontrotation = 90.0,
title = LaTeXString("Planform, \$ S = $(round(Sw; digits = 6)),~C_L = $(round(CL_tgt; digits = 6)) \$"),
title = LaTeXString("Planform, \$ S = $(round(Sw; digits = 4)),~C_{L_{req}} = $(round(CL_tgt; digits = 4)) \$"),
grid = false,
# aspect_ratio = 1,
# zlim = (-0.5, 0.5) .* span(wing_init)
Expand Down Expand Up @@ -188,19 +188,19 @@ plot!(
[ -cumsum(wing_init.surface.spans)[end:-1:1]; 0; cumsum(wing_init.surface.spans) ],
[ wing_init.surface.chords[end:-1:2]; wing_init.surface.chords ],
lc = :black,
label = LaTeXString("Initial Wing: \$ (C_{D_i}, C_{D_v}, C_D) = $(round.([init.CDi;init.CDv;init.CD]; digits = 6)) \$"),
label = LaTeXString("Initial Wing: \$ (C_{D_i}, C_{D_v}, C_D, C_L) = $(round.([init.CDi;init.CDv;init.CD;init.CL]; digits = 4)) \$"),
)
plot!(
[ -cumsum(wing_opt.surface.spans)[end:-1:1]; 0; cumsum(wing_opt.surface.spans) ],
[ wing_opt.surface.chords[end:-1:2]; wing_opt.surface.chords ],
lc = :cornflowerblue,
label = LaTeXString("Optimized Wing: \$ (C_{D_i}, C_{D_v}, C_D) = $(round.([opt.CDi;opt.CDv;opt.CD]; digits = 6)) \$"),
label = LaTeXString("Optimized Wing: \$ (C_{D_i}, C_{D_v}, C_D, C_L) = $(round.([opt.CDi;opt.CDv;opt.CD;opt.CL]; digits = 4)) \$"),
)
plot!(
[ -cumsum(wing_exact.surface.spans)[end:-1:1]; 0; cumsum(wing_exact.surface.spans) ],
[ wing_exact.surface.chords[end:-1:2]; wing_exact.surface.chords ],
lc = :green,
label =LaTeXString("Inviscid Optimum: \$ (C_{D_i}, C_{D_v}, C_D) = $(round.([exact.CDi;exact.CDv;exact.CD]; digits = 6)) \$"),
label = LaTeXString("Inviscid Optimum: \$ (C_{D_i}, C_{D_v}, C_D, C_L) = $(round.([exact.CDi;exact.CDv;exact.CD;exact.CL]; digits = 6)) \$"),
)

plt_CL = plot(
Expand Down
8 changes: 5 additions & 3 deletions examples/optimization/wing_definition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ function make_wing(xc, w = 0.25)
# Planform geometry
n_vars = length(xc)
bs = fill(1., n_vars - 1)
# bs = AeroFuse.MathTools.sine_spacing(0., 1., n_vars)[end:-1:2]
bs = bs / sum(bs)
wing = Wing(
foils = fill(naca4(4,4,1,2), n_vars),
chords = xc, # Design variables
spans = bs / sum(bs), # Normalizing halfspan to 1
w_sweep = w, # Quarter-chord
spans = bs, # Normalizing halfspan to 1
w_sweep = w, # Quarter-chord sweep
symmetry = true
)

# Meshing
wing_mesh = WingMesh(
wing, fill(2, n_vars - 1), 6,
wing, fill(2, n_vars - 1), 1,
span_spacing = Uniform(),
);

Expand Down
Binary file added plots/SNOWWingOptimization.pdf
Binary file not shown.
Binary file modified plots/SciMLWingOptimization.pdf
Binary file not shown.
Loading

2 comments on commit 9d24004

@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/79544

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.3 -m "<description of version>" 9d2400409d2b38ca9fb632539229cc0d1899fe6e
git push origin v0.4.3

Please sign in to comment.