% % THIS IS NOT A FUNCTION % % Here is the main program to compute the potential vorticity Q % from the flow (UVEL,VVEL), potential temperature (THETA) and % salinity (SALTanom); given snapshot fields. % 3 steps to do it: % 1- compute the potential density SIGMATHETA (also called ST) % from THETA and SALTanom: % ST = SIGMA(S,THETA,p=0) % 2- compute the 3D relative vorticity field OMEGA (called O) % without vertical velocity terms: % O = ( -dVdz ; dUdz ; dVdx - dUdy ) % 3- compute the potential vorticity Q: % Q = Ox.dSTdx + Oy.dSTdy + (f+Oz).dSTdz % (note that we only add the planetary vorticity at this last % step) % % Input files are supposed to be in a subdirectory called: % ./netcdf-files// % % File names id are stored in global variables: % netcdf_UVEL, netcdf_VVEL, netcdf_THETA, netcdf_SALTanom % with the format: % netcdf_.. % where netcdf_domain and netcdf_suff are also in global % THE DOT IS ADDED IN SUB-PROG, SO AVOID IT IN DEFINITIONS % % Note that Q is not defined with the ratio by SIGMA % % A simple potential vorticity (splQ) computing is also available. % It is defined as: splQ = f. dSIGMATHETA/dz % % 06/07/2006 % gmaze@mit.edu % clear disp('') disp('This program will compute the potential vorticity from horizontal flow,') disp('potential temperature and salinity fields') disp('(For a 50*800*700 grid this takes around 30 minutes to compute PV ...)') disp('') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SETUP: % Files are looked for in subdirectory defined by: ./netcdf-files// % So let's define the snapshot: snapshot = '200103'; % File's name: global netcdf_UVEL netcdf_VVEL netcdf_THETA netcdf_SALTanom global netcdf_suff netcdf_domain netcdf_UVEL = 'UVEL'; netcdf_VVEL = 'VVEL'; netcdf_THETA = 'THETA'; netcdf_SALTanom = 'SALTanom'; netcdf_suff = 'nc'; netcdf_domain = 'north_atlantic'; % FLAGS: % Turn 0/1 the following flag to determine which PV to compute: wantsplPV = 0; % (turn 1 for simple PV computing) % Turn 0/1 this flag to get online computing informations: global toshow toshow = 0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMPUTING PV: % STEP 1: % Output netcdf file is: % ./netcdf-files//SIGMATHETA.. A_compute_potential_density(snapshot) % STEP 2: % Output netcdf files are: % ./netcdf-files//OMEGAX.. % ./netcdf-files//OMEGAY.. % ./netcdf-files//ZETA.. % No interest for the a splPV computing if ~wantsplPV B_compute_relative_vorticity(snapshot) end %if % STEP 3: % Output netcdf file is: % ./netcdf-files//PV.. C_compute_potential_vorticity(snapshot,wantsplPV) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% THAT'S IT !