Skip to content

Commit

Permalink
Merge pull request #132 from GodotMisogi/develop
Browse files Browse the repository at this point in the history
Version 0.4.5: Added ring vortices for vortex lattice analysis and other minor bugfixes
  • Loading branch information
Arjit Seth committed Mar 20, 2023
2 parents d73c5af + 90b9a28 commit a568136
Show file tree
Hide file tree
Showing 37 changed files with 1,231 additions and 789 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.4"
version = "0.4.5"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
4 changes: 2 additions & 2 deletions README.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.4},
date = {2023-03-14},
version = {0.4.5},
date = {2023-03-20},
}
```
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
Expand Down
36 changes: 27 additions & 9 deletions docs/lit/howto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,33 @@ using LaTeXStrings # hide
# How to work with airfoil geometry.

# ### Import Coordinates File
# You can specify the path consisting of the foil's coordinates to the `read_foil` function. The format for the coordinates file requires a header for the name in the first line of the file. A custom name can be provided by setting the optional `name` variable.
# You can specify the path consisting of the foil's coordinates to the `read_foil` function. The [Selig format](https://openvsp.org/wiki/doku.php?id=airfoilexport) for the coordinates file is followed, in which a header for the name in the first line of the file with the coordinates following from the second line are required. A custom name can be provided by setting the optional `name` variable.

## Airfoil coordinates file path
foilpath = string(@__DIR__, "/misc/s1223.dat")

# Note that, in this example, `@__DIR__` points to the Julia REPL's current working directory. Use the correct local path for the coordinates on your computer.

## Read coordinates file
my_foil = read_foil(foilpath;
name = "S1223" # To overwrite name in header
)
my_foil = read_foil(
foilpath; # Path to the airfoil coordinates file
name = "S1223" # To overwrite name in header
)

#
plot(xlabel = L"x", ylabel = L"y", aspect_ratio = 1)
plot!(my_foil)

# !!! tip
# You can also import airfoil coordinates from the internet by using `FileIO`.

## Read coordinates from an internet address.
using FileIO

online_foil = read_foil(download("https://m-selig.ae.illinois.edu/ads/coord/s1210.dat"))

plot!(online_foil)

# ### Interpolate and Process Coordinates

# A basic cosine interpolation functionality is provided for foils.
Expand Down Expand Up @@ -141,7 +154,7 @@ print_info(wing, "My Wing")
# ### Geometry
# First we define the lifting surfaces. These can be a combination of `Wing` types constructed using the various methods available.
# !!! warning "Alert"
# Support for fuselages and control surfaces will be added soon.
# Support for fuselages and control surfaces is in progress.

# Horizontal tail
htail = WingSection(
Expand Down Expand Up @@ -197,6 +210,9 @@ vtail_mesh = WingMesh(vtail, [10], 5); # Vertical tail
# The inviscid 3D analysis uses a vortex lattice method. The `WingMesh` type allows you to generate horseshoe elements easily.
wing_horsies = make_horseshoes(wing_mesh)

# !!! note
# You can also generate vortex ring elements by calling `make_vortex rings`.

# For multiple lifting surfaces, it is most convenient to define a single vector consisting of all the components' horseshoes using [ComponentArrays.jl](https://github.com/jonniedie/ComponentArrays.jl).
aircraft = ComponentVector(
wing = wing_horsies,
Expand All @@ -217,7 +233,7 @@ fs = Freestream(

## Define reference values
refs = References(
speed = 10.0,
speed = 150.0,
density = 1.225,
viscosity = 1.5e-5,
area = projected_area(wing),
Expand All @@ -226,11 +242,12 @@ refs = References(
location = mean_aerodynamic_center(wing)
)

# The vortex lattice analysis can be executed with the horseshoes, freestream condition, and reference values defined.
# The vortex lattice analysis can be executed with the vortex elements, freestream conditions, and reference values defined. An optional named argument is provided for enabling compressibility corrections at ``M > 0.3`` via the Prandtl-Glauert transformation.

## Solve system
system = solve_case(
aircraft, fs, refs;
compressible = true, # Compressibility corrections via Prandtl-Glauert transformation
print = true, # Prints the results for only the aircraft
print_components = true, # Prints the results for all components
)
Expand Down Expand Up @@ -260,7 +277,8 @@ Fs, Ms = surface_dynamics(system; axes = ax)
# A Trefftz plane integration is performed to compute farfield forces.
#
# !!! note
# The farfield forces are usually more accurate compared to nearfield forces, as the components do not interact as in the evaluation of the Biot-Savart integrals for the latter.
# The farfield forces are usually more accurate compared to nearfield forces.
# (This is because the components do not interact as in the evaluation of the Biot-Savart integrals for the latter.)
#
# To obtain the nearfield coefficients of the components (in wind axes by definition):
nfs = nearfield_coefficients(system)
Expand All @@ -279,7 +297,7 @@ print_coefficients(nfs.wing, ffs.wing, :wing)
print_coefficients(nf, ff, :aircraft)

# ## Aerodynamic Stability Analyses
# The derivatives of the aerodynamic coefficients with respect to the freestream values is obtained by automatic differentiation enabled by [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl). The following function evaluates the derivatives of the aerodynamic coefficients with respect to the freestream values. You can also optionally provide the axes for the reference frame of the coefficients.
# The derivatives of the aerodynamic coefficients with respect to the freestream values are obtained by automatic differentiation enabled by [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl). The following function evaluates the derivatives of the aerodynamic coefficients with respect to the freestream values. You can also optionally provide the axes for the reference frame of the coefficients.
dv_data = freestream_derivatives(
system,
print = true, # Prints the results for only the aircraft
Expand Down
2 changes: 1 addition & 1 deletion docs/lit/tutorials-airfoil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ plot(

# ## Your First Doublet-Source Analysis
#
# Now we have an airfoil, and we would like to analyze its aerodynamic characteristics. The potential flow panel method for inviscid analyses of airfoils, which you may have studied in your course in aerodynamics, provides decent estimations of the lift generated by the airfoil.
# Now we have an airfoil, and we would like to analyze its aerodynamic characteristics. The potential flow panel method for inviscid analyses of airfoils, which you may have studied in your course on aerodynamics, provides decent estimations of the lift generated by the airfoil.

# Our analysis also requires boundary conditions, which is the freestream flow defined by a magnitude ``V_\infty`` and angle of attack ``\alpha``. We provide these to the analysis by defining variables and feeding them to a `Uniform2D` type, corresponding to uniform flow in 2 dimensions.
V = 1.0
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ makedocs(
analytics = "UA-89998292-1"
# highlightjs = "theme/highlight.js",
),
checkdocs = :exports,
)

## Deployment
Expand Down
6 changes: 3 additions & 3 deletions docs/src/assets/VortexLattice.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 33 additions & 11 deletions docs/src/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,40 @@ using LaTeXStrings # hide
How to work with airfoil geometry.

### Import Coordinates File
You can specify the path consisting of the foil's coordinates to the `read_foil` function. The format for the coordinates file requires a header for the name in the first line of the file. A custom name can be provided by setting the optional `name` variable.
You can specify the path consisting of the foil's coordinates to the `read_foil` function. The [Selig format](https://openvsp.org/wiki/doku.php?id=airfoilexport) for the coordinates file is followed, in which a header for the name in the first line of the file with the coordinates following from the second line are required. A custom name can be provided by setting the optional `name` variable.

````@example howto
# Airfoil coordinates file path
foilpath = string(@__DIR__, "/misc/s1223.dat")
foilpath = string(@__DIR__, "/misc/s1223.dat") #
````

Note that, in this example, `@__DIR__` points to the Julia REPL's current working directory. Use the correct local path for the coordinates on your computer.

````@example howto
# Read coordinates file
my_foil = read_foil(foilpath;
name = "S1223" # To overwrite name in header
)
my_foil = read_foil(
foilpath; # Path to the airfoil coordinates file
name = "S1223" # To overwrite name in header
)
````

````@example howto
plot(xlabel = L"x", ylabel = L"y", aspect_ratio = 1)
plot!(my_foil)
````

!!! tip
You can also import airfoil coordinates from the internet by directly specifying the URL to a file.

````@example howto
# Read coordinates from an internet address.
using FileIO
online_foil = read_foil(download("https://m-selig.ae.illinois.edu/ads/coord/s1210.dat"))
plot!(online_foil)
````

### Interpolate and Process Coordinates

A basic cosine interpolation functionality is provided for foils.
Expand Down Expand Up @@ -185,7 +202,7 @@ How to run a generic aerodynamic analysis on a conventional aircraft configurati
### Geometry
First we define the lifting surfaces. These can be a combination of `Wing` types constructed using the various methods available.
!!! warning "Alert"
Support for fuselages and control surfaces will be added soon.
Support for fuselages and control surfaces is in progress.

Horizontal tail

Expand Down Expand Up @@ -256,6 +273,9 @@ The inviscid 3D analysis uses a vortex lattice method. The `WingMesh` type allow
wing_horsies = make_horseshoes(wing_mesh)
````

!!! note
You can also generate vortex ring elements by calling `make_vortex rings`.

For multiple lifting surfaces, it is most convenient to define a single vector consisting of all the components' horseshoes using [ComponentArrays.jl](https://github.com/jonniedie/ComponentArrays.jl).

````@example howto
Expand Down Expand Up @@ -283,7 +303,7 @@ To define reference values, use the following `References` type.
````@example howto
# Define reference values
refs = References(
speed = 10.0,
speed = 150.0,
density = 1.225,
viscosity = 1.5e-5,
area = projected_area(wing),
Expand All @@ -293,12 +313,13 @@ refs = References(
)
````

The vortex lattice analysis can be executed with the horseshoes, freestream condition, and reference values defined.
The vortex lattice analysis can be executed with the vortex elements, freestream conditions, and reference values defined. An optional named argument is provided for enabling compressibility corrections at ``M > 0.3`` via the Prandtl-Glauert transformation.

````@example howto
# Solve system
system = solve_case(
aircraft, fs, refs;
compressible = true, # Compressibility corrections via Prandtl-Glauert transformation
print = true, # Prints the results for only the aircraft
print_components = true, # Prints the results for all components
)
Expand Down Expand Up @@ -340,7 +361,8 @@ Fs, Ms = surface_dynamics(system; axes = ax)
A Trefftz plane integration is performed to compute farfield forces.

!!! note
The farfield forces are usually more accurate compared to nearfield forces, as the components do not interact as in the evaluation of the Biot-Savart integrals for the latter.
The farfield forces are usually more accurate compared to nearfield forces.
(This is because the components do not interact as in the evaluation of the Biot-Savart integrals for the latter.)

To obtain the nearfield coefficients of the components (in wind axes by definition):

Expand All @@ -354,7 +376,7 @@ Similarly for the farfield coefficients of the components.
ffs = farfield_coefficients(system)
````

You can access the values corresponding to the components by the name used in the `ComponentArray` constrution.
You can access the values corresponding to the components by the name used in the `ComponentArray` construction.

````@example howto
@show (nfs.wing, ffs.wing)
Expand All @@ -374,7 +396,7 @@ print_coefficients(nf, ff, :aircraft)
````

## Aerodynamic Stability Analyses
The derivatives of the aerodynamic coefficients with respect to the freestream values is obtained by automatic differentiation enabled by [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl). The following function evaluates the derivatives of the aerodynamic coefficients with respect to the freestream values. You can also optionally provide the axes for the reference frame of the coefficients.
The derivatives of the aerodynamic coefficients with respect to the freestream values are obtained by automatic differentiation enabled by [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl). The following function evaluates the derivatives of the aerodynamic coefficients with respect to the freestream values. You can also optionally provide the axes for the reference frame of the coefficients.

````@example howto
dv_data = freestream_derivatives(
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ 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.4},
date = {2023-03-14},
version = {0.4.5},
date = {2023-03-20},
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials-airfoil.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ plot(

## Your First Doublet-Source Analysis

Now we have an airfoil, and we would like to analyze its aerodynamic characteristics. The potential flow panel method for inviscid analyses of airfoils, which you may have studied in your course in aerodynamics, provides decent estimations of the lift generated by the airfoil.
Now we have an airfoil, and we would like to analyze its aerodynamic characteristics. The potential flow panel method for inviscid analyses of airfoils, which you may have studied in your course on aerodynamics, provides decent estimations of the lift generated by the airfoil.

Our analysis also requires boundary conditions, which is the freestream flow defined by a magnitude ``V_\infty`` and angle of attack ``\alpha``. We provide these to the analysis by defining variables and feeding them to a `Uniform2D` type, corresponding to uniform flow in 2 dimensions.

Expand Down
Loading

2 comments on commit a568136

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

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.5 -m "<description of version>" a568136193645b4f10132ee3a47d93a605cb48e5
git push origin v0.4.5

Please sign in to comment.