Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Three kinds of input data is needed:
- kite wing: model of polars included, n sections to define

- The airflow and turn rate:
- `v_app` vector and `omega` (turn rate) vector in Kite Body (KB) reference frame
- `va_vec` vector and `omega` (turn rate) vector in Kite Body (KB) reference frame

- The configuration:
- how many panels
Expand All @@ -106,7 +106,7 @@ A whole run — the flight condition, each wing and the solver — is configured
n_panels = 20 # Number of panels
span = 20.0 # Wing span [m]
chord = 1.0 # Chord length [m]
v_a = 20.0 # Magnitude of inflow velocity [m/s]
va = 20.0 # Magnitude of inflow velocity [m/s]
density = 1.225 # Air density [kg/m³]
alpha_deg = 30.0 # Angle of attack [degrees]
alpha = deg2rad(alpha_deg)
Expand All @@ -131,8 +131,8 @@ refine!(wing)
body_aero = BodyAerodynamics([wing])

# Set inflow conditions
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
set_va!(body_aero, vel_app)
va_vec = [cos(alpha), 0.0, sin(alpha)] .* va
set_va!(body_aero, va_vec)
```
It is possible to import the wing geometry using an `.obj` file as shown in the example `ram_air_kite.jl`. During the import the polars are calculated automatically using XFoil. This approach is valid for rigid wings and ram-air kites, but not for leading edge inflatable kites.

Expand Down
8 changes: 4 additions & 4 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ julia> using VortexStepMethod
julia> n_panels = 20 # Number of panels
julia> span = 20.0 # Wing span [m]
julia> chord = 1.0 # Chord length [m]
julia> v_a = 20.0 # Magnitude of inflow velocity [m/s]
julia> va = 20.0 # Magnitude of inflow velocity [m/s]
julia> alpha_deg = 30.0 # Angle of attack [degrees]
julia> alpha = deg2rad(alpha_deg)
```
Expand Down Expand Up @@ -77,8 +77,8 @@ multiple wings.
###### Set inflow conditions

```julia
julia> vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
julia> set_va!(body_aero, vel_app, [0, 0, 0.1])
julia> va_vec = [cos(alpha), 0.0, sin(alpha)] .* va
julia> set_va!(body_aero, va_vec, [0, 0, 0.1])
```

#### Step 5: Initialize solvers for both LLT and VSM methods
Expand Down Expand Up @@ -118,7 +118,7 @@ julia> plot_combined_analysis(
solver_label=["LLT", "VSM"],
angle_range=angle_range,
angle_type="angle_of_attack",
v_a=v_a,
v_a=va,
title="Rectangular Wing",
is_show=true,
)
Expand Down
8 changes: 4 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Three kinds of input data is needed:
- kite wing: model of polars included, n sections to define

- The airflow and turn rate:
- `v_app` vector and `omega` (turn rate) vector in Kite Body (KB) reference frame
- `va_vec` vector and `omega` (turn rate) vector in Kite Body (KB) reference frame

- The configuration:
- how many panels
Expand All @@ -112,7 +112,7 @@ A whole run — the flight condition, each wing and the solver — is configured
n_panels = 20 # Number of panels
span = 20.0 # Wing span [m]
chord = 1.0 # Chord length [m]
v_a = 20.0 # Magnitude of inflow velocity [m/s]
va = 20.0 # Magnitude of inflow velocity [m/s]
density = 1.225 # Air density [kg/m³]
alpha_deg = 30.0 # Angle of attack [degrees]
alpha = deg2rad(alpha_deg)
Expand All @@ -137,8 +137,8 @@ refine!(wing)
body_aero = BodyAerodynamics([wing])

# Set inflow conditions
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
set_va!(body_aero, vel_app)
va_vec = [cos(alpha), 0.0, sin(alpha)] .* va
set_va!(body_aero, va_vec)
```

It is possible to import the wing geometry using an `.obj` file as shown in the example `ram_air_kite.jl`. During the import the polars are calculated automatically, using NeuralFoil by default or XFoil as a viscous cross-check. This approach is valid for rigid wings and ram-air kites, but not for leading edge inflatable kites. See [From CAD mesh to aerodynamic model](@ref) for the full pipeline.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/reference_frames.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### Introduction
Reference frames are needed for following purposes:
- for creating a CAD model of the wing (or the wings)
- for defining the apparent wind speed vector $v_a$
- for defining the apparent wind speed vector `va_vec`
- for calculating the lift and drag and side force coefficients
- for calculating the resulting forces and moments

Expand All @@ -30,6 +30,6 @@ The turn rates $\mathrm{omega} = [\mathrm{omega_x}, \mathrm{omega_y} ,\mathrm{om

## Input and output
- when running a simulation, the turnrate of the kite must be provided on each time step
- the apparent wind speed vector `v_a` is defined in the **KB** reference frame
- the apparent wind speed vector `va_vec` is defined in the **KB** reference frame
- the resulting forces are defined in the **KB** reference frame
- the **CL**, **CD**, **CS** and the resulting moments and moment coefficients are defined in the **KB** reference frame
2 changes: 1 addition & 1 deletion examples/V3_kite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ PLOT && plot_distribution(
[body_y_coordinates],
[results],
["VSM"];
title="CAD_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(wind_speed, digits=1))",
title="CAD_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_va_$(round(wind_speed, digits=1))",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
is_show=true,
Expand Down
4 changes: 2 additions & 2 deletions examples/V3_neuralfoil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ nf_yaml = obj_to_yaml(OBJ_PATH, gen_dir; n_sections=N_SLICES, Re=RE,
rotation=ROTATION, wrap_method=WRAP, aero_solver=NF_SOLVER, verbose=true)

# Flight conditions
v_a = 10.0
va = 10.0
angle_range = range(-5, 25, length=31)

# Load settings and create wing with CFD polars
Expand Down Expand Up @@ -105,7 +105,7 @@ fig = plot_polars(
"Wind tunnel (Poland 2025)"];
literature_path_list=literature_paths,
angle_range,
v_a,
v_a=va,
title="TU Delft V3 Kite: CFD vs NeuralFoil (Re=$RE)",
is_save=false,
)
Expand Down
14 changes: 7 additions & 7 deletions examples/bench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using VortexStepMethod: solve_base!
n_panels = 20 # Number of panels
span = 20.0 # Wing span [m]
chord = 1.0 # Chord length [m]
v_a = 20.0 # Magnitude of inflow velocity [m/s]
va = 20.0 # Magnitude of inflow velocity [m/s]
density = 1.225 # Air density [kg/m³]
alpha_deg = 30.0 # Angle of attack [degrees]
alpha = deg2rad(alpha_deg)
Expand All @@ -37,8 +37,8 @@ refine!(wing)
body_aero = BodyAerodynamics([wing])

# Set inflow conditions
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
set_va!(body_aero, vel_app)
va_vec = [cos(alpha), 0.0, sin(alpha)] .* va
set_va!(body_aero, va_vec)

# Step 4: Initialize solvers for both LLT and VSM methods
llt_solver = Solver(body_aero; aerodynamic_model_type=LLT)
Expand Down Expand Up @@ -73,17 +73,17 @@ vsm_solver = Solver(
)

# Setting velocity conditions
v_a = 15.0
va = 15.0
aoa = 15.0
side_slip = 0.0
yaw_rate = 0.0
aoa_rad = deg2rad(aoa)
vel_app = [
va_vec = [
cos(aoa_rad) * cos(side_slip),
sin(side_slip),
sin(aoa_rad)
] * v_a
set_va!(body_aero, vel_app)
] * va
set_va!(body_aero, va_vec)

# Solving
solve_base!(vsm_solver, body_aero, nothing)
Expand Down
6 changes: 3 additions & 3 deletions examples/billowing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ sideslip_deg = condition_cfg["beta"]

α0 = deg2rad(angle_of_attack_deg)
β0 = deg2rad(sideslip_deg)
va = wind_speed .* [cos(α0) * cos(β0), sin(β0), sin(α0) * cos(β0)]
set_va!(body_aero_flat, va)
set_va!(body_aero_bill, va)
va_vec = wind_speed .* [cos(α0) * cos(β0), sin(β0), sin(α0) * cos(β0)]
set_va!(body_aero_flat, va_vec)
set_va!(body_aero_bill, va_vec)

# --- Solve and compare ---
results_flat = VortexStepMethod.solve(
Expand Down
24 changes: 12 additions & 12 deletions examples/linearize_check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ solver = Solver(body_aero;
use_gamma_prev=false,
)

v_a = 15.0
aoa_deg = 10.0
aoa_rad = deg2rad(aoa_deg)
side_slip = 0.0
va_b_0 = [
va = 15.0
aoa_deg = 10.0
aoa_rad = deg2rad(aoa_deg)
side_slip = 0.0
va_vec_b_0 = [
cos(aoa_rad) * cos(side_slip),
sin(side_slip),
sin(aoa_rad),
] * v_a
omega_b_0 = zeros(3)
theta_0 = zeros(n_unrefined)
] * va
omega_b_0 = zeros(3)
theta_0 = zeros(n_unrefined)

theta_idxs = 1:n_unrefined
va_idxs = (n_unrefined + 1):(n_unrefined + 3)
omega_idxs = (n_unrefined + 4):(n_unrefined + 6)
y0 = [theta_0; va_b_0; omega_b_0]
y0 = [theta_0; va_vec_b_0; omega_b_0]

@info "Computing FiniteDiff Jacobian …"
t_fd = @elapsed begin
Expand Down Expand Up @@ -97,7 +97,7 @@ n_outputs = length(output_labels)

input_scales = [
fill(0.05, n_unrefined)..., # θ [rad] : ±0.05 rad ≈ ±2.9°
fill(1.0, 3)..., # va: ±1 m/s
fill(1.0, 3)..., # va_vec: ±1 m/s
fill(0.05, 3)..., # ω : ±0.05 rad/s
]
n_sweep = 11
Expand All @@ -109,14 +109,14 @@ last_theta = fill(NaN, n_unrefined)

function solve_at!(y)
theta = y[theta_idxs]
va = y[va_idxs]
va_vec = y[va_idxs]
omega = y[omega_idxs]
if !all(theta .== last_theta)
unrefined_deform!(wing, theta, nothing; smooth=false)
reinit!(body_aero; init_aero=false)
last_theta .= theta
end
set_va!(body_aero, va, omega)
set_va!(body_aero, va_vec, omega)
solve!(solver, body_aero; log=false)
return [
solver.sol.force_coeffs...,
Expand Down
6 changes: 3 additions & 3 deletions examples/obj_to_yaml_kite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using LinearAlgebra

PLOT = true
USE_TEX = false
v_a = 15.0
va = 15.0
project_dir = dirname(@__DIR__)
obj_path = joinpath(project_dir, "data", "ram_air_kite", "ram_air_kite_body.obj")
output_dir = joinpath(project_dir, "output", "ram_air_kite_converted")
Expand Down Expand Up @@ -73,7 +73,7 @@ body_aero = BodyAerodynamics([wing])
VortexStepMethod.reinit!(body_aero)

solver = Solver(body_aero; aerodynamic_model_type=VSM, rtol=1e-5, solver_type=LOOP)
set_va!(body_aero, [cos(deg2rad(8)) * v_a, 0.0, sin(deg2rad(8)) * v_a])
set_va!(body_aero, [cos(deg2rad(8)) * va, 0.0, sin(deg2rad(8)) * va])
results = VortexStepMethod.solve(solver, body_aero; log=true)

if PLOT
Expand All @@ -86,7 +86,7 @@ if PLOT
plot_section_polars(body_aero, :cd; is_show=true)

plot_polars([solver], [body_aero], ["VSM (NeuralFoil polars from .obj)"];
angle_range=range(-5, 20, length=26), v_a=v_a,
angle_range=range(-5, 20, length=26), v_a=va,
title="Ram air kite: obj_to_yaml route", is_save=false, use_tex=USE_TEX)
end

Expand Down
2 changes: 1 addition & 1 deletion examples/pyramid_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ PLOT && plot_distribution(
[body_y_coordinates],
[results],
["VSM"];
title="pyramid_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(wind_speed, digits=1))",
title="pyramid_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_va_$(round(wind_speed, digits=1))",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
is_show=true,
Expand Down
4 changes: 2 additions & 2 deletions examples/ram_air_kite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using LinearAlgebra

PLOT = true
USE_TEX = false
v_a = 15.0
va = 15.0
RE = 1e6

# Shared boundary-layer transition settings — both backends use the e^N model.
Expand Down Expand Up @@ -97,7 +97,7 @@ if PLOT
[body_xfoil, body_nf],
["XFoil", "NeuralFoil"];
angle_range=range(-5, 25, length=31),
v_a=v_a,
v_a=va,
title="Ram Air Kite: XFoil vs NeuralFoil",
is_save=false,
use_tex=USE_TEX
Expand Down
8 changes: 4 additions & 4 deletions examples/rectangular_wing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ OUTPUT_DIR = joinpath(dirname(@__DIR__), "output")
n_panels = 20 # Number of panels
span = 20.0 # Wing span [m]
chord = 1.0 # Chord length [m]
v_a = 20.0 # Magnitude of inflow velocity [m/s]
va = 20.0 # Magnitude of inflow velocity [m/s]
density = 1.225 # Air density [kg/m³]
alpha_deg = 30.0 # Angle of attack [degrees]
alpha = deg2rad(alpha_deg)
Expand All @@ -41,8 +41,8 @@ refine!(wing)
body_aero = BodyAerodynamics([wing])

# Set inflow conditions
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
set_va!(body_aero, vel_app, [0, 0, 0.1])
va_vec = [cos(alpha), 0.0, sin(alpha)] .* va
set_va!(body_aero, va_vec, [0, 0, 0.1])

# Step 4: Initialize solvers for both LLT and VSM methods
llt_solver = Solver(body_aero; aerodynamic_model_type=LLT)
Expand Down Expand Up @@ -94,7 +94,7 @@ PLOT && plot_polars(
["LLT", "VSM"];
angle_range,
angle_type="angle_of_attack",
v_a,
v_a=va,
title="Rectangular Wing Polars",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
Expand Down
12 changes: 6 additions & 6 deletions examples/stall_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ VSM_with_stall_correction = Solver(body_aero;
)

# Setting velocity conditions
v_a = 15.0
va = 15.0
aoa = 17.0
side_slip = 0.0
yaw_rate = 0.0
aoa_rad = deg2rad(aoa)
vel_app = [
va_vec = [
cos(aoa_rad) * cos(side_slip),
sin(side_slip),
sin(aoa_rad)
] * v_a
set_va!(body_aero, vel_app)
] * va
set_va!(body_aero, va_vec)

# Plotting geometry
PLOT && plot_geometry(
Expand All @@ -91,7 +91,7 @@ PLOT && plot_distribution(
[CAD_y_coordinates, CAD_y_coordinates],
[results, results_with_stall],
["VSM", "VSM with stall correction"];
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))",
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_va_$(round(va, digits=1))",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
is_show=true,
Expand Down Expand Up @@ -127,7 +127,7 @@ PLOT && plot_polars(
angle_type="angle_of_attack",
angle_of_attack=aoa,
side_slip=side_slip,
v_a=v_a,
v_a=va,
title="tutorial_testing_stall_model_n_panels_$(n_panels)_distribution_$(spanwise_distribution)",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
Expand Down
Loading
Loading