/[MITgcm]/MITgcm/utils/matlab/dens_poly3.m
ViewVC logotype

Contents of /MITgcm/utils/matlab/dens_poly3.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1.6.1 - (show annotations) (download)
Mon Apr 8 20:10:39 2002 UTC (22 years ago) by heimbach
Branch: release1
CVS Tags: release1_p13_pre, release1_p13, release1_p8, release1_p9, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, release1_chkpt44d_post, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, release1_p12_pre
Branch point for: release1_50yr
Changes since 1.1: +0 -0 lines
Changes encapsulated by checkpoint43a-release1mods and chkpt44d_post
on the main trunk.
These are:

 o added missing EXCLUDE_MONITOR flags
 o changed "e" to "_d" in gmredi_slope_limit, gmredi_slope_psi
   (incompatible typ in MIN/MAX expressions caused problems
   on IBM SP3)
 o in genmake added variable MAKEDEPEND
   plus resetting for case SunOS
 o added timer_stats.c routine for IBM SP3
 o removed variables in dynamics
 o real fresh water flux implemented with non-linear free-surface.
 o few fix (mask in shap_s2, EmPmR in external_field_load,
   USE_NATURAL_BCS in solve_for_P);
 o add arguments myIter & myTime to S/R obcs_calc & solve_for_P
 o merge of relevant stuff from the ecco-branch:
   - genmake: removed $S64 overwrite for case SunOS
   - pkg/exf: update and corrections for field swapping and obcs
   - pkg/ecco: parameter lists for the_model_main, the_main_loop
               harmonized between ECCO and MITgcm
   - pkg/autodiff: added flow directives for obcs, mdsio_gl_slice
                   updated checkpointing_lev... lists for obcs
   - model/src: minor changes in forward_step, plot_field
                added directive for divided adjoint in the_main_loop
   - pkg/mdsio: added mdsio_gl_slice
 o check parameters & config (chkpt44a_pre,post)
 o OBC and NonLin_FrSurf.
 o fix bug in mom_vi_del2uv
 o select when filters are applied ; add options to zonal_filter (data.zonfilt)
 o gmredi: fix Pb in the adiabatic form ; add options (.e.g. Bolus advection)
 o update AIM experiments (NCEP input files)
 o improve and extend diagnostics (Monitor, TimeAve with NonLin-FrSurf)
 o added some stuff for AD

These were merged with
cvs co -r release1 -P MITgcm
cd MITgcm
cvs update -kk
cvs update -j checkpoint43a-release1mods -j chkpt44d_post -d -P -kk

1 function [dens] = dens_poly3(poly3,t,s)
2 % D=DENS_POLY3(P,T,S)
3 %
4 % Calculates in-situ density as approximated by the POLY3 method
5 % used in the MITgcm.
6 % P - coefficients read from file 'POLY3.COEFFS' using INI_POLY3
7 % T - potential temperature
8 % S - salinity
9 %
10 % eg.
11 % >> P=ini_poly3;
12 % >> T=rdmds('T',100);
13 % >> S=rdmds('S',100);
14 % >> D=dens_poly3(P,T,S);
15 %
16 % or to work within a single model level
17 % >> D=dens_poly3(P(3),T(:,:,3),S(:,:,3));
18
19 if size(t) ~= size(s)
20 error('T and S must be the same shape and size')
21 end
22 %if size(t,ndims(t)) ~= size(poly3,2)
23 % error('Last dimension of T and S must be the number of levels in P')
24 %end
25
26 n=size(t);
27 nz=size(poly3,2);
28
29 t=reshape(t,[prod(size(t))/nz nz]);
30 s=reshape(s,[prod(size(t))/nz nz]);
31
32 for k=1:nz,
33 tRef=poly3(k).t;
34 sRef=poly3(k).s;
35 dRef=poly3(k).dens;
36 tp=t(:,k)-tRef;
37 sp=s(:,k)-sRef;
38
39 deltaSig= ...
40 poly3(k).coeffs(1) .*tp ...
41 +poly3(k).coeffs(2) .*sp ...
42 +poly3(k).coeffs(3) .*tp.*tp ...
43 +poly3(k).coeffs(4) .*tp .*sp ...
44 +poly3(k).coeffs(5) .*sp.*sp ...
45 +poly3(k).coeffs(6) .*tp.*tp.*tp ...
46 +poly3(k).coeffs(7) .*tp.*tp .*sp ...
47 +poly3(k).coeffs(8) .*tp .*sp.*sp ...
48 +poly3(k).coeffs(9) .*sp.*sp.*sp ...
49 ;
50 dens(:,k)=deltaSig+dRef;
51 end
52
53 dens=reshape(dens,n);

  ViewVC Help
Powered by ViewVC 1.1.22