3
EAS Ocean Modeling | Homework #4 Diffusion & Advection Based on the numerical theory developed in chapter 5 and 6 of the book implement the following examples: 2D Diffusion Algorithm Implement a rectangular domain and solve the following problems: Initial condition problem #1 The diffusion of a circular blob of tracer placed in the middle of the domain. Boundary condition problem #2 The diffusion of a tracer from the boundary. For both of these cases try an implicit and explicit scheme. For the explicitly scheme try different parameter setting to explore the different stability conditions of the scheme as shown in the figure below from the book. Plot the solution as different time frame to show Δz 2 2κΔt Unstable region Time oscillations D = 1 2 D = 1 4 D = 1 6 Better space representation Better time representation Decreasing global error Figure 5-11 Different paths to convergence in the (Δz 2 , Δt) plane for the explicit scheme. For excessive values of Δt, D 1/2, the scheme is unstable. Convergence can only be obtained by remaining within the stability region. When Δt alone is reduced (progressing vertically downward in the graph), the error decreases and then increases again. If Δz alone is decreased (progressing horizontally to the left in the graph), the error similarly decreases first and then increases, until the scheme becomes unstable. Reducing both Δt and Δz simultaneously at fixed D within the stability sector leads to monotonic convergence. The convergence rate is highest along the line D =1/6 because the scheme then happens to be fourth-order accurate.

HW4 - o3d.org

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: HW4 - o3d.org

EAS Ocean Modeling | Homework #4 Diffusion & Advection

Based on the numerical theory developed in chapter 5 and 6 of the book implement the following examples:

2D Diffusion Algorithm

Implement a rectangular domain and solve the following problems:

Initial condition problem #1 The diffusion of a circular blob of tracer placed in the middle of the domain.

Boundary condition problem #2 The diffusion of a tracer from the boundary.

For both of these cases try an implicit and explicit scheme. For the explicitly scheme try different parameter setting to explore the different stability conditions of the scheme as shown in the figure below from the book. Plot the solution as different time frame to show 136 CHAPTER 5. DIFFUSIVE PROCESSES

∆z2

2κ∆t

Unstable region

Time oscillations

!

!

!

D =12

D =14

D =16

Better space representation

Bettertimerepresentation

Decreasing global error

Figure 5-11 Different paths to convergence in the (∆z2, ∆t) plane for the explicit scheme. Forexcessive values of ∆t, D ≥ 1/2, the scheme is unstable. Convergence can only be obtained byremaining within the stability region. When ∆t alone is reduced (progressing vertically downwardin the graph), the error decreases and then increases again. If ∆z alone is decreased (progressinghorizontally to the left in the graph), the error similarly decreases first and then increases, until thescheme becomes unstable. Reducing both ∆t and ∆z simultaneously at fixed D within the stabilitysector leads to monotonic convergence. The convergence rate is highest along the lineD = 1/6 becausethe scheme then happens to be fourth-order accurate.

stability. The implicit scheme therefore allows us in principle to use a time step as large as wewish. We immediately sense, of course, that a large time step cannot be acceptable. Shouldthe time step be too large, the calculated values would not “explode” but would provide a veryinaccurate approximation to the true solution. This is confirmed by comparing the dampingof the numerical scheme against its true value:

τ =ω̃i

ωi

=ln |1 + 4D sin

2(kz∆z/2)|

4D (kz∆z/2)2. (5.43)

For small D, the scheme behaves reasonably well, but for larger D, even for scales ten timeslarger than the grid spacing, the error on the damping rate is similar to the damping rate itself(Figure 5-12).

Setting aside the accuracy restriction, we still have another problem to solve. To calculatethe left hand side of (5.41) at grid node k, we have to know the values of the yet-unknowns

Page 2: HW4 - o3d.org

the evolution of the solution as a function of time. For each of the cases write a small description.

2D Advection Algorithm

Implement a rectangular domain and solve the following problems:

Initial condition problem #1 The advection of a circular blob of tracer placed in the middle of the domain with constant velocity in one direction (e.g. the x axis)

Boundary condition problem #2 The advection of a tracer from the boundary with constant velocity in one direction (e.g. the x axis)

For both of these cases try both a centered advection scheme and the upwind scheme. Plot the solution as different time frame to show the evolution of the solution as a function of time. Comment on the differences you see in the solution.

2D Advection Algorithm in a realistic flow

Download the file UV.nc containing a 2D velocity field in a region of ocean of the Kuroshio. The file contains 10 time records. The time interval between records is 3days.

Example of velocity field

Page 3: HW4 - o3d.org

Use this velocity field in conjunction with your two advection schemes to advect a passive tracer released in the area defined by the orange box for about 30days. Comment on the solution.