-
Notifications
You must be signed in to change notification settings - Fork 29
/
lecture3_ex2.jl
44 lines (34 loc) · 1.62 KB
/
lecture3_ex2.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
md"""
## Exercise 2 — **Operator splitting for advection-diffusion**
"""
#md # 👉 See [Logistics](/logistics/#submission) for submission details.
md"""
The goal of this exercise is to implement the advection-diffusion with implicit timestepping for diffusion. Start from the time-dependent code you developed in Exercise 1. Then add advection step after the iteration loop so that the concentration is advected only once per physical time step.
"""
md"""
### Getting started
1. Duplicate the file `implicit_diffusion_1D.jl` in the folder `lecture3` and name it `implicit_advection_diffusion_1D.jl`.
4. Modify that script so that it includes the advection step as follows.
"""
md"""
### Task 1
Add advection to the implicit diffusion code, using an advection velocity of
```julia
vx = 1.0
```
and use the stability criteria for advection to specify the physical timestep:
```julia
dt = dx/abs(vx)
```
Note that now one doesn't need to take the minimum between the time steps for diffusion and advection, since the diffusion that is more restrictive is resolved implicitly. Also, we do not consider any change in velocity direction at mid-simulation.
Now the physical timestep `dt` is defined by advection velocity, so the `da` number that is needed for calculating the optimal PT parameters, has to be computed from `dt`:
```julia
# derived numerics
dt = dx/abs(vx)
da = lx^2/dc/dt
re = ...
ρ = ...
dτ = ...
```
Report with the figure, plotting a spatial distribution of concentration `C` after `nt=10` time steps, on top of the plot of the initial concentration distribution. Add the figure to the `README.md` file.
"""