Index: ../trunk-jpl/src/wrappers/M1qn3/M1qn3.cpp
===================================================================
--- ../trunk-jpl/src/wrappers/M1qn3/M1qn3.cpp	(revision 19023)
+++ ../trunk-jpl/src/wrappers/M1qn3/M1qn3.cpp	(revision 19024)
@@ -4,7 +4,7 @@
 
 #include "./M1qn3.h"
 
-#ifndef _HAVE_M1QN3_
+#ifdef _HAVE_M1QN3_
 /*m1qn3 prototypes {{{*/
 extern "C" void *ctonbe_; // DIS mode : Conversion
 extern "C" void *ctcabe_; // DIS mode : Conversion
@@ -37,7 +37,7 @@
 #endif
 WRAPPER(M1qn3){
 
-#ifndef _HAVE_M1QN3_
+#ifdef _HAVE_M1QN3_
 	/*input: */
 	double* Xs=NULL;
 	double* Gs=NULL;
@@ -160,7 +160,7 @@
 }
 
 
-#ifndef _HAVE_M1QN3_
+#ifdef _HAVE_M1QN3_
 void fakesimul(long* indic,long* n,double* X,double* pf,double* G,long izs[1],float rzs[1],void* dzs){
 
 	Data* ds=(Data*)dzs;
Index: ../trunk-jpl/src/m/classes/calving.py
===================================================================
--- ../trunk-jpl/src/m/classes/calving.py	(revision 19023)
+++ ../trunk-jpl/src/m/classes/calving.py	(revision 19024)
@@ -13,15 +13,18 @@
 	"""
 
 	def __init__(self): # {{{
-		self.calvingrate            = float('NaN')
-		self.meltingrate            = float('NaN')
 
+		self.stabilization = 0
+		self.calvingrate   = float('NaN')
+		self.meltingrate   = float('NaN')
+
 		#set defaults
 		self.setdefaultparameters()
 
 		#}}}
 	def __repr__(self): # {{{
 		string='   Calving parameters:'
+		string="%s\n%s"%(string,fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding'))
 		string="%s\n%s"%(string,fielddisplay(self,'calvingrate','calving rate at given location [m/a]'))
 		string="%s\n%s"%(string,fielddisplay(self,'meltingrate','melting rate at given location [m/a]'))
 
@@ -29,6 +32,9 @@
 		#}}}
 	def setdefaultparameters(self): # {{{
 
+		#stabilization = 2 by default
+		self.stabilization = 2
+
 		return self
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
@@ -37,6 +43,7 @@
 		if (solution!=TransientSolutionEnum()) or (not md.transient.iscalving):
 			return md
 
+		md = checkfield(md,'fieldname','calving.stabilization','values',[0,1,2]);
 		md = checkfield(md,'fieldname','calving.calvingrate','>=',0,'forcing',1,'NaN',1);
 		md = checkfield(md,'fieldname','calving.meltingrate','>=',0,'forcing',1,'NaN',1);
 
@@ -47,6 +54,7 @@
 		yts=365.*24.*3600.
 
 		WriteData(fid,'enum',CalvingLawEnum(),'data',DefaultCalvingEnum(),'format','Integer');
+		WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
 		WriteData(fid,'object',self,'fieldname','calvingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts)
 		WriteData(fid,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts)
 	# }}}
Index: ../trunk-jpl/src/m/classes/calvinglevermann.py
===================================================================
--- ../trunk-jpl/src/m/classes/calvinglevermann.py	(revision 19023)
+++ ../trunk-jpl/src/m/classes/calvinglevermann.py	(revision 19024)
@@ -13,8 +13,9 @@
 	"""
 
 	def __init__(self): # {{{
-		self.coeff       = float('NaN')
-		self.meltingrate = float('NaN')
+		self.stabilization = 0
+		self.coeff         = float('NaN')
+		self.meltingrate   = float('NaN')
 
 		#set defaults
 		self.setdefaultparameters()
@@ -22,6 +23,7 @@
 		#}}}
 	def __repr__(self): # {{{
 		string='   Calving Levermann parameters:'
+		string="%s\n%s"%(string,fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding'))
 		string="%s\n%s"%(string,fielddisplay(self,'coeff','proportionality coefficient in Levermann model'))
 		string="%s\n%s"%(string,fielddisplay(self,'meltingrate','melting rate at given location [m/a]'))
 
@@ -29,6 +31,9 @@
 		#}}}
 	def setdefaultparameters(self): # {{{
 
+		#stabilization = 2 by default
+		self.stabilization = 2
+
 		#Proportionality coefficient in Levermann model
 		self.coeff=2e13;
 	#}}}
@@ -38,6 +43,7 @@
 		if (solution!=TransientSolutionEnum()) or (not md.transient.iscalving):
 			return md
 
+		md = checkfield(md,'fieldname','calving.stabilization','values',[0,1,2]);
 		md = checkfield(md,'fieldname','calving.coeff','size',[md.mesh.numberofvertices],'>',0)
 		md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices],'>=',0)
 		return md
@@ -45,6 +51,7 @@
 	def marshall(self,md,fid):    # {{{
 		yts=365.*24.*3600.
 		WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingLevermannEnum(),'format','Integer');
+		WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
 		WriteData(fid,'enum',CalvinglevermannCoeffEnum(),'data',self.coeff,'format','DoubleMat','mattype',1)
 		WriteData(fid,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts)
 	# }}}
Index: ../trunk-jpl/src/m/classes/calving.m
===================================================================
--- ../trunk-jpl/src/m/classes/calving.m	(revision 19023)
+++ ../trunk-jpl/src/m/classes/calving.m	(revision 19024)
@@ -5,35 +5,10 @@
 
 classdef calving
 	properties (SetAccess=public) 
-		 calvingrate            = NaN;
-		 meltingrate            = NaN;
+		stabilization = 0;
+		calvingrate   = NaN;
+		meltingrate   = NaN;
 	end
-	methods (Static)
-		function obj = loadobj(obj) % {{{
-			% This function is directly called by matlab when a model object is
-			% loaded. If the input is a struct it is an old version of this class and
-			% old fields must be recovered (make sure they are in the deprecated
-			% model properties)
-
-			if verLessThan('matlab','7.9'),
-				disp('Warning: your matlab version is old and there is a risk that load does not work correctly');
-				disp('         if the model is not loaded correctly, rename temporarily loadobj so that matlab does not use it');
-
-				% This is a Matlab bug: all the fields of md have their default value
-				% Example of error message:
-				% Warning: Error loading an object of class 'model':
-				% Undefined function or method 'exist' for input arguments of type 'cell'
-				%
-				% This has been fixed in MATLAB 7.9 (R2009b) and later versions
-			end
-
-			if isstruct(obj)
-				disp('Recovering calving from older version');
-				objstruct = obj;
-				obj = structtoobj(calving(),objstruct);
-			end
-		end% }}}
-	end
 	methods
 		function obj = calving(varargin) % {{{
 			switch nargin
@@ -55,21 +30,28 @@
 		end % }}}
 		function obj = setdefaultparameters(obj) % {{{
 
+			%stabilization = 2 by default
+			obj.stabilization = 2;
+
 		end % }}}
 		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			%Early return
 			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+
+			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
 			md = checkfield(md,'fieldname','calving.calvingrate(1:md.mesh.numberofvertices,:)','>=',0,'forcing',1,'NaN',1);
 			md = checkfield(md,'fieldname','calving.meltingrate(1:md.mesh.numberofvertices,:)','>=',0,'forcing',1,'NaN',1);
 		end % }}}
 		function disp(obj) % {{{
 			disp(sprintf('   Calving parameters:'));
+			fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
 			fielddisplay(obj,'calvingrate','calving rate at given location [m/a]');
 			fielddisplay(obj,'meltingrate','melting rate at given location [m/a]');
 		end % }}}
 		function marshall(obj,md,fid) % {{{
 			yts=365.0*24.0*3600.0;
 			WriteData(fid,'enum',CalvingLawEnum(),'data',DefaultCalvingEnum(),'format','Integer');
+			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',obj.stabilization,'format','Integer');
 			WriteData(fid,'object',obj,'fieldname','calvingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
 			WriteData(fid,'object',obj,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
 		end % }}}
Index: ../trunk-jpl/src/m/classes/calvingpi.m
===================================================================
--- ../trunk-jpl/src/m/classes/calvingpi.m	(revision 19023)
+++ ../trunk-jpl/src/m/classes/calvingpi.m	(revision 19024)
@@ -5,8 +5,9 @@
 
 classdef calvingpi
 	properties (SetAccess=public) 
-		 coeff       = NaN;
-		 meltingrate = NaN;
+		stabilization = 0;
+		coeff         = NaN;
+		meltingrate   = NaN;
 	end
 	methods
 		function obj = calvingpi(varargin) % {{{
@@ -28,17 +29,24 @@
 			end
 		end % }}}
 		function obj = setdefaultparameters(obj) % {{{
+
+			%stabilization = 2 by default
+			obj.stabilization = 2;
+
 			%Proportionality coefficient in Pi model
 			obj.coeff=2e13;
 		end % }}}
 		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			%Early return
 			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+
+			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
 			md = checkfield(md,'fieldname','calving.coeff','>',0,'size',[md.mesh.numberofvertices 1]);
 			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices 1],'>=',0);
 		end % }}}
 		function disp(obj) % {{{
 			disp(sprintf('   Calving Pi parameters:'));
+			fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
 			fielddisplay(obj,'coeff','proportionality coefficient in Pi model');
 			fielddisplay(obj,'meltingrate','melting rate at given location [m/a]');
 
@@ -46,6 +54,7 @@
 		function marshall(obj,md,fid) % {{{
 			yts=365.0*24.0*3600.0;
 			WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingPiEnum(),'format','Integer');
+			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',obj.stabilization,'format','Integer');
 			WriteData(fid,'enum',CalvingpiCoeffEnum(),'data',obj.coeff,'format','DoubleMat','mattype',1);
 			WriteData(fid,'object',obj,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
 		end % }}}
Index: ../trunk-jpl/src/m/classes/calvinglevermann.m
===================================================================
--- ../trunk-jpl/src/m/classes/calvinglevermann.m	(revision 19023)
+++ ../trunk-jpl/src/m/classes/calvinglevermann.m	(revision 19024)
@@ -5,8 +5,9 @@
 
 classdef calvinglevermann
 	properties (SetAccess=public) 
-		 coeff       = NaN;
-		 meltingrate = NaN;
+		stabilization = 0;
+		coeff         = NaN;
+		meltingrate   = NaN;
 	end
 	methods
 		function obj = calvinglevermann(varargin) % {{{
@@ -28,17 +29,24 @@
 			end
 		end % }}}
 		function obj = setdefaultparameters(obj) % {{{
+
+			%stabilization = 2 by default
+			obj.stabilization = 2;
+
 			%Proportionality coefficient in Levermann model
 			obj.coeff=2e13;
 		end % }}}
 		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			%Early return
 			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+
+			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
 			md = checkfield(md,'fieldname','calving.coeff','>',0,'size',[md.mesh.numberofvertices 1]);
 			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices 1],'>=',0);
 		end % }}}
 		function disp(obj) % {{{
 			disp(sprintf('   Calving Levermann parameters:'));
+			fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
 			fielddisplay(obj,'coeff','proportionality coefficient in Levermann model');
 			fielddisplay(obj,'meltingrate','melting rate at given location [m/a]');
 
@@ -46,6 +54,7 @@
 		function marshall(obj,md,fid) % {{{
 			yts=365.0*24.0*3600.0;
 			WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingLevermannEnum(),'format','Integer');
+			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',obj.stabilization,'format','Integer');
 			WriteData(fid,'enum',CalvinglevermannCoeffEnum(),'data',obj.coeff,'format','DoubleMat','mattype',1);
 			WriteData(fid,'object',obj,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
 		end % }}}
