Skip to content

Commit 884b539

Browse files
committed
move ControlPlots to extension
1 parent 7490b00 commit 884b539

File tree

7 files changed

+35
-15
lines changed

7 files changed

+35
-15
lines changed

Project.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ version = "1.0.0"
55

66
[deps]
77
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
8-
ControlPlots = "23c2ee80-7a9e-4350-b264-8e670f12517c"
98
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
109
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
1110
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
@@ -20,6 +19,12 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2019
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2120
Timers = "21f18d07-b854-4dab-86f0-c15a3821819a"
2221

22+
[weakdeps]
23+
ControlPlots = "23c2ee80-7a9e-4350-b264-8e670f12517c"
24+
25+
[extensions]
26+
VortexStepMethodExt = "ControlPlots"
27+
2328
[compat]
2429
BenchmarkTools = "1"
2530
Colors = "0.13"

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ if you haven't already. On Linux, make sure that Python3, Matplotlib and LaTeX a
1818
sudo apt install python3-matplotlib
1919
sudo apt install texlive-full texlive-fonts-extra cm-super
2020
```
21-
Furthermore, the package `TestEnv` must be installed globally:
22-
```
23-
julia -e 'using Pkg; Pkg.add("TestEnv")'
21+
Furthermore, the packages `TestEnv` and `ControlPlots` must be installed globally:
2422
```
23+
julia -e 'using Pkg; Pkg.add("TestEnv"); Pkg.add(ControlPlots)'
24+
```)
2525
2626
Before installing this software it is suggested to create a new project, for example like this:
2727
```bash
@@ -62,6 +62,7 @@ Pkg.update()
6262
```
6363
and then you can display a menu with the available examples:
6464
```julia
65+
using ControlPlots
6566
using VortexStepMethod
6667
menu()
6768
```

examples/stall_model.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ end
4343
body_aero_CAD_19ribs = BodyAerodynamics([CAD_wing])
4444

4545
# Create solvers
46-
VSM = Solver(
46+
vsm_solver = Solver(
4747
aerodynamic_model_type=VSM,
4848
is_with_artificial_damping=false
4949
)
@@ -78,7 +78,7 @@ plot && plot_geometry(
7878
)
7979

8080
# Solving and plotting distributions
81-
results = solve(VSM, body_aero_CAD_19ribs)
81+
results = solve(vsm_solver, body_aero_CAD_19ribs)
8282
@time results_with_stall = solve(VSM_with_stall_correction, body_aero_CAD_19ribs)
8383
@time results_with_stall = solve(VSM_with_stall_correction, body_aero_CAD_19ribs)
8484

@@ -106,7 +106,7 @@ path_cfd_lebesque = joinpath(
106106
)
107107

108108
plot && plot_polars(
109-
[VSM, VSM_with_stall_correction],
109+
[vsm_solver, VSM_with_stall_correction],
110110
[body_aero_CAD_19ribs, body_aero_CAD_19ribs],
111111
[
112112
"VSM CAD 19ribs",

ext/VortexStepMethodExt.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module VortexStepMethodExt
2+
using ControlPlots, LaTeXStrings, VortexStepMethod, LinearAlgebra, Statistics, DelimitedFiles
3+
import ControlPlots: plt
4+
import VortexStepMethod: calculate_filaments_for_plotting
5+
6+
export plot_wing, plot_circulation_distribution, plot_geometry, plot_distribution, plot_polars
7+
8+
include("../src/plotting.jl")
9+
10+
end

src/VortexStepMethod.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ using Logging
66
using Statistics
77
using Colors
88
using DelimitedFiles
9-
using ControlPlots
109
using Measures
1110
using LaTeXStrings
1211
using NonlinearSolve
@@ -22,11 +21,19 @@ export Solver, solve
2221
export calculate_results, solve_circulation_distribution
2322
export add_section!, set_va!
2423
export calculate_span, calculate_projected_area
25-
export plot_wing, plot_circulation_distribution, plot_geometry, plot_distribution, plot_polars
2624
export show_plot, save_plot, menu
2725
export Model, VSM, LLT
2826
export PanelDistribution, LINEAR, COSINE, COSINE_VAN_GARREL, SPLIT_PROVIDED, UNCHANGED
2927

28+
export plot_geometry, plot_distribution, plot_circulation_distribution, plot_geometry, plot_polars
29+
30+
# the following functions are defined in ext/VortexStepMethodExt.jl
31+
function plot_geometry end
32+
function plot_distribution end
33+
function plot_circulation_distribution end
34+
function plot_geometry end
35+
function plot_polars end
36+
3037
"""
3138
const MVec3 = MVector{3, Float64}
3239
@@ -94,7 +101,4 @@ include("wake.jl")
94101
include("body_aerodynamics.jl")
95102
include("solver.jl")
96103

97-
# include plotting
98-
include("plotting.jl")
99-
100104
end # module

src/plotting.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Plot wing geometry from different viewpoints and optionally save/show plots.
261261
- `view_azimuth`: initial view azimuth angle (default: -120) [°]
262262
263263
"""
264-
function plot_geometry(body_aero::BodyAerodynamics, title;
264+
function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title;
265265
data_type=".pdf",
266266
save_path=nothing,
267267
is_save=false,
@@ -317,7 +317,7 @@ Plot spanwise distributions of aerodynamic properties.
317317
- `is_save`: Whether to save plots (default: false)
318318
- `is_show`: Whether to display plots (default: true)
319319
"""
320-
function plot_distribution(y_coordinates_list, results_list, label_list;
320+
function VortexStepMethod.plot_distribution(y_coordinates_list, results_list, label_list;
321321
title="spanwise_distribution",
322322
data_type=".pdf",
323323
save_path=nothing,
@@ -594,7 +594,7 @@ Plot polar data comparing different solvers and configurations.
594594
- `is_save`: Whether to save plots (default: true)
595595
- `is_show`: Whether to display plots (default: true)
596596
"""
597-
function plot_polars(
597+
function VortexStepMethod.plot_polars(
598598
solver_list,
599599
body_aero_list,
600600
label_list;

0 commit comments

Comments
 (0)