/[MITgcm]/MITgcm_contrib/mlosch/interp_llc/addshelfice.m
ViewVC logotype

Diff of /MITgcm_contrib/mlosch/interp_llc/addshelfice.m

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

revision 1.1 by mlosch, Thu May 3 21:07:20 2007 UTC revision 1.2 by mlosch, Fri May 4 14:53:00 2007 UTC
# Line 1  Line 1 
1  clear all  clear all
2    
3  new = 'input.180x120x23_shelfice';  new = 'input.shelfice';
4  input = 'input.180x120x23';  input = 'input';
5  eostype = 'mdjwf';  eostype = 'mdjwf';
6    
7  nx = 180;  nx = 45;
8  ny = 120;  ny = nx*18;
9  nz = 23;  nz = 23;
10  nt = 12;  nt = 12;
11    
12  load FMT  load FMT
13  hn = mit_readfield(fullfile(input,'bathymetry.bin'),[nx ny],fmt);  load HN
14  hnz = mit_readfield(fullfile(input,'shelfice_bath.bin'),[nx ny],fmt);  load ZN
15  zn = mit_readfield(fullfile(input,'shelfice_topo.bin'),[nx ny],fmt);  % $$$ hn = mit_readfield(fullfile(input,'bathy_llc_p90.bin'),[nx ny],fmt);
16    % $$$ hnz = mit_readfield(fullfile(input,'shelfice_bath.bin'),[nx ny],fmt);
17    % $$$ zn = mit_readfield(fullfile(input,'shelfice_topo.bin'),[nx ny],fmt);
18    
19  h = hn+hnz;  h = hn+hnz;
20  mit_writefield(fullfile(new,'bathymetry.bin'),hn,fmt);  mit_writefield(fullfile(new,'bathy_llc_p90.bin'),mdsiocompact(hn),fmt);
21  mit_writefield(fullfile(new,'bathymetry.shice'),h,fmt);  mit_writefield(fullfile(new,'bathy_llc_p90.shice'),mdsiocompact(h),fmt);
22  mit_writefield(fullfile(new,'shelfice_topo.bin'),zn,fmt);  mit_writefield(fullfile(new,'shelfice_topo.bin'),mdsiocompact(zn),fmt);
23    
24  % create hydrographic fields  % create hydrographic fields
25  levt = mit_readfield(fullfile(input,'lev_t.bin'),[nx ny nz nt],fmt);  levt = mit_readfield(fullfile(input,'lev_t.bin'),[nx ny nz nt],fmt);
# Line 25  levs = mit_readfield(fullfile(input,'lev Line 27  levs = mit_readfield(fullfile(input,'lev
27  is = find(zn~=0);  is = find(zn~=0);
28  [ix,iy] = find(zn~=0);  [ix,iy] = find(zn~=0);
29  [t,s] = shelfice_hydrography(ix,iy,is,levt,levs);  [t,s] = shelfice_hydrography(ix,iy,is,levt,levs);
30  mit_writefield(fullfile(new,'lev_t.shice'),t,fmt);  mit_writefield(fullfile(new,'lev_t.shice'),mdsiocompact(t),fmt);
31  mit_writefield(fullfile(new,'lev_s.shice'),s,fmt);  mit_writefield(fullfile(new,'lev_s.shice'),mdsiocompact(s),fmt);
32    
33    % create hydrographic fields
34    levt = mdsiocompact(mit_readfield(fullfile(input,'lev_t.init'),[nx ny nz],fmt),0);
35    levs = mdsiocompact(mit_readfield(fullfile(input,'lev_s.init'),[nx ny nz],fmt),0);
36    is = find(zn~=0);
37    [ix,iy] = find(zn~=0);
38    [t,s] = shelfice_hydrography(ix,iy,is,levt,levs);
39    mit_writefield(fullfile(new,'lev_t.shice.init'),mdsiocompact(t),fmt);
40    mit_writefield(fullfile(new,'lev_s.shice.init'),mdsiocompact(s),fmt);
41    
42  % create geopotential anomaly  % create geopotential anomaly
43  gravity = 9.81;  gravity = 9.81;
# Line 80  for ks=1:length(ix) Line 91  for ks=1:length(ix)
91    ph(ks) = phiHydF(kl,ks);    ph(ks) = phiHydF(kl,ks);
92  end  end
93    
94  pload = zeros(nx,ny);  pload = 0*hn;
95  for ks=1:length(ix)  for ks=1:length(ix)
96    pload(ix(ks),iy(ks)) = -ph(ks)*rho0;    pload(ix(ks),iy(ks)) = -ph(ks)*rho0;
97  end  end
98    
99  mit_writefield(fullfile(new,['pload.' eostype]),pload,fmt);  mit_writefield(fullfile(new,['pload.' eostype]),mdsiocompact(pload),fmt);
100    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22