Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 27797)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 27798)
@@ -1128,7 +1128,9 @@
 	int         dim, domaintype;
 	IssmDouble	vx, vy, vel, c, wrate;
+	IssmDouble  time, groundedice;
 
 	/*Get problem dimension and whether there is moving front or not*/
 	this->FindParam(&domaintype,DomainTypeEnum);
+	this->FindParam(&time,TimeEnum);
 
 	switch(domaintype){
@@ -1144,4 +1146,5 @@
 	Input *vy_input      = this->GetInput(VyEnum);                                _assert_(vy_input);
 	Input *wrate_input   = this->GetInput(CalvingAblationrateEnum);               _assert_(wrate_input); 
+	Input* gr_input      = this->GetInput(MaskOceanLevelsetEnum);						_assert_(gr_input);
 
 	/* Use which experiment: use existing Enum */
@@ -1149,13 +1152,15 @@
 
 	/* Start looping on the number of vertices: */
-	GaussTria* gauss=new GaussTria();
+	GaussTria gauss;
 	for(int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Get velocity components */
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=sqrt(vx*vx+vy*vy)+1.e-14;
 
+		/* no calving for grounded ice in EXP4 */
+		gr_input->GetInputValue(&groundedice,&gauss);
 
 		switch (experiment) { 
@@ -1166,12 +1171,16 @@
 				break;
 			case 2:
+				/* Exp 2: set c=v-wrate(given)*/
+				wrate_input->GetInputValue(&wrate,&gauss);
+				break;
 			case 4:
-				/* Exp 2 and 4: set c=v-wrate(given)*/
-				/*Get wrate*/
-				wrate_input->GetInputValue(&wrate,gauss);
-				break;
-			case 0:
-				/* This is for second half of Exp 2 and 4: to set c=0*/
-				wrate = vel;
+				/* Exp 4: set c=v-wrate(given), for the first 500 years, then c=0 for the second 500 years*/
+				if((groundedice<0) && (time<=500.0)) {
+					wrate_input->GetInputValue(&wrate,&gauss);
+				}
+				else {
+					/* no calving on the grounded ice*/
+					wrate = vel;
+				}
 				break;
 			default:
@@ -1187,7 +1196,4 @@
 	this->AddInput(CalvingratexEnum,&calvingratex[0],P1DGEnum);
 	this->AddInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
