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
36 changes: 26 additions & 10 deletions docs/src/manual/lavd.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ using Plots
using Statistics
````

# Viscous Flow of Pitching Flat Plate
## Problem Specification
## Viscous Flow of Pitching Flat Plate
### Problem Specification
For faster compututation and testing purposes, the Reynolds number is set to 100 as opposed to 1000 in Huang's paper. The grid Re is also set to 4.0. If better resolution is desired, try grid Re = 3.0. The domain of interest is from x = -0.5 to x = 5.5, but it is set from x = -3.0 to x = 5.5 since the velocity and vorticity fields ahead of the flat plate are required to compute LAVD.

````@example lavd
Expand All @@ -33,7 +33,7 @@ g = setup_grid(xlim,ylim,my_params)
Δs = surface_point_spacing(g,my_params)
````

## Set up Body
### Set up Body
Create a rectangle of length 1.0 and thickness 0.023.

````@example lavd
Expand All @@ -42,7 +42,7 @@ body = Rectangle(Lp/2,0.023/2,Δs)
bl = BodyList([body])
````

## Set the Body Motion
### Set the Body Motion
Create a smooth position ramp of 45 degreess of the flat plate's angle of attack about its leading edge.

````@example lavd
Expand Down Expand Up @@ -96,7 +96,7 @@ end
@animate_motion bl m 0.01 4 (-0.5, 5.5) ylim
````

## Define the Boundary Condition Functions
### Define the Boundary Condition Functions

````@example lavd
function my_vsplus(t,x,base_cache,phys_params,motions)
Expand All @@ -114,7 +114,7 @@ end
bcdict = Dict("exterior" => my_vsplus, "interior" => my_vsminus)
````

## Construct the system structure
### Construct the system structure

````@example lavd
sys = viscousflow_system(g,bl,phys_params=my_params,motions=m,bc=bcdict);
Expand Down Expand Up @@ -152,9 +152,9 @@ end
plt
````

# Compute LAVD
## Compute LAVD

## Generate a Sequence of Velocity and Vorticity Fields
### Generate a Sequence of Velocity and Vorticity Fields
This step obtains the computed velocity and vorticity fields at a sequence of times, and stores them as a sequence of interpolatable
fields. This will greatly speed up how we compute the flow properties (i.e. vorticity) along trajectories.

Expand All @@ -171,7 +171,7 @@ vortseq = ScalarFieldSequence(tr,vortxy);
nothing #hide
````

## Generate Initial Conditions
### Generate Initial Conditions
Here, we generate a grid of initial locations from which to integrate trajectories.

````@example lavd
Expand All @@ -181,11 +181,13 @@ Y_MIN = -2.0
Y_MAX = 1.0
dx = 0.04
lavdgrid = PhysicalGrid((X_MIN,X_MAX),(Y_MIN,Y_MAX),dx)
ftlegrid = PhysicalGrid((X_MIN,X_MAX),(Y_MIN,Y_MAX),dx)
lavd_cache = SurfaceScalarCache(lavdgrid)
ftle_cache = SurfaceScalarCache(ftlegrid)
x0, y0 = x_grid(lavd_cache), y_grid(lavd_cache)
````

## Solve the IVP and Generate LAVD Fields
### Solve the IVP and Generate LAVD Fields

Compute trajectories

Expand Down Expand Up @@ -226,6 +228,20 @@ plot!(surfaces(sol,sys,t0))
#savefig("vorticity")
````

Compute and plot the backward FTLE field

````@example lavd
T = 8.5
t0 = 8.5
xb, yb = displacement_field(velseq,x0,y0,(t0,t0-T),alg=Euler())
fFTLE = similar(x0)
compute_FTLE!(fFTLE,xb,yb,dx,dx,T);

plot(fFTLE,ftle_cache, colorbar = true, levels = 100)
plot!(surfaces(sol,sys,t0))
#savefig("ftle")
````

---

*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
Expand Down
160 changes: 80 additions & 80 deletions examples/dmdtest.ipynb

Large diffs are not rendered by default.

10,550 changes: 5,275 additions & 5,275 deletions examples/ftle.ipynb

Large diffs are not rendered by default.

9,584 changes: 4,792 additions & 4,792 deletions examples/ftle_continuous.ipynb

Large diffs are not rendered by default.

16,480 changes: 11,638 additions & 4,842 deletions examples/lavd.ipynb

Large diffs are not rendered by default.

1,800 changes: 900 additions & 900 deletions examples/pod.ipynb

Large diffs are not rendered by default.

36 changes: 26 additions & 10 deletions test/literate/lavd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ using Plots
using Statistics

#=
# Viscous Flow of Pitching Flat Plate
## Problem Specification
## Viscous Flow of Pitching Flat Plate
### Problem Specification
For faster compututation and testing purposes, the Reynolds number is set to 100 as opposed to 1000 in Huang's paper. The grid Re is also set to 4.0. If better resolution is desired, try grid Re = 3.0. The domain of interest is from x = -0.5 to x = 5.5, but it is set from x = -3.0 to x = 5.5 since the velocity and vorticity fields ahead of the flat plate are required to compute LAVD.
=#

Expand All @@ -30,7 +30,7 @@ g = setup_grid(xlim,ylim,my_params)
Δs = surface_point_spacing(g,my_params)

#=
## Set up Body
### Set up Body
Create a rectangle of length 1.0 and thickness 0.023.
=#

Expand All @@ -39,7 +39,7 @@ body = Rectangle(Lp/2,0.023/2,Δs)
bl = BodyList([body])

#=
## Set the Body Motion
### Set the Body Motion
Create a smooth position ramp of 45 degreess of the flat plate's angle of attack about its leading edge.
=#

Expand Down Expand Up @@ -93,7 +93,7 @@ end
@animate_motion bl m 0.01 4 (-0.5, 5.5) ylim

#=
## Define the Boundary Condition Functions
### Define the Boundary Condition Functions
=#

function my_vsplus(t,x,base_cache,phys_params,motions)
Expand All @@ -111,7 +111,7 @@ end
bcdict = Dict("exterior" => my_vsplus, "interior" => my_vsminus)

#=
## Construct the system structure
### Construct the system structure
=#

sys = viscousflow_system(g,bl,phys_params=my_params,motions=m,bc=bcdict);
Expand Down Expand Up @@ -149,11 +149,11 @@ end
plt

#=
# Compute LAVD
## Compute LAVD
=#

#=
## Generate a Sequence of Velocity and Vorticity Fields
### Generate a Sequence of Velocity and Vorticity Fields
This step obtains the computed velocity and vorticity fields at a sequence of times, and stores them as a sequence of interpolatable
fields. This will greatly speed up how we compute the flow properties (i.e. vorticity) along trajectories.
=#
Expand All @@ -169,7 +169,7 @@ vortxy = vorticity_xy(sol,sys,tr)
vortseq = ScalarFieldSequence(tr,vortxy);

#=
## Generate Initial Conditions
### Generate Initial Conditions
Here, we generate a grid of initial locations from which to integrate trajectories.
=#

Expand All @@ -179,11 +179,13 @@ Y_MIN = -2.0
Y_MAX = 1.0
dx = 0.04
lavdgrid = PhysicalGrid((X_MIN,X_MAX),(Y_MIN,Y_MAX),dx)
ftlegrid = PhysicalGrid((X_MIN,X_MAX),(Y_MIN,Y_MAX),dx)
lavd_cache = SurfaceScalarCache(lavdgrid)
ftle_cache = SurfaceScalarCache(ftlegrid)
x0, y0 = x_grid(lavd_cache), y_grid(lavd_cache)

#=
## Solve the IVP and Generate LAVD Fields
### Solve the IVP and Generate LAVD Fields
=#

#=
Expand Down Expand Up @@ -223,3 +225,17 @@ Plot the vorticity fields
plot(vorticity(sol, sys, t0), sys, layers = false,clim = (-5,5),levels = range(-5,5,length=30), colorbar = true, xlim = (-0.5, 5.5))
plot!(surfaces(sol,sys,t0))
#savefig("vorticity")

#=
Compute and plot the backward FTLE field
=#

T = 8.5
t0 = 8.5
xb, yb = displacement_field(velseq,x0,y0,(t0,t0-T),alg=Euler())
fFTLE = similar(x0)
compute_FTLE!(fFTLE,xb,yb,dx,dx,T);

plot(fFTLE,ftle_cache, colorbar = true, levels = 100)
plot!(surfaces(sol,sys,t0))
#savefig("ftle")
Loading