Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bl dev #61

Merged
merged 22 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
23e1b61
get integral boundary layer setup to work in overall framework
juddmehr Oct 2, 2024
1b982a3
update tests
juddmehr Oct 2, 2024
bb292c2
clean up typos and add remaining boundary layer stuff.
juddmehr Oct 2, 2024
7622961
get boundary layer working in framework, get smooth stagnation finder…
juddmehr Oct 4, 2024
4da1949
fix bugs in imperial thermo and operating point functions and add tests.
juddmehr Oct 7, 2024
a37f7af
add docstrings and update docs
juddmehr Oct 7, 2024
6d8998c
continue BL development and make needed adjustments to tests and othe…
juddmehr Oct 16, 2024
4910ee0
clean up and add docstrings
juddmehr Oct 18, 2024
50bec79
add boundary layer stuff to docstrings
juddmehr Oct 18, 2024
767d53a
fix backup bug
juddmehr Oct 28, 2024
82ddf82
update boundary layer and add some visualization
juddmehr Nov 4, 2024
ae853ed
update boundary layer and add visualization
juddmehr Nov 4, 2024
1e9d87d
add tutorial back into docs and add boundary layer stuff to post proc…
juddmehr Nov 5, 2024
0169e32
clean up docs
juddmehr Nov 8, 2024
6490c6e
clean up and swap some defaults
juddmehr Nov 8, 2024
00bdc9b
add some notes in the boundary layer for later, move dfdc polar fitti…
juddmehr Nov 8, 2024
5d4826a
bump version
juddmehr Nov 8, 2024
8d859c1
update boundary layer tests for swap to head's method
juddmehr Nov 8, 2024
c296455
fix bugs in visualization
juddmehr Nov 8, 2024
bebb47f
fix plotting bug
juddmehr Nov 9, 2024
bb72085
add progress bars to animation generation functions
juddmehr Nov 9, 2024
56c2dbf
pre-make gifs so github doesn't time out
juddmehr Nov 9, 2024
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: 6 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
name = "DuctAPE"
uuid = "ad8e49fd-fab7-444e-af4a-0daba3b8bf11"
authors = ["Judd Mehr"]
version = "0.5.1"
version = "0.6.0"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
FLOWMath = "6cb5d3fb-0fe8-4cc2-bd89-9fe0b19a99d3"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
FixedPoint = "3325f569-5a18-4e7d-8356-246b69339eea"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
ImplicitAD = "e7cbb90b-9b31-4eb2-a8c8-45099c074ee1"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4"
SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Expand All @@ -33,7 +38,6 @@ FastGaussQuadrature = "1"
FiniteDiff = "2"
FixedPoint = "1"
ForwardDiff = "0.10"
ImplicitAD = "0.3"
LineSearches = "7"
MINPACK = "1"
NLsolve = "4"
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
site/
gr-temp/
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ makedocs(;
"Outputs" => "DuctAPE/advanced_usage/outputs.md",
# "Manual Geometry" => "DuctAPE/advanced_usage/manual_repaneling.md",
],
"Visualization" => "DuctAPE/visualization.md",
"API" => [
"Public API Reference" => "DuctAPE/api/public_api.md",
"Private API Reference" => [
Expand Down
31 changes: 31 additions & 0 deletions docs/src/DuctAPE/advanced_usage/option.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,37 @@ DuctAPE.set_options(;
!!! note "Iteration Counters"
The `iterations` field (not to be confused with the `iterations_limit` field) in the solver options should generally not be changed. They automatically save (in-place) the number of iterations the solver performs and can be accessed after the analysis is run.

## Boundary Layer Solvers

If desired, a one-way turbulent boundary layer can be modeled, from which an approximate viscous drag can be determined.
Currently, only the Head's method for turbulent boundary layer computation is working.
In the case of separation, a separation drag penalty is applied based on values selected in the options.

```@docs; canonical=false
DuctAPE.HeadsBoundaryLayerOptions
```

Here is an example of a possible boundary layer option setting:

```julia
# Define Boundary Layer Settings
boundary_layer_options = DuctAPE.HeadsBoundaryLayerOptions(;
model_drag=true,
separation_penalty_upper=0.1,
separation_penalty_lower=0.1,
separation_allowance_upper=3,
separation_allowance_lower=25,
)

# set all the options
DuctAPE.set_options(;
integration_options=integration_options,
grid_solver_options=wake_solve_options,
solver_options=aero_solver_options,
boundary_layer_options=boundary_layer_options,
)
```

## Advanced Options for Multi-point analyses

For using advanced options in multi-point analyses, there are various changes that need to be made to avoid run-time errors.
Expand Down
54 changes: 54 additions & 0 deletions docs/src/DuctAPE/api/private_postprocess.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
```@contents
Pages = ["private_postprocess.md"]
Depth = 5
```

```@docs
DuctAPE.post_process
Expand Down Expand Up @@ -51,4 +55,54 @@ DuctAPE.get_blade_loads
DuctAPE.get_blade_loads!
```

## Boundary Layer

### Thermodynamics
```@docs
DuctAPE.sa1
DuctAPE.sa2
DuctAPE.standard_atmosphere
DuctAPE.ideal_gas_rho
DuctAPE.sutherlands_law
DuctAPE.speed_of_sound
DuctAPE.calculate_mach
DuctAPE.total_temperature
DuctAPE.total_pressure
DuctAPE.static_temperature
DuctAPE.static_pressure
DuctAPE.static_density
DuctAPE.convert_temperature_to_kelvin
DuctAPE.convert_viscosity
```

### General Boundary Layer Functions

```@docs
DuctAPE.arc_lengths_from_panel_lengths
DuctAPE.split_at_stagnation_point
DuctAPE.bl_step_fun
DuctAPE.set_boundary_layer_steps
DuctAPE.RK2
DuctAPE.RK4
```

### Head's Method Specific Functions

```@docs
DuctAPE.setup_boundary_layer_functions_head
DuctAPE.calculate_H
DuctAPE.calculate_cf
DuctAPE.boundary_layer_residual_head
DuctAPE.boundary_layer_residual_head!
DuctAPE.solve_head_boundary_layer!
```

### Viscous Drag

```@docs
DuctAPE.squire_young
DuctAPE.total_viscous_drag_duct
DuctAPE.compute_viscous_drag_duct
DuctAPE.compute_single_side_drag_coefficient_head
DuctAPE.compute_viscous_drag_duct_schlichting
```
1 change: 0 additions & 1 deletion docs/src/DuctAPE/api/private_preprocess.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

```@contents
Pages = ["private_preprocess.md"]
Depth = 5
Expand Down
8 changes: 8 additions & 0 deletions docs/src/DuctAPE/api/public_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ DuctAPE.setup_analysis
DuctAPE.analyze
```

## Postprocess

```@docs
DuctAPE.BoundaryLayerOptions
DuctAPE.HeadsBoundaryLayerOptions
DuctAPE.GreensBoundaryLayerOptions
```

## Miscellaneous

### Airfoil/Geometry Manipulation
Expand Down
3 changes: 3 additions & 0 deletions docs/src/DuctAPE/api/visualiztion_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```@docs
DuctAPE.generate_plots
```
Empty file modified docs/src/DuctAPE/theory_latex/build.sh
100755 → 100644
Empty file.
Empty file modified docs/src/DuctAPE/theory_latex/clean.sh
100755 → 100644
Empty file.
8 changes: 3 additions & 5 deletions docs/src/DuctAPE/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ DuctAPE.OperatingPoint

```@example tutorial
# Freestream
Vinf = 0.0 # hover condition
Vinf = 30.0
rhoinf = 1.226
asound = 340.0
muinf = 1.78e-5
Expand All @@ -356,7 +356,7 @@ RPM = 8000.0
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 = DuctAPE.OperatingPoint(Vinf, rhoinf, muinf, asound, Omega)
operating_point = DuctAPE.OperatingPoint(Vinf, Omega, rhoinf, muinf, asound)
nothing # hide
```

Expand Down Expand Up @@ -434,7 +434,7 @@ Running a multi-point analysis on the example geometry given there, it might loo

```@example tutorial
# - Advance Ratio Range - #
Js = range(0.0, 2.0; step=0.01)
Js = range(0.1, 2.0; step=0.01)

# - Calculate Vinfs - #
D = 2.0 * rotor.Rtip[1] # rotor diameter
Expand Down Expand Up @@ -514,8 +514,6 @@ nothing #hide
And then we can plot the data to compare DFDC and DuctAPE.

```@example tutorial
using Plots

# set up efficiency plot
pe = plot(; xlabel="Advance Ratio", ylabel="Efficiency")

Expand Down
84 changes: 84 additions & 0 deletions docs/src/DuctAPE/visualization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Visualization

There are several convenience plotting methods implemented in DuctAPE based on [RecipesBase](https://juliaplots.org/RecipesBase.jl/stable/).
In addition a general function for plotting the suite of available plots or animations is provided in the `generate_plots` function.

```@docs; canonical=false
DuctAPE.generate_plots
```

```@setup visualize
using DuctAPE
include("../assets/plots_default.jl")
gr()
```

The following generates animations across the given advance ratios.

!!! warning "Plotting Streamlines"
Currently, plotting streamlines, especially animations, takes an exceptionally long time.

```@julia
using Plots

# - Advance Ratio Range - #
advance_ratios = range(0.1, 2.0; step=0.01)

# - Calculate Vinfs - #
D = 2.0 * rotor.Rtip[1] # rotor diameter
n = RPM / 60.0 # rotation rate in revolutions per second
Vinfs = advance_ratios * n * D

# - Set Operating Points - #
operating_points = [deepcopy(operating_point) for i in 1:length(Vinfs)]
for (iv, v) in enumerate(Vinfs)
operating_points[iv].Vinf[] = v
end

# - Run Multi-point Analysis - #
outs, ins, success_flags = DuctAPE.analyze(
ducted_rotor,
operating_points,
reference_parameters,
DuctAPE.set_options(
operating_points;
boundary_layer_options=DuctAPE.HeadsBoundaryLayerOptions(;
model_drag=true, n_steps=1000, separation_criteria=3.0
),
);
return_inputs=true,
)

DuctAPE.generate_plots(
DuctAPE.animatedPlots(),
Plots, # Pass in the Plots namespace
ins,
outs;
plot_pressure=true,
plot_velocity=true,
plot_boundary_layer=true,
plot_streamlines=true,
save_path="../assets/",
static_file_type=".png",
(;
custom_defaults...,
# size=(600,400), # causes misalignment issues
cp_ylim=(-3, 3), # keyword argument to set ylim for cp plots
vtan_ylim=(0, 3), # keyword argument to set ylim for vtan plots
bl_ylim=(0.1, 0.25), # keyword argument to set ylim for boundary layer plots
)...,
)
nothing # hide
```

!!! note "Custom Defaults"
Additional arguments splatted into `generate_plots` are passed into `Plots.plot` directly as keyword arguments. In this case, `custom_defaults` happens to be the defaults associated with the plot formatting used in these docs. Any arguments passed in this way will override any options set in the plots recipes for all the plots. In the plots shown here, we have overridden the color palatte, but nothing else.

!!! warning "Custom Sizes"
For some reason, specifying figure size causes misalignment with pressure and velocity distributions and the underlayed geometry.

![](../assets/geometry.png)
![](../assets/surface_pressure.gif)
![](../assets/surface_velocity.gif)
![](../assets/boundary_layer.gif)
![](../assets/streamlines.gif)
Binary file added docs/src/assets/boundary_layer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/src/assets/define_propulsor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RPM = 8000.0
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)
operating_point = dt.OperatingPoint(Vinf, Omega, rhoinf, muinf, asound)

nduct_inlet = 50
ncenterbody_inlet = 30
Expand Down
Empty file modified docs/src/assets/gen_trim_logo.sh
100755 → 100644
Empty file.
Binary file added docs/src/assets/geometry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading