1 |
% |
2 |
% THIS IS NOT A FUNCTION |
3 |
% |
4 |
% Here is the main program to compute the potential vorticity Q |
5 |
% from the flow (UVEL,VVEL), potential temperature (THETA) and |
6 |
% salinity (SALTanom); given snapshot fields. |
7 |
% 3 steps to do it: |
8 |
% 1- compute the potential density SIGMATHETA (also called ST) |
9 |
% from THETA and SALTanom: |
10 |
% ST = SIGMA(S,THETA,p=0) |
11 |
% 2- compute the 3D relative vorticity field OMEGA (called O) |
12 |
% without vertical velocity terms: |
13 |
% O = ( -dVdz ; dUdz ; dVdx - dUdy ) |
14 |
% 3- compute the potential vorticity Q: |
15 |
% Q = Ox.dSTdx + Oy.dSTdy + (f+Oz).dSTdz |
16 |
% (note that we only add the planetary vorticity at this last |
17 |
% step) |
18 |
% |
19 |
% Input files are supposed to be in a subdirectory called: |
20 |
% ./netcdf-files/<snapshot>/ |
21 |
% |
22 |
% File names id are stored in global variables: |
23 |
% netcdf_UVEL, netcdf_VVEL, netcdf_THETA, netcdf_SALTanom |
24 |
% with the format: |
25 |
% netcdf_<ID>.<netcdf_domain>.<netcdf_suff> |
26 |
% where netcdf_domain and netcdf_suff are also in global |
27 |
% THE DOT IS ADDED IN SUB-PROG, SO AVOID IT IN DEFINITIONS |
28 |
% |
29 |
% Note that Q is not defined with the ratio by SIGMA |
30 |
% |
31 |
% A simple potential vorticity (splQ) computing is also available. |
32 |
% It is defined as: splQ = f. dSIGMATHETA/dz |
33 |
% |
34 |
% 06/07/2006 |
35 |
% gmaze@mit.edu |
36 |
% |
37 |
clear |
38 |
|
39 |
disp('') |
40 |
disp('This program will compute the potential vorticity from horizontal flow,') |
41 |
disp('potential temperature and salinity fields') |
42 |
disp('(For a 50*800*700 grid this takes around 30 minutes to compute PV ...)') |
43 |
disp('') |
44 |
|
45 |
|
46 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SETUP: |
47 |
|
48 |
% Files are looked for in subdirectory defined by: ./netcdf-files/<snapshot>/ |
49 |
% So let's define the snapshot: |
50 |
snapshot = '200103'; |
51 |
|
52 |
|
53 |
% File's name: |
54 |
global netcdf_UVEL netcdf_VVEL netcdf_THETA netcdf_SALTanom |
55 |
global netcdf_suff netcdf_domain |
56 |
netcdf_UVEL = 'UVEL'; |
57 |
netcdf_VVEL = 'VVEL'; |
58 |
netcdf_THETA = 'THETA'; |
59 |
netcdf_SALTanom = 'SALTanom'; |
60 |
netcdf_suff = 'nc'; |
61 |
netcdf_domain = 'north_atlantic'; |
62 |
|
63 |
% FLAGS: |
64 |
|
65 |
% Turn 0/1 the following flag to determine which PV to compute: |
66 |
wantsplPV = 0; % (turn 1 for simple PV computing) |
67 |
|
68 |
% Turn 0/1 this flag to get online computing informations: |
69 |
global toshow |
70 |
toshow = 0; |
71 |
|
72 |
|
73 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMPUTING PV: |
74 |
% STEP 1: |
75 |
% Output netcdf file is: |
76 |
% ./netcdf-files/<snapshot>/SIGMATHETA.<netcdf_domain>.<netcdf_suff> |
77 |
A_compute_potential_density(snapshot) |
78 |
|
79 |
|
80 |
% STEP 2: |
81 |
% Output netcdf files are: |
82 |
% ./netcdf-files/<snapshot>/OMEGAX.<netcdf_domain>.<netcdf_suff> |
83 |
% ./netcdf-files/<snapshot>/OMEGAY.<netcdf_domain>.<netcdf_suff> |
84 |
% ./netcdf-files/<snapshot>/ZETA.<netcdf_domain>.<netcdf_suff> |
85 |
% No interest for the a splPV computing |
86 |
if ~wantsplPV |
87 |
B_compute_relative_vorticity(snapshot) |
88 |
end %if |
89 |
|
90 |
% STEP 3: |
91 |
% Output netcdf file is: |
92 |
% ./netcdf-files/<snapshot>/PV.<netcdf_domain>.<netcdf_suff> |
93 |
C_compute_potential_vorticity(snapshot,wantsplPV) |
94 |
|
95 |
|
96 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% THAT'S IT ! |