Index: /issm/trunk/src/ad/validation.sh
===================================================================
--- /issm/trunk/src/ad/validation.sh	(revision 9816)
+++ /issm/trunk/src/ad/validation.sh	(revision 9816)
@@ -0,0 +1,9 @@
+#!/bin/bash
+#This is a quick validation test for new ADIC2 capability development
+#Just run it, it will fire up matlab, which will create a binary file
+#launch issm.exe using the binary file, post-process the output binary 
+#and compare it against an archive result.
+
+cd validation
+matlab -nojvm -r "addpath $ISSM_TIER/; startup;" < MatlabScript/validation.m
+cd ..
Index: /issm/trunk/src/ad/validation/Exp/Square.exp
===================================================================
--- /issm/trunk/src/ad/validation/Exp/Square.exp	(revision 9816)
+++ /issm/trunk/src/ad/validation/Exp/Square.exp	(revision 9816)
@@ -0,0 +1,10 @@
+## Name:domainoutline
+## Icon:0
+# Points Count  Value
+5 1.
+# X pos Y pos
+0 0
+1000000 0
+1000000 1000000
+0 1000000
+0 0
Index: /issm/trunk/src/ad/validation/MatlabScript/validation.m
===================================================================
--- /issm/trunk/src/ad/validation/MatlabScript/validation.m	(revision 9816)
+++ /issm/trunk/src/ad/validation/MatlabScript/validation.m	(revision 9816)
@@ -0,0 +1,25 @@
+tolerance=1e-13;
+
+md=setmesh(model,'Exp/Square.exp',150000);
+md=setmask(md,'all','');
+md=parameterize(md,'Par/SquareShelfConstrained.par');
+md=setflowequation(md,'macayeal','all');
+md.cluster=generic('name',oshostname(),'np',3);
+
+md.autodiff.analysis=true;
+md.autodiff.forward=true;
+md.verbose=verbose('solution',true);
+
+md=solve(md,PrognosticSolutionEnum);
+
+s=load('Archive/archive.mat'); h0=s.Archive110_field1;
+h=PatchToVec(md.results.PrognosticSolution.Thickness);
+
+error_diff=full(max(abs(h-h0))/(max(abs(h0))+eps));
+
+if (error_diff>tolerance);
+	disp(sprintf(['\n\n\nERROR   difference: %-7.2g > %7.2g \n\n\n'],error_diff,tolerance));
+else
+	disp(sprintf(['\n\n\nSUCCESS difference: %-7.2g < %7.2g \n\n\n'],error_diff,tolerance));
+end
+
Index: /issm/trunk/src/ad/validation/Par/SquareShelfConstrained.par
===================================================================
--- /issm/trunk/src/ad/validation/Par/SquareShelfConstrained.par	(revision 9816)
+++ /issm/trunk/src/ad/validation/Par/SquareShelfConstrained.par	(revision 9816)
@@ -0,0 +1,54 @@
+%Start defining model parameters here
+
+%Geometry
+hmin=300;
+hmax=1000;
+ymin=min(md.mesh.y);
+ymax=max(md.mesh.y);
+md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin);
+md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
+md.geometry.surface=md.geometry.bed+md.geometry.thickness;
+
+%Initial velocity 
+load('Data/SquareShelfConstrained.data','-mat');
+md.initialization.vx=InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y);
+md.initialization.vy=InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y);
+clear vx vy x y index;
+md.initialization.vz=zeros(md.mesh.numberofvertices,1);
+md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
+
+%Materials
+md.initialization.temperature=(273-20)*ones(md.mesh.numberofvertices,1);
+md.materials.rheology_B=paterson(md.initialization.temperature);
+md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
+
+%Surface mass balance and basal melting
+md.surfaceforcings.mass_balance=10*ones(md.mesh.numberofvertices,1);
+md.basalforcings.melting_rate=5*ones(md.mesh.numberofvertices,1);
+
+%Friction
+pos=find(md.mask.elementonfloatingice);
+md.friction.coefficient=20*ones(md.mesh.numberofvertices,1);
+md.friction.coefficient(md.mesh.elements(pos,:))=0;
+md.friction.p=ones(md.mesh.numberofelements,1);
+md.friction.q=ones(md.mesh.numberofelements,1);
+
+%Numerical parameters
+md.diagnostic.viscosity_overshoot=0.0;
+md.prognostic.stabilization=1;
+md.thermal.stabilization=1;
+md.verbose=verbose(0);
+md.settings.waitonlock=30;
+md.diagnostic.restol=0.05;
+md.diagnostic.reltol=0.05;
+md.steadystate.reltol=0.05;
+md.diagnostic.abstol=NaN;
+md.timestepping.time_step=1;
+md.timestepping.final_time=3;
+
+%Deal with boundary conditions:
+md=SetIceShelfBC(md);
+
+%Change name so that no test have the same name
+A=dbstack;
+if (length(A)>2), md.miscellaneous.name=A(3).file(1:end-2); end
