Ignore:
Timestamp:
04/04/18 09:42:04 (7 years ago)
Author:
dmenemen
Message:

adding lines that prepare MITgcm for
step #12: RunCoupledMITgcmISSM2

File:
1 edited

Legend:

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

    r22670 r22672  
    573573        !\cp ../MITgcm/build/mitgcmuv run
    574574        !\cp ../MITgcm/input/* run
    575 
    576         %load data:
    577         loaddata(org,'Parameters');
    578575
    579576        % initial salinity
     
    845842        loaddata(org,'Parameters');
    846843        loaddata(org,'ParameterizeIce');
    847 
    848         if exist ('run')
    849                 !\rm -rf run/test4002*
    850         end
    851        
     844        loaddata(org,'Bathymetry');
     845        loaddata(org,'IceSheetGeometry');
     846        endtime = round(MITgcmDeltaT * ...
     847         floor(time_step*y2s*async_step_MITgcm_multiplier/MITgcmDeltaT));
     848
     849        % {{{ prepare MITgcm
     850        % rename previous run directory and create new one
     851        if exist ('run.old')
     852            !\rm -rf run.old
     853        end
     854        if exist ('run')
     855            !\mv run run.old
     856        end
     857        !\mkdir run
     858        !\cp ../MITgcm/build/mitgcmuv run
     859        !\cp ../MITgcm/input/* run
     860
     861        % initial salinity
     862        S=iniSalt*ones(Nx,Ny,Nz);
     863        writebin('run/Salt.bin',S);
     864
     865        % initial temperature
     866        T=iniTheta*ones(Nx,Ny,Nz);
     867        writebin('run/Theta.bin',T);
     868
     869        % initial velocity
     870        Z=zeros(Nx,Ny,Nz);
     871        writebin('run/Uvel.bin',Z);
     872        writebin('run/Vvel.bin',Z);
     873
     874        % initial sea surface height
     875        Z=zeros(Nx,Ny);
     876        writebin('run/Etan.bin',Z);
     877
     878        % salinity boundary conditions
     879        S=obcSalt*ones(Ny,Nz);
     880        thk=delZ*ones(Nz,1);
     881        bot=cumsum(thk);
     882        ik=find(bot<=mlDepth);
     883        S(:,ik)=mlSalt;
     884        writebin('run/OBs.bin',S);
     885
     886        % temperature boundary conditions
     887        T=obcTheta*ones(Ny,Nz);
     888        T(:,ik)=mlTheta;
     889        writebin('run/OBt.bin',T);
     890
     891        % zonal velocity boundary conditions
     892        U=obcUvel*ones(Ny,Nz);
     893        writebin('run/OBu.bin',U);
     894
     895        % zero boundary conditions
     896        Z=zeros(Ny,Nz);
     897        writebin('run/zeros.bin',Z);
     898
     899        % build parameter file data.obcs
     900        fidi=fopen('../MITgcm/input/data.obcs','r');
     901        fido=fopen('run/data.obcs','w');
     902        tline = fgetl(fidi);
     903        fprintf(fido,'%s\n',tline);
     904        while 1
     905            tline = fgetl(fidi);
     906            if ~ischar(tline), break, end
     907            %do the change here:
     908            if strcmpi(tline,' OB_Iwest = 40*1,'),
     909                fprintf(fido,'%s%i%s\n',' OB_Iwest = ',Ny,'*1,');
     910                continue;
     911            end
     912            if strcmpi(tline,' OB_Ieast = 40*-1,'),
     913                fprintf(fido,'%s%i%s\n',' OB_Ieast = ',Ny,'*-1,');
     914                continue;
     915            end
     916            fprintf(fido,'%s\n',tline);
     917        end
     918        %close  files
     919        fclose(fidi);
     920        fclose(fido);
     921
     922        %save bathymetry and bedrock in run directory
     923        writebin('run/bathymetry.bin',bathymetry);
     924        writebin('run/icetopo.bin',draft);
     925        % }}}
     926        % {{{ generate MITgcm parameter file data
     927        fidi=fopen('../MITgcm/input/data','r');
     928        fido=fopen('run/data','w');
     929        tline = fgetl(fidi);
     930        fprintf(fido,'%s\n',tline);
     931        while 1
     932            tline = fgetl(fidi);
     933            if ~ischar(tline), break, end
     934            %do the change here:
     935            if strcmpi(tline,' xgOrigin = 0.0,'),
     936                fprintf(fido,'%s%i%s\n',' xgOrigin = ',xgOrigin,',');
     937                continue;
     938            end
     939            if strcmpi(tline,' ygOrigin = -80.0,'),
     940                fprintf(fido,'%s%i%s\n',' ygOrigin = ',ygOrigin,',');
     941                continue;
     942            end
     943            if strcmpi(tline,' delX = 20*0.25,'),
     944                fprintf(fido,'%s%i*%g%s\n',' delX = ',Nx,dLong,',');
     945                continue;
     946            end
     947            if strcmpi(tline,' delY = 20*0.25,'),
     948                fprintf(fido,'%s%i*%g%s\n',' delY = ',Ny,dLat,',');
     949                continue;
     950            end
     951            if strcmpi(tline,' delZ = 30*30.0,'),
     952                fprintf(fido,'%s%i*%g%s\n',' delZ = ',Nz,delZ,',');
     953                continue;
     954            end
     955            if strcmpi(tline,' endTime=2592000.,'),
     956                fprintf(fido,'%s%i%s\n',' endTime= ',endtime,',');
     957                continue;
     958            end
     959            if strcmpi(tline,' deltaT=1200.0,'),
     960                fprintf(fido,'%s%i%s\n',' deltaT= ',MITgcmDeltaT,',');
     961                continue;
     962            end
     963            if strcmpi(tline,' pChkptFreq=2592000.,'),
     964                fprintf(fido,'%s%i%s\n',' pChkptFreq= ',endtime,',');
     965                continue;
     966            end
     967            if strcmpi(tline,' taveFreq=2592000.,'),
     968                fprintf(fido,'%s%i%s\n',' taveFreq= ',endtime,',');
     969                continue;
     970            end
     971            if strcmpi(tline,' rhoConst=1030.,'),
     972                fprintf(fido,'%s%i%s\n',' rhoConst= ',rho_water,',');
     973                continue;
     974            end
     975            if strcmpi(tline,' rhoNil=1030.,'),
     976                fprintf(fido,'%s%i%s\n',' rhoNil= ',rho_water,',');
     977                continue;
     978            end
     979            fprintf(fido,'%s\n',tline);
     980        end
     981        %close  files
     982        fclose(fidi);
     983        fclose(fido);
     984        % }}}
     985               
    852986        md.transient.isoceancoupling=1;
    853987        md.transient.isgroundingline=1;
Note: See TracChangeset for help on using the changeset viewer.