/[MITgcm]/MITgcm_contrib/shelfice_remeshing/DIG/input/rdmds_init_pig.m
ViewVC logotype

Contents of /MITgcm_contrib/shelfice_remeshing/DIG/input/rdmds_init_pig.m

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


Revision 1.1 - (show annotations) (download)
Fri Apr 1 10:19:40 2016 UTC (9 years, 4 months ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
Added rough code to dig ice shelf to make continuous ocean

1 %This program creates open boundary prescription files for the PIG
2 %experiment based on the 10 yrs spin-up run using OBCS with
3 %U,V = 0, Tref, Sref
4
5 %following variables
6 %-----3D fields-----
7 % T Temperature (C)
8 % S Salinity (psu)
9 % U u-velocity (m/s)
10 % PH ocean pressure (or atm geopotential)
11
12
13
14
15 %Set the grid size;
16 nx = 3; delx = 1; X = nx*delx;
17 ny = 400; dely = 1; Y = ny*dely;
18 nz = 210; delz = 10; Z = nz*delz;
19
20 %x axis
21 x = 1:delx:X;
22 %y axis
23 y = 1:dely:Y;
24 %z axis [m]
25 z = delz:delz:Z;
26
27
28 %Note:
29 %Ensure that the volume flux is zero at the open boundary
30
31
32 %% ________________________________________________________________________
33 % First try: linear velocity profile.
34 % From U = -0.025 ms-1 (outwards) to 0.025 ms-1
35 % Constant in y direction (meridionally)
36 % Do not take exactly Umin and Umax from the OBC of the original
37 % experiment: Take modified numbers to that Umin = -Umax and volume is conserved
38
39 % Initialize variable
40 V_OBC(1:nx,1:nz) = NaN;
41
42
43 v_sfc = 0.025; %U at sfc
44 v_bottom = -0.025; %U at bottom
45 del_v = (v_bottom - v_sfc)/((90-1)*delz); %delu/delz
46 for iz = 1:nz;
47 V_OBC(1:nx,iz) = 0;
48 end
49 for iz = 1:90;
50 V_OBC(1:nx,iz) = v_sfc + del_v*((iz-1)*delz);
51 end
52
53
54
55 % Linear T profile
56 % From Tmin at sfc increasing to Tmax at bottom
57 % Take Tmin and Tmax from the OBC of the original PIG experiment
58
59 % Initialize variable
60 T_OBC(1:nx,1:nz) = NaN;
61
62
63 T_sfc = -1.9;
64 T_bottom = 1.1967;
65 del_T = (T_bottom - T_sfc)/((nz-1)*delz);
66
67 for iz = 1:150;
68 T_OBC(1:nx,iz) = T_sfc + del_T*((iz-1)*delz);
69 end
70
71 for iz = 150:210;
72 T_OBC(1:nx,iz) = -2;
73 end
74
75
76 % Linear S profile
77 % From Smin at sfc increasing to Smax at bottom
78 % Take Smin and Smax from the OBC of the original PIG experiment
79
80 % Initialize variable
81 S_OBC(1:nx,1:nz) = NaN;
82
83 S_sfc = 34.2050;
84 S_bottom = 34.6967;
85 del_S = (S_bottom - S_sfc)/((nz-1)*delz);
86
87 for iz = 1:nz;
88 S_OBC(1:nx,iz) = S_sfc + del_S*((iz-1)*delz);
89 end
90
91
92
93 %% Initial T & S conditions
94
95 % Take western open boundary conditions for T & S
96 % and assume no change in x-direction
97
98 T_init = zeros(nx,ny,nz);
99 S_init = zeros(nx,ny,nz);
100
101 for iy = 1:ny;
102 T_init(:,iy,:) = T_OBC;
103 S_init(:,iy,:) = S_OBC;
104 end
105
106
107
108 %% Print OBCS files for T, S
109
110 % fid=fopen('uvel.obw','w','b'); fprintf(fid,'%10.4f',U_OBC);fclose(fid);
111 fid=fopen('vvel.obw','w','b'); fwrite(fid,V_OBC,'real*8'); fclose(fid);
112 % fid=fopen('uvel.obw','w','b'); fwrite(fid,U_OBC,'real*8'); fclose(fid);
113 fid=fopen('theta.obw','w','b'); fwrite(fid,T_OBC,'real*8'); fclose(fid);
114 fid=fopen('salt.obw','w','b'); fwrite(fid,S_OBC,'real*8'); fclose(fid);
115 % fid=fopen('theta.obw','w'); fprintf(fid,'%10.4f',T_OBC);fclose(fid);
116 % fid=fopen('salt.obw','w'); fprintf(fid,'%10.4f',S_OBC);fclose(fid);
117
118
119
120 %% Print init files for T, S
121
122 fid_T=fopen('theta.init','w','b');fwrite(fid,T_init,'real*8');fclose(fid);
123 fid_T=fopen('salt.init','w','b');fwrite(fid,S_init,'real*8');fclose(fid);
124
125
126 % for iz = 1:nz;
127 % fprintf(fid_T,'%10.4f',T_init(:,:,iz));
128 % fprintf(fid_S,'%10.4f',S_init(:,:,iz));
129 % end
130 %
131 % fclose(fid_T);
132 % fclose(fid_S);

  ViewVC Help
Powered by ViewVC 1.1.22