Index: /issm/trunk-jpl/test/MITgcm/build.sh
===================================================================
--- /issm/trunk-jpl/test/MITgcm/build.sh	(revision 18544)
+++ /issm/trunk-jpl/test/MITgcm/build.sh	(revision 18544)
@@ -0,0 +1,35 @@
+#!/bin/bash
+#This script compiles and links MITgcm
+
+#recover hostname and model path:
+hostname="$1"
+modelpath="$2"
+
+if [ -e ~/.bashrc ]; then
+	source ~/.bashrc
+fi
+
+# Clean up build directory
+cd $modelpath
+if [ ! -d "build" ]; then mkdir build; fi
+\rm -f build/*
+
+# Get MITgcm code, if needed
+if [ ! -d "$SLR_DIR/components/mitgcm/install" ]; then
+   cd $modelpath/../MITgcm
+   source install.sh
+   cd $modelpath
+fi
+
+#create MITgcm makefile and code links for this run
+cd build
+if [ ! -f Makefile ]; then
+
+	if [ $hostname == "pleiades" ]; then 
+		$SLR_DIR/components/mitgcm/install/tools/genmake2 -of $SLR_DIR/models/ice-ocean/configs/linux_amd64_gfortran+mpi_ice_nas -mo ../code -rd $SLR_DIR/components/mitgcm/install
+	else
+		$modelpath/../MITgcm/install/tools/genmake2 -mpi -mo $modelpath/../MITgcm/code -rd $modelpath/../MITgcm/install
+	fi
+    make depend
+fi
+make -j 8
Index: /issm/trunk-jpl/test/NightlyRun/test4001.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test4001.m	(revision 18543)
+++ /issm/trunk-jpl/test/NightlyRun/test4001.m	(revision 18544)
@@ -10,5 +10,5 @@
 
 presentdirectory=pwd; 
-addpath([pwd '/../MITgcm/tools']);
+addpath(recursivepath([pwd '/../MITgcm']));
 
 % {{{ Parameters: 
@@ -23,5 +23,5 @@
 	dLong=.25; %longitude grid spacing
 	dLat=.05; %latitude grid spacing
-        delZ=30; %thickness of vertical levels
+	delZ=30; %thickness of vertical levels
 	icefront_position_ratio=.75; 
 	ice_thickness=100;
@@ -29,14 +29,14 @@
 	rho_water=1028.14;
 	di=rho_ice/rho_water;
-        
-        % MITgcm initial and lateral boundary conditions
-        iniSalt  = 34.4; % initial salinity (PSU)
-        iniTheta = -1.9; % initial potential temperature (deg C)
-        obcSalt  = 34.4; % open boundary salinity (PSU)
-        obcTheta =  1.0; % open boundary potential temperature (deg C)
-        mlDepth  = 120.; % mixed layer depth (m)
-        mlSalt   = 33.4; % open boundary salinity (PSU)
-        mlTheta  = -1.9; % open boundary potential temperature (deg C)
-        obcUvel  = -0.1; % open boundary velocity (m/s)        
+
+	% MITgcm initial and lateral boundary conditions
+	iniSalt  = 34.4; % initial salinity (PSU)
+	iniTheta = -1.9; % initial potential temperature (deg C)
+	obcSalt  = 34.4; % open boundary salinity (PSU)
+	obcTheta =  1.0; % open boundary potential temperature (deg C)
+	mlDepth  = 120.; % mixed layer depth (m)
+	mlSalt   = 33.4; % open boundary salinity (PSU)
+	mlTheta  = -1.9; % open boundary potential temperature (deg C)
+	obcUvel  = -0.1; % open boundary velocity (m/s)        
 
 	MITgcmDeltaT=600; % MITgcm time step in seconds
@@ -46,6 +46,6 @@
 	start_time=0; % in decimal years
 	time_step=1/12; % coupling interval in decimal years
-        async_step_MITgcm_multiplier=1/30; % used to reduce run time for MItgcm
-        
+	async_step_MITgcm_multiplier=1/30; % used to reduce run time for MItgcm
+
 	% bedrock/bathymetry
 	hmax=1000;
@@ -55,13 +55,12 @@
 
 	% issm settings:
-	higherorder=0;
 	numlayers=10;
 
 	savedata(org, Nx, Ny, nPx, nPy, Nz, dLong, dLat, delZ, xgOrigin, ...
-                 ygOrigin, icefront_position_ratio, ice_thickness, rho_ice, ...
-                 rho_water, di, hmax, trough_depth, deltah, sea_level, ...
-                 iniSalt, iniTheta, obcSalt, obcTheta, mlDepth, mlSalt, ...
-                 mlTheta, obcUvel, start_time, time_step, MITgcmDeltaT, y2s,...
-                 higherorder,numlayers,async_step_MITgcm_multiplier);
+		ygOrigin, icefront_position_ratio, ice_thickness, rho_ice, ...
+		rho_water, di, hmax, trough_depth, deltah, sea_level, ...
+		iniSalt, iniTheta, obcSalt, obcTheta, mlDepth, mlSalt, ...
+		mlTheta, obcUvel, start_time, time_step, MITgcmDeltaT, y2s,...
+		numlayers,async_step_MITgcm_multiplier);
 end
 % }}}
@@ -167,5 +166,5 @@
     fclose(fido);
 
-	system('./build_mitgcm.sh generic');
+	 system(['../MITgcm/build.sh generic ' pwd]);
 end
 % }}}
@@ -177,6 +176,6 @@
     loaddata(org,'Bathymetry');
     loaddata(org,'IceSheetGeometry');
-    endtime = round(MITgcmDeltaT * ...
-     floor(time_step*y2s*async_step_MITgcm_multiplier/MITgcmDeltaT));
+	 endtime = round(MITgcmDeltaT * ...
+		 floor(time_step*y2s*async_step_MITgcm_multiplier/MITgcmDeltaT));
 
     % {{{ prepare MITgcm 
@@ -535,25 +534,4 @@
 end
 % }}}
-% {{{ Extrude: 
-if perform(org,'Extrude'),
-	
-	loaddata(org,'Parameters');
-	loaddata(org,'ParameterizeIce');
-
-	if higherorder,
-		md=extrude(md,numlayers,3);
-		md=setflowequation(md,'HO','all');
-
-		%water needs to be spc'd: 
-		pos=find(md.mask.ice_levelset>0); 
-		md.stressbalance.spcvx(pos)=0;
-		md.stressbalance.spcvy(pos)=0;
-		md.stressbalance.spcvz(pos)=0;
-		md.masstransport.spcthickness(pos)=0;
-	end
-
-	savemodel(org,md);
-end
-% }}}
 % {{{ RunUncoupledISSM: 
 if perform(org,'RunUncoupledISSM'),
@@ -598,6 +576,9 @@
         end
         !\mkdir run
+		  disp('-------------- file: test4001.m line: 578'); 
         !\cp ../MITgcm/build/mitgcmuv run
+		  disp('-------------- file: test4001.m line: 580'); 
         !\cp ../MITgcm/input/* run
+		  disp('-------------- file: test4001.m line: 582'); 
 
         %load data: 
