Skip to content

Commit

Permalink
clean up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
juddmehr committed Jul 3, 2024
1 parent 19057e5 commit 746cba9
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main
tags: '*'
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
Expand Down
12 changes: 0 additions & 12 deletions docs/src/DuctAPE/advanced_usage/examples.md

This file was deleted.

Empty file.
21 changes: 11 additions & 10 deletions docs/src/DuctAPE/advanced_usage/option.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ aero_solver_options = DuctAPE.NLsolveOptions(;
# set all the options
DuctAPE.set_options(;
integration_options=integration_options,
grid_solver_options=wake_solve_options
solver_options = aero_solver_options
grid_solver_options=wake_solve_options,
solver_options=aero_solver_options,
)
```

Expand All @@ -154,7 +154,7 @@ Here is an example for setting options with the CSOR solver.
nop = 3

options = DuctAPE.set_options(;
solver_options=DuctAPE.CSORSolverOptions(
solver_options=DuctAPE.CSORSolverOptions(;
converged=fill(false, (1, nop)), # need a convergence flag for each operating point
iterations=zeros(Int, (1, nop)), # need a iteration count for each operating point
Vconv=ones(nop), # in this case, we need a reference velocity for each operating point
Expand All @@ -174,18 +174,19 @@ options = DuctAPE.set_options(;
DuctAPE.NLsolveOptions(;
algorithm=:anderson,
atol=1e-12,
iteration_limit=200
converged=fill(false, (1,nop)), # flags for each operating point
iterations=zeros(Int, (1,nop)), # counters for each operating point
iteration_limit=200,
converged=fill(false, (1, nop)), # flags for each operating point
iterations=zeros(Int, (1, nop)), # counters for each operating point
),
DuctAPE.MinpackOptions(;
atol=1e-12,
iteration_limit=100,
converged=fill(false, (1,nop)),
iterations=zeros(Int, (1,nop)),
converged=fill(false, (1, nop)),
iterations=zeros(Int, (1, nop)),
),
],
converged=fill(false, (2,nop)), # flags for each solver and each operating point
iterations=fill(0, (2,nop)), # counts for each solver and each operating point
converged=fill(false, (2, nop)), # flags for each solver and each operating point
iterations=zeros(Int, (2, nop)), # counts for each solver and each operating point
),
)
```
74 changes: 64 additions & 10 deletions docs/src/DuctAPE/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,25 @@ nothing # hide
```

```@example tutorial
pg = plot(duct_coordinates[:,1], duct_coordinates[:,2], aspectratio=1, color=1, linewidth=2, label="Duct", xlabel="z", ylabel="r", legend=:left) # hide
plot!(pg, centerbody_coordinates[:,1], centerbody_coordinates[:,2], color=2, linewidth=2, label="Center Body") # hide
pg = plot(
duct_coordinates[:, 1],
duct_coordinates[:, 2];
aspectratio=1,
color=1,
linewidth=2,
label="Duct",
xlabel="z",
ylabel="r",
legend=:left,
) # hide
plot!(
pg,
centerbody_coordinates[:, 1],
centerbody_coordinates[:, 2];
color=2,
linewidth=2,
label="Center Body",
) # hide
```

!!! note
Expand All @@ -157,14 +174,19 @@ DuctAPE.RotorStatorParameters
In this example, we have a single rotor defined as follows.

```@example tutorial
# number of rotors
B = 5
# rotor axial location
rotorzloc = 0.12
# rotor tip radius
Rtip = 0.15572081487373543
# rotor hub radius
Rhub = 0.04495252299071941
# non-dimensional blade element radial stations
r = [
0.050491
0.061567
Expand All @@ -176,8 +198,9 @@ r = [
0.12803
0.13911
0.15018
]./Rtip
] ./ Rtip
# dimensional chord lengths
chords = [
0.089142
0.079785
Expand All @@ -191,6 +214,7 @@ chords = [
0.038243
]
# twist angles (from plane of rotation) in radians
twists = [
69.012
59.142
Expand All @@ -202,9 +226,9 @@ twists = [
33.354
31.349
29.596
].*pi/180.0
] .* pi / 180.0
# DFDC-type airfoil object
afparams = DuctAPE.c4b.DFDCairfoil(;
alpha0=0.0,
clmax=1.5,
Expand All @@ -221,8 +245,10 @@ afparams = DuctAPE.c4b.DFDCairfoil(;
mcrit=0.7,
)
# all airfoils are the same
airfoils = fill(afparams, length(r)) # specify the airfoil array
# assemble rotor parameters
rotorstator_parameters = dt.RotorStatorParameters(
[B],
[rotorzloc],
Expand All @@ -239,7 +265,15 @@ nothing # hide
```

```@example tutorial
plot!(pg, rotorzloc*ones(length(r)), r.*Rtip, seriestype=:scatter, markersize=3, markerstrokewidth=0, label="Blade Elements") # hide
plot!(
pg,
rotorzloc * ones(length(r)),
r .* Rtip;
seriestype=:scatter,
markersize=3,
markerstrokewidth=0,
label="Blade Elements",
) # hide
```

!!! note "Airfoils"
Expand Down Expand Up @@ -269,7 +303,6 @@ Omega = RPM * pi / 30 # if using RPM, be sure to convert to rad/s
# utilizing the constructor function to put things in vector types
operating_point = dt.OperatingPoint(Vinf, rhoinf, muinf, asound, Omega)
nothing # hide
```

Expand All @@ -284,13 +317,28 @@ DuctAPE.PanelingConstants
```

```@example tutorial
# number of panels for the duct inlet
nduct_inlet = 30
# number of panels for the center body inlet
ncenterbody_inlet = 30
npanels = [30, 1, 30] # the 1 is due to the fact that the duct and center body trailing edges are not quite aligned.
dte_minus_cbte = -1.0 # the duct trailing edge is ahead of the centerbody trailing edge.
# number of panels from:
# - rotor to duct trailing edge
# - duct trailing edge to center body trailing edge
# - center body trailing edge to end of wake
npanels = [30, 1, 30]
# the duct trailing edge is ahead of the centerbody trailing edge.
dte_minus_cbte = -1.0
# number of wake sheets (one more than blade elements to use)
nwake_sheets = 11
# non-dimensional wake length aft of rear-most trailing edge
wake_length = 0.8
# assemble paneling constants
paneling_constants = dt.PanelingConstants(
nduct_inlet, ncenterbody_inlet, npanels, dte_minus_cbte, nwake_sheets, wake_length
)
Expand All @@ -306,9 +354,13 @@ DuctAPE.ReferenceParameters
```

```@example tutorial
Vref = 50.0 #this turns out to be close to the average axial velocity at the rotor in our case
# reference velocity (close to average axial velocity at rotor in this case)
Vref = 50.0
# reference radius (usually tip radius of rotor)
Rref = Rtip
# assemble reference parameters
reference_parameters = dt.ReferenceParameters([Vref], [Rref])
nothing # hide
```
Expand All @@ -318,6 +370,7 @@ nothing # hide
We are now posed to construct the `Propulsor` input type.

```@example tutorial
# assemble propulsor object
propulsor = dt.Propulsor(
duct_coordinates,
centerbody_coordinates,
Expand Down Expand Up @@ -397,6 +450,7 @@ end
# - Run Multi-point Analysis - #
outs_vec, success_flags = DuctAPE.analyze(ops, propulsor, DuctAPE.set_options(ops))
nothing #hide
```

There are a few things to note here.
Expand Down

0 comments on commit 746cba9

Please sign in to comment.