Changeset 23884


Ignore:
Timestamp:
04/22/19 14:24:44 (6 years ago)
Author:
dmenemen
Message:

building and running MITgcm only experiment

Location:
issm/trunk-jpl/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/test/NightlyRun/test4003.m

    r23881 r23884  
    44%Script control parameters
    55steps=[1 2 3 4 5 6 7 8 9 10 11 12];
    6 steps=[1 2 3 4];
    76final_time=1/365;
    87
     
    136135% {{{ BuildMITgcm:
    137136if perform(org,'BuildMITgcm'),
    138 
    139     %load data:
    140     loaddata(org,'Parameters');
    141 
    142     %specify computational grid in SIZE.h
    143     if ~exist('../MITgcm/code/SIZE.h')
    144         fidi=fopen('../MITgcm/code/SIZE.h.bak','r');
    145         fido=fopen('../MITgcm/code/SIZE.h','w');
    146         tline = fgetl(fidi);
    147         fprintf(fido,'%s\n',tline);
    148         while 1
    149             tline = fgetl(fidi);
    150             if ~ischar(tline), break, end
    151             %do the change here:
    152             if strcmpi(tline,'     &           sNx =  20,'),
    153                 fprintf(fido,'%s%i%s\n','     &           sNx =  ',round(Nx/nPx),',');
    154                 continue;
    155             end
    156             if strcmpi(tline,'     &           sNy =  20,'),
    157                 fprintf(fido,'%s%i%s\n','     &           sNy =  ',round(Ny/nPy),',');
    158                 continue;
    159             end
    160             if strcmpi(tline,'     &           nPx =   1,'),
    161                 fprintf(fido,'%s%i%s\n','     &           nPx = ',nPx,',');
    162                 continue;
    163             end
    164             if strcmpi(tline,'     &           nPy =   2,'),
    165                 fprintf(fido,'%s%i%s\n','     &           nPy = ',nPy,',');
    166                 continue;
    167             end
    168             fprintf(fido,'%s\n',tline);
    169         end
    170         %close  files
    171         fclose(fidi);
    172         fclose(fido);
    173     end
    174 
    175     system(['../MITgcm/build.sh generic ' pwd '/../MITgcm']);
     137    system(['../MITgcm/build_4003.sh generic ' pwd '/../MITgcm']);
    176138end
    177139% }}}
     
    179141% {{{ RunUncoupledMITgcm:
    180142if perform(org,'RunUncoupledMITgcm'),
    181 
    182     %load data:
    183     loaddata(org,'Parameters');
    184     loaddata(org,'Bathymetry');
    185     loaddata(org,'IceSheetGeometry');
    186          endtime = round(MITgcmDeltaT * ...
    187                  floor(time_step*y2s*async_step_MITgcm_multiplier/MITgcmDeltaT));
    188 
    189     % {{{ prepare MITgcm
    190143    % rename previous run directory and create new one
    191144    if exist ('run.old')
     
    197150    !\mkdir run
    198151    !\cp ../MITgcm/build/mitgcmuv run
    199     !\cp ../MITgcm/input/* run
    200     !\cp ../MITgcm/input/eedata_uncoupled run/eedata
    201    
    202     %load data:
    203     loaddata(org,'Parameters');
    204 
    205     % initial salinity
    206     S=iniSalt*ones(Nx,Ny,Nz);
    207     writebin('run/Salt.bin',S);
    208    
    209     % initial temperature
    210     T=iniTheta*ones(Nx,Ny,Nz);
    211     writebin('run/Theta.bin',T);
    212    
    213     % initial velocity
    214     Z=zeros(Nx,Ny,Nz);
    215     writebin('run/Uvel.bin',Z);
    216     writebin('run/Vvel.bin',Z);
    217    
    218     % initial sea surface height
    219     Z=zeros(Nx,Ny);
    220     writebin('run/Etan.bin',Z);
    221 
    222     % salinity boundary conditions
    223     S=obcSalt*ones(Ny,Nz);
    224     thk=delZ*ones(Nz,1);
    225     bot=cumsum(thk);
    226     ik=find(bot<=mlDepth);
    227     S(:,ik)=mlSalt;
    228     writebin('run/OBs.bin',S);
    229 
    230     % temperature boundary conditions
    231     T=obcTheta*ones(Ny,Nz);
    232     T(:,ik)=mlTheta;
    233     writebin('run/OBt.bin',T);
    234 
    235     % zonal velocity boundary conditions
    236     U=obcUvel*ones(Ny,Nz);
    237     writebin('run/OBu.bin',U);
    238    
    239     % zero boundary conditions
    240     Z=zeros(Ny,Nz);
    241     writebin('run/zeros.bin',Z);
    242 
    243     % build parameter file data.obcs
    244     fidi=fopen('../MITgcm/input/data.obcs','r');
    245     fido=fopen('run/data.obcs','w');
    246     tline = fgetl(fidi);
    247     fprintf(fido,'%s\n',tline);
    248     while 1
    249         tline = fgetl(fidi);
    250         if ~ischar(tline), break, end
    251         %do the change here:
    252         if strcmpi(tline,' OB_Iwest = 40*1,'),
    253             fprintf(fido,'%s%i%s\n',' OB_Iwest = ',Ny,'*1,');
    254             continue;
    255         end
    256         if strcmpi(tline,' OB_Ieast = 40*-1,'),
    257             fprintf(fido,'%s%i%s\n',' OB_Ieast = ',Ny,'*-1,');
    258             continue;
    259         end
    260         fprintf(fido,'%s\n',tline);
    261     end
    262     %close  files
    263     fclose(fidi);
    264     fclose(fido);
    265 
    266     %save bathymetry and bedrock in run directory
    267     writebin('run/bathymetry.bin',bathymetry);
    268     writebin('run/icetopo.bin',draft);
    269     % }}}
    270 
    271     %start looping: 
    272     for t=start_time:time_step:final_time,
    273         disp(['Year: ' num2str(t)])
    274         % {{{ generate MITgcm parameter file data
    275         fidi=fopen('../MITgcm/input/data','r');
    276         fido=fopen('run/data','w');
    277         tline = fgetl(fidi);
    278         fprintf(fido,'%s\n',tline);
    279         while 1
    280             tline = fgetl(fidi);
    281             if ~ischar(tline), break, end
    282             %do the change here:
    283             if strcmpi(tline,' xgOrigin = 0.0,'),
    284                 fprintf(fido,'%s%i%s\n',' xgOrigin = ',xgOrigin,',');
    285                 continue;
    286             end
    287             if strcmpi(tline,' ygOrigin = -80.0,'),
    288                 fprintf(fido,'%s%i%s\n',' ygOrigin = ',ygOrigin,',');
    289                 continue;
    290             end
    291             if strcmpi(tline,' delX = 20*0.25,'),
    292                 fprintf(fido,'%s%i*%g%s\n',' delX = ',Nx,dLong,',');
    293                 continue;
    294             end
    295             if strcmpi(tline,' delY = 20*0.25,'),
    296                 fprintf(fido,'%s%i*%g%s\n',' delY = ',Ny,dLat,',');
    297                 continue;
    298             end
    299             if strcmpi(tline,' delZ = 30*30.0,'),
    300                 fprintf(fido,'%s%i*%g%s\n',' delZ = ',Nz,delZ,',');
    301                 continue;
    302             end
    303             if strcmpi(tline,' endTime=2592000.,'),
    304                 fprintf(fido,'%s%i%s\n',' endTime= ',endtime,',');
    305                 continue;
    306             end
    307             if strcmpi(tline,' deltaT=1200.0,'),
    308                 fprintf(fido,'%s%i%s\n',' deltaT= ',MITgcmDeltaT,',');
    309                 continue;
    310             end
    311             if strcmpi(tline,' pChkptFreq=2592000.,'),
    312                 fprintf(fido,'%s%i%s\n',' pChkptFreq= ',endtime,',');
    313                 continue;
    314             end
    315             if strcmpi(tline,' taveFreq=2592000.,'),
    316                 fprintf(fido,'%s%i%s\n',' taveFreq= ',endtime,',');
    317                 continue;
    318             end
    319             if strcmpi(tline,' rhoConst=1030.,'),
    320                 fprintf(fido,'%s%i%s\n',' rhoConst= ',rho_water,',');
    321                 continue;
    322             end
    323             if strcmpi(tline,' rhoNil=1030.,'),
    324                 fprintf(fido,'%s%i%s\n',' rhoNil= ',rho_water,',');
    325                 continue;
    326             end
    327             fprintf(fido,'%s\n',tline);
    328         end
    329         %close  files
    330         fclose(fidi);
    331         fclose(fido);
    332         % }}}
    333         % {{{ generate initial MITgcm conditions
    334 
    335         ds=round(endtime/MITgcmDeltaT);
    336         if t>start_time
    337             % Read pickup file
    338             fnm=['run/pickup.' myint2str(ds,10) '.data'];
    339             U=readbin(fnm,[Nx Ny Nz],1,'real*8',0);
    340             V=readbin(fnm,[Nx Ny Nz],1,'real*8',1);
    341             T=readbin(fnm,[Nx Ny Nz],1,'real*8',2);
    342             S=readbin(fnm,[Nx Ny Nz],1,'real*8',3);
    343             E=readbin(fnm,[Nx Ny],1,'real*8',8*Nz);
    344             writebin('run/Salt.bin' ,S);
    345             writebin('run/Theta.bin',T);
    346             writebin('run/Uvel.bin' ,U);
    347             writebin('run/Vvel.bin' ,V);
    348             writebin('run/Etan.bin' ,E);
    349         end
    350 
    351         % }}}
    352         % {{{ system call to run MITgcm
    353         cd run
    354         eval(['!mpirun -np ' int2str(nPx*nPy) ' ./mitgcmuv']);
    355         ts=round((t+time_step)*y2s/MITgcmDeltaT);
    356         eval(['!\mv STDERR.0000 STDERR_' myint2str(ts,10) '.data'])
    357         eval(['!\mv STDOUT.0000 STDOUT_' myint2str(ts,10) '.data'])
    358         eval(['!\cp hFacC.data hFacC_' myint2str(ts,10) '.data'])
    359         eval(['!\cp icetopo.bin icetopo_' myint2str(ts,10) '.data'])
    360         for fld={'S','T','U','V','Eta', ...
    361                  'SHICE_heatFluxtave','SHICE_fwFluxtave'}
    362             eval(['!\mv ' fld{1} '.' myint2str(ds,10) '.data ' ...
    363                   fld{1} '_' myint2str(ts,10) '.data'])
    364         end
    365         cd ..
    366         % }}}
    367     end
     152    !\cp ../MITgcm/install_dngoldberg/verification/shelfice_remeshing/input/* run
     153    cd run
     154    eval(['!mpirun -np ' int2str(nPx*nPy) ' ./mitgcmuv']);
    368155end
    369156% }}}
     
    1016803end
    1017804% }}}
    1018 
    1019 %Fields and tolerances to track changes
    1020 fnm=['run/SHICE_fwFluxtave.0000000006.data'];
    1021 melting_rate_1=readbin(fnm,[Nx Ny]);
    1022 fnm=['run/SHICE_fwFluxtave.0000000012.data'];
    1023 melting_rate_2=readbin(fnm,[Nx Ny]);
    1024 fnm=['run/SHICE_fwFluxtave.0000000018.data'];
    1025 melting_rate_3=readbin(fnm,[Nx Ny]);
    1026 fnm=['run/SHICE_fwFluxtave.0000000024.data'];
    1027 melting_rate_4=readbin(fnm,[Nx Ny]);
    1028 field_names     ={'Base1','Melting1','Vx2','Vy2','Thickness2','Base2','MaskGroundediceLevelset2','FloatingiceMeltingRate2',...
    1029         'Melting2','Vx3','Vy3','Thickness3','Base3','MaskGroundediceLevelset3','FloatingiceMeltingRate3',...
    1030         'Melting3','Vx4','Vy4','Thickness4','Base4','MaskGroundediceLevelset4','FloatingiceMeltingRate4','Melting4'};
    1031 field_tolerances={2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
    1032         1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13,...
    1033         1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13 };
    1034 field_values={...
    1035         (md.results.TransientSolution(1).Base),...
    1036         (melting_rate_1(:)),...
    1037         (md.results.TransientSolution(2).Vx),...
    1038         (md.results.TransientSolution(2).Vy),...
    1039         (md.results.TransientSolution(2).Thickness),...
    1040         (md.results.TransientSolution(2).Base),...
    1041         (md.results.TransientSolution(2).MaskGroundediceLevelset),...
    1042         (md.results.TransientSolution(2).BasalforcingsFloatingiceMeltingRate),...
    1043         (melting_rate_2(:)),...
    1044         (md.results.TransientSolution(3).Vx),...
    1045         (md.results.TransientSolution(3).Vy),...
    1046         (md.results.TransientSolution(3).Thickness),...
    1047         (md.results.TransientSolution(3).Base),...
    1048         (md.results.TransientSolution(3).MaskGroundediceLevelset),...
    1049         (md.results.TransientSolution(3).BasalforcingsFloatingiceMeltingRate),...
    1050         (melting_rate_3(:)),...
    1051         (md.results.TransientSolution(4).Vx),...
    1052         (md.results.TransientSolution(4).Vy),...
    1053         (md.results.TransientSolution(4).Thickness),...
    1054         (md.results.TransientSolution(4).Base),...
    1055         (md.results.TransientSolution(4).MaskGroundediceLevelset),...
    1056         (md.results.TransientSolution(4).BasalforcingsFloatingiceMeltingRate),...
    1057         (melting_rate_4(:)),...
    1058         };
Note: See TracChangeset for help on using the changeset viewer.