Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

GEOL0060, Term 1 (2022)

Exercise #3

1.   Write a MATLAB code from scratch that solves (instantaneously) the coupled momentum-continuity equations for constant viscosity in a square box. Resolution: 26 x 31 (regular grid). The right half of the box should have a different density than the left half of the box. Boundary conditions: no slip at the top and bottom; free slip at the sides. The instantaneous solution requires solving one timestep only (no advection term required).

hint_1 : it will be most straightforward to build three (non-nestled) loops when filling the big matrix (L). One loop for the x-Stokes eq.; one for the y-Stokes eq; and one for the continuity equation. The big matrix should normally be of dimensions 2592x2592 including ghost points. hint_2: Ideally, the code should be setup such that it can also handle an irregular grid.

2.    Extend the MATLAB code from the previous exercise (exercise #2) for variable viscosity.