Skip to content
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f7a8b0e
replace Plots with ControlPlots step one
ufechner7 Feb 17, 2025
3f8cb0b
fix using command
ufechner7 Feb 17, 2025
c749788
No syntax error, something is plotted
ufechner7 Feb 17, 2025
16ebc74
add geometry.png
ufechner7 Feb 17, 2025
58b3ec5
install matplotlib
ufechner7 Feb 17, 2025
d11c27a
call view_init
ufechner7 Feb 17, 2025
1ae0107
update set_plot_style()
ufechner7 Feb 17, 2025
d18efc8
set_plot_style works now
ufechner7 Feb 17, 2025
e5a60b2
add legend
ufechner7 Feb 17, 2025
56fcab8
tight_layout
ufechner7 Feb 17, 2025
8e54dfd
happy with the legend now
ufechner7 Feb 17, 2025
6528859
first plot OK
ufechner7 Feb 17, 2025
02b5f69
first plot nice now
ufechner7 Feb 17, 2025
653dbbe
cleanup
ufechner7 Feb 17, 2025
2bbbe15
added plot 2 of 9
ufechner7 Feb 17, 2025
43f8733
cleanup
ufechner7 Feb 17, 2025
b629305
Relax types
ufechner7 Feb 17, 2025
aa75568
start to use MVec3 for Section
ufechner7 Feb 17, 2025
e6cab17
relax types
ufechner7 Feb 17, 2025
25a6384
use MVec3 for Panel
ufechner7 Feb 17, 2025
aba857a
added third plot
ufechner7 Feb 18, 2025
a541ef2
add alpha_geometric plot
ufechner7 Feb 18, 2025
b424518
added corrected alpha plot
ufechner7 Feb 18, 2025
dda194c
some progress
ufechner7 Feb 18, 2025
187e217
add missing calculations as comments
ufechner7 Feb 18, 2025
ea8e5f7
plot_distribution() completed
ufechner7 Feb 18, 2025
4bd3e26
generate_polar_data() works now
ufechner7 Feb 18, 2025
e96fdbf
some progress
ufechner7 Feb 18, 2025
9bb5e87
some progress
ufechner7 Feb 18, 2025
4ae4b9e
update README.md
ufechner7 Feb 18, 2025
a869be6
trigger CI
ufechner7 Feb 18, 2025
0f20539
add codecov badge
ufechner7 Feb 18, 2025
1946a74
fixed invalid cff file
ufechner7 Feb 18, 2025
5aac2dc
fix URL and version of CFF file
ufechner7 Feb 18, 2025
768a5c5
improve CITATION.cff
ufechner7 Feb 18, 2025
e11a436
added CL plot
ufechner7 Feb 19, 2025
dcccc6f
add CD plot
ufechner7 Feb 19, 2025
2bb5d1d
improve layout
ufechner7 Feb 19, 2025
6f35725
add plot CL vs CD
ufechner7 Feb 19, 2025
0ec5df7
Merge branch 'main' into controlplots
ufechner7 Feb 19, 2025
b16ad27
delete plot
ufechner7 Feb 19, 2025
68c0c1f
save_plot works
ufechner7 Feb 19, 2025
4329a05
Nearly working
ufechner7 Feb 19, 2025
3ffa1dd
Minor fixes
ufechner7 Feb 19, 2025
dfa519b
add test_plotting
ufechner7 Feb 19, 2025
7b91983
fix dependencies
ufechner7 Feb 19, 2025
653ddfc
comment out function that is not working yet
1-Bart-1 Feb 19, 2025
68d6a03
succesful plotting of stall model
1-Bart-1 Feb 19, 2025
7db754a
Merge branch 'main' into controlplots
1-Bart-1 Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
arch: x64
version: 1
steps:
- name: Install matplotlib
run: if [ "$RUNNER_OS" = "Linux" ]; then sudo apt-get install -y python3-matplotlib; fi
shell: bash
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
Expand Down
16 changes: 7 additions & 9 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
cff-version: 0.1.0
cff-version: 1.2.0
message: "If you are using this software, please cite it as shown below."
authors:
-
family-names: "Cayon"
- family-names: "Cayon"
given-names: "Oriol"
orcid: "https://orcid.org/0000-0002-2065-8673"
family-names: "Poland"
- family-names: "Poland"
given-names: "Jelle Agatho Wilhelm"
orcid: "https://orcid.org/0000-0003-3164-5648"
title: "VortexStepMethod"
title: "VortexStepMethod.jl"
keywords:
- Airborne Wind Energy
version: 0.1.0
- Airborne Wind Energy, AWE, AWES, Vortex step methods
version: 1.0.0
# doi: "11.1111/11111"
# date-released: YYYY-MM-DD
license: MIT
url: "https://github.com/ocayon/Vortex-Step-Method"
url: "https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl"
preferred-citation:
type: article
authors:
Expand All @@ -31,4 +30,3 @@ preferred-citation:
issue: 7
volume: 16
year: 2023
article-number: 3061
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ version = "0.1.0"
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
ControlPlots = "23c2ee80-7a9e-4350-b264-8e670f12517c"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
ControlPlots = "0.2.5"
Measures = "0.3"
StaticArrays = "1"
Plots = "1"
Statistics = "1"
DelimitedFiles = "1"
BenchmarkTools = "1"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Build Status](https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/Albatross-Kite-Transport/VortexStepMethod.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Coverage](https://codecov.io/gh/Albatross-Kite-Transport/VortexStepMethod.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/Albatross-Kite-Transport/VortexStepMethod.jl)

=======

# Simulation of a 3D airfoil using the Vortex Step Method

The Vortex Step Method (VSM) is an enhanced lifting line method that improves upon the classic approach by solving the
Expand Down Expand Up @@ -116,7 +118,7 @@ Surfplan files can be converted to an input for `VortexStepMethod.jl` using the
## Output
- CL, CD, CS (side force coefficient)
- the spanwise distribution of forces
--> moment coefficients (not yet implemented)
--> moment coefficients (will be implemented in release 1.1)

## Citation
If you use this project in your research, please consider citing it.
Expand Down
Binary file removed Spanwise Distributions.pdf
Binary file not shown.
Binary file added docs/geometry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 23 additions & 26 deletions examples/rectangular_wing.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using LinearAlgebra
using Plots
using ControlPlots
using VortexStepMethod

# Step 1: Define wing parameters
Expand Down Expand Up @@ -55,36 +55,33 @@ println("Projected area = $(round(results_vsm["projected_area"], digits=4)) m²"
# Step 6: Plot geometry
plot_geometry(
wa,
"rectangular_wing_geometry";
"Rectangular_wing_geometry";
data_type=".pdf",
save_path=".",
is_save=false,
is_show=true,
)
nothing

# # Step 7: Plot spanwise distributions
# y_coordinates = [panel.aerodynamic_center[2] for panel in wa.panels]
# Step 7: Plot spanwise distributions
y_coordinates = [panel.aerodynamic_center[2] for panel in wa.panels]

# plot_distribution(
# [y_coordinates, y_coordinates],
# [results_vsm, results_llt],
# ["VSM", "LLT"],
# title="Spanwise Distributions"
# )

# # Step 8: Plot polar curves
# angle_range = range(0, 20, 20)
# plot_polars(
# [llt_solver, vsm_solver],
# [wa, wa],
# ["LLT", "VSM"],
# angle_range=angle_range,
# angle_type="angle_of_attack",
# Umag=Umag,
# title="Rectangular Wing Polars"
# )
plot_distribution(
[y_coordinates, y_coordinates],
[results_vsm, results_llt],
["VSM", "LLT"],
title="Spanwise Distributions"
)

# Save plots if needed
# savefig("geometry.pdf")
# savefig("distributions.pdf")
# savefig("polars.pdf")
# Step 8: Plot polar curves
angle_range = range(0, 20, 20)
plot_polars(
[llt_solver, vsm_solver],
[wa, wa],
["LLT", "VSM"],
angle_range=angle_range,
angle_type="angle_of_attack",
Umag=Umag,
title="Rectangular Wing Polars"
)
nothing
6 changes: 3 additions & 3 deletions src/VortexStepMethod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Logging
using Statistics
using Colors
using DelimitedFiles
using Plots
using ControlPlots
using Measures
using LaTeXStrings

Expand All @@ -31,8 +31,8 @@ const MVec3 = MVector{3, Float64}

Position vector, either a `MVec3` or a `Vector` for use in function signatures.
"""
const PosVector=Union{MVec3, Vector}
const VelVector=Union{MVec3, Vector}
const PosVector=Union{MVec3, Vector, SizedVector{3, Float64, Vector{Float64}}}
const VelVector=Union{MVec3, Vector, SizedVector{3, Float64, Vector{Float64}}}

# Include core functionality
include("wing_geometry.jl")
Expand Down
66 changes: 31 additions & 35 deletions src/color_palette.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,41 +69,37 @@

Set the default style for plots using LaTeX.
"""
function set_plot_style()
default(
fontfamily="Computer Modern",
titlefontsize=14,
guidefontsize=12,
tickfontsize=10,
legendfontsize=10,
linewidth=1,
markersize=6,
size=(600, 400),
grid=true,
gridstyle=:dash,
gridcolor=:gray,
gridalpha=0.3
)

# LaTeX settings if using PGFPlotsX backend
if backend() isa PGFPlotsX
pgfplotsx(
tex_output_standalone=true,
pdf_engine="pdflatex",
latex_engine="pdflatex"
)
end
function set_plot_style(titel_size=16)

Check warning on line 72 in src/color_palette.jl

View check run for this annotation

Codecov / codecov/patch

src/color_palette.jl#L72

Added line #L72 was not covered by tests
# plt.style.use('seaborn-whitegrid')
# plt.style.use("seaborn-v0_8-whitegrid")
rcParams = plt.PyDict(plt.matplotlib."rcParams")
rcParams["text.usetex"] = true
rcParams["font.family"] = "serif"
rcParams["font.serif"] = ["Computer Modern Roman"]
rcParams["axes.titlesize"] = titel_size

Check warning on line 79 in src/color_palette.jl

View check run for this annotation

Codecov / codecov/patch

src/color_palette.jl#L75-L79

Added lines #L75 - L79 were not covered by tests
# rcParams["axes.ymargin"] = 0.1
rcParams["axes.labelsize"] = 12
rcParams["axes.linewidth"] = 1
rcParams["lines.linewidth"] = 1
rcParams["lines.markersize"] = 6
rcParams["xtick.labelsize"] = 10
rcParams["ytick.labelsize"] = 10
rcParams["legend.fontsize"] = 10
rcParams["figure.titlesize"] = 16
rcParams["pgf.texsystem"] = "pdflatex" # Use pdflatex
rcParams["pgf.rcfonts"] = false
rcParams["figure.figsize"] = (10, 6) # Default figure size

Check warning on line 91 in src/color_palette.jl

View check run for this annotation

Codecov / codecov/patch

src/color_palette.jl#L81-L91

Added lines #L81 - L91 were not covered by tests
end

"""
apply_palette!(p::Plots.Plot, colors::Vector{String})
# """
# apply_palette!(p::Plots.Plot, colors::Vector{String})

Apply the color palette to a plot.
"""
function apply_palette!(p::Plots.Plot, colors::Vector{String})
for (i, series) in enumerate(p.series_list)
color_name = colors[mod1(i, length(colors))]
series.plotattributes[:linecolor] = get_color(color_name)
end
return p
end
# Apply the color palette to a plot.
# """
# function apply_palette!(p::Plots.Plot, colors::Vector{String})
# for (i, series) in enumerate(p.series_list)
# color_name = colors[mod1(i, length(colors))]
# series.plotattributes[:linecolor] = get_color(color_name)
# end
# return p
# end
28 changes: 14 additions & 14 deletions src/panel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Represents a panel in a vortex step method simulation.
- `filaments::Vector{BoundFilament}`: Panel filaments
"""
mutable struct Panel
TE_point_1::Vector{Float64}
LE_point_1::Vector{Float64}
TE_point_2::Vector{Float64}
LE_point_2::Vector{Float64}
TE_point_1::MVec3
LE_point_1::MVec3
TE_point_2::MVec3
LE_point_2::MVec3
chord::Float64
va::Union{Nothing,Vector{Float64}}
corner_points::Matrix{Float64}
Expand All @@ -37,13 +37,13 @@ mutable struct Panel
cd_coefficients::Union{Nothing,Vector{Float64}}
cm_coefficients::Union{Nothing,Vector{Float64}}
panel_polar_data::Union{Nothing,Matrix{Float64}}
aerodynamic_center::Vector{Float64}
control_point::Vector{Float64}
bound_point_1::Vector{Float64}
bound_point_2::Vector{Float64}
x_airf::Vector{Float64}
y_airf::Vector{Float64}
z_airf::Vector{Float64}
aerodynamic_center::MVec3
control_point::MVec3
bound_point_1::MVec3
bound_point_2::MVec3
x_airf::MVec3
y_airf::MVec3
z_airf::MVec3
width::Float64
filaments::Vector{Union{BoundFilament, SemiInfiniteFilament}}

Expand All @@ -54,9 +54,9 @@ mutable struct Panel
control_point::PosVector,
bound_point_1::PosVector,
bound_point_2::PosVector,
x_airf::Vector{Float64},
y_airf::Vector{Float64},
z_airf::Vector{Float64}
x_airf::PosVector,
y_airf::PosVector,
z_airf::PosVector
)
# Initialize basic geometry
TE_point_1 = copy(section_1.TE_point)
Expand Down
Loading
Loading