Index: /issm/trunk-jpl/test/MITgcm/build_4003.sh
===================================================================
--- /issm/trunk-jpl/test/MITgcm/build_4003.sh	(revision 23884)
+++ /issm/trunk-jpl/test/MITgcm/build_4003.sh	(revision 23884)
@@ -0,0 +1,38 @@
+#!/bin/bash
+#This script compiles and links MITgcm
+
+#recover hostname and model path:
+hostname="$1"
+modelpath="$2"
+
+if [ -e ~/.bashrc ]; then
+    source ~/.bashrc
+fi
+
+# Get MITgcm code, if needed
+if [ ! -d "$modelpath/../MITgcm/install_dngoldberg" ]; then
+    cd $modelpath/../MITgcm
+    source install_dngoldberg.sh
+    cd $modelpath
+fi
+
+# Create build directory, if needed
+cd $modelpath
+if [ ! -d "build" ]; then mkdir build; fi
+cd build
+
+#create MITgcm makefile for this run, if needed
+if [ ! -f Makefile ]; then
+    if [ $hostname == "pleiades" ]; then 
+	$modelpath/../MITgcm/install_dngoldberg/tools/genmake2 -of $SLR_DIR/models/ice-ocean/configs/linux_amd64_gfortran+mpi_ice_nas -mo $modelpath/../MITgcm/install_dngoldberg/verification/shelfice_remeshing/code -rd $modelpath/../MITgcm/install_dngoldberg
+    else
+	$modelpath/../MITgcm/install_dngoldberg/tools/genmake2 -mpi -mo $modelpath/../MITgcm/install_dngoldberg/verification/shelfice_remeshing/code -rd $modelpath/../MITgcm/install_dngoldberg
+    fi
+fi
+
+#create MITgcm code links for this run, if needed
+if [ ! -f BUILD_INFO.h ]; then
+    make depend
+fi
+
+make -j 4
Index: /issm/trunk-jpl/test/NightlyRun/test4003.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test4003.m	(revision 23883)
+++ /issm/trunk-jpl/test/NightlyRun/test4003.m	(revision 23884)
@@ -4,5 +4,4 @@
 %Script control parameters
 steps=[1 2 3 4 5 6 7 8 9 10 11 12];
-steps=[1 2 3 4];
 final_time=1/365;
 
@@ -136,42 +135,5 @@
 % {{{ BuildMITgcm: 
 if perform(org,'BuildMITgcm'),
-
-    %load data: 
-    loaddata(org,'Parameters');
-
-    %specify computational grid in SIZE.h
-    if ~exist('../MITgcm/code/SIZE.h')
-        fidi=fopen('../MITgcm/code/SIZE.h.bak','r');
-        fido=fopen('../MITgcm/code/SIZE.h','w');
-        tline = fgetl(fidi);
-        fprintf(fido,'%s\n',tline);
-        while 1
-            tline = fgetl(fidi);
-            if ~ischar(tline), break, end
-            %do the change here: 
-            if strcmpi(tline,'     &           sNx =  20,'),
-                fprintf(fido,'%s%i%s\n','     &           sNx =  ',round(Nx/nPx),',');
-                continue;
-            end
-            if strcmpi(tline,'     &           sNy =  20,'),
-                fprintf(fido,'%s%i%s\n','     &           sNy =  ',round(Ny/nPy),',');
-                continue;
-            end
-            if strcmpi(tline,'     &           nPx =   1,'),
-                fprintf(fido,'%s%i%s\n','     &           nPx = ',nPx,',');
-                continue;
-            end
-            if strcmpi(tline,'     &           nPy =   2,'),
-                fprintf(fido,'%s%i%s\n','     &           nPy = ',nPy,',');
-                continue;
-            end
-            fprintf(fido,'%s\n',tline);
-        end
-        %close  files
-        fclose(fidi);
-        fclose(fido);
-    end
-
-    system(['../MITgcm/build.sh generic ' pwd '/../MITgcm']);
+    system(['../MITgcm/build_4003.sh generic ' pwd '/../MITgcm']);
 end
 % }}}
@@ -179,13 +141,4 @@
 % {{{ RunUncoupledMITgcm: 
 if perform(org,'RunUncoupledMITgcm'),
-
-    %load data: 
-    loaddata(org,'Parameters');
-    loaddata(org,'Bathymetry');
-    loaddata(org,'IceSheetGeometry');
-	 endtime = round(MITgcmDeltaT * ...
-		 floor(time_step*y2s*async_step_MITgcm_multiplier/MITgcmDeltaT));
-
-    % {{{ prepare MITgcm 
     % rename previous run directory and create new one
     if exist ('run.old')
@@ -197,173 +150,7 @@
     !\mkdir run
     !\cp ../MITgcm/build/mitgcmuv run
-    !\cp ../MITgcm/input/* run
-    !\cp ../MITgcm/input/eedata_uncoupled run/eedata
-    
-    %load data: 
-    loaddata(org,'Parameters');
-
-    % initial salinity
-    S=iniSalt*ones(Nx,Ny,Nz);
-    writebin('run/Salt.bin',S);
-    
-    % initial temperature
-    T=iniTheta*ones(Nx,Ny,Nz);
-    writebin('run/Theta.bin',T);
-    
-    % initial velocity
-    Z=zeros(Nx,Ny,Nz);
-    writebin('run/Uvel.bin',Z);
-    writebin('run/Vvel.bin',Z);
-    
-    % initial sea surface height
-    Z=zeros(Nx,Ny);
-    writebin('run/Etan.bin',Z);
-
-    % salinity boundary conditions
-    S=obcSalt*ones(Ny,Nz);
-    thk=delZ*ones(Nz,1);
-    bot=cumsum(thk);
-    ik=find(bot<=mlDepth);
-    S(:,ik)=mlSalt;
-    writebin('run/OBs.bin',S);
-
-    % temperature boundary conditions
-    T=obcTheta*ones(Ny,Nz);
-    T(:,ik)=mlTheta;
-    writebin('run/OBt.bin',T);
-
-    % zonal velocity boundary conditions
-    U=obcUvel*ones(Ny,Nz);
-    writebin('run/OBu.bin',U);
-    
-    % zero boundary conditions
-    Z=zeros(Ny,Nz);
-    writebin('run/zeros.bin',Z);
-
-    % build parameter file data.obcs
-    fidi=fopen('../MITgcm/input/data.obcs','r');
-    fido=fopen('run/data.obcs','w');
-    tline = fgetl(fidi);
-    fprintf(fido,'%s\n',tline);
-    while 1
-        tline = fgetl(fidi);
-        if ~ischar(tline), break, end
-        %do the change here: 
-        if strcmpi(tline,' OB_Iwest = 40*1,'),
-            fprintf(fido,'%s%i%s\n',' OB_Iwest = ',Ny,'*1,');
-            continue;
-        end
-        if strcmpi(tline,' OB_Ieast = 40*-1,'),
-            fprintf(fido,'%s%i%s\n',' OB_Ieast = ',Ny,'*-1,');
-            continue;
-        end
-        fprintf(fido,'%s\n',tline);
-    end
-    %close  files
-    fclose(fidi);
-    fclose(fido);
-
-    %save bathymetry and bedrock in run directory
-    writebin('run/bathymetry.bin',bathymetry);
-    writebin('run/icetopo.bin',draft);
-    % }}}
-
-    %start looping:  
-    for t=start_time:time_step:final_time,
-        disp(['Year: ' num2str(t)])
-        % {{{ generate MITgcm parameter file data 
-        fidi=fopen('../MITgcm/input/data','r');
-        fido=fopen('run/data','w');
-        tline = fgetl(fidi);
-        fprintf(fido,'%s\n',tline);
-        while 1
-            tline = fgetl(fidi);
-            if ~ischar(tline), break, end
-            %do the change here: 
-            if strcmpi(tline,' xgOrigin = 0.0,'),
-                fprintf(fido,'%s%i%s\n',' xgOrigin = ',xgOrigin,',');
-                continue;
-            end
-            if strcmpi(tline,' ygOrigin = -80.0,'),
-                fprintf(fido,'%s%i%s\n',' ygOrigin = ',ygOrigin,',');
-                continue;
-            end
-            if strcmpi(tline,' delX = 20*0.25,'),
-                fprintf(fido,'%s%i*%g%s\n',' delX = ',Nx,dLong,',');
-                continue;
-            end
-            if strcmpi(tline,' delY = 20*0.25,'),
-                fprintf(fido,'%s%i*%g%s\n',' delY = ',Ny,dLat,',');
-                continue;
-            end
-            if strcmpi(tline,' delZ = 30*30.0,'),
-                fprintf(fido,'%s%i*%g%s\n',' delZ = ',Nz,delZ,',');
-                continue;
-            end
-            if strcmpi(tline,' endTime=2592000.,'),
-                fprintf(fido,'%s%i%s\n',' endTime= ',endtime,',');
-                continue;
-            end
-            if strcmpi(tline,' deltaT=1200.0,'),
-                fprintf(fido,'%s%i%s\n',' deltaT= ',MITgcmDeltaT,',');
-                continue;
-            end
-            if strcmpi(tline,' pChkptFreq=2592000.,'),
-                fprintf(fido,'%s%i%s\n',' pChkptFreq= ',endtime,',');
-                continue;
-            end
-            if strcmpi(tline,' taveFreq=2592000.,'),
-                fprintf(fido,'%s%i%s\n',' taveFreq= ',endtime,',');
-                continue;
-            end
-            if strcmpi(tline,' rhoConst=1030.,'),
-                fprintf(fido,'%s%i%s\n',' rhoConst= ',rho_water,',');
-                continue;
-            end
-            if strcmpi(tline,' rhoNil=1030.,'),
-                fprintf(fido,'%s%i%s\n',' rhoNil= ',rho_water,',');
-                continue;
-            end
-            fprintf(fido,'%s\n',tline);
-        end
-        %close  files
-        fclose(fidi);
-        fclose(fido);
-        % }}}
-        % {{{ generate initial MITgcm conditions
-
-        ds=round(endtime/MITgcmDeltaT);
-        if t>start_time
-            % Read pickup file
-            fnm=['run/pickup.' myint2str(ds,10) '.data'];
-            U=readbin(fnm,[Nx Ny Nz],1,'real*8',0);
-            V=readbin(fnm,[Nx Ny Nz],1,'real*8',1);
-            T=readbin(fnm,[Nx Ny Nz],1,'real*8',2);
-            S=readbin(fnm,[Nx Ny Nz],1,'real*8',3);
-            E=readbin(fnm,[Nx Ny],1,'real*8',8*Nz);
-            writebin('run/Salt.bin' ,S);
-            writebin('run/Theta.bin',T);
-            writebin('run/Uvel.bin' ,U);
-            writebin('run/Vvel.bin' ,V);
-            writebin('run/Etan.bin' ,E);
-        end
-
-        % }}}
-        % {{{ system call to run MITgcm
-        cd run
-        eval(['!mpirun -np ' int2str(nPx*nPy) ' ./mitgcmuv']);
-        ts=round((t+time_step)*y2s/MITgcmDeltaT);
-        eval(['!\mv STDERR.0000 STDERR_' myint2str(ts,10) '.data'])
-        eval(['!\mv STDOUT.0000 STDOUT_' myint2str(ts,10) '.data'])
-        eval(['!\cp hFacC.data hFacC_' myint2str(ts,10) '.data'])
-        eval(['!\cp icetopo.bin icetopo_' myint2str(ts,10) '.data'])
-        for fld={'S','T','U','V','Eta', ...
-                 'SHICE_heatFluxtave','SHICE_fwFluxtave'}
-            eval(['!\mv ' fld{1} '.' myint2str(ds,10) '.data ' ...
-                  fld{1} '_' myint2str(ts,10) '.data'])
-        end
-        cd ..
-        % }}}
-    end
+    !\cp ../MITgcm/install_dngoldberg/verification/shelfice_remeshing/input/* run
+    cd run
+    eval(['!mpirun -np ' int2str(nPx*nPy) ' ./mitgcmuv']);
 end
 % }}}
@@ -1016,43 +803,2 @@
 end
 % }}}
-
-%Fields and tolerances to track changes
-fnm=['run/SHICE_fwFluxtave.0000000006.data'];
-melting_rate_1=readbin(fnm,[Nx Ny]);
-fnm=['run/SHICE_fwFluxtave.0000000012.data'];
-melting_rate_2=readbin(fnm,[Nx Ny]);
-fnm=['run/SHICE_fwFluxtave.0000000018.data'];
-melting_rate_3=readbin(fnm,[Nx Ny]);
-fnm=['run/SHICE_fwFluxtave.0000000024.data'];
-melting_rate_4=readbin(fnm,[Nx Ny]);
-field_names     ={'Base1','Melting1','Vx2','Vy2','Thickness2','Base2','MaskGroundediceLevelset2','FloatingiceMeltingRate2',...
-	'Melting2','Vx3','Vy3','Thickness3','Base3','MaskGroundediceLevelset3','FloatingiceMeltingRate3',...
-	'Melting3','Vx4','Vy4','Thickness4','Base4','MaskGroundediceLevelset4','FloatingiceMeltingRate4','Melting4'};
-field_tolerances={2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
-	1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13,...
-	1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13 };
-field_values={...
-	(md.results.TransientSolution(1).Base),...
-	(melting_rate_1(:)),...
-	(md.results.TransientSolution(2).Vx),...
-	(md.results.TransientSolution(2).Vy),...
-	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).Base),...
-	(md.results.TransientSolution(2).MaskGroundediceLevelset),...
-	(md.results.TransientSolution(2).BasalforcingsFloatingiceMeltingRate),...
-	(melting_rate_2(:)),...
-	(md.results.TransientSolution(3).Vx),...
-	(md.results.TransientSolution(3).Vy),...
-	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).Base),...
-	(md.results.TransientSolution(3).MaskGroundediceLevelset),...
-	(md.results.TransientSolution(3).BasalforcingsFloatingiceMeltingRate),...
-	(melting_rate_3(:)),...
-	(md.results.TransientSolution(4).Vx),...
-	(md.results.TransientSolution(4).Vy),...
-	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).Base),...
-	(md.results.TransientSolution(4).MaskGroundediceLevelset),...
-	(md.results.TransientSolution(4).BasalforcingsFloatingiceMeltingRate),...
-	(melting_rate_4(:)),...
-	};
