Index: /issm/trunk-jpl/src/c/classes/Elements/Element.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 17118)
@@ -151,4 +151,5 @@
 		virtual bool   IsOnBed()=0;
 		virtual bool   IsOnSurface()=0;
+		virtual bool   IsIceInElement()=0;
 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17118)
@@ -1256,5 +1256,5 @@
 /*FUNCTION Penta::ZeroLevelsetCoordinates{{{*/
 void Penta::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
-	/*Computeportion of the element that is grounded*/ 
+	/*Compute portion of the element that is grounded*/ 
 
 	int         normal_orientation=0;
@@ -1271,5 +1271,5 @@
 		s2=levelset[2]/(levelset[2]-levelset[0]);
 
-		if(levelset[2]>0.) normal_orientation=1;
+		if(levelset[2]<0.) normal_orientation=1; //orientation of quadrangle at base and top, depending on distribution of levelsetfunction
 		/*New point 1*/
 		xyz_zero[3*normal_orientation+0]=xyz_list[2*3+0]+s1*(xyz_list[1*3+0]-xyz_list[2*3+0]);
@@ -1297,5 +1297,5 @@
 		s2=levelset[0]/(levelset[0]-levelset[1]);
 
-		if(levelset[0]>0.) normal_orientation=1;
+		if(levelset[0]<0.) normal_orientation=1;
 		/*New point 1*/
 		xyz_zero[3*normal_orientation+0]=xyz_list[0*3+0]+s1*(xyz_list[2*3+0]-xyz_list[0*3+0]);
@@ -1323,5 +1323,5 @@
 		s2=levelset[1]/(levelset[1]-levelset[2]);
 
-		if(levelset[1]>0.) normal_orientation=1;
+		if(levelset[1]<0.) normal_orientation=1;
 		/*New point 0*/
 		xyz_zero[3*normal_orientation+0]=xyz_list[1*3+0]+s1*(xyz_list[0*3+0]-xyz_list[1*3+0]);
@@ -2068,6 +2068,6 @@
 }
 /*}}}*/
-/*FUNCTION Penta::NoIceInElement {{{*/
-bool   Penta::NoIceInElement(){
+/*FUNCTION Penta::IsIceInElement {{{*/
+bool   Penta::IsIceInElement(){
 
 	/*Get levelset*/
@@ -2075,9 +2075,9 @@
 	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
 
-	/*If the level set is >0, ice is present in this element*/
-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.) return false;
-
-	/*If the level set is awlays <=0, there is no ice here*/
-	return true;
+	/*If the level set one one of the nodes is <0, ice is present in this element*/
+	if(ls[0]<0. || ls[1]<0. || ls[2]<0.) 
+		return true;
+	else
+		return false;
 }
 /*}}}*/
@@ -2666,5 +2666,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Bail out if this element if:
@@ -3111,5 +3111,5 @@
 	/*If the level set is awlays <=0, there is no ice front here*/
 	iszerols = false;
-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
+	if(IsIceInElement()){
 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
 			iszerols = true;
@@ -3133,5 +3133,5 @@
 	IssmDouble xyz_list[NUMVERTICES][3];
 
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
@@ -3157,5 +3157,5 @@
 	IssmDouble xyz_list[NUMVERTICES][3];
 
-	if(NoIceInElement() || IsFloating() || !IsOnBed())return 0;
+	if(!IsIceInElement() || IsFloating() || !IsOnBed())return 0;
 
 	rho_ice=matpar->GetRhoIce();
@@ -3380,5 +3380,5 @@
 	rho_ice=matpar->GetRhoIce();
 
-	if(NoIceInElement() || !IsOnSurface()) return 0.;
+	if(!IsIceInElement() || !IsOnSurface()) return 0.;
 
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
@@ -3543,5 +3543,5 @@
 
 	/*If on water, skip grad (=0): */
-	if(NoIceInElement())return;
+	if(!IsIceInElement())return;
 					
 	/*First deal with ∂/∂alpha(KU-F)*/
@@ -3917,5 +3917,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Bail out if this element if:
@@ -3954,5 +3954,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Bail out if this element if:
@@ -3991,5 +3991,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Bail out if this element if:
@@ -4030,5 +4030,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Bail out if this element if:
@@ -4067,5 +4067,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Bail out if this element if:
@@ -4110,5 +4110,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 	_error_("Not implemented yet");
 
@@ -4126,5 +4126,5 @@
 
 	/*If on water, on shelf or not on bed, skip: */
-	if(NoIceInElement()|| IsFloating() || !IsOnBed()) return 0;
+	if(!IsIceInElement()|| IsFloating() || !IsOnBed()) return 0;
 
 	tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1
@@ -4141,5 +4141,5 @@
 
 	/*If on water, on shelf or not on bed, skip: */
-	if(NoIceInElement() || !IsOnBed()) return 0;
+	if(!IsIceInElement() || !IsOnBed()) return 0;
 
 	tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17118)
@@ -234,5 +234,5 @@
 		void           JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
-		bool           NoIceInElement(void); 
+		bool           IsIceInElement(void); 
 		Gauss*         NewGauss(void);
 		Gauss*         NewGauss(int order);
Index: /issm/trunk-jpl/src/c/classes/Elements/Seg.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17118)
@@ -114,5 +114,5 @@
 		void        NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		void        NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
-		bool        NoIceInElement(){_error_("not implemented yet");};
+		bool        IsIceInElement(){_error_("not implemented yet");};
 		void        NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17118)
@@ -812,5 +812,5 @@
 		s2=levelset[2]/(levelset[2]-levelset[0]);
 
-		if(levelset[2]>0.) normal_orientation=1;
+		if(levelset[2]<0.) normal_orientation=1; //orientation of quadrangle depending on distribution of levelsetfunction
 		/*New point 1*/
 		xyz_zero[3*normal_orientation+0]=xyz_list[2*3+0]+s1*(xyz_list[1*3+0]-xyz_list[2*3+0]);
@@ -828,5 +828,5 @@
 		s2=levelset[0]/(levelset[0]-levelset[1]);
 
-		if(levelset[0]>0.) normal_orientation=1;
+		if(levelset[0]<0.) normal_orientation=1;
 		/*New point 1*/
 		xyz_zero[3*normal_orientation+0]=xyz_list[0*3+0]+s1*(xyz_list[2*3+0]-xyz_list[0*3+0]);
@@ -844,5 +844,5 @@
 		s2=levelset[1]/(levelset[1]-levelset[2]);
 
-		if(levelset[1]>0.) normal_orientation=1;
+		if(levelset[1]<0.) normal_orientation=1;
 		/*New point 0*/
 		xyz_zero[3*normal_orientation+0]=xyz_list[1*3+0]+s1*(xyz_list[0*3+0]-xyz_list[1*3+0]);
@@ -1869,6 +1869,6 @@
 }
 /*}}}*/
-/*FUNCTION Tria::NoIceInElement {{{*/
-bool   Tria::NoIceInElement(){
+/*FUNCTION Tria::IsIceInElement {{{*/
+bool   Tria::IsIceInElement(){
 
 	/*Get levelset*/
@@ -1876,9 +1876,9 @@
 	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
 
-	/*If the level set is >0, ice is present in this element*/
-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.) return false;
-
-	/*If the level set is awlays <=0, there is no ice here*/
-	return true;
+	/*If the level set on one of the nodes is <0, ice is present in this element*/
+	if(ls[0]<0. || ls[1]<0. || ls[2]<0.) 
+		return true;
+	else
+		return false;
 }
 /*}}}*/
@@ -2264,5 +2264,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()){
+	if(!IsIceInElement()){
 		printf("no ice in element!\n");
 		return 0;
@@ -2503,5 +2503,5 @@
 	/*If the level set is awlays <0, there is no ice front here*/
 	iszerols= false;
-	if(ls[0]>0. || ls[1]>0. || ls[2]>0.){
+	if(IsIceInElement()){
 		if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]==0.)){
 			iszerols= true;
@@ -2560,5 +2560,5 @@
 	IssmDouble xyz_list[NUMVERTICES][3];
 
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*First get back the area of the base*/
@@ -2590,5 +2590,5 @@
 	IssmDouble xyz_list[NUMVERTICES][3];
 
-	if(NoIceInElement() || IsFloating())return 0;
+	if(!IsIceInElement() || IsFloating())return 0;
 
 	rho_ice=matpar->GetRhoIce();
@@ -2892,5 +2892,5 @@
 	rho_ice=matpar->GetRhoIce();
 
-   if(NoIceInElement())return 0;
+   if(!IsIceInElement())return 0;
 
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
@@ -2921,5 +2921,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -2959,5 +2959,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -3137,5 +3137,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()) return 0;
+	if(!IsIceInElement()) return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -3317,5 +3317,5 @@
 
 	/*If on water, grad = 0: */
-	if(NoIceInElement()) return;
+	if(!IsIceInElement()) return;
 
 	/*First deal with ∂/∂alpha(KU-F)*/
@@ -3902,5 +3902,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()) return 0;
+	if(!IsIceInElement()) return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -3941,5 +3941,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -4000,5 +4000,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -4059,5 +4059,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -4117,5 +4117,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -4176,5 +4176,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -4238,5 +4238,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()) return 0;
+	if(!IsIceInElement()) return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -4282,5 +4282,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()) return 0;
+	if(!IsIceInElement()) return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -4333,5 +4333,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()) return 0;
+	if(!IsIceInElement()) return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -4381,5 +4381,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement())return 0;
+	if(!IsIceInElement())return 0;
 
 	/*Retrieve all inputs we will be needing: */
@@ -4427,5 +4427,5 @@
 
 	/*If on water, return 0: */
-	if(NoIceInElement()) return 0;
+	if(!IsIceInElement()) return 0;
 
 	/*Retrieve all inputs we will be needing: */
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17118)
@@ -102,5 +102,5 @@
 		int         NumberofNodesVelocity(void);
 		int         NumberofNodesPressure(void);
-		bool        NoIceInElement();
+		bool        IsIceInElement();
 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
 		void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
Index: /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 17117)
+++ /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 17118)
@@ -476,5 +476,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	Tria*  tria=(Tria*)element;
-	if(tria->NoIceInElement()) return NULL;
+	if(!tria->IsIceInElement()) return NULL;
 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMNODES_INTERNAL,this->parameters);
 
@@ -540,5 +540,5 @@
 	ElementMatrix* Ke = NULL;
 	Tria*  tria=(Tria*)element;
-	if(tria->NoIceInElement()) return NULL;
+	if(!tria->IsIceInElement()) return NULL;
 
 	/*Retrieve all inputs and parameters*/
@@ -629,5 +629,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	Tria*  tria=(Tria*)element;
-	if(tria->NoIceInElement()) return NULL;
+	if(!tria->IsIceInElement()) return NULL;
 	ElementMatrix* Ke=new ElementMatrix(nodes,NUMNODES_INTERNAL,this->parameters);
 
@@ -692,5 +692,5 @@
 	ElementMatrix* Ke = NULL;
 	Tria*  tria=(Tria*)element;
-	if(tria->NoIceInElement()) return NULL;
+	if(!tria->IsIceInElement()) return NULL;
 
 	/*Retrieve all inputs and parameters*/
@@ -818,5 +818,5 @@
 	ElementVector* pe = NULL;
 	Tria*  tria=(Tria*)element;
-	if(tria->NoIceInElement()) return NULL;
+	if(!tria->IsIceInElement()) return NULL;
 
 	/*Retrieve all inputs and parameters*/
@@ -912,5 +912,5 @@
 	ElementVector* pe = NULL;
 	Tria*  tria=(Tria*)element;
-	if(tria->NoIceInElement()) return NULL;
+	if(!tria->IsIceInElement()) return NULL;
 
 	/*Retrieve all inputs and parameters*/
Index: /issm/trunk-jpl/src/m/parameterization/setmask.m
===================================================================
--- /issm/trunk-jpl/src/m/parameterization/setmask.m	(revision 17117)
+++ /issm/trunk-jpl/src/m/parameterization/setmask.m	(revision 17118)
@@ -42,5 +42,5 @@
 
 %level sets
-md.mask.ice_levelset=+1.*ones(md.mesh.numberofvertices,1);
+md.mask.ice_levelset=-1.*ones(md.mesh.numberofvertices,1);
 md.mask.groundedice_levelset=vertexongroundedice;
 md.mask.groundedice_levelset(find(vertexongroundedice==0.))=-1.;
Index: /issm/trunk-jpl/src/m/parameterization/setmask.py
===================================================================
--- /issm/trunk-jpl/src/m/parameterization/setmask.py	(revision 17117)
+++ /issm/trunk-jpl/src/m/parameterization/setmask.py	(revision 17118)
@@ -42,5 +42,5 @@
 
 	#level sets
-	md.mask.ice_levelset         = +1.*numpy.ones((md.mesh.numberofvertices,1))
+	md.mask.ice_levelset         = -1.*numpy.ones((md.mesh.numberofvertices,1))
 	md.mask.groundedice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
 	md.mask.groundedice_levelset[md.mesh.elements[numpy.nonzero(elementongroundedice),:]-1]=1.
