|
1 | 1 | classdef QuasiGeostrophicProblem < otp.Problem |
2 | | - |
| 2 | + % A chaotic PDE modeling the flow of a fluid on the earth. |
| 3 | + % |
| 4 | + % The governing partial differential equation that is discretized is, |
| 5 | + % |
| 6 | + % $$ |
| 7 | + % Δψ_t = -J(ψ,ω) - {Ro}^{-1} ψ_x -{Re}^{-1} Δω - {Ro}^{-1} F, \\ |
| 8 | + % $$ |
| 9 | + % where the Jacobian term is a quadratic function, |
| 10 | + % $$ |
| 11 | + % J(ψ,ω) \equiv ψ_x ω_y - ψ_y ω_x, |
| 12 | + % $$ |
| 13 | + % the relationship between the vorticity $ω$ and the stream function $ψ$ is |
| 14 | + % $$ |
| 15 | + % ω = -Δψ, |
| 16 | + % $$ |
| 17 | + % the term $Δ$ is the two dimensional Laplacian over the |
| 18 | + % discretization, $Ro$ is the Rossby number, $Re$ is the Reynolds |
| 19 | + % number, and $F$ is a forcing term. |
| 20 | + % The spatial domain is fixed to $x ∈ [0, 1]$ and $y ∈ [0, 2]$, and |
| 21 | + % the boundary conditions of the PDE are assumed to be zero dirichlet |
| 22 | + % everywhere. |
| 23 | + % |
| 24 | + % A second order finite difference approximation is performed on the |
| 25 | + % grid to create the first derivative operators and the Laplacian |
| 26 | + % operator. The Jacobian is discretized using the Arakawa approximation |
| 27 | + % CITEME |
| 28 | + % $$ |
| 29 | + % J(ψ,ω) = \frac{1}{3}[ψ_x ω_y - ψ_y ω_x + (ψ ω_y)_x - (ψ ω_x)_y + (ψ_x ω)_y - (ψ_y ω)_x], |
| 30 | + % $$ |
| 31 | + % in order for the system to not become unstable. |
| 32 | + % |
| 33 | + % The Poisson equation is solved by the eigenvalue sylvester method for |
| 34 | + % computational efficiency. |
| 35 | + % |
| 36 | + % A ADLES MORE HERE. |
| 37 | + % |
| 38 | + % Notes |
| 39 | + % ----- |
| 40 | + % +---------------------+-----------------------------------------------------------+ |
| 41 | + % | Type | ODE | |
| 42 | + % +---------------------+-----------------------------------------------------------+ |
| 43 | + % | Number of Variables | $nx \times ny$ | |
| 44 | + % +---------------------+-----------------------------------------------------------+ |
| 45 | + % | Stiff | not typically, depending on $Re$, $Ro$, $Nx$, and $Ny$ | |
| 46 | + % +---------------------+-----------------------------------------------------------+ |
| 47 | + % |
| 48 | + % Example |
| 49 | + % ------- |
| 50 | + % >>> problem = otp.quasigeostrophic.presets.PopovMouSanduIliescu; |
| 51 | + % >>> sol = problem.solve(); |
| 52 | + % >>> problem.movie(sol); |
| 53 | + % |
| 54 | + |
3 | 55 | methods |
4 | 56 | function obj = QuasiGeostrophicProblem(timeSpan, y0, parameters) |
5 | 57 |
|
|
19 | 71 |
|
20 | 72 | methods (Static) |
21 | 73 |
|
22 | | - function u = resize(u, newsize) |
23 | | - % resize uses interpolation to resize states |
24 | | - |
25 | | - s = size(u); |
| 74 | + function psi = resize(psi, newsize) |
| 75 | + % Resizes the state onto a new grid by performing interpolation |
| 76 | + % |
| 77 | + % Parameters |
| 78 | + % ---------- |
| 79 | + % psi : numeric(nx, ny) |
| 80 | + % the old state on the $x \times y$ grid. |
| 81 | + % newsize : numeric(1, 2) |
| 82 | + % the new size as a two-tuple $[nx, ny]$ indicating the new state of the system. |
| 83 | + % |
| 84 | + |
| 85 | + s = size(psi); |
26 | 86 |
|
27 | 87 | X = linspace(0, 1, s(1) + 2); |
28 | 88 | Y = linspace(0, 2, s(2) + 2).'; |
|
34 | 94 | Xnew = Xnew(2:end-1); |
35 | 95 | Ynew = Ynew(2:end-1); |
36 | 96 |
|
37 | | - u = interp2(Y, X, u, Ynew, Xnew); |
| 97 | + psi = interp2(Y, X, psi, Ynew, Xnew); |
38 | 98 |
|
39 | 99 | end |
40 | 100 |
|
|
0 commit comments