Skip to content

Commit

Permalink
Merge pull request #51 from byuflowlab/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
EdoAlvarezR authored Apr 7, 2023
2 parents ae5beba + b846935 commit a14efd3
Show file tree
Hide file tree
Showing 82 changed files with 734 additions and 11,537 deletions.
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,32 +163,32 @@ See the following publications for an in-depth dive into the theory and validati

### Examples

**Propeller:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/propeller-J040)] [Validation]
**Propeller:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/propeller-J040)] [[Validation](https://flow.byu.edu/FLOWUnsteady/theory/validation/#Propeller)]

<p align="center"> <a href="https://www.youtube.com/watch?v=lUIytQybCpQ&hd=1"> <img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/youtube-prop.png" alt="youtube.com/watch?v=lUIytQybCpQ" style="width:70%"> </a> </p>


**Rotor in Hover:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/rotorhover-aero)] [Validation]
**Rotor in Hover:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/rotorhover-aero)] [[Validation](https://flow.byu.edu/FLOWUnsteady/theory/validation/#Rotor)]

<p align="center"> <a href="https://www.youtube.com/watch?v=u9SgYbYhPpU&hd=1"> <img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/youtube-hover.png" alt="youtube.com/watch?v=u9SgYbYhPpU" style="width:70%"> </a> </p>


**Blown Wing:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/blownwing-aero)] [Validation]
**Blown Wing:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/blownwing-aero)] [[Validation](https://flow.byu.edu/FLOWUnsteady/theory/validation/#Rotor-Wing-Interactions)]

<p align="center">
<img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/prowimhtp-wvol34-cropped00.jpg" alt="img" style="width:100%">
</p>

<p><br></p>

**Airborne-Wind-Energy Aircraft:** [Validation] [[Video](https://www.youtube.com/watch?v=iFM3B4_N2Ls)]
**Airborne-Wind-Energy Aircraft:** [[Video](https://www.youtube.com/watch?v=iFM3B4_N2Ls)]

<p align="left">
<img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/circular-fdom-top02.jpg" alt="img" style="width:75%">
</p>


**eVTOL Transition:** [Tutorial] [[Video 1](https://www.youtube.com/watch?v=-6aR37Z6hig)] [[Video 2](https://www.youtube.com/watch?v=d__wNtRIBY8)]
**eVTOL Transition:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/vahana-vehicle/)]

Mid-fidelity
<p align="center"> <a href="https://www.youtube.com/watch?v=d__wNtRIBY8&hd=1"> <img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/youtube-vahanamid.png" alt="youtube.com/watch?v=d__wNtRIBY8" style="width:70%"> </a> </p>
Expand All @@ -197,7 +197,7 @@ High-fidelity
<p align="center"> <a href="https://www.youtube.com/watch?v=-6aR37Z6hig&hd=1"> <img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/youtube-vahanahi.png" alt="youtube.com/watch?v=-6aR37Z6hig" style="width:70%"> </a> </p>


**Aeroacoustic Noise:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/rotorhover-acoustics)] [Validation]
**Aeroacoustic Noise:** [[Tutorial](https://flow.byu.edu/FLOWUnsteady/examples/rotorhover-acoustics)] [[Validation](https://flow.byu.edu/FLOWUnsteady/theory/validation/#Rotor)]

<p align="center">
<img src="http://edoalvar2.groups.et.byu.net/public/FLOWUnsteady/cfdnoise_ningdji_multi_005D_03_20.gif" alt="Vid" style="width:60%"/>
Expand Down Expand Up @@ -237,16 +237,3 @@ If the issue still persists, please
* Main developer : Eduardo J. Alvarez ([edoalvarez.com](https://www.edoalvarez.com/))
* Created : Sep 2017
* License : MIT License

**TODO**
* [ ] README
* [ ] Add links to examples in README
* [ ] Theory
* [ ] Add a validations section compiling all validation studies
* [ ] List of publications
* [ ] Test installation instructions on MacOS and native Windows
* [ ] Examples
* [ ] Vahana
* [ ] Bring fidelity down, list parameters for high fidelity
* [ ] Post processing: fluid domain?
* [ ] Add analytics
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include("src/generate_examples.jl")

makedocs(
sitename = "FLOWUnsteady",
format = Documenter.HTML(;
format = Documenter.HTML(; analytics = "G-B7CBF7WC7L",
sidebar_sitename = false,
assets = ["assets/favicon.ico"],
collapselevel = 1
Expand Down
6 changes: 3 additions & 3 deletions docs/src/api/flowunsteady-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ FLOWUnsteady.generate_aerodynamicforce_parasiticdrag
FLOWUnsteady.calc_aerodynamicforce_unsteady
```

## Wake Treatment
## [Wake Treatment](@id waketreatmentapi)
Since the full set of state variables is passed to `extra_runtime_function`,
this function can also be used to alter the simulation on the fly.
In some circumstances it is desirable to be able to remove or modify particles,
Expand All @@ -84,13 +84,13 @@ monitor_states = uns.generate_monitor_statevariables()
monitor_enstrophy = uns.generate_monitor_enstrophy()

# Monitor pipeline
monitors(args...; optargs...) = monitor_states(args...; optargs...) || monitor_enstrophy(args...; optargs...)
monitors = uns.concatenate(monitor_states, monitor_enstrophy)

# Define wake treatment
wake_treatment = uns.remove_particles_sphere(1.0, 1; Xoff=zeros(3))

# Extra runtime function pipeline
extra_runtime_function(args...; optargs...) = monitors(args...; optargs...) || wake_treatment(args...; optargs...)
extra_runtime_function = uns.concatenate(monitors, wake_treatment)

```
Then pass this pipeline to the simulation as
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/blownwing-asm.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Actuator Surface Model
# [Actuator Surface Model](@id asm)

The aerodynamic solution computed in [the first section](@ref blownwingaero)
was intended to be a mid-low fidelity simulation, which modeled the wing
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/rotorhover-aero.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ particles (right).
high-fidelity simulation.


In [examples/rotorhover/rotorhover_postprocess.jl](https://github.com/byuflowlab/FLOWUnsteady/blob/master/examples/rotorhover/rotorhover_postprocess.jl)
In [examples/rotorhover/rotorhover_postprocessing.jl](https://github.com/byuflowlab/FLOWUnsteady/blob/master/examples/rotorhover/rotorhover_postprocessing.jl)
we show how to postprocess the simulations to compare ``C_T`` and blade
loading to experimental data by Zawodny *et al*.[^1] and a URANS simulation
(STAR-CCM+) by Schenk[^2]:
Expand Down
3 changes: 2 additions & 1 deletion docs/src/examples/vahana-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ function generate_monitor_vahana(vehicle, rho, RPMref, nsteps, save_path, Vinf;
nsteps;
save_path=save_path,
run_name=monitor_name,
figname=monitor_name)
figname=monitor_name,
save_init_plots=false)
push!(monitors, rotors_monitor)
end

Expand Down
114 changes: 83 additions & 31 deletions docs/src/examples/vahana-run.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# [Run Simulation](@id vahanarun)

A mid fidelity resolution makes the computational cost
tractable and possible to be run the full maneuver (30 seconds of real time)
overnight on a laptop computer.
This is a video of the full maneuver in mid fidelity:

```@raw html
<div style="position:relative;padding-top:50%;">
<iframe style="position:absolute;left:0;top:0;height:80%;width:72%;"
Expand All @@ -10,6 +15,51 @@
</div>
```

With a finer temporal and spatial resolution, it becomes impractical to resolve
the entire maneuver, and instead we recommend simulating one fragment of
the maneuver at a time.
For instance, here is a high-fidelity simulation of the transition from
hover to cruise:

```@raw html
<div style="position:relative;padding-top:50%;">
<iframe style="position:absolute;left:0;top:0;height:80%;width:72%;"
src="https://www.youtube.com/embed/-6aR37Z6hig?hd=1"
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</div>
```

As a reference, here are the parameters that we have used for the mid and high
fidelity simulations:


| Parameter | Mid fidelity | High fidelity | Description |
| :-------: | :----------: | :-----------: | :---------- |
| `n_factor`| `1` | `4` | Factor that controls the level of discretization of wings and blade surfaces |
| `nsteps` | `4*5400` | `8*5400` | Time steps for the entire maneuver |
| `t_start` | `0` | `0.20*ttot` | (s) start simulation at this point in time |
| `t_quit` | `ttot` | `0.30*ttot` | (s) end imulation at this point in time |
| `lambda_vpm` | `2.125` | `1.5*2.125` | VPM core overlap |
| `vlm_vortexsheet` | `false` | `true` | Whether to spread the wing surface vorticity as a vortex sheet |
| `vpm_integration` | `vpm.euler` | `vpm.rungekutta3` | VPM time integration scheme |


```@raw html
<br>
```

Along the way, in this simulation we exemplify the following advanced features:
* Defining a variable pitch for rotors between hover and cruise
* Using the [actuator surface model](@ref asm) for wing surfaces
* Defining a [wake treatment](@ref waketreatmentapi) that speeds up the
simulation by removing particles that can be neglected

```@raw html
<br>
```


```julia
#=##############################################################################
Expand All @@ -26,30 +76,33 @@
* License : MIT
=###############################################################################



import FLOWUnsteady as uns
import FLOWUnsteady: vlm, vpm, gt, Im

include(joinpath(uns.examples_path, "vahana_vehicle.jl"))
include(joinpath(uns.examples_path, "vahana_maneuver.jl"))
include(joinpath(uns.examples_path, "vahana_monitor.jl"))
include(joinpath(uns.examples_path, "vahana", "vahana_vehicle.jl"))
include(joinpath(uns.examples_path, "vahana", "vahana_maneuver.jl"))
include(joinpath(uns.examples_path, "vahana", "vahana_monitor.jl"))

run_name = "vahana-example" # Name of this simulation
save_path = run_name # Where to save this simulation
run_name = "vahana" # Name of this simulation
save_path = "vahana-example" # Where to save this simulation
paraview = true # Whether to visualize with Paraview

# ----------------- GEOMETRY PARAMETERS ----------------------------------------
n_factor = 4 # Discretization factor
n_factor = 1 # Discretization factor
add_wings = true # Whether to include wings
add_rotors = true # Whether to include rotors

# Reference lengths
R = 0.75 # (m) reference blade radius
b = 5.86 # (m) reference wing span
chord = b/7.4 # (m) reference wing chord
thickness = 0.04*chord # (m) reference wing thickness

# ----------------- SIMULATION PARAMETERS --------------------------------------
# Maneuver settings
Vcruise = 30.0 # (m/s) cruise speed (reference)
Vcruise = 15.0 # (m/s) cruise speed (reference)
RPMh_w = 600.0 # RPM of main-wing rotors in hover (reference)
ttot = 30.0 # (s) total time to perform maneuver

Expand All @@ -62,10 +115,10 @@ mu = 1.81e-5 # (kg/ms) air dynamic viscosity

# NOTE: Use these parameters to start and end the simulation at any arbitrary
# point along the eVTOL maneuver (tstart=0 and tquit=ttot will simulate
# the entire maneuver, tstart=0.25*ttot will start it in the middle of
# the entire maneuver, tstart=0.20*ttot will start it at the beginning of
# the hover->cruise transition)
tstart = 0.25*ttot # (s) start the simulation at this point in time
tquit = 0.35*ttot # (s) end the simulation at this point in time
tstart = 0.00*ttot # (s) start simulation at this point in time
tquit = 1.00*ttot # (s) end simulation at this point in time

start_kinmaneuver = true # If true, it starts the maneuver with the
# velocity and angles of tstart.
Expand All @@ -78,7 +131,7 @@ VehicleType = uns.UVLMVehicle # Unsteady solver
# VehicleType = uns.QVLMVehicle # Quasi-steady solver

# Time parameters
nsteps = 2*4*5400 # Time steps for entire maneuver
nsteps = 4*5400 # Time steps for entire maneuver
dt = ttot/nsteps # (s) time step

# VPM particle shedding
Expand All @@ -91,26 +144,26 @@ unsteady_shedcrit = 0.001 # Shed unsteady loading whenever cir
# Regularization of embedded vorticity
sigma_vlm_surf = b/400 # VLM-on-VPM smoothing radius
sigma_rotor_surf= R/20 # Rotor-on-VPM smoothing radius
lambda_vpm = 1.2*2.125 # VPM core overlap
lambda_vpm = 2.125 # VPM core overlap
# VPM smoothing radius
sigma_vpm_overwrite = lambda_vpm * (2*pi*RPMh_w/60*R + Vcruise)*dt / p_per_step
sigmafactor_vpmonvlm= 1 # Shrink particles by this factor when
sigma_vpm_overwrite = lambda_vpm * (2*pi*RPMh_w/60*R + Vcruise)*dt / p_per_step
sigmafactor_vpmonvlm = 1 # Shrink particles by this factor when
# calculating VPM-on-VLM/Rotor induced velocities

vlm_vortexsheet = true # Whether to spread the wing circulation as a vortex sheet
vlm_vortexsheet_overlap = 2.125 # Overlap of the particles that make the vortex sheet
vlm_vortexsheet_distribution = uns.g_pressure # Distribution of the vortex sheet
# Rotor solver
vlm_rlx = 0.2 # VLM relaxation <-- this also applied to rotors
hubtiploss_correction = vlm.hubtiploss_correction_prandtl # Hub and tip correction

# Wing solver: actuator surface model (ASM)
vlm_vortexsheet = false # Whether to spread the wing surface vorticity as a vortex sheet (activates ASM)
vlm_vortexsheet_overlap = 2.125 # Overlap of the particles that make the vortex sheet
vlm_vortexsheet_distribution= uns.g_pressure# Distribution of the vortex sheet
# vlm_vortexsheet_sigma_tbv = thickness*chord / 100 # Size of particles in trailing bound vortices
vlm_vortexsheet_sigma_tbv = sigma_vpm_overwrite
vlm_vortexsheet_sigma_tbv = sigma_vpm_overwrite
# How many particles to preallocate for the vortex sheet
vlm_vortexsheet_maxstaticparticle = vlm_vortexsheet==false ? nothing : 6000000

# Rotor solver
vlm_rlx = 0.2 # VLM relaxation <-- this also applied to rotors
hubtiploss_correction = vlm.hubtiploss_correction_prandtl # Hub and tip correction


# Wing solver
# Wing solver: force calculation
KJforce_type = "regular" # KJ force evaluated at middle of bound vortices_vortexsheet also true)
include_trailingboundvortex = false # Include trailing bound vortices in force calculations

Expand All @@ -124,14 +177,14 @@ wing_polar_file = "xf-n0012-il-500000-n5.csv" # Airfoil polar for


# VPM solver
vpm_integration = vpm.rungekutta3 # VPM temporal integration scheme
# vpm_integration = vpm.euler
# vpm_integration = vpm.rungekutta3 # VPM temporal integration scheme
vpm_integration = vpm.euler

vpm_viscous = vpm.Inviscid() # VPM viscous diffusion scheme
# vpm_viscous = vpm.CoreSpreading(-1, -1, vpm.zeta_fmm; beta=100.0, itmax=20, tol=1e-1)

# vpm_SFS = vpm.SFS_none # VPM LES subfilter-scale model
vpm_SFS = vpm.DynamicSFS(vpm.Estr_fmm, vpm.pseudo3level_positive;
# vpm_SFS = vpm.SFS_none # VPM LES subfilter-scale model
vpm_SFS = vpm.DynamicSFS(vpm.Estr_fmm, vpm.pseudo3level_positive;
alpha=0.999, maxC=1.0,
clippings=[vpm.clipping_backscatter],
controls=[vpm.control_directional, vpm.control_magnitude])
Expand Down Expand Up @@ -180,9 +233,9 @@ simulation = uns.Simulation(vehicle, maneuver, Vref, RPMref, ttot;
Vinit=Vinit, Winit=Winit, t=tstart);

# Maximum number of particles (for pre-allocating memory)
max_particles = ceil(Int, (nsteps+2)*(2*vlm.get_m(vehicle.vlm_system)+1)*p_per_step)
max_particles = ceil(Int, (nsteps+2)*(2*vlm.get_m(vehicle.wake_system)*(p_per_step+1) + p_per_step) )
max_particles = tquit != Inf ? ceil(Int, max_particles*(tquit-tstart)/ttot) : max_particles
max_particles = min(30000000, max_particles)
max_particles = min(10000000, max_particles)
max_particles = VehicleType==uns.QVLMVehicle ? 10000 : max_particles


Expand Down Expand Up @@ -389,6 +442,5 @@ uns.run_simulation(simulation, nsteps;
save_path=save_path,
run_name=run_name,
save_wopwopin=true, # <--- Generates input files for PSU-WOPWOP noise analysis
save_code=splitdir(@__FILE__)[1]
);
```
6 changes: 3 additions & 3 deletions docs/src/examples/vahana-vehicle.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,15 @@ function generate_vahana_vehicle(;

# System solved through VLM solver
vlm_system_m = vlm.WingSystem()
vlm.addwing(vlm_system_m, "letL", winglet_L)
vlm.addwing(vlm_system_m, "L", wing_L)
vlm.addwing(vlm_system_m, "middle", wing_md)
vlm.addwing(vlm_system_m, "R", wing_R)
vlm.addwing(vlm_system_m, "letR", winglet_R)
vlm.addwing(vlm_system_m, "L", wing_L)
vlm.addwing(vlm_system_m, "letL", winglet_L)

vlm_system_t = vlm.WingSystem()
vlm.addwing(vlm_system_t, "R", twing_R)
vlm.addwing(vlm_system_t, "L", twing_L)
vlm.addwing(vlm_system_t, "R", twing_R)

vlm_system = vlm.WingSystem()
if add_wings
Expand Down
2 changes: 1 addition & 1 deletion docs/src/generate_examples_blownwing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ end
open(joinpath(output_path, output_name*"-asm.md"), "w") do fout

println(fout, """
# Actuator Surface Model
# [Actuator Surface Model](@id asm)
The aerodynamic solution computed in [the first section](@ref blownwingaero)
was intended to be a mid-low fidelity simulation, which modeled the wing
Expand Down
2 changes: 1 addition & 1 deletion docs/src/generate_examples_rotorhover.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ open(joinpath(output_path, output_name*"-aero.md"), "w") do fout
high-fidelity simulation.
In [examples/rotorhover/rotorhover_postprocess.jl](https://github.com/byuflowlab/FLOWUnsteady/blob/master/examples/rotorhover/rotorhover_postprocess.jl)
In [examples/rotorhover/rotorhover_postprocessing.jl](https://github.com/byuflowlab/FLOWUnsteady/blob/master/examples/rotorhover/rotorhover_postprocessing.jl)
we show how to postprocess the simulations to compare ``C_T`` and blade
loading to experimental data by Zawodny *et al*.[^1] and a URANS simulation
(STAR-CCM+) by Schenk[^2]:
Expand Down
Loading

0 comments on commit a14efd3

Please sign in to comment.