Warning, /verification/tutorial_barotropic_gyre/input/gendata.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit ce0d9af5 on 2021-04-21 19:30:20 UTC
ce0d9af5ea Jeff*0001 ieee = 'b'; % big-endian format
0002 accuracy = 'float32'; % this is single-precision (='real*4')
f8369b5e5d Jean*0003
ce0d9af5ea Jeff*0004 Ho = 5000; % ocean depth in meters
0005 nx = 62; % number of gridpoints in x-direction
0006 ny = 62; % number of gridpoints in y-direction
0007 xo = 0; % origin in x,y for ocean domain
0008 yo = 0; % (i.e. southwestern corner of ocean domain)
0009 dx = 20; % grid spacing in x (km)
0010 dy = 20; % grid spacing in y (km)
0011 xeast = xo + (nx-2)*dx; % eastern extent of ocean domain
0012 ynorth = yo + (ny-2)*dy; % northern extent of ocean domain
f8369b5e5d Jean*0013
0014 % Flat bottom at z=-Ho
ce0d9af5ea Jeff*0015 h = -Ho * ones(nx, ny);
0016
0017 % Walls (surrounding domain); generate bathymetry file
0018 h([1 end], :) = 0; % set ocean depth to zero at east and west walls
0019 h(:, [1 end]) = 0; % set ocean depth to zero at south and north walls
0020 fid = fopen('bathy.bin', 'w', ieee);
0021 fwrite(fid, h, accuracy);
0022 fclose(fid);
0023
0024 % Ocean domain extends from (xo,yo) to (xeast,ynorth)
0025 % (i.e. the ocean spans nx-2, ny-2 grid cells)
0026 % out-of-box-config: xo=yo=0, dx=dy=20 km, ocean extent (0,0)-(1200,1200) km
0027 % model domain includes a land cell surrounding the ocean domain
0028 % The full model domain cell centers are located at:
0029 % XC(:,1) = -10, +10, ..., +1210 (km)
0030 % YC(1,:) = -10, +10, ..., +1210 (km)
0031 % and full model domain cell corners are located at:
0032 % XG(:,1) = -20, 0, ..., 1200 [, 1220] (km)
0033 % YG(1,:) = -20, 0, ..., 1200 [, 1220] (km)
0034 % where the last value in brackets is not included in the MITgcm grid variable
0035 % and reflects the eastern and northern edge of the model domain respectively.
0036 % See section 2.11.4 of the MITgcm users manual.
0037
0038 % Zonal wind-stress, located at u-points (see section 2.11.4)
0039 % here we non-dimensionalize: 0 at southern and western ocean boundary
0040 % to 1.0 at eastern and northern ocean boundary
0041 % for the purpose of applying sinusoidal-shaped wind stress curve
0042 tauMax = 0.1; % wind stress maximum
0043 x = (-1:nx-2) / (nx-2); % non-dim x-coordinate, located at XG points
0044 y = ((0:ny-1)-0.5) / (ny-2); % non-dim y-coordinate, located at YC points
0045 [X,Y] = ndgrid(x, y);
0046
0047 % generate file for -cos(y) profile
0048 tau = -tauMax * cos(pi*Y);
0049 fid = fopen('windx_cosy.bin', 'w', ieee);
0050 fwrite(fid, tau, accuracy);
0051 fclose(fid);
0052
0053 % generate file for sin(y) profile
0054 tau = tauMax * sin(pi*Y);
0055 fid = fopen('windx_siny.bin', 'w', ieee);
0056 fwrite(fid, tau, accuracy);
0057 fclose(fid);
0058
0059 % Meridional wind-stress, if desired, would be located at v-points (XC, YG)