Skip to content

Commit e7dde34

Browse files
authored
Add Documenter docu (#46)
* Add Documenter docu * build docu * trigger workflow * Fix workflow * install matplotlib * fix doc string * better line brakes * small fix * next try --------- Co-authored-by: Uwe Fechner <[email protected]>
1 parent 02d219d commit e7dde34

File tree

8 files changed

+235
-16
lines changed

8 files changed

+235
-16
lines changed

.github/workflows/CI.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,26 @@ jobs:
6262
with:
6363
files: lcov.info
6464
token: ${{ secrets.CODECOV_TOKEN }}
65-
65+
docs:
66+
name: Documentation
67+
runs-on: ubuntu-latest
68+
timeout-minutes: 40
69+
steps:
70+
- name: Install matplotlib
71+
run: if [ "$RUNNER_OS" = "Linux" ]; then sudo apt-get install -y python3-matplotlib; fi
72+
shell: bash
73+
- uses: actions/checkout@v4
74+
- uses: julia-actions/setup-julia@v2
75+
- uses: julia-actions/cache@v2
76+
- uses: julia-actions/julia-buildpkg@v1
77+
- uses: julia-actions/julia-docdeploy@v1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
81+
- run: |
82+
julia --project=docs -e '
83+
using Documenter: DocMeta, doctest
84+
using VortexStepMethod
85+
DocMeta.setdocmeta!(VortexStepMethod, :DocTestSetup, :(using VortexStepMethod); recursive=true)
86+
doctest(VortexStepMethod)'
87+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Manifest.toml
22
.vscode/settings.json
33
venv
44
results/TUDELFT_V3_LEI_KITE/polars/tutorial_testing_stall_model_n_panels_54_distribution_split_provided.pdf
5+
docs/build/

Project.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
1616
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
1717
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1818
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
19-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2019

2120
[compat]
2221
BenchmarkTools = "1"
@@ -29,3 +28,10 @@ Measures = "0.3"
2928
NonlinearSolve = "4"
3029
StaticArrays = "1"
3130
Statistics = "1"
31+
32+
[extras]
33+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
34+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
35+
36+
[targets]
37+
test = ["Test", "Documenter"]

docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
VortexStepMethod = "ed3cd733-9f0f-46a9-93e0-89b8d4998dd9"

docs/make.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using VortexStepMethod
2+
using Pkg
3+
if ("TestEnv" keys(Pkg.project().dependencies))
4+
if ! ("Documents" keys(Pkg.project().dependencies))
5+
using TestEnv; TestEnv.activate()
6+
end
7+
end
8+
using Documenter
9+
10+
DocMeta.setdocmeta!(VortexStepMethod, :DocTestSetup, :(using VortexStepMethod); recursive=true)
11+
12+
makedocs(;
13+
modules=[VortexStepMethod],
14+
authors="Uwe Fechner <[email protected]>, Bart van de Lint <[email protected]> and contributors",
15+
sitename="VortexStepMethod.jl",
16+
checkdocs=:none,
17+
format = Documenter.HTML(prettyurls = haskey(ENV, "CI")),
18+
pages=[
19+
"Home" => "index.md",
20+
"Exported Functions" => "functions.md",
21+
],
22+
)
23+
24+
deploydocs(;
25+
repo="github.com/Albatross-Kite-Transport/VortexStepMethod.jl",
26+
devbranch="main",
27+
)

docs/src/functions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
```@meta
2+
CurrentModule = VortexStepMethod
3+
```
4+
## Main Plotting Functions
5+
```@docs
6+
plot_geometry
7+
plot_distribution
8+
plot_polars
9+
```
10+
11+
## Helper Functions
12+
```@docs
13+
set_plot_style
14+
save_plot
15+
show_plot
16+
plot_line_segment!
17+
set_axes_equal!
18+
create_geometry_plot
19+
generate_polar_data
20+
```

docs/src/index.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
```@meta
2+
CurrentModule = VortexStepMethod
3+
```
4+
5+
# Simulation of a 3D airfoil using the Vortex Step Method
6+
7+
The Vortex Step Method (VSM) is an enhanced lifting line method that improves upon the classic approach by solving the circulation system at the three-quarter chord position, among the most important details. This adjustment allows for more accurate calculations of lift and drag forces, particularly addressing the shortcomings in induced drag prediction.
8+
VSM is further refined by coupling it with 2D viscous airfoil polars, making it well-suited for complex geometries,
9+
including low aspect ratio wings, as well as configurations with sweep, dihedral, and anhedral angles.
10+
11+
The software presented here includes a couple of examples: a rectangular wing, a leading-edge inflatable kite and a ram-air kite.
12+
13+
This package was translated from the Python code version 1.0.0 available at https://github.com/ocayon/Vortex-Step-Method with some extensions as documented in [News.md](https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl/blob/main/NEWS.md).
14+
15+
## Installation
16+
Install [Julia 1.10](https://ufechner7.github.io/2024/08/09/installing-julia-with-juliaup.html) or later,
17+
if you haven't already. On Linux, make sure that Python3, Matplotlib and LaTeX are installed:
18+
```
19+
sudo apt install python3-matplotlib
20+
sudo apt install texlive-full texlive-fonts-extra cm-super
21+
```
22+
23+
Before installing this software it is suggested to create a new project, for example like this:
24+
```bash
25+
mkdir test
26+
cd test
27+
julia --project=.
28+
```
29+
Then add VortexStepMethod from Julia's package manager, by typing:
30+
```julia
31+
using Pkg
32+
pkg"add https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl"
33+
```
34+
at the Julia prompt. You can run the unit tests with the command:
35+
```julia
36+
pkg"test VortexStepMethod"
37+
```
38+
39+
## Running the examples
40+
If you have git installed, check out this repo because it makes it easier to understand the code:
41+
```bash
42+
mkdir repos
43+
cd repos
44+
git clone https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl
45+
cd VortexStepMethod.jl
46+
```
47+
You can launch Julia with:
48+
```bash
49+
julia --project
50+
```
51+
or with:
52+
```bash
53+
./bin/run_julia
54+
```
55+
In Julia, first update the packages:
56+
```julia
57+
using Pkg
58+
Pkg.update()
59+
```
60+
and then you can execute the first example:
61+
```julia
62+
include("examples/rectangular_wing.jl")
63+
```
64+
To browse the code, it is suggested to use [VSCode](https://code.visualstudio.com/) with the Julia plugin.
65+
66+
## Input
67+
Three kinds of input data is needed:
68+
69+
- The wing geometry, defined by section:
70+
- rec wing two section, two point + polars
71+
- kite: model of polars included, n sections to define
72+
73+
- The airflow:
74+
- v_app vector
75+
76+
- The configuration:
77+
- how many panels
78+
--> two sections make a panel.
79+
80+
Apart from the wing geometry there is no input file yet, the input has to be defined in the code.
81+
82+
### Example for defining the required input:
83+
```julia
84+
85+
# Step 1: Define wing parameters
86+
n_panels = 20 # Number of panels
87+
span = 20.0 # Wing span [m]
88+
chord = 1.0 # Chord length [m]
89+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
90+
density = 1.225 # Air density [kg/m³]
91+
alpha_deg = 30.0 # Angle of attack [degrees]
92+
alpha = deg2rad(alpha_deg)
93+
94+
# Step 2: Create wing geometry with linear panel distribution
95+
wing = Wing(n_panels, spanwise_panel_distribution="linear")
96+
97+
# Add wing sections - defining only tip sections with inviscid airfoil model
98+
add_section!(wing,
99+
[0.0, span/2, 0.0], # Left tip LE
100+
[chord, span/2, 0.0], # Left tip TE
101+
"inviscid")
102+
add_section!(wing,
103+
[0.0, -span/2, 0.0], # Right tip LE
104+
[chord, -span/2, 0.0], # Right tip TE
105+
"inviscid")
106+
107+
# Step 3: Initialize aerodynamics
108+
wa = WingAerodynamics([wing])
109+
110+
# Set inflow conditions
111+
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
112+
set_va!(wa, (vel_app, 0.0)) # Second parameter is yaw rate
113+
```
114+
It is possible to import the wing geometry using an `.obj` file as shown in the example `ram_air_kite.jl`.
115+
116+
Surfplan files can be converted to an input for `VortexStepMethod.jl` using the [SurfplanAdapter](https://github.com/jellepoland/SurfplanAdapter).
117+
118+
## Output
119+
- CL, CD, CS (side force coefficient)
120+
- the spanwise distribution of forces
121+
--> moment coefficients (will be implemented in release 1.1)
122+
123+
## Citation
124+
If you use this project in your research, please consider citing it.
125+
Citation details can be found in the [CITATION.cff](https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl/blob/main/CITATION.cff) file included in this repository.
126+
127+
## License
128+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl/blob/main/LICENSE) file for details.
129+
130+
### Copyright
131+
Copyright (c) 2022 Oriol Cayon
132+
133+
Copyright (c) 2024 Oriol Cayon, Jelle Poland, TU Delft
134+
135+
Copyright (c) 2025 Oriol Cayon, Jelle Poland, Bart van de Lint
136+

src/plotting.jl

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Set the default style for plots using LaTeX.
66
77
# Arguments:
8-
- `titel_size: size of the plot title in points (default: 16)
8+
- `titel_size`: size of the plot title in points (default: 16)
99
"""
1010
function set_plot_style(titel_size=16)
1111
rcParams = plt.PyDict(plt.matplotlib."rcParams")
@@ -112,12 +112,15 @@ function plot_line_segment!(ax, segment, color, label; width=3)
112112
end
113113

114114
"""
115-
set_axes_equal!(ax)
115+
set_axes_equal!(ax; zoom=1.8)
116116
117117
Set 3D plot axes to equal scale.
118118
119119
# Arguments
120120
- ax: 3D plot axis
121+
122+
# Keyword arguments
123+
zoom: zoom factor (default: 1.8)
121124
"""
122125
function set_axes_equal!(ax; zoom=1.8)
123126
x_lims = ax.get_xlim3d() ./ zoom
@@ -153,7 +156,8 @@ Create a 3D plot of wing geometry including panels and filaments.
153156
# Keyword arguments
154157
- zoom: zoom factor (default: 1.8)
155158
"""
156-
function create_geometry_plot(wing_aero::WingAerodynamics, title, view_elevation, view_azimuth; zoom=1.8)
159+
function create_geometry_plot(wing_aero::WingAerodynamics, title, view_elevation, view_azimuth;
160+
zoom=1.8)
157161
set_plot_style(28)
158162

159163
panels = wing_aero.panels
@@ -245,16 +249,16 @@ end
245249
Plot wing geometry from different viewpoints and optionally save/show plots.
246250
247251
# Arguments:
248-
- wing_aero: struct of type WingAerodynamics
252+
- `wing_aero`: struct of type WingAerodynamics
249253
- title: plot title
250254
251255
# Keyword arguments:
252-
- data_type: string with the file type postfix (default: ".pdf")
253-
- save_path: path for saving the graphic (default: `nothing``)- is_save
254-
- is_save: boolean value, indicates if the graphic shall be saved (default: `false`)
255-
- is_show: boolean value, indicates if the graphic shall be displayed (default: `false`)
256-
- view_elevation: initial view elevation angle (default: 15) [°]
257-
- view_azimuth: initial view azimuth angle (default: -120) [°]
256+
- `data_type``: string with the file type postfix (default: ".pdf")
257+
- `save_path`: path for saving the graphic (default: `nothing`)
258+
- `is_save`: boolean value, indicates if the graphic shall be saved (default: `false`)
259+
- `is_show`: boolean value, indicates if the graphic shall be displayed (default: `false`)
260+
- `view_elevation`: initial view elevation angle (default: 15) [°]
261+
- `view_azimuth`: initial view azimuth angle (default: -120) [°]
258262
259263
"""
260264
function plot_geometry(wing_aero::WingAerodynamics, title;
@@ -565,10 +569,10 @@ end
565569

566570
"""
567571
plot_polars(solver_list, wing_aero_list, label_list;
568-
literature_path_list=String[], angle_range=range(0, 20, 2), angle_type="angle_of_attack", angle_of_attack=0.0,
569-
side_slip=0.0, v_a=10.0, title="polar", data_type=".pdf", save_path=nothing,
570-
is_save=true,
571-
is_show=true)
572+
literature_path_list=String[], angle_range=range(0, 20, 2), angle_type="angle_of_attack",
573+
angle_of_attack=0.0, side_slip=0.0, v_a=10.0,
574+
title="polar", data_type=".pdf", save_path=nothing,
575+
is_save=true, is_show=true)
572576
573577
Plot polar data comparing different solvers and configurations.
574578

0 commit comments

Comments
 (0)