Matlab examples for modelling
The following matlab files wree used in the lecture on an introduction to modelling. Save the files to a directory on your pc. Open Matlab, and cd to the directory that you saved the file into. Then type the name of the file and <ENTER> to run it. The contents of the m files can be viewed in any text editor. They have all been heavily commented to help you understand what is happening in the program.
This m file is a very simple model integrating the advection equation for the case of tidal advection of salt along a horizontal salinity gradient (i.e. in an estuary).
This m file extends advect1.m to include the advection of salinity at several vertical positions through the water column, with a simple formulation for the depth-variation of a tidal current. It illustrates the basic process of tidal straining in a ROFI (stratification developing during one half of the tidal cycle, then re-forming a mixed profile during the second half).
This m file adds the effect of vertical diffusion (turbulent mixing) during the tidal straining of the salinity profile. Note that the mixing limits the strength of the stratification at the end of the ebb tide compared to the previous case. Note also that this results in the flood tide over-straining the profile beyond the initially mixed state, so that by the end of the tidal cycle we have a convectively unstable salinity profile (higher density towards the surface).
To overcome the problem of the unrealistic, unstable salinity profile at the end of the tidal cycle, this next m file includes a test for convective instability and increases the vertical mixing as a simple way of removing the instabilitiy.
Finally, this m file integrates over several tidal cycles, and produces a final output graph of stratification and tidal current to illustrate a timeseries of tidal straining (stratification during the ebb tide, remixing during the flood tide).
School of Ocean and Earth Science
University of Southampton
Southampton Oceanography Centre
European WaySouthampton SO14 3ZH, United Kingdom
Tel. +44 (0)23 80596490Fax +44 (0)23 80593059 or 593052
Author: Jonathan SharplesLast Updated: February 4th 2003