Index: sm/trunk/src/m/utils/Miscellaneous/find_option.m
===================================================================
--- /issm/trunk/src/m/utils/Miscellaneous/find_option.m	(revision 2171)
+++ 	(revision )
@@ -1,41 +1,0 @@
-function  value=find_option(options,field)
-%FINDARG - find argument associated to a field in a list
-%
-%   This function parses through an argument list (typically varargin in a routine)
-%   looking for a character array equal to field. Once this is found, we return the 
-%   next value in the varargin (if possible). 
-%   Because field might appear several times in the argument list, we return a structure 
-%   holding all these values. 
-%   Note that all comparisons to field value are case independent.
-%
-%   Usage:
-%      vals=find_option(options,field)
-%
-%   See also: RECOVER_OPTIONS
-
-%some argument checking: 
-if ((nargin~=2) | (nargout~=1)),
-	help find_option;
-	error('find_option error message');
-end
-
-if ~ischar(field),
-	error('find_option error message: field should be a string');
-end
-
-if ~iscell(options),
-	error('find_option error message: argument list should be a cell array.');
-end
-
-if mod(size(options,2),2),
-	error('find_option error message: options should be a cell of 2 columns')
-end
-
-%Recover option
-value=[];
-for i=1:size(options,1),
-	if strcmpi(options{i,1},field)
-		value=options{i,2};
-		return
-	end
-end
Index: sm/trunk/src/m/utils/Miscellaneous/recover_options.m
===================================================================
--- /issm/trunk/src/m/utils/Miscellaneous/recover_options.m	(revision 2171)
+++ 	(revision )
@@ -1,22 +1,0 @@
-function options=recover_options(varargin)
-%RECOVER_OPTIONS - recover options from a list of inputs
-%
-%   Usage:
-%      options=recover_solve_options(varargin);
-%
-%   See also: RECOVER_PLOT_OPTIONS, MESHYAMS,SOLVE
-
-%initialize options.
-options=cell(0,2);
-
-%make sure length(varargin) is even, ie options come in pairs.
-if mod(length(varargin),2),
-	error('recover_options error message: an even number of options is necessary');
-end
-
-%go through varargin, extract options 
-for i=1:length(varargin)/2,
-
-	options(end+1,:)={varargin{2*i-1} varargin{2*i}};
-
-end
Index: /issm/trunk/src/m/utils/Nightly/nightlyrun.m
===================================================================
--- /issm/trunk/src/m/utils/Nightly/nightlyrun.m	(revision 2171)
+++ /issm/trunk/src/m/utils/Nightly/nightlyrun.m	(revision 2172)
@@ -3,8 +3,14 @@
 %
 %   This function goes to each directory of 'tests/Verifications' and
-%   launch the nightly tests. A specific package can be given in input
-%   only this package will be tested
-%   if last arguments are a pair of numbers, they represent the node rank and the number of 
-%   cpus being used for the nightly run.
+%   launch the nightly tests. A list of option can be given in input:
+%     o analysis_type: cell containing all the analysis that the user wants to run
+%     o sub_analysis_type: cell containing all the sub_analysis that the user wants to run
+%     o qmu: 1 for qmu analysis only, 0 for no qmu analysis
+%     o control: 1 for control only, 0 for no control
+%     o control_fit: cell containing all the fits the user wants to run
+%     o parallel: 1 for parallel only, 0 for serial only
+%     o procedure: 'check' or 'update' to update archives
+%     o rank: the node rank
+%     o numproc: number of cpus being used
 %
 %  Usage:
@@ -13,8 +19,7 @@
 %   Example:
 %      nightlyrun;
-%      nightlyrun({'ice'});
-%      nightlyrun({'cielo_serial','cielo_parallel'});
-%      nightlyrun({'ice'},{'prognostic','diagnostic'});
-%      nightlyrun({'ice'},{'prognostic','diagnostic'},1,3);
+%      nightlyrun('analysis_type',{'prognostic','diagnostic'});
+%      nightlyrun('procedure','update','analysis_type',{'prognostic','diagnostic'},'parallel',0);
+%      nightlyrun('analysis_type',{'prognostic','diagnostic'},'parallel',1,'rank',1,'numproc',3);
 
 %use ISSM_DIR generated by startup.m
@@ -24,9 +29,9 @@
 options=recover_options(varargin{:});
 
-%check numproc and rank options
+%check some options
 rank=find_option(options,'rank');
 if isempty(rank), rank=1; end
-rank=find_option(options,'numproc');
-if isempty(rank), numproc=1; end
+procedure=find_option(options,'procedure');
+if isempty(procedure), procedure='check'; end
 
 %Go to Test directory
@@ -41,8 +46,5 @@
 for j=1:numel(list),
 	eval(['cd ' list{j}]);
-	runme(varargin{:});
+	runme('procedure',procedure,varargin{:});
 	cd ..
 end
-
-%display needed by nightlyrun.sh to check that no error popped up.
-disp('NIGHTLYRUNTERMINATEDCORRECTLY');
Index: /issm/trunk/src/m/utils/Nightly/runme.m
===================================================================
--- /issm/trunk/src/m/utils/Nightly/runme.m	(revision 2171)
+++ /issm/trunk/src/m/utils/Nightly/runme.m	(revision 2172)
@@ -7,20 +7,17 @@
 %   Examples:
 %      runme;
-%      runme({'ice'});
-%      runme({'ice','cielo_serial'},{'diagnostic'});
-%      md=runme({'cielo_parallel'});
+%      runme('analysis_type',{'prognostic','diagnostic'});
+%      runme('analysis_type',{'prognostic','diagnostic'},'parallel',0);
+%      runme('analysis_type',{'prognostic','diagnostic'},'parallel',1);
 %
-%   See Also: UPDATEARCHIVE
+%   See Also: NIGHTLYRUN UPDATEARCHIVE
 
 % This file can be run to check that the current version of issm is giving 
-% coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry 
-% is square. Just run this file in Matlab, with a properly setup ISSM code. 
+% coherent results.
 % The results of this test will indicate if there is a difference between current computations 
 % and archived results.
 
 % Errors  between archived results and the current version will get flagged if they are not within 
-% a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this 
-% tolerance should be lowered (for example, if you are running single precision compilers?), feel 
-% free to tweak the tolerance variable.
+% a certain tolerance. 
 
 %check arguments
@@ -31,5 +28,5 @@
 
 %call runme_core
-md=runme_core('check',varargin{:});
+md=runme_core('procedure','check',varargin{:});
 
 %output model md if requested
Index: /issm/trunk/src/m/utils/Nightly/runme_core.m
===================================================================
--- /issm/trunk/src/m/utils/Nightly/runme_core.m	(revision 2171)
+++ /issm/trunk/src/m/utils/Nightly/runme_core.m	(revision 2172)
@@ -1,7 +1,7 @@
-function md=runme_core(testtype,varargin)
+function md=runme_core(varargin)
 %RUNME_CORE - test deck for ISSM nightly runs
 %
 %   Usage:
-%      md=runme_core(varargin,testtype);
+%      md=runme_core(varargin);
 %
 %   Examples:
@@ -11,5 +11,5 @@
 
 % This file can be run to check that the current version of issm is giving 
-% coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry 
+% coherent results.
 % is square. Just run this file in Matlab, with a properly setup ISSM code. 
 % The results of this test will indicate if there is a difference between current computations 
@@ -17,7 +17,5 @@
 
 % Errors  between archived results and the current version will get flagged if they are not within 
-% a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this 
-% tolerance should be lowered (for example, if you are running single precision compilers?), feel 
-% free to tweak the tolerance variable.
+% a certain tolerance.
 
 %recover options
@@ -71,4 +69,28 @@
 	end
 
+	%CHECK qmu
+	qmu_arg=find_option(options,'qmu');
+	if ~isempty(qmu_arg),
+		if qmu~=qmu_arg,
+			continue
+		end
+	end
+
+	%CHECK control
+	control_arg=find_option(options,'control');
+	if ~isempty(control_arg),
+		if control~=control_arg,
+			continue
+		end
+	end
+
+	%CHECK control_fit
+	control_fit_arg=find_option(options,'control_fit');
+	if ~isempty(control_fit_arg),
+		if ~ismember(control_fit,control_fit_arg)
+			continue
+		end
+	end
+
 	%CHECK parallel
 	parallel_arg=find_option(options,'parallel');
@@ -77,4 +99,11 @@
 			continue
 		end
+	end
+
+	%CHECK procedure
+	procedure=find_option(options,'procedure');
+	if isempty(procedure),
+		disp('runme_core warning: no procedure found, defaulting to test checking')
+		procedure='check';
 	end
 
Index: /issm/trunk/src/m/utils/Nightly/updatearchive.m
===================================================================
--- /issm/trunk/src/m/utils/Nightly/updatearchive.m	(revision 2171)
+++ /issm/trunk/src/m/utils/Nightly/updatearchive.m	(revision 2172)
@@ -1,4 +1,4 @@
 function varargout=updatearchive(varargin)
-%RUNME - test deck for ISSM nightly runs
+%UPDATEARCHIVE - update test deck for ISSM nightly runs
 %
 %   Usage:
@@ -7,20 +7,15 @@
 %   Examples:
 %      updatearchive;
-%      updatearchive({'ice'});
-%      updatearchive({'ice','cielo_serial'},{'diagnostic'});
-%      md=updatearchive({'cielo_parallel'});
+%      updatearchive('analysis_type',{'prognostic','diagnostic'});
+%      updatearchive('analysis_type',{'prognostic','diagnostic'},'parallel',0);
+%      updatearchive('analysis_type',{'prognostic','diagnostic'},'parallel',1);
 %
-%   See Also: UPDATEARCHIVE
+%   See Also: NIGHTLYRUN RUNME
 
-% This file can be run to check that the current version of issm is giving 
-% coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry 
-% is square. Just run this file in Matlab, with a properly setup ISSM code. 
+% This file can be run to update that the current version of issm is giving 
+% coherent results. 
+% Just run this file in Matlab, with a properly setup ISSM code. 
 % The results of this test will indicate if there is a difference between current computations 
 % and archived results.
-
-% Errors  between archived results and the current version will get flagged if they are not within 
-% a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this 
-% tolerance should be lowered (for example, if you are running single precision compilers?), feel 
-% free to tweak the tolerance variable.
 
 %check arguments
@@ -31,5 +26,5 @@
 
 %call updatearchive_core
-md=runme_core('update',varargin{:});
+md=runme_core('procedure','update',varargin{:});
 
 %output model md if requested
Index: /issm/trunk/src/m/utils/OptionsList/find_option.m
===================================================================
--- /issm/trunk/src/m/utils/OptionsList/find_option.m	(revision 2172)
+++ /issm/trunk/src/m/utils/OptionsList/find_option.m	(revision 2172)
@@ -0,0 +1,41 @@
+function  value=find_option(options,field)
+%FINDARG - find argument associated to a field in a list
+%
+%   This function parses through an argument list (typically varargin in a routine)
+%   looking for a character array equal to field. Once this is found, we return the 
+%   next value in the varargin (if possible). 
+%   Because field might appear several times in the argument list, we return a structure 
+%   holding all these values. 
+%   Note that all comparisons to field value are case independent.
+%
+%   Usage:
+%      vals=find_option(options,field)
+%
+%   See also: RECOVER_OPTIONS
+
+%some argument checking: 
+if ((nargin~=2) | (nargout~=1)),
+	help find_option;
+	error('find_option error message');
+end
+
+if ~ischar(field),
+	error('find_option error message: field should be a string');
+end
+
+if ~iscell(options),
+	error('find_option error message: argument list should be a cell array.');
+end
+
+if mod(size(options,2),2),
+	error('find_option error message: options should be a cell of 2 columns')
+end
+
+%Recover option
+value=[];
+for i=1:size(options,1),
+	if strcmpi(options{i,1},field)
+		value=options{i,2};
+		return
+	end
+end
Index: /issm/trunk/src/m/utils/OptionsList/recover_options.m
===================================================================
--- /issm/trunk/src/m/utils/OptionsList/recover_options.m	(revision 2172)
+++ /issm/trunk/src/m/utils/OptionsList/recover_options.m	(revision 2172)
@@ -0,0 +1,22 @@
+function options=recover_options(varargin)
+%RECOVER_OPTIONS - recover options from a list of inputs
+%
+%   Usage:
+%      options=recover_solve_options(varargin);
+%
+%   See also: RECOVER_PLOT_OPTIONS, MESHYAMS,SOLVE
+
+%initialize options.
+options=cell(0,2);
+
+%make sure length(varargin) is even, ie options come in pairs.
+if mod(length(varargin),2),
+	error('recover_options error message: an even number of options is necessary');
+end
+
+%go through varargin, extract options 
+for i=1:length(varargin)/2,
+
+	options(end+1,:)={varargin{2*i-1} varargin{2*i}};
+
+end
